Commit 94afde72 authored by Damon's avatar Damon

fix: 上传图片地址错误修复

parent 82321386
...@@ -162,6 +162,10 @@ ...@@ -162,6 +162,10 @@
let dataList = [] let dataList = []
var flag = false; var flag = false;
res.data.forEach(item=>{ res.data.forEach(item=>{
item.key = item.orderImages ? item.orderImages.map(v => {
const key = v.split('com/')
return key[1]
}) : []
if(dataList.length===0 ){ if(dataList.length===0 ){
var dataItem = {type:'',list:[]} var dataItem = {type:'',list:[]}
dataItem.type = item.type dataItem.type = item.type
...@@ -246,10 +250,9 @@ ...@@ -246,10 +250,9 @@
}, },
async closeTake(img) { async closeTake(img) {
if(img !== undefined){ if(img !== undefined){
// 复制一份 用于保存
if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = [] if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = []
let saveList = this.currentItemDate.orderImages.slice(0) // 真实地址key
let saveList = this.currentItemDate.key
const files = img.map(v => v.path) const files = img.map(v => v.path)
const value = await this.saveToTask(files) const value = await this.saveToTask(files)
value.forEach(item =>{ value.forEach(item =>{
...@@ -258,19 +261,16 @@ ...@@ -258,19 +261,16 @@
// step1 添加缓存图片 到显示 // step1 添加缓存图片 到显示
this.currentItemDate.orderImages.push(item.path) this.currentItemDate.orderImages.push(item.path)
}) })
// step2 保存图片 // // step2 保存图片
var data = { const data = {
type: this.currentItemDate.type, type: this.currentItemDate.type,
images: saveList, images: saveList,
fieldsName: this.currentItemDate.fieldName fieldsName: this.currentItemDate.fieldName
} }
console.log("data", data) console.log("data", data)
this.$u.api.saveImage(data,this.orderId).then((res) => { this.$u.api.saveImage(data,this.orderId).then((res) => {
if (res.code == 200) { if (res.code !== 200) console.log("保存图片异常",res.data.message)
} else { })
console.log("保存图片异常",res.data.message)
}
});
} }
this.takeStatus = false this.takeStatus = false
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment