Commit ec30a0f2 authored by 郭志伟's avatar 郭志伟

feat(refresh): 刷新功能

parent 8f38572b
......@@ -71,6 +71,10 @@ export default class EditorController extends Controller {
ctx.body = ctx.helper.ok(list);
}
public async clearCache(ctx: Context) {
ctx.body = ctx.helper.ok({});
}
public async delete(ctx: Context) {
const pageInfo = await ctx.model.PageInfo.update({ enable: 0 }, {where: { id: +ctx.params.pageId }});
ctx.body = ctx.helper.ok(pageInfo);
......
......@@ -11,6 +11,7 @@ export default (application: Application) => {
router.post('/editor/save', controller.editor.save);
router.post('/editor/update', controller.editor.update);
router.post('/editor/clearcache', controller.editor.clearCache);
router.get('/editor/get/list', controller.editor.getList);
router.get('/editor/get/template', controller.editor.getTemplateList);
router.get('/editor/get/:uuid', controller.editor.get);
......
......@@ -6,6 +6,9 @@ export default {
getPageList(params) {
return http.get('editor/get/list', { params });
},
refreshCache() {
return http.post('editor/clearcache');
},
getPageById(params) {
return http.get(`editor/get/${params.pageId}`);
},
......
......@@ -19,6 +19,7 @@
<script>
import FormList from '../mixins/formList.mixin.ts';
import { SHOP_CART_CONFIG, SHARE_CONFIG, DEFAULT_CONFIG } from '@service/staticData.service';
import { v4 as uuid } from 'uuid';
const CONFIG_MAP = {
['购物车']: SHOP_CART_CONFIG,
......@@ -42,6 +43,16 @@ const CONFIG_MAP = {
this.$set(this.list, index, JSON.parse(JSON.stringify(CONFIG_MAP[e])));
this.oldPersets[index] = e;
}
},
add() {
const object = this.formControl.reduce((pre, cur) => {
pre[cur.key] = this.formDefault[cur.key] || '';
return pre;
}, {});
if (object.persets === '自定义') {
object.name = '自定义-' + uuid().slice(19);
}
this.list.push(object);
}
}
}
......
......@@ -77,6 +77,15 @@ export default class DynamicPageForm extends Mixins(ContextMenuMixin) {
type: 'select',
options: ['购物车', '分享', '自定义']
},
{
key: 'name',
name: '名称',
type: 'text',
props: {
require: true,
placeholder: '(必填) 区分埋点'
}
},
{
key: 'txt',
name: '文字',
......
......@@ -5,6 +5,7 @@
:request="query"
@newBtnClick="addPage"
>
<Button type="default" class="btnStyle" @click="refreshData()">更新缓存</Button>
</QGTable>
</template>
<script>
......@@ -187,7 +188,16 @@ export default {
},
addPage() {
this.$router.push('/detail');
}
},
async refreshData() {
try {
await editorApi.refreshCache();
this.$Notice.success({ title: '刷新成功!' });
} catch (error) {
console.log(error);
this.$Notice.warning({ title: '刷新失败!' });
}
},
},
mounted(){}
}
......
......@@ -90,6 +90,7 @@ export const defaultState = {
btAttachVal: [
{
persets: '购物车',
name: '购物车',
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
......
......@@ -2,6 +2,7 @@
export const SHOP_CART_CONFIG = {
persets: '购物车',
txt: '',
name: '购物车',
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
......@@ -15,6 +16,7 @@ export const SHOP_CART_CONFIG = {
export const BACK_TOP_CONFIG = {
persets: '自定义',
name: '',
icon: 'back-top-o',
background: '#fff',
color: '#333',
......@@ -25,6 +27,7 @@ export const BACK_TOP_CONFIG = {
export const SHARE_CONFIG = {
persets: '分享',
name: '分享',
txt: '',
icon: 'share',
url: '',
......@@ -39,6 +42,7 @@ export const SHARE_CONFIG = {
export const DEFAULT_CONFIG = {
persets: '自定义',
name: '',
txt: '',
icon: '',
url: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment