feat:【代码优化】减少部分模块的 import * 的 API
This commit is contained in:
@@ -6,7 +6,10 @@ import { useRoute } from 'vue-router';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import * as DiyPageApi from '#/api/mall/promotion/diy/page';
|
||||
import {
|
||||
getDiyPageProperty,
|
||||
updateDiyPageProperty,
|
||||
} from '#/api/mall/promotion/diy/page';
|
||||
import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components';
|
||||
|
||||
/** 装修页面表单 */
|
||||
@@ -23,7 +26,7 @@ async function getPageDetail(id: any) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
formData.value = await DiyPageApi.getDiyPageProperty(id);
|
||||
formData.value = await getDiyPageProperty(id);
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
@@ -36,7 +39,7 @@ async function submitForm() {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await DiyPageApi.updateDiyPageProperty(unref(formData)!);
|
||||
await updateDiyPageProperty(unref(formData)!);
|
||||
message.success('保存成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
|
||||
@@ -13,8 +13,11 @@ import { isEmpty } from '@vben/utils';
|
||||
|
||||
import { message, Radio, RadioGroup, Tooltip } from 'ant-design-vue';
|
||||
|
||||
import * as DiyPageApi from '#/api/mall/promotion/diy/page';
|
||||
import * as DiyTemplateApi from '#/api/mall/promotion/diy/template';
|
||||
import { updateDiyPageProperty } from '#/api/mall/promotion/diy/page';
|
||||
import {
|
||||
getDiyTemplateProperty,
|
||||
updateDiyTemplateProperty,
|
||||
} from '#/api/mall/promotion/diy/template';
|
||||
import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components';
|
||||
|
||||
/** 装修模板表单 */
|
||||
@@ -54,7 +57,7 @@ async function getPageDetail(id: any) {
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
formData.value = await DiyTemplateApi.getDiyTemplateProperty(id);
|
||||
formData.value = await getDiyTemplateProperty(id);
|
||||
|
||||
// 拼接手机预览链接
|
||||
const domain = import.meta.env.VITE_MALL_H5_DOMAIN;
|
||||
@@ -112,20 +115,18 @@ async function submitForm() {
|
||||
// 情况一:基础设置
|
||||
if (i === 0) {
|
||||
// 提交模板属性
|
||||
await DiyTemplateApi.updateDiyTemplateProperty(
|
||||
isEmpty(data) ? formData.value! : data,
|
||||
);
|
||||
await updateDiyTemplateProperty(isEmpty(data) ? formData.value! : data);
|
||||
continue;
|
||||
}
|
||||
// 提交页面属性
|
||||
// 情况二:提交当前正在编辑的页面
|
||||
if (currentFormData.value?.name.includes(templateItem.name)) {
|
||||
await DiyPageApi.updateDiyPageProperty(currentFormData.value!);
|
||||
await updateDiyPageProperty(currentFormData.value!);
|
||||
continue;
|
||||
}
|
||||
// 情况三:提交页面编辑缓存
|
||||
if (!isEmpty(data)) {
|
||||
await DiyPageApi.updateDiyPageProperty(data!);
|
||||
await updateDiyPageProperty(data!);
|
||||
}
|
||||
}
|
||||
message.success('保存成功');
|
||||
|
||||
Reference in New Issue
Block a user