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

Merge branch 'feat/v1.3' into feat/1.3-local

# Conflicts:
#	package-lock.json
#	package.json
parents 547a4461 73b7221d
......@@ -28,3 +28,5 @@ app/view/*
yarn.lock
*.log
coverage
.yalc/
yalc.lock
\ No newline at end of file
......@@ -71,6 +71,25 @@ export default class EditorController extends Controller {
ctx.body = ctx.helper.ok(list);
}
public async clearCache(ctx: Context) {
const where = {
updated_at: {
[ctx.model.Sequelize.Op.lt]: Date.now(),
[ctx.model.Sequelize.Op.gt]: new Date(Date.now() - 1000 * 60 * 60 * 24 * 7)
},
enable: 1,
isPublish: 1
};
const pageInfo = await ctx.model.PageInfo.findAll({
attributes: ['uuid'],
where
});
pageInfo.forEach(async item => {
await ctx.service.redis.del(`page:${item.uuid}`);
});
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);
}
}
}
......
......@@ -335,10 +335,11 @@ export default class DynamicForm extends Mixins(ContextMenuMixin, DynamicFormMix
}
changeMargin() {
const ele = this.getCurElement();
const prevCommonStyle = cloneDeep(ele.commonStyle || {});
// this.point.w = this.point.w - (this.commonStyle.paddingLeft || 0) - (this.commonStyle.paddingRight || 0);
this.point.h = this.point.h - (this.prevCommonStyle.paddingTop || 0) - (this.prevCommonStyle.paddingBottom || 0) + (this.commonStyle.paddingTop || 0) + (this.commonStyle.paddingBottom || 0);
this.point.h = this.point.h - (prevCommonStyle.paddingTop || 0) - (prevCommonStyle.paddingBottom || 0) + (this.commonStyle.paddingTop || 0) + (this.commonStyle.paddingBottom || 0);
this.updateCommonStyle({ containerIndex: this.curEleIndex, childIndex: this.curChildIndex, data: this.commonStyle });
this.prevCommonStyle = cloneDeep(this.commonStyle);
this.updatePoint();
// this.adjustHeight();
}
......
import {Component, Vue, Prop, Watch, Emit} from 'vue-property-decorator';
import { Getter } from 'vuex-class';
import DynamicForm from '@editor/component/DynamicForm/index.vue';
import DynamicPageForm from '@editor/component/DynamicPageForm/index.vue';
// import EventBus from '@service/eventBus.service';
......@@ -6,6 +7,8 @@ import DynamicPageForm from '@editor/component/DynamicPageForm/index.vue';
@Component({ components: { DynamicPageForm, DynamicForm }, name: 'RecordModal' })
export default class DynamicFormTabs extends Vue {
@Getter('curRightTabName') curRightTabName!: string | null;
@Emit('modProps')
modProps(props, ele, type) {
// return props, ele, type;
......
<template>
<Tabs class="dynamic-form-tabs">
<TabPane label="组件设置">
<Tabs class="dynamic-form-tabs" :value="curRightTabName">
<TabPane name="组件设置" label="组件设置">
<dynamic-form @modProps="modProps" @resizedChildEvent="resizedChildEvent"></dynamic-form>
</TabPane>
<!-- <TabPane label="事件">事件</TabPane> -->
<TabPane label="页面设置">
<TabPane name="页面设置" label="页面设置">
<dynamic-page-form @modProps="modProps" @resizedChildEvent="resizedChildEvent"></dynamic-page-form>
</TabPane>
</Tabs>
......
......@@ -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: '文字',
......
......@@ -69,6 +69,11 @@ export default class OperationPanel extends Mixins(TransformStyleMixin) {
//
}
@Emit('handlePageSetClick')
handlePageSetClick() {
//
}
@Emit('show')
show(event, containerIndex, childIndex) {
//
......
<template>
<div class="Dcm-container-panel_container">
<title-preview />
<title-preview @click.native.stop="handlePageSetClick" />
<div :class="[{'Dcm-container-panel_in': isDragIn, 'Dcm-container-panel_draging': isDraging}, 'Dcm-container-panel']" @dragover.prevent @dragenter="dragenter" @dragover="dragover"
@dragleave="dragleave" @drop="drops">
<grid-layout
......@@ -40,12 +40,13 @@
:i="bottomInfo.i"
:static="true"
:key="bottomInfo.i + pageData.elements.length"
@click.native.stop="handlePageSetClick"
>
<page-bottom-tip />
<page-bottom-tip @click.native.stop="handlePageSetClick" />
</grid-item>
</grid-layout>
</div>
<back-top-preview />
<back-top-preview @click.native.stop="handlePageSetClick" />
</div>
</template>
<script lang="ts" src="./index.ts"></script>
......
......@@ -37,7 +37,9 @@ export default class ContextMenuMixin extends Vue {
const elements = this.pageData.elements[this.curEleIndex];
const component = document.getElementById(elements.id);
const height = component ? getStyle(component, 'height') : 0;
console.log('adjustHeight', height);
this.updatePageInfo({ containerIndex: this.curEleIndex, data: { ...elements, point: { ...elements.point, h: Math.ceil(+height || elements.point.h) } } });
const paddingTop = elements.commonStyle.paddingTop || 0;
const paddingBottom = elements.commonStyle.paddingBottom || 0;
console.log('adjustHeight', height, elements.commonStyle);
this.updatePageInfo({ containerIndex: this.curEleIndex, data: { ...elements, point: { ...elements.point, h: Math.ceil((+height || elements.point.h) + paddingTop + paddingBottom) } } });
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ export default class DashBoard extends Mixins(ContextMenuMixin, GoodsTabsMixin,
@Mutation('SET_PAGE_DATA') setPageData;
@Mutation('UPDATE_PAGE_STYLE') setPageStyle;
@Mutation('UPDATE_PAGE_PROPS') setPageProps;
@Mutation('SET_CUR_RIGHT_TAB_NAME') setRightTabName;
@Action('resetPageData') resetPageData;
@Action('savePageData') savePageData;
@Action('getPageDate') getPageDate;
......@@ -119,6 +120,18 @@ export default class DashBoard extends Mixins(ContextMenuMixin, GoodsTabsMixin,
this.toggle(false);
this.setCurEleIndex(curEleIndex);
this.setCurChildIndex(curChildIndex);
this.setRightTabName('组件设置');
}
handlePageSetClick() {
this.toggle(false);
this.setRightTabName('页面设置');
}
getPageElements(ids = []) {
return ids.length === 0 ? this.pageData.elements : ids.map(item => {
const targetEl =
this.pageData.elements.find(it => it.id === (item.componentId || item));
return targetEl;
});
}
toggle(val) {
......
......@@ -16,7 +16,7 @@
<Col class="dashboard-container-middle" span="17">
<Row class="Dc-middle-row">
<Col :span="isCollapsed ? 24 : 16" class="Dc-middle-container" @click.native="toggle(true)">
<OperationPanel :isDragIn.sync="isDragIn" :isDraging="isDraging" @dragover="dragover" @drops="drops" @handleElementClick="handleElementClick" @show="show" @resizedEvent="resizedEvent" @movedEvent="movedEvent" @toggle="toggle" />
<OperationPanel :isDragIn.sync="isDragIn" :isDraging="isDraging" @dragover="dragover" @drops="drops" @handleElementClick="handleElementClick" @show="show" @resizedEvent="resizedEvent" @movedEvent="movedEvent" @toggle="toggle" @handlePageSetClick="handlePageSetClick" />
</Col>
<Col span="8" :class="[{'Dcm-sider_none': isCollapsed}, 'Dc-middle-sider']">
<DynamicFormTabs @modProps="modProps" @resizedChildEvent="resizedChildEvent" />
......
......@@ -5,6 +5,7 @@
:request="query"
@newBtnClick="addPage"
>
<Button type="default" class="btnStyle" @click="refreshData()">更新缓存</Button>
</QGTable>
</template>
<script>
......@@ -187,8 +188,17 @@ 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(){}
}
</script>
\ No newline at end of file
......@@ -15,7 +15,8 @@ import {
SET_PAGE_DATA,
UPDATE_COMMON_STYLE,
UPDATE_PAGE_STYLE,
UPDATE_PAGE_PROPS
UPDATE_PAGE_PROPS,
SET_CUR_RIGHT_TAB_NAME
} from './type';
import RootState from '../../state';
......@@ -36,6 +37,9 @@ export default class EditorModule implements Module<EditorState, RootState> {
},
pageInfo(state: EditorState): PageInfo {
return state.pageInfo;
},
curRightTabName(state: EditorState): string | null {
return state.curRightTabName;
}
};
......@@ -111,8 +115,11 @@ export default class EditorModule implements Module<EditorState, RootState> {
[SET_CUR_ELE_INDEX](state, curEleIndex) {
state.curEleIndex = curEleIndex;
},
[SET_CUR_CHILD_INDEX](state, curChildIndex) {
state.curChildIndex = curChildIndex;
[SET_CUR_ELE_INDEX](state, curEleIndex) {
state.curEleIndex = curEleIndex;
},
[SET_CUR_RIGHT_TAB_NAME](state, curRightTabName) {
state.curRightTabName = curRightTabName;
},
[SET_TEMPLATE_LIST](state, data) {
state.templateList = data;
......
......@@ -60,6 +60,7 @@ export default interface EditorState {
pageInfo: PageInfo;
curEleIndex: number | null;
curChildIndex: number | null;
curRightTabName: string | null;
templateList: any[];
gridLayout: GridLayout;
}
......@@ -67,6 +68,7 @@ export default interface EditorState {
export const defaultState = {
curEleIndex: null,
curChildIndex: null,
curRightTabName: null,
pageInfo: {
id: 0,
pageName: '',
......@@ -90,7 +92,8 @@ export const defaultState = {
btAttachVal: [
{
persets: '购物车',
icon: 'shopping-cart-o',
name: '购物车',
icon: 'shopping-cart',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
iconColor: '#333',
......
......@@ -12,3 +12,4 @@ export const SET_PAGE_DATA = 'SET_PAGE_DATA';
export const UPDATE_COMMON_STYLE = 'UPDATE_COMMON_STYLE';
export const UPDATE_PAGE_STYLE = 'UPDATE_PAGE_STYLE';
export const UPDATE_PAGE_PROPS = 'UPDATE_PAGE_PROPS';
export const SET_CUR_RIGHT_TAB_NAME = 'SET_CUR_RIGHT_TAB_NAME';
......@@ -2,7 +2,8 @@
export const SHOP_CART_CONFIG = {
persets: '购物车',
txt: '',
icon: 'shopping-cart-o',
name: '购物车',
icon: 'shopping-cart',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
iconColor: '#333',
......@@ -15,16 +16,18 @@ export const SHOP_CART_CONFIG = {
export const BACK_TOP_CONFIG = {
persets: '自定义',
icon: 'back-top-o',
name: '',
icon: 'back-top',
background: '#fff',
color: '#333',
size: 46,
iconSize: 20,
txt: '顶部'
txt: ''
};
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: '',
......
{
"name": "quantum-blocks",
"version": "0.0.1",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -1481,9 +1481,9 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
},
"@popperjs/core": {
"version": "2.9.3",
"resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.9.3.tgz",
"integrity": "sha512-xDu17cEfh7Kid/d95kB6tZsLOmSWKCZKtprnhVepjsSaCij+lM3mItSJDuuHDMbCWTh8Ejmebwb+KONcCJ0eXQ=="
"version": "2.10.1",
"resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.10.1.tgz",
"integrity": "sha1-co7NlasgequKmk5CHwQi2zKSMr4="
},
"@qg/apollo-nodejs": {
"version": "2.1.2",
......@@ -1491,9 +1491,9 @@
"integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg=="
},
"@qg/cherry-ui": {
"version": "2.22.4",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.22.4.tgz",
"integrity": "sha512-tvrtr3w/a0hhWu8TUuZvvyT2tXV+4rQLWfYxBFRI5PAvQ8+s6Iyo3QLZAf/JNKo0gAz1ZjK6QSK6Mn6GBLvReg==",
"version": "2.23.4",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.23.4.tgz",
"integrity": "sha512-Bvwss2EIwFe2Dp3SHlaej76AprQf0LkUIDbIx6ysT85fSh3Nf4xWi8eEkPRfJQ5SUA4GVx0zsb2nMtDIEJ+3UQ==",
"requires": {
"@popperjs/core": "^2.5.4",
"vue-lazyload": "^1.3.3",
......@@ -1501,12 +1501,12 @@
}
},
"@qg/citrus-ui": {
"version": "0.3.0-beta2",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.0-beta2.tgz",
"integrity": "sha512-HuUjVWoy11IowPr3w2A0f8jXyVDz0cGEuNSjLWyICI0QaHqa5RiR2XJELiLy7+lx7K8r3XIETuadqfbhmHtjCg==",
"version": "0.3.1",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.1.tgz",
"integrity": "sha512-kNJvDx0WMW7zhn7+tjg9rFbsMsezcMro1nAjqNU1YuSWLNMjrrRJiaSWhEf6Al0hN8IvLW8zotsxHbuwvx+RYg==",
"requires": {
"@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.21.1",
"@qg/cherry-ui": "^2.23.4",
"@qg/js-bridge": "^1.1.12",
"axios": "^0.21.1",
"intersection-observer": "^0.12.0",
......@@ -9003,9 +9003,9 @@
}
},
"es5-shim": {
"version": "4.5.15",
"resolved": "http://npmprivate.quantgroups.com/es5-shim/-/es5-shim-4.5.15.tgz",
"integrity": "sha512-FYpuxEjMeDvU4rulKqFdukQyZSTpzhg4ScQHrAosrlVpR6GFyaw14f74yn2+4BugniIS0Frpg7TvwZocU4ZMTw=="
"version": "4.6.2",
"resolved": "http://npmprivate.quantgroups.com/es5-shim/-/es5-shim-4.6.2.tgz",
"integrity": "sha1-gnzdDG+1vrJv02jWVDDoterrqUI="
},
"es6-iterator": {
"version": "2.0.3",
......
{
"name": "quantum-blocks",
"version": "0.0.1",
"version": "1.0.0",
"description": "低代码平台",
"scripts": {
"start": "cross-env NODE_ENV=production APOLLO_CLUSTER=RC egg-scripts start --port 9050 --workers 1",
......@@ -26,8 +26,8 @@
"@easy-team/easywebpack-vue": "^4.0.0",
"@hubcarl/json-typescript-mapper": "^2.0.0",
"@qg/apollo-nodejs": "^2.1.2",
"@qg/cherry-ui": "2.22.4",
"@qg/citrus-ui": "0.3.0-beta2",
"@qg/cherry-ui": "2.23.4",
"@qg/citrus-ui": "0.3.1",
"@riophae/vue-treeselect": "^0.4.0",
"@types/lodash": "^4.14.117",
"@types/node": "^10.12.0",
......
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