parent
d1c9f702d9
commit
ae2209a53e
@ -5,7 +5,7 @@ export interface DiyPageVO {
|
||||
templateId?: number
|
||||
name: string
|
||||
remark: string
|
||||
previewImageUrls: string[]
|
||||
previewPicUrls: string[]
|
||||
property: string
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ export interface DiyTemplateVO {
|
||||
used: boolean
|
||||
usedTime?: Date
|
||||
remark: string
|
||||
previewImageUrls: string[]
|
||||
previewPicUrls: string[]
|
||||
property: string
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预览图" prop="previewImageUrls">
|
||||
<UploadImgs v-model="formData.previewImageUrls" />
|
||||
<el-form-item label="预览图" prop="previewPicUrls">
|
||||
<UploadImgs v-model="formData.previewPicUrls" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -40,7 +40,7 @@ const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
remark: undefined,
|
||||
previewImageUrls: []
|
||||
previewPicUrls: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }]
|
||||
@ -58,8 +58,8 @@ const open = async (type: string, id?: number) => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
const diyPage = await DiyPageApi.getDiyPage(id) // 处理预览图
|
||||
if (diyPage?.previewImageUrls?.length > 0) {
|
||||
diyPage.previewImageUrls = diyPage.previewImageUrls.map((url: string) => {
|
||||
if (diyPage?.previewPicUrls?.length > 0) {
|
||||
diyPage.previewPicUrls = diyPage.previewPicUrls.map((url: string) => {
|
||||
return { url }
|
||||
})
|
||||
}
|
||||
@ -82,10 +82,10 @@ const submitForm = async () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
// 处理预览图
|
||||
const previewImageUrls = formData.value.previewImageUrls.map((item) => {
|
||||
const previewPicUrls = formData.value.previewPicUrls.map((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') {
|
||||
await DiyPageApi.createDiyPage(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
@ -107,7 +107,7 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
remark: undefined,
|
||||
previewImageUrls: []
|
||||
previewPicUrls: []
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ const resetForm = () => {
|
||||
templateId: undefined,
|
||||
name: '',
|
||||
remark: '',
|
||||
previewImageUrls: [],
|
||||
previewPicUrls: [],
|
||||
property: ''
|
||||
} as DiyPageApi.DiyPageVO
|
||||
formRef.value?.resetFields()
|
||||
|
@ -47,14 +47,14 @@
|
||||
<ContentWrap>
|
||||
<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="previewImageUrls">
|
||||
<el-table-column label="预览图" align="center" prop="previewPicUrls">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
class="h-40px max-w-40px"
|
||||
v-for="(url, index) in scope.row.previewImageUrls"
|
||||
v-for="(url, index) in scope.row.previewPicUrls"
|
||||
:key="index"
|
||||
:src="url"
|
||||
:preview-src-list="scope.row.previewImageUrls"
|
||||
:preview-src-list="scope.row.previewPicUrls"
|
||||
:initial-index="index"
|
||||
preview-teleported
|
||||
/>
|
||||
|
@ -13,8 +13,8 @@
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预览图" prop="previewImageUrls">
|
||||
<UploadImgs v-model="formData.previewImageUrls" />
|
||||
<el-form-item label="预览图" prop="previewPicUrls">
|
||||
<UploadImgs v-model="formData.previewPicUrls" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -40,7 +40,7 @@ const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
remark: undefined,
|
||||
previewImageUrls: []
|
||||
previewPicUrls: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }]
|
||||
@ -59,8 +59,8 @@ const open = async (type: string, id?: number) => {
|
||||
try {
|
||||
const diyTemplate = await DiyTemplateApi.getDiyTemplate(id)
|
||||
// 处理预览图
|
||||
if (diyTemplate?.previewImageUrls?.length > 0) {
|
||||
diyTemplate.previewImageUrls = diyTemplate.previewImageUrls.map((url: string) => {
|
||||
if (diyTemplate?.previewPicUrls?.length > 0) {
|
||||
diyTemplate.previewPicUrls = diyTemplate.previewPicUrls.map((url: string) => {
|
||||
return { url }
|
||||
})
|
||||
}
|
||||
@ -83,10 +83,10 @@ const submitForm = async () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
// 处理预览图
|
||||
const previewImageUrls = formData.value.previewImageUrls.map((item) => {
|
||||
const previewPicUrls = formData.value.previewPicUrls.map((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') {
|
||||
await DiyTemplateApi.createDiyTemplate(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
@ -108,7 +108,7 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
remark: undefined,
|
||||
previewImageUrls: []
|
||||
previewPicUrls: []
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ const resetForm = () => {
|
||||
used: false,
|
||||
usedTime: undefined,
|
||||
remark: '',
|
||||
previewImageUrls: [],
|
||||
previewPicUrls: [],
|
||||
property: '',
|
||||
pages: []
|
||||
} as DiyTemplateApi.DiyTemplatePropertyVO
|
||||
|
@ -47,14 +47,14 @@
|
||||
<ContentWrap>
|
||||
<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="previewImageUrls">
|
||||
<el-table-column label="预览图" align="center" prop="previewPicUrls">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
class="h-40px max-w-40px"
|
||||
v-for="(url, index) in scope.row.previewImageUrls"
|
||||
v-for="(url, index) in scope.row.previewPicUrls"
|
||||
:key="index"
|
||||
:src="url"
|
||||
:preview-src-list="scope.row.previewImageUrls"
|
||||
:preview-src-list="scope.row.previewPicUrls"
|
||||
:initial-index="index"
|
||||
preview-teleported
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user