营销:统一装修预览图片字段名称

This commit is contained in:
owen 2024-01-11 11:21:23 +08:00
parent 1fb7701e6e
commit a9c231bed6
8 changed files with 26 additions and 26 deletions

View File

@ -5,7 +5,7 @@ export interface DiyPageVO {
templateId?: number templateId?: number
name: string name: string
remark: string remark: string
previewImageUrls: string[] previewPicUrls: string[]
property: string property: string
} }

View File

@ -7,7 +7,7 @@ export interface DiyTemplateVO {
used: boolean used: boolean
usedTime?: Date usedTime?: Date
remark: string remark: string
previewImageUrls: string[] previewPicUrls: string[]
property: string property: string
} }

View File

@ -13,8 +13,8 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" /> <el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
<el-form-item label="预览图" prop="previewImageUrls"> <el-form-item label="预览图" prop="previewPicUrls">
<UploadImgs v-model="formData.previewImageUrls" /> <UploadImgs v-model="formData.previewPicUrls" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -40,7 +40,7 @@ const formData = ref({
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }]
@ -58,8 +58,8 @@ const open = async (type: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
const diyPage = await DiyPageApi.getDiyPage(id) // const diyPage = await DiyPageApi.getDiyPage(id) //
if (diyPage?.previewImageUrls?.length > 0) { if (diyPage?.previewPicUrls?.length > 0) {
diyPage.previewImageUrls = diyPage.previewImageUrls.map((url: string) => { diyPage.previewPicUrls = diyPage.previewPicUrls.map((url: string) => {
return { url } return { url }
}) })
} }
@ -82,10 +82,10 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
// //
const previewImageUrls = formData.value.previewImageUrls.map((item) => { const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : item return item['url'] ? item['url'] : item
}) })
const data = { ...formData.value, previewImageUrls } as unknown as DiyPageApi.DiyPageVO const data = { ...formData.value, previewPicUrls } as unknown as DiyPageApi.DiyPageVO
if (formType.value === 'create') { if (formType.value === 'create') {
await DiyPageApi.createDiyPage(data) await DiyPageApi.createDiyPage(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -107,7 +107,7 @@ const resetForm = () => {
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -52,7 +52,7 @@ const resetForm = () => {
templateId: undefined, templateId: undefined,
name: '', name: '',
remark: '', remark: '',
previewImageUrls: [], previewPicUrls: [],
property: '' property: ''
} as DiyPageApi.DiyPageVO } as DiyPageApi.DiyPageVO
formRef.value?.resetFields() formRef.value?.resetFields()

View File

@ -47,14 +47,14 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<el-table-column label="预览图" align="center" prop="previewImageUrls"> <el-table-column label="预览图" align="center" prop="previewPicUrls">
<template #default="scope"> <template #default="scope">
<el-image <el-image
class="h-40px max-w-40px" class="h-40px max-w-40px"
v-for="(url, index) in scope.row.previewImageUrls" v-for="(url, index) in scope.row.previewPicUrls"
:key="index" :key="index"
:src="url" :src="url"
:preview-src-list="scope.row.previewImageUrls" :preview-src-list="scope.row.previewPicUrls"
:initial-index="index" :initial-index="index"
preview-teleported preview-teleported
/> />

View File

@ -13,8 +13,8 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" /> <el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" />
</el-form-item> </el-form-item>
<el-form-item label="预览图" prop="previewImageUrls"> <el-form-item label="预览图" prop="previewPicUrls">
<UploadImgs v-model="formData.previewImageUrls" /> <UploadImgs v-model="formData.previewPicUrls" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -40,7 +40,7 @@ const formData = ref({
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }]
@ -59,8 +59,8 @@ const open = async (type: string, id?: number) => {
try { try {
const diyTemplate = await DiyTemplateApi.getDiyTemplate(id) const diyTemplate = await DiyTemplateApi.getDiyTemplate(id)
// //
if (diyTemplate?.previewImageUrls?.length > 0) { if (diyTemplate?.previewPicUrls?.length > 0) {
diyTemplate.previewImageUrls = diyTemplate.previewImageUrls.map((url: string) => { diyTemplate.previewPicUrls = diyTemplate.previewPicUrls.map((url: string) => {
return { url } return { url }
}) })
} }
@ -83,10 +83,10 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
// //
const previewImageUrls = formData.value.previewImageUrls.map((item) => { const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : item return item['url'] ? item['url'] : item
}) })
const data = { ...formData.value, previewImageUrls } as unknown as DiyTemplateApi.DiyTemplateVO const data = { ...formData.value, previewPicUrls } as unknown as DiyTemplateApi.DiyTemplateVO
if (formType.value === 'create') { if (formType.value === 'create') {
await DiyTemplateApi.createDiyTemplate(data) await DiyTemplateApi.createDiyTemplate(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -108,7 +108,7 @@ const resetForm = () => {
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -118,7 +118,7 @@ const resetForm = () => {
used: false, used: false,
usedTime: undefined, usedTime: undefined,
remark: '', remark: '',
previewImageUrls: [], previewPicUrls: [],
property: '', property: '',
pages: [] pages: []
} as DiyTemplateApi.DiyTemplatePropertyVO } as DiyTemplateApi.DiyTemplatePropertyVO

View File

@ -47,14 +47,14 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<el-table-column label="预览图" align="center" prop="previewImageUrls"> <el-table-column label="预览图" align="center" prop="previewPicUrls">
<template #default="scope"> <template #default="scope">
<el-image <el-image
class="h-40px max-w-40px" class="h-40px max-w-40px"
v-for="(url, index) in scope.row.previewImageUrls" v-for="(url, index) in scope.row.previewPicUrls"
:key="index" :key="index"
:src="url" :src="url"
:preview-src-list="scope.row.previewImageUrls" :preview-src-list="scope.row.previewPicUrls"
:initial-index="index" :initial-index="index"
preview-teleported preview-teleported
/> />