内容、布局按钮添加提示
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="true"
|
||||
:title="isUpdate ? '页面设置' : '页面设置'"
|
||||
:title="isUpdate ? '编辑内容' : '添加内容'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
@@ -99,7 +99,7 @@
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { uuid} from 'ele-admin-pro';
|
||||
import { addDesign, updateDesign } from '@/api/cms/design';
|
||||
import { addDesign, pageDesign, updateDesign } from "@/api/cms/design";
|
||||
import { Design } from '@/api/cms/design/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -110,6 +110,7 @@ import TinymceEditor from "@/components/TinymceEditor/index.vue";
|
||||
import useFormData from "@/utils/use-form-data";
|
||||
import {removeSiteInfoCache} from "@/api/cms/website";
|
||||
import {FileRecord} from "@/api/system/file/model";
|
||||
import category from "@/views/cms/category/index.vue";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -153,6 +154,7 @@ const { form, resetFields, assignFields } = useFormData<Design>({
|
||||
content: '',
|
||||
buyUrl: '',
|
||||
type: '',
|
||||
categoryId: undefined,
|
||||
styles: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
@@ -337,7 +339,7 @@ const save = () => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form,
|
||||
navigationId: props.categoryId,
|
||||
categoryId: props.categoryId,
|
||||
content: content.value
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateDesign : addDesign;
|
||||
@@ -362,30 +364,38 @@ watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
content.value = ''
|
||||
images.value = []
|
||||
if (props.data) {
|
||||
assignFields(props.data);
|
||||
if(props.data.content){
|
||||
content.value = props.data.content
|
||||
}
|
||||
if(props.data.photo){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.photo,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = !!props.data.pageId;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
// 查询页面设计元素
|
||||
if(props.categoryId){
|
||||
content.value = '';
|
||||
resetFields();
|
||||
images.value = []
|
||||
console.log(props.categoryId);
|
||||
pageDesign({categoryId: props.categoryId,limit: 1}).then(res => {
|
||||
const design = res?.list[0];
|
||||
if(design){
|
||||
assignFields(design);
|
||||
if(design?.content){
|
||||
content.value = design.content
|
||||
}
|
||||
if(design.photo){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: design.photo,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = true;
|
||||
}else {
|
||||
isUpdate.value = false;
|
||||
content.value = '';
|
||||
resetFields();
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user