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

修复图片文件回显的问题

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