Commit 5c79a357 authored by 徐光星's avatar 徐光星

Merge branch 'feat/templateError' into 'master'

Feat/template error

See merge request !85
parents 5f73dabc 520383a5
<template> <template>
<div id="app" class="layout" > <div id="app" class="layout">
<Row type="flex" class="layout-container" v-if="!isDashboard"> <Row type="flex" class="layout-container" v-if="!isDashboard">
<i-col :span="3" class="layout-menu-left"> <i-col :span="3" class="layout-menu-left">
<Menu :active-name="activeName" theme="dark" width="auto" :open-names="['1']" accordion @on-select="select"> <Menu
:active-name="activeName"
theme="dark"
width="auto"
:open-names="['1']"
accordion
@on-select="select"
>
<div class="layout-logo-left">低代码平台</div> <div class="layout-logo-left">低代码平台</div>
<Menu-item v-if="tenant.workist" name="list">作品列表</Menu-item> <Menu-item name="list">作品列表</Menu-item>
<Menu-item v-if="tenant.draftList" name="my">我的草稿</Menu-item> <Menu-item name="my">我的草稿</Menu-item>
<Menu-item v-if="tenant.tmplList" name="template">创意模板</Menu-item> <Menu-item name="template">创意模板</Menu-item>
<Menu-item name="navigator">导航配置</Menu-item> <Menu-item name="navigator">导航配置</Menu-item>
</Menu> </Menu>
</i-col> </i-col>
...@@ -29,118 +36,117 @@ ...@@ -29,118 +36,117 @@
</div> </div>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
#app { #app {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.ivu-spin-fix { .ivu-spin-fix {
z-index: 1000; z-index: 1000;
background-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.8);
} }
.layout { .layout {
border: 1px solid #d7dde4; border: 1px solid #d7dde4;
background: #f5f7f9; background: #f5f7f9;
position: relative; position: relative;
border-radius: 4px; border-radius: 4px;
overflow: auto; overflow: auto;
height: 100%; height: 100%;
} }
.layout-container { .layout-container {
height: 100%; height: 100%;
} }
.layout-breadcrumb { .layout-breadcrumb {
padding: 10px 15px 0; padding: 10px 15px 0;
} }
.layout-content { .layout-content {
flex: 1; flex: 1;
overflow: auto; overflow: auto;
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
} }
.layout-content-main { .layout-content-main {
padding: 10px; padding: 10px;
} }
.layout-copy { .layout-copy {
height: 45px; height: 45px;
text-align: center; text-align: center;
padding: 10px 0 20px; padding: 10px 0 20px;
color: #9ea7b4; color: #9ea7b4;
} }
.layout-menu-left { .layout-menu-left {
background: #464c5b; background: #464c5b;
} }
.layout-menu-right { .layout-menu-right {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.layout-header { .layout-header {
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
background: #fff; background: #fff;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
} }
.layout-ceiling-main { .layout-ceiling-main {
float: right; float: right;
margin-right: 15px; margin-right: 15px;
} }
.layout-logo-left { .layout-logo-left {
width: 90%; width: 90%;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
color: #fff; color: #fff;
font-size: 18px; font-size: 18px;
text-align: center; text-align: center;
background: #5b6270; background: #5b6270;
border-radius: 3px; border-radius: 3px;
margin: 15px auto; margin: 15px auto;
} }
.layout-ceiling-main a { .layout-ceiling-main a {
color: #9ba7b5; color: #9ba7b5;
} }
.ivu-col { .ivu-col {
transition: width 0.2s ease-in-out; transition: width 0.2s ease-in-out;
} }
.router-fade-enter-active, .router-fade-enter-active,
.router-fade-leave-active { .router-fade-leave-active {
transition: opacity 0.3s; transition: opacity 0.3s;
} }
.router-fade-enter, .router-fade-enter,
.router-fade-leave-active { .router-fade-leave-active {
opacity: 0; opacity: 0;
} }
.avator { .avator {
float: right; float: right;
width: 120px; width: 120px;
height: 45px; height: 45px;
line-height: 45px; line-height: 45px;
font-size: 14px; font-size: 14px;
} }
body { body {
/deep/ .cr-popup { /deep/ .cr-popup {
z-index: 1111; z-index: 1111;
} }
} }
</style> </style>
<script lang="ts" src="./index.ts"></script> <script lang="ts" src="./index.ts"></script>
\ No newline at end of file
...@@ -92,7 +92,28 @@ export default class EditorModule implements Module<EditorState, RootState> { ...@@ -92,7 +92,28 @@ export default class EditorModule implements Module<EditorState, RootState> {
const res = await api.getPageById(condition); const res = await api.getPageById(condition);
const { page } = res as PageInfo; const { page } = res as PageInfo;
const { pageInfo } = cloneDeep(defaultState); const { pageInfo } = cloneDeep(defaultState);
commit(SET_PAGE_INFO, { ...pageInfo, page: JSON.parse(page as string) }); const pageObj = JSON.parse(page as string);
commit(SET_PAGE_INFO, { ...pageInfo, page: pageObj });
const goodsTabs = {};
(pageObj as Page).elements.forEach((element, idx) => {
if (element.name === 'cs-goods-tabs' && element?.child?.length) {
goodsTabs[idx] = cloneDeep(element.child);
// 逆向循环
for (let i = element.child.length - 1; i >= 0; i--) {
commit(COPY_OR_DELETE_PAGE_INFO, { type: 'delete', containerIndex: idx, childIndex: i });
// this.updatePageData({ type: 'delete', containerIndex: idx, childIndex: i });
}
}
});
let tempIndex = 0;
Object.keys(goodsTabs).forEach(key => {
goodsTabs[key].forEach((child, index) => {
commit(UPDATE_PAGE_INFO, { containerIndex: +key + 1 + index + tempIndex, data: child, type: 'add' });
// console.log('parseGoodsTabs', { containerIndex: +key + 1 + index, data: child });
// this.updatePageInfo({ containerIndex: +key + 1 + index, data: child });
});
tempIndex++;
});
}, },
setDragable({ commit }, condition) { setDragable({ commit }, condition) {
commit(SET_DRAGABLE, condition); commit(SET_DRAGABLE, condition);
......
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