mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-03-07 03:39:08 +08:00
【缺陷修复】商城装修:解决模版修改不生效的问题
This commit is contained in:
parent
9c2b13f2d0
commit
f7477c3264
@ -12,17 +12,17 @@
|
|||||||
<el-button-group class="header-right">
|
<el-button-group class="header-right">
|
||||||
<el-tooltip content="重置">
|
<el-tooltip content="重置">
|
||||||
<el-button @click="handleReset">
|
<el-button @click="handleReset">
|
||||||
<Icon icon="system-uicons:reset-alt" :size="24" />
|
<Icon :size="24" icon="system-uicons:reset-alt" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="预览" v-if="previewUrl">
|
<el-tooltip v-if="previewUrl" content="预览">
|
||||||
<el-button @click="handlePreview">
|
<el-button @click="handlePreview">
|
||||||
<Icon icon="ep:view" :size="24" />
|
<Icon :size="24" icon="ep:view" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="保存">
|
<el-tooltip content="保存">
|
||||||
<el-button @click="handleSave">
|
<el-button @click="handleSave">
|
||||||
<Icon icon="ep:check" :size="24" />
|
<Icon :size="24" icon="ep:check" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
@ -31,21 +31,21 @@
|
|||||||
<!-- 中心区域 -->
|
<!-- 中心区域 -->
|
||||||
<el-container class="editor-container">
|
<el-container class="editor-container">
|
||||||
<!-- 左侧:组件库(ComponentLibrary) -->
|
<!-- 左侧:组件库(ComponentLibrary) -->
|
||||||
<ComponentLibrary ref="componentLibrary" :list="libs" v-if="libs && libs.length > 0" />
|
<ComponentLibrary v-if="libs && libs.length > 0" ref="componentLibrary" :list="libs" />
|
||||||
<!-- 中心:设计区域(ComponentContainer) -->
|
<!-- 中心:设计区域(ComponentContainer) -->
|
||||||
<div class="editor-center page-prop-area" @click="handlePageSelected">
|
<div class="editor-center page-prop-area" @click="handlePageSelected">
|
||||||
<!-- 手机顶部 -->
|
<!-- 手机顶部 -->
|
||||||
<div class="editor-design-top">
|
<div class="editor-design-top">
|
||||||
<!-- 手机顶部状态栏 -->
|
<!-- 手机顶部状态栏 -->
|
||||||
<img src="@/assets/imgs/diy/statusBar.png" alt="" class="status-bar" />
|
<img alt="" class="status-bar" src="@/assets/imgs/diy/statusBar.png" />
|
||||||
<!-- 手机顶部导航栏 -->
|
<!-- 手机顶部导航栏 -->
|
||||||
<ComponentContainer
|
<ComponentContainer
|
||||||
v-if="showNavigationBar"
|
v-if="showNavigationBar"
|
||||||
|
:active="selectedComponent?.id === navigationBarComponent.id"
|
||||||
:component="navigationBarComponent"
|
:component="navigationBarComponent"
|
||||||
:show-toolbar="false"
|
:show-toolbar="false"
|
||||||
:active="selectedComponent?.id === navigationBarComponent.id"
|
|
||||||
@click="handleNavigationBarSelected"
|
|
||||||
class="cursor-pointer!"
|
class="cursor-pointer!"
|
||||||
|
@click="handleNavigationBarSelected"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 绝对定位的组件:例如 弹窗、浮动按钮等 -->
|
<!-- 绝对定位的组件:例如 弹窗、浮动按钮等 -->
|
||||||
@ -55,43 +55,43 @@
|
|||||||
@click="handleComponentSelected(component, index)"
|
@click="handleComponentSelected(component, index)"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
v-if="component.position === 'fixed' && selectedComponent?.uid === component.uid"
|
|
||||||
:is="component.id"
|
:is="component.id"
|
||||||
|
v-if="component.position === 'fixed' && selectedComponent?.uid === component.uid"
|
||||||
:property="component.property"
|
:property="component.property"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 手机页面编辑区域 -->
|
<!-- 手机页面编辑区域 -->
|
||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
height="100%"
|
|
||||||
wrap-class="editor-design-center page-prop-area"
|
|
||||||
view-class="phone-container"
|
|
||||||
:view-style="{
|
:view-style="{
|
||||||
backgroundColor: pageConfigComponent.property.backgroundColor,
|
backgroundColor: pageConfigComponent.property.backgroundColor,
|
||||||
backgroundImage: `url(${pageConfigComponent.property.backgroundImage})`
|
backgroundImage: `url(${pageConfigComponent.property.backgroundImage})`
|
||||||
}"
|
}"
|
||||||
|
height="100%"
|
||||||
|
view-class="phone-container"
|
||||||
|
wrap-class="editor-design-center page-prop-area"
|
||||||
>
|
>
|
||||||
<draggable
|
<draggable
|
||||||
class="page-prop-area drag-area"
|
|
||||||
v-model="pageComponents"
|
v-model="pageComponents"
|
||||||
item-key="index"
|
|
||||||
:animation="200"
|
:animation="200"
|
||||||
|
:force-fallback="true"
|
||||||
|
class="page-prop-area drag-area"
|
||||||
filter=".component-toolbar"
|
filter=".component-toolbar"
|
||||||
ghost-class="draggable-ghost"
|
ghost-class="draggable-ghost"
|
||||||
:force-fallback="true"
|
|
||||||
group="component"
|
group="component"
|
||||||
|
item-key="index"
|
||||||
@change="handleComponentChange"
|
@change="handleComponentChange"
|
||||||
>
|
>
|
||||||
<template #item="{ element, index }">
|
<template #item="{ element, index }">
|
||||||
<ComponentContainer
|
<ComponentContainer
|
||||||
v-if="!element.position || element.position === 'center'"
|
v-if="!element.position || element.position === 'center'"
|
||||||
:component="element"
|
|
||||||
:active="selectedComponentIndex === index"
|
:active="selectedComponentIndex === index"
|
||||||
:can-move-up="index > 0"
|
|
||||||
:can-move-down="index < pageComponents.length - 1"
|
:can-move-down="index < pageComponents.length - 1"
|
||||||
@move="(direction) => handleMoveComponent(index, direction)"
|
:can-move-up="index > 0"
|
||||||
|
:component="element"
|
||||||
|
@click="handleComponentSelected(element, index)"
|
||||||
@copy="handleCopyComponent(index)"
|
@copy="handleCopyComponent(index)"
|
||||||
@delete="handleDeleteComponent(index)"
|
@delete="handleDeleteComponent(index)"
|
||||||
@click="handleComponentSelected(element, index)"
|
@move="(direction) => handleMoveComponent(index, direction)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</draggable>
|
</draggable>
|
||||||
@ -99,9 +99,9 @@
|
|||||||
<!-- 手机底部导航 -->
|
<!-- 手机底部导航 -->
|
||||||
<div v-if="showTabBar" :class="['editor-design-bottom', 'component', 'cursor-pointer!']">
|
<div v-if="showTabBar" :class="['editor-design-bottom', 'component', 'cursor-pointer!']">
|
||||||
<ComponentContainer
|
<ComponentContainer
|
||||||
|
:active="selectedComponent?.id === tabBarComponent.id"
|
||||||
:component="tabBarComponent"
|
:component="tabBarComponent"
|
||||||
:show-toolbar="false"
|
:show-toolbar="false"
|
||||||
:active="selectedComponent?.id === tabBarComponent.id"
|
|
||||||
@click="handleTabBarSelected"
|
@click="handleTabBarSelected"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -109,9 +109,9 @@
|
|||||||
<div class="fixed-component-action-group">
|
<div class="fixed-component-action-group">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-if="showPageConfig"
|
v-if="showPageConfig"
|
||||||
size="large"
|
|
||||||
:effect="selectedComponent?.uid === pageConfigComponent.uid ? 'dark' : 'plain'"
|
:effect="selectedComponent?.uid === pageConfigComponent.uid ? 'dark' : 'plain'"
|
||||||
:type="selectedComponent?.uid === pageConfigComponent.uid ? '' : 'info'"
|
:type="selectedComponent?.uid === pageConfigComponent.uid ? '' : 'info'"
|
||||||
|
size="large"
|
||||||
@click="handleComponentSelected(pageConfigComponent)"
|
@click="handleComponentSelected(pageConfigComponent)"
|
||||||
>
|
>
|
||||||
<Icon :icon="pageConfigComponent.icon" :size="12" />
|
<Icon :icon="pageConfigComponent.icon" :size="12" />
|
||||||
@ -120,10 +120,10 @@
|
|||||||
<template v-for="(component, index) in pageComponents" :key="index">
|
<template v-for="(component, index) in pageComponents" :key="index">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-if="component.position === 'fixed'"
|
v-if="component.position === 'fixed'"
|
||||||
size="large"
|
|
||||||
closable
|
|
||||||
:effect="selectedComponent?.uid === component.uid ? 'dark' : 'plain'"
|
:effect="selectedComponent?.uid === component.uid ? 'dark' : 'plain'"
|
||||||
:type="selectedComponent?.uid === component.uid ? '' : 'info'"
|
:type="selectedComponent?.uid === component.uid ? '' : 'info'"
|
||||||
|
closable
|
||||||
|
size="large"
|
||||||
@click="handleComponentSelected(component)"
|
@click="handleComponentSelected(component)"
|
||||||
@close="handleDeleteComponent(index)"
|
@close="handleDeleteComponent(index)"
|
||||||
>
|
>
|
||||||
@ -134,11 +134,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 右侧:属性面板(ComponentContainerProperty) -->
|
<!-- 右侧:属性面板(ComponentContainerProperty) -->
|
||||||
<el-aside class="editor-right" width="350px" v-if="selectedComponent?.property">
|
<el-aside v-if="selectedComponent?.property" class="editor-right" width="350px">
|
||||||
<el-card
|
<el-card
|
||||||
shadow="never"
|
|
||||||
body-class="h-[calc(100%-var(--el-card-padding)-var(--el-card-padding))]"
|
body-class="h-[calc(100%-var(--el-card-padding)-var(--el-card-padding))]"
|
||||||
class="h-full"
|
class="h-full"
|
||||||
|
shadow="never"
|
||||||
>
|
>
|
||||||
<!-- 组件名称 -->
|
<!-- 组件名称 -->
|
||||||
<template #header>
|
<template #header>
|
||||||
@ -152,8 +152,8 @@
|
|||||||
view-class="p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
|
view-class="p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:key="selectedComponent?.uid || selectedComponent?.id"
|
|
||||||
:is="selectedComponent?.id + 'Property'"
|
:is="selectedComponent?.id + 'Property'"
|
||||||
|
:key="selectedComponent?.uid || selectedComponent?.id"
|
||||||
v-model="selectedComponent.property"
|
v-model="selectedComponent.property"
|
||||||
/>
|
/>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@ -166,8 +166,8 @@
|
|||||||
<Dialog v-model="previewDialogVisible" title="预览" width="700">
|
<Dialog v-model="previewDialogVisible" title="预览" width="700">
|
||||||
<div class="flex justify-around">
|
<div class="flex justify-around">
|
||||||
<IFrame
|
<IFrame
|
||||||
class="w-375px border-4px border-rounded-8px border-solid p-2px h-667px!"
|
|
||||||
:src="previewUrl"
|
:src="previewUrl"
|
||||||
|
class="w-375px border-4px border-rounded-8px border-solid p-2px h-667px!"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<el-text>手机扫码预览</el-text>
|
<el-text>手机扫码预览</el-text>
|
||||||
@ -179,6 +179,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// 注册所有的组件
|
// 注册所有的组件
|
||||||
import { components } from './components/mobile/index'
|
import { components } from './components/mobile/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ...components }
|
components: { ...components }
|
||||||
}
|
}
|
||||||
@ -257,6 +258,11 @@ watch(
|
|||||||
|
|
||||||
// 保存
|
// 保存
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
|
// 发送保存通知
|
||||||
|
emits('save')
|
||||||
|
}
|
||||||
|
// 监听配置修改
|
||||||
|
const pageConfigChange = () => {
|
||||||
const pageConfig = {
|
const pageConfig = {
|
||||||
page: pageConfigComponent.value.property,
|
page: pageConfigComponent.value.property,
|
||||||
navigationBar: navigationBarComponent.value.property,
|
navigationBar: navigationBarComponent.value.property,
|
||||||
@ -272,10 +278,19 @@ const handleSave = () => {
|
|||||||
// 发送数据更新通知
|
// 发送数据更新通知
|
||||||
const modelValue = isString(props.modelValue) ? JSON.stringify(pageConfig) : pageConfig
|
const modelValue = isString(props.modelValue) ? JSON.stringify(pageConfig) : pageConfig
|
||||||
emits('update:modelValue', modelValue)
|
emits('update:modelValue', modelValue)
|
||||||
// 发送保存通知
|
|
||||||
emits('save', pageConfig)
|
|
||||||
}
|
}
|
||||||
|
watch(
|
||||||
|
() => [
|
||||||
|
pageConfigComponent.value.property,
|
||||||
|
navigationBarComponent.value.property,
|
||||||
|
tabBarComponent.value.property,
|
||||||
|
pageComponents.value
|
||||||
|
],
|
||||||
|
() => {
|
||||||
|
pageConfigChange()
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
)
|
||||||
// 处理页面选中:显示属性表单
|
// 处理页面选中:显示属性表单
|
||||||
const handlePageSelected = (event: any) => {
|
const handlePageSelected = (event: any) => {
|
||||||
if (!props.showPageConfig) return
|
if (!props.showPageConfig) return
|
||||||
@ -547,6 +562,7 @@ $toolbar-height: 42px;
|
|||||||
:deep(.el-tag) {
|
:deep(.el-tag) {
|
||||||
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
.el-tag__content {
|
.el-tag__content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
<DiyEditor
|
<DiyEditor
|
||||||
v-if="formData && !formLoading"
|
v-if="formData && !formLoading"
|
||||||
v-model="currentFormData!.property"
|
v-model="currentFormData!.property"
|
||||||
:title="templateItems[selectedTemplateItem].name"
|
|
||||||
:libs="libs"
|
:libs="libs"
|
||||||
|
:preview-url="previewUrl"
|
||||||
|
:show-navigation-bar="selectedTemplateItem !== 0"
|
||||||
:show-page-config="selectedTemplateItem !== 0"
|
:show-page-config="selectedTemplateItem !== 0"
|
||||||
:show-tab-bar="selectedTemplateItem === 0"
|
:show-tab-bar="selectedTemplateItem === 0"
|
||||||
:show-navigation-bar="selectedTemplateItem !== 0"
|
:title="templateItems[selectedTemplateItem].name"
|
||||||
:preview-url="previewUrl"
|
|
||||||
@save="submitForm"
|
|
||||||
@reset="handleEditorReset"
|
@reset="handleEditorReset"
|
||||||
|
@save="submitForm"
|
||||||
>
|
>
|
||||||
<template #toolBarLeft>
|
<template #toolBarLeft>
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="selectedTemplateItem"
|
:model-value="selectedTemplateItem"
|
||||||
class="h-full!"
|
class="h-full!"
|
||||||
@change="handleTemplateItemChange"
|
@change="handleTemplateItemChange"
|
||||||
>
|
>
|
||||||
@ -26,13 +26,14 @@
|
|||||||
</template>
|
</template>
|
||||||
</DiyEditor>
|
</DiyEditor>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
// TODO @疯狂:要不要建个 decorate 目录,然后挪进去,改成 index.vue,这样可以更明确看到是个独立界面哈,更好找
|
// TODO @疯狂:要不要建个 decorate 目录,然后挪进去,改成 index.vue,这样可以更明确看到是个独立界面哈,更好找
|
||||||
import * as DiyTemplateApi from '@/api/mall/promotion/diy/template'
|
import * as DiyTemplateApi from '@/api/mall/promotion/diy/template'
|
||||||
import * as DiyPageApi from '@/api/mall/promotion/diy/page'
|
import * as DiyPageApi from '@/api/mall/promotion/diy/page'
|
||||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||||
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
import { DiyComponentLibrary, PAGE_LIBS } from '@/components/DiyEditor/util' // 商城的 DIY 组件,在 DiyEditor 目录下
|
||||||
import { toNumber } from 'lodash-es'
|
import { toNumber } from 'lodash-es'
|
||||||
|
import { isEmpty } from '@/utils/is'
|
||||||
|
|
||||||
/** 装修模板表单 */
|
/** 装修模板表单 */
|
||||||
defineOptions({ name: 'DiyTemplateDecorate' })
|
defineOptions({ name: 'DiyTemplateDecorate' })
|
||||||
@ -52,6 +53,10 @@ const formData = ref<DiyTemplateApi.DiyTemplatePropertyVO>()
|
|||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
// 当前编辑的属性
|
// 当前编辑的属性
|
||||||
const currentFormData = ref<DiyTemplateApi.DiyTemplatePropertyVO | DiyPageApi.DiyPageVO>()
|
const currentFormData = ref<DiyTemplateApi.DiyTemplatePropertyVO | DiyPageApi.DiyPageVO>()
|
||||||
|
// templateItem 对应的缓存
|
||||||
|
const currentFormDataMap = ref<
|
||||||
|
Map<string, DiyTemplateApi.DiyTemplatePropertyVO | DiyPageApi.DiyPageVO>
|
||||||
|
>(new Map())
|
||||||
// 商城 H5 预览地址
|
// 商城 H5 预览地址
|
||||||
const previewUrl = ref('')
|
const previewUrl = ref('')
|
||||||
|
|
||||||
@ -60,8 +65,6 @@ const getPageDetail = async (id: any) => {
|
|||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await DiyTemplateApi.getDiyTemplateProperty(id)
|
formData.value = await DiyTemplateApi.getDiyTemplateProperty(id)
|
||||||
currentFormData.value = formData.value
|
|
||||||
|
|
||||||
// 拼接手机预览链接
|
// 拼接手机预览链接
|
||||||
const domain = import.meta.env.VITE_MALL_H5_DOMAIN
|
const domain = import.meta.env.VITE_MALL_H5_DOMAIN
|
||||||
previewUrl.value = `${domain}/#/pages/index/index?templateId=${formData.value.id}`
|
previewUrl.value = `${domain}/#/pages/index/index?templateId=${formData.value.id}`
|
||||||
@ -75,19 +78,31 @@ const templateLibs = [] as DiyComponentLibrary[]
|
|||||||
// 当前组件库
|
// 当前组件库
|
||||||
const libs = ref<DiyComponentLibrary[]>(templateLibs)
|
const libs = ref<DiyComponentLibrary[]>(templateLibs)
|
||||||
// 模板选项切换
|
// 模板选项切换
|
||||||
const handleTemplateItemChange = () => {
|
const handleTemplateItemChange = (val: number) => {
|
||||||
|
// 缓存模版编辑数据
|
||||||
|
currentFormDataMap.value.set(
|
||||||
|
templateItems[selectedTemplateItem.value].name,
|
||||||
|
currentFormData.value!
|
||||||
|
)
|
||||||
|
// 读取模版缓存
|
||||||
|
const data = currentFormDataMap.value.get(templateItems[val].name)
|
||||||
|
|
||||||
|
// 切换模版
|
||||||
|
selectedTemplateItem.value = val
|
||||||
// 编辑模板
|
// 编辑模板
|
||||||
if (selectedTemplateItem.value === 0) {
|
if (val === 0) {
|
||||||
libs.value = templateLibs
|
libs.value = templateLibs
|
||||||
currentFormData.value = formData.value
|
currentFormData.value = isEmpty(data) ? formData.value : data
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑页面
|
// 编辑页面
|
||||||
libs.value = PAGE_LIBS
|
libs.value = PAGE_LIBS
|
||||||
currentFormData.value = formData.value!.pages.find(
|
currentFormData.value = isEmpty(data)
|
||||||
(page: DiyPageApi.DiyPageVO) => page.name === templateItems[selectedTemplateItem.value].name
|
? formData.value!.pages.find(
|
||||||
)
|
(page: DiyPageApi.DiyPageVO) => page.name === templateItems[val].name
|
||||||
|
)
|
||||||
|
: data
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
@ -97,12 +112,25 @@ const submitForm = async () => {
|
|||||||
// 提交请求
|
// 提交请求
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
if (selectedTemplateItem.value === 0) {
|
// 对所有的 templateItems 都进行保存,有缓存则保存缓存,解决都有修改时只保存了当前所编辑的 templateItem,导致装修效果存在差异
|
||||||
// 提交模板属性
|
for (let i = 0; i < templateItems.length; i++) {
|
||||||
await DiyTemplateApi.updateDiyTemplateProperty(unref(formData)!)
|
const data = currentFormDataMap.value.get(templateItems[i].name) as any
|
||||||
} else {
|
// 情况一:基础设置
|
||||||
|
if (i === 0) {
|
||||||
|
// 提交模板属性
|
||||||
|
await DiyTemplateApi.updateDiyTemplateProperty(isEmpty(data) ? unref(formData)! : data)
|
||||||
|
continue
|
||||||
|
}
|
||||||
// 提交页面属性
|
// 提交页面属性
|
||||||
await DiyPageApi.updateDiyPageProperty(unref(currentFormData)!)
|
// 情况二:提交当前正在编辑的页面
|
||||||
|
if (currentFormData.value?.name.includes(templateItems[i].name)) {
|
||||||
|
await DiyPageApi.updateDiyPageProperty(unref(currentFormData)!)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// 情况三:提交页面编辑缓存
|
||||||
|
if (!isEmpty(data)) {
|
||||||
|
await DiyPageApi.updateDiyPageProperty(data!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
message.success('保存成功')
|
message.success('保存成功')
|
||||||
} finally {
|
} finally {
|
||||||
@ -140,10 +168,16 @@ const recoverPageIndex = () => {
|
|||||||
const pageIndex = toNumber(sessionStorage.getItem(DIY_PAGE_INDEX_KEY)) || 0
|
const pageIndex = toNumber(sessionStorage.getItem(DIY_PAGE_INDEX_KEY)) || 0
|
||||||
// 移除标记
|
// 移除标记
|
||||||
sessionStorage.removeItem(DIY_PAGE_INDEX_KEY)
|
sessionStorage.removeItem(DIY_PAGE_INDEX_KEY)
|
||||||
|
|
||||||
|
// 重新初始化数据
|
||||||
|
currentFormData.value = formData.value
|
||||||
|
currentFormDataMap.value = new Map<
|
||||||
|
string,
|
||||||
|
DiyTemplateApi.DiyTemplatePropertyVO | DiyPageApi.DiyPageVO
|
||||||
|
>()
|
||||||
// 切换页面
|
// 切换页面
|
||||||
if (pageIndex !== selectedTemplateItem.value) {
|
if (pageIndex !== selectedTemplateItem.value) {
|
||||||
selectedTemplateItem.value = pageIndex
|
handleTemplateItemChange(pageIndex)
|
||||||
handleTemplateItemChange()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user