Commit 964fc284 authored by Damon's avatar Damon

fix: 兼容安卓环境下图片不存在的情况

parent ed1505cd
...@@ -50,6 +50,7 @@ export default { ...@@ -50,6 +50,7 @@ export default {
let lists = files.map(v => { let lists = files.map(v => {
const key = randomChar(10) const key = randomChar(10)
return { return {
time: this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss'),
key: key, key: key,
path: v, path: v,
src: key, src: key,
...@@ -61,7 +62,7 @@ export default { ...@@ -61,7 +62,7 @@ export default {
// const row = await this.saveFiles(path) // const row = await this.saveFiles(path)
// lists.push(row) // lists.push(row)
// } // }
const data = this.uploadTask const data = JSON.parse(JSON.stringify(this.uploadTask))
const saveLists = data.concat(lists) const saveLists = data.concat(lists)
this.$u.vuex('uploadTask', saveLists) this.$u.vuex('uploadTask', saveLists)
return lists return lists
......
...@@ -32,9 +32,10 @@ export default { ...@@ -32,9 +32,10 @@ export default {
err.mobile = that.vuex_user.mobile err.mobile = that.vuex_user.mobile
if(!err.key) err.files = uploadTask if(!err.key) err.files = uploadTask
if(!err.orderNumber) err.orderNumber = uploadTask[0].orderNumber
ERROR('upload_photo_error', err) ERROR('upload_photo_error', err)
if (err.errMsg && err.errMsg.indexOf('fail file not found') !== -1) { // 在任务中删除不存在的图片 if (err.errMsg && (err.errMsg.indexOf('fail file not found') !== -1 || err.errMsg.indexOf('file doesn') !== -1)) { // 在任务中删除不存在的图片
const newTask = uploadTask.filter(v => v.key !== err.key) const newTask = uploadTask.filter(v => v.key !== err.key)
that.$u.vuex('uploadTask', newTask) that.$u.vuex('uploadTask', newTask)
} }
......
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