提交 ebb58fba authored 作者: 龙菲's avatar 龙菲

修复图片文件回显的问题

上级 f1bda61e
......@@ -84,9 +84,9 @@ export default {
// 将回填的字段从url-->pressUrl
this.fileList = val.map((item) => {
return {
highImg: this.$getFullUrl(item.url),
lowImg: this.$getFullUrl(item.pressUrl),
url: this.$getFullUrl(item.pressUrl),
highImg: item.url,
lowImg: item.pressUrl,
url: item.pressUrl,
// pressUrl:item.pressUrl,
name: item.name,
fileId: item.fileId,
......@@ -99,12 +99,24 @@ export default {
value: {
handler: function (val) {
if (val) {
this.fileList = JSON.parse(JSON.stringify(val));
this.fileList = val.map((item) => {
return {
highImg: item.url,
lowImg: item.pressUrl,
url: item.pressUrl,
// pressUrl:item.pressUrl,
name: item.name,
fileId: item.fileId,
};
});
}
},
immediate: true,
deep: true,
},
advice(value) {
console.log(value);
},
},
computed: {
// 是否显示提示
......@@ -194,8 +206,6 @@ export default {
// 文件列表移除文件时的钩子
handleRemove(file, fileList) {
// debugger
// console.log("handleRemove", file, fileList);
let that = this;
that.fileList.map(async (item, index) => {
if (item.uid === file.uid) {
......@@ -203,9 +213,9 @@ export default {
}
});
if (
that.fileType == "jpg" ||
that.fileType == "png" ||
that.fileType == "jpeg"
this.fileType.indexOf("jpg") != -1 ||
this.fileType.indexOf("jpeg") != -1 ||
this.fileType.indexOf("png") != -1
) {
let newFileList = that.fileList.map((item) => {
item.url = item.highImg;
......@@ -222,7 +232,7 @@ export default {
handleChange(file, fileList) {
let that = this;
// console.log("handleChange", file, fileList);
console.log("handleChange", file, fileList);
if (fileList.length == this.fileLimit) {
this.maxNum = this.fileLimit;
}
......@@ -231,11 +241,12 @@ export default {
.then((res) => {
that.fileList.push(res);
if (
that.fileType == "jpg" ||
that.fileType == "png" ||
that.fileType == "jpeg"
this.fileType.indexOf("jpg") != -1 ||
this.fileType.indexOf("jpeg") != -1 ||
this.fileType.indexOf("png") != -1
) {
let newFileList = that.fileList.map((item) => {
let tempList = JSON.parse(JSON.stringify(that.fileList));
let newFileList = tempList.map((item) => {
item.url = item.highImg;
item.pressUrl = item.lowImg;
item.name = item.name;
......@@ -259,11 +270,6 @@ export default {
.disabled .el-upload--picture-card {
display: none !important;
}
// 上传抖动修复
.el-upload-list__item.is-ready {
display: none;
}
// 隐藏回显动画
.el-upload-list__item {
transition: none !important;
}
......
......@@ -90,9 +90,9 @@ export default {
},
handleEditAblequestion() {
if (this.qillInit) {
this.$refs.text.quill.enable(true);
this.$refs.myQuillEditor.quill.enable(true);
console.log(111);
this.$refs.text.quill.focus();
this.$refs.myQuillEditor.quill.focus();
this.qillInit = false;
}
},
......
......@@ -175,6 +175,20 @@ export const Throttle = (fn, t) => {
}
}
// // 获取完整的url,根据环境进行配置
// export function getFullUrl(url) {
// let fullUrl = ''
// if (url && url.indexOf('http') != -1 && url.indexOf('files') != -1) {
// let urlArr = url.split('files')
// fullUrl = '/files' + urlArr[1]
// } else if (url && url.indexOf('http') == -1 && url.indexOf('files') == -1) {
// fullUrl = '/files' + url
// } else {
// fullUrl = url
// }
// return fullUrl
// }
// 获取完整的url,根据环境进行配置
export function getFullUrl(url) {
let fullUrl = ''
......
......@@ -61,6 +61,7 @@
/>
</el-col>
<el-col :span="24" class="mg-bt20">
<div>单元文物:</div>
<el-select
v-model="currentData.crIds"
multiple
......@@ -85,7 +86,6 @@
<el-col :span="24">
<div>单元图片:</div>
<ManualUploader
v-model="currentData.imagesVo"
:files="currentData.imagesVo"
:fileLimit="7"
:fileSize="50"
......@@ -178,22 +178,21 @@ export default {
arr.forEach((item) => {
if (item.culturalRelics && item.culturalRelics.length > 0) {
that.$set(that, "crList", item.culturalRelics);
that.crList = item.culturalRelics;
item.crIds = [];
item.culturalRelics.map((cr) => {
// item.crIds.push(cr.crId);
item.crIds.push(cr.crId);
that.$nextTick(() => {
// console.log("remoteSelect", that.$refs["remoteSelect"]);
that.$refs["remoteSelect"].cachedOptions.push({
currentLabel: cr.name, // 当前绑定的数据的label
currentValue: cr.crId, // 当前绑定数据的value
label: cr.name, // 当前绑定的数据的label
value: cr.crId, // 当前绑定数据的value
});
});
// that.$nextTick(() => {
// // console.log("remoteSelect", that.$refs["remoteSelect"]);
// that.$refs["remoteSelect"].cachedOptions.push({
// currentLabel: cr.name, // 当前绑定的数据的label
// currentValue: cr.crId, // 当前绑定数据的value
// label: cr.name, // 当前绑定的数据的label
// value: cr.crId, // 当前绑定数据的value
// });
// });
});
} else {
that.$set(that, "crList", []);
}
......@@ -265,7 +264,6 @@ export default {
this.$refs[ref].focus();
console.log(this.$refs[`1Title`]);
}, 100);
// this.$refs[data.euId+'Title'].focus();
},
appendChild(data) {
......@@ -273,15 +271,11 @@ export default {
euId: euId++,
title: "单元标题",
intro: "",
showMediaUploader: false,
images: "",
imagesVo: [],
crIds: [],
videos: "",
children: [],
// unit: "",
// imagesVo: [],
// videosVo: [],
};
if (!data.children) {
this.$set(data, "children", []);
......@@ -296,7 +290,6 @@ export default {
title: "单元标题",
intro: "",
crIds: [],
showMediaUploader: false,
images: "",
imagesVo: [],
videos: "",
......@@ -320,6 +313,7 @@ export default {
const index = children.findIndex((d) => d.euId === data.euId);
children.splice(index, 1);
},
changeFileList(fileList) {
this.currentData.imagesVo = fileList;
},
......@@ -344,25 +338,6 @@ export default {
break;
}
},
//失去焦点事件
onEditorBlur(quill) {
console.log("editor blur!", quill);
},
//获得焦点事件
onEditorFocus(quill) {
console.log("editor focus!", quill);
},
// 准备富文本编辑器
onEditorReady(quill) {
console.log("editor ready!", quill);
},
//内容改变事件
onEditorChange({ quill, html, text }) {
console.log("editor change!", quill, html, text);
this.content = html;
},
handleToUnit(type) {
// debugger
const { euId } = this.currentData;
......@@ -371,8 +346,6 @@ export default {
let that = this;
// debugger
traverseTree(this.treeData);
console.log("next", next);
console.log("prev", prev);
function traverseTree(arr) {
if (arr && arr.length > 0) {
arr.map((item, index) => {
......@@ -405,16 +378,6 @@ export default {
});
}
}
// this.treeData.map();
// switch (type) {
// case "prev":
// console.log(1);
// break;
// case "next":
// console.log(-1);
// break;
// }
},
},
};
......
......@@ -242,6 +242,7 @@
listType="picture-card"
:fileType="['png', 'jpeg', 'jpg']"
:files="faceImage"
v-model="faceImage"
ref="faceImage"
/>
</el-form-item>
......@@ -694,7 +695,7 @@ export default {
this.reload();
},
// 回到顶部
handleToTop(){
let el = document.getElementById("dialog-content");
el.scrollIntoView({ block: 'start',behavior: "smooth" })
......
......@@ -49,7 +49,8 @@
</el-form-item>
<el-form-item label="展览介绍" :label-width="formLabelWidth">
<VueQuillEditor ref="VueQuillEditor"
<VueQuillEditor
ref="VueQuillEditor"
v-model="dialogForm.intro"
:placeholder="'请输入产品介绍'"
/>
......@@ -90,7 +91,7 @@ export default {
name: "InfoEditDialog",
components: {
ManualUploader,
VueQuillEditor
VueQuillEditor,
},
props: {
visible: {
......@@ -134,7 +135,18 @@ export default {
// 回填状态
that.status = Boolean(Number(that.dialogForm.status));
// 回填图片
that.images = that.dialogForm.imagesVo || [];
if (that.dialogForm.imagesVo.length > 0) {
let tempList = [];
that.dialogForm.imagesVo.map((item) => {
item.pressUrl = "/files" + item.pressUrl;
item.url = "/files" + item.url;
tempList.push(item);
that.images = tempList;
});
} else {
that.images = [];
}
}
},
immediate: true,
......@@ -240,8 +252,6 @@ export default {
ContentLength: typeof prop === "string" ? prop.length : prop.size,
},
}));
console.log("formDataArr.length", formDataArr.length);
console.log("params", params);
// return;
// formData有长度时再进行上传
if (formDataArr.length > 0) {
......@@ -253,7 +263,7 @@ export default {
});
}
}
params.images = imgFileIds.join(',');
params.images = imgFileIds.join(",");
} else {
params.images = "";
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论