|
@@ -53,8 +53,7 @@
|
|
|
</el-row>
|
|
|
</template>
|
|
|
<template #contentImg>
|
|
|
- <el-row style="width: 100%">
|
|
|
- <el-col :span="6">
|
|
|
+
|
|
|
<el-form-item prop="contentImg">
|
|
|
<el-upload
|
|
|
class="avatar-uploader"
|
|
@@ -64,23 +63,28 @@
|
|
|
accept=".gif, .jpeg, .jpg, .png"
|
|
|
:on-success="contentImgSuccess"
|
|
|
:before-upload="uploadContentImg">
|
|
|
- <el-image
|
|
|
- v-if="formData.data.contentImgList && formData.data.contentImgList.length > 0"
|
|
|
- :src="formData.data.contentImgList[0].fileUrl"
|
|
|
- fit="scale-down"
|
|
|
- class="avatar" />
|
|
|
- <el-icon v-else class="uploader-icon"><Plus /></el-icon>
|
|
|
+ <el-row style="width: 100%">
|
|
|
+ <el-col :span="6" v-for="(item,index) in formData.data.contentImgList" style="padding: 0 10px">
|
|
|
+ <el-image
|
|
|
+ :src="item.fileUrl"
|
|
|
+ fit="scale-down"
|
|
|
+ class="avatar" />
|
|
|
+ <el-button
|
|
|
+ class="delete-btn"
|
|
|
+ type="danger"
|
|
|
+ @click="deleteContentImg(index) ">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-icon class="uploader-icon"><Plus /></el-icon>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-upload>
|
|
|
- <el-button
|
|
|
- class="delete-btn"
|
|
|
- type="danger"
|
|
|
- v-if="formData.data.contentImgList && formData.data.contentImgList.length > 0"
|
|
|
- @click="formData.data.contentImgList = []">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
+
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+
|
|
|
+
|
|
|
</template>
|
|
|
<template #content>
|
|
|
<div style="width: 100%" v-if="dialogVisible">
|
|
@@ -125,6 +129,7 @@ import byForm from "@/components/byForm/index.vue";
|
|
|
import {getDictOneByXmhjc, getFileList, getFileStr} from "@/api/XMHJC/common";
|
|
|
import { computed, ref } from "vue";
|
|
|
import TinymceEditor from "@/components/Editor/TinymceEditor.vue";
|
|
|
+import {isNullOrUndefined} from "@tinymce/tinymce-vue/lib/es2015/main/ts/Utils";
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
|
const specDict = ref([]);
|
|
@@ -343,20 +348,20 @@ const formConfig = computed(() => {
|
|
|
width: "50%",
|
|
|
},
|
|
|
},
|
|
|
-/* {
|
|
|
- type: "select",
|
|
|
- prop: "contentType",
|
|
|
- label: "详情类型",
|
|
|
- data: contentType.value,
|
|
|
- required: true,
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // type: "select",
|
|
|
+ // prop: "contentType",
|
|
|
+ // label: "详情类型",
|
|
|
+ // data: contentType.value,
|
|
|
+ // required: true,
|
|
|
+ // },
|
|
|
{
|
|
|
type: "slot",
|
|
|
prop: "contentImgList",
|
|
|
slotName: "contentImg",
|
|
|
label: "详情图片",
|
|
|
- isShow: formData.data.contentType == "1"
|
|
|
- },*/
|
|
|
+
|
|
|
+ },
|
|
|
{
|
|
|
type: "slot",
|
|
|
prop: "content",
|
|
@@ -428,15 +433,18 @@ const changeStatus = (row) => {
|
|
|
};
|
|
|
|
|
|
//编辑详情
|
|
|
-const getDetail = (row) => {
|
|
|
+const getDetail = async (row) => {
|
|
|
modalType.value = "edit";
|
|
|
- proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
|
|
|
- formData.data = res;
|
|
|
- getFileList({businessIdList: [res.id], fileType: 1}).then((resFile1) => {
|
|
|
- formData.data.coverUrlList = resFile1.data[res.id];
|
|
|
- dialogVisible.value = true;
|
|
|
- });
|
|
|
- getSubCategoryList(res.categoryId, false);
|
|
|
+ proxy.post("/productInfo/detail", { id: row.id }).then(async (res) => {
|
|
|
+ formData.data = res;
|
|
|
+ await getFileList({businessIdList: [res.id], fileType: 1}).then((resFile1) => {
|
|
|
+ formData.data.coverUrlList = resFile1.data[res.id];
|
|
|
+ });
|
|
|
+ await getFileList({businessIdList: [res.id], fileType: 2}).then((resFile1) => {
|
|
|
+ formData.data.contentImgList = resFile1.data[res.id];
|
|
|
+ });
|
|
|
+ dialogVisible.value = true;
|
|
|
+ getSubCategoryList(res.categoryId, false);
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -531,13 +539,19 @@ const uploadContentImg = async (file) => {
|
|
|
};
|
|
|
|
|
|
const contentImgSuccess = (response, uploadFile) => {
|
|
|
- formData.data.contentImgList = [
|
|
|
+ if (isNullOrUndefined(formData.data.contentImgList)){
|
|
|
+ formData.data.contentImgList = []
|
|
|
+ }
|
|
|
+ formData.data.contentImgList.push(
|
|
|
{
|
|
|
- id: uploadFile.raw.id,
|
|
|
- fileName: uploadFile.raw.fileName,
|
|
|
- fileUrl: uploadFile.raw.fileUrl,
|
|
|
- },
|
|
|
- ];
|
|
|
+ id: uploadFile.raw.id,
|
|
|
+ fileName: uploadFile.raw.fileName,
|
|
|
+ fileUrl: uploadFile.raw.fileUrl,
|
|
|
+ }
|
|
|
+ )
|
|
|
+};
|
|
|
+const deleteContentImg = (index) => {
|
|
|
+ formData.data.contentImgList.splice(index,1)
|
|
|
};
|
|
|
|
|
|
const coverUrlOne = ref({});
|