Commit 6cde5207 authored by Damon's avatar Damon

离线图片使用临时文件

parent f2474220
......@@ -261,17 +261,17 @@
const self = this
const photo = getApp().globalData.photo
const data = cache.getCache(self.systemId)
let path = []
data.result.forEach(v => {
v.list.forEach(item => {
if (item.imageList.length > 0) path = path.concat(item.imageList)
})
})
for (let i of path) {
uni.removeSavedFile({
filePath: i
})
}
// let path = []
// data.result.forEach(v => {
// v.list.forEach(item => {
// if (item.imageList.length > 0) path = path.concat(item.imageList)
// })
// })
// for (let i of path) {
// uni.removeSavedFile({
// filePath: i
// })
// }
cache.removeCache(self.systemId)
self.isPopShow = false
self.getListData()
......
......@@ -109,22 +109,16 @@
saveToStroage(path) {
const photo = getApp().globalData.photo
const currentItem = photo.currentItem
uni.saveFile({
tempFilePath: path,
success(e) {
const { savedFilePath } = e
currentItem.imageList.unshift(savedFilePath)
// 从缓存数据中找到修改对象并替换
const data = cache.getCache(currentItem.system_id)
data.result.forEach(v => {
const index = v.list.findIndex(item => item._id === currentItem._id)
if (index > -1) {
v.list[index] = currentItem
}
})
cache.setCache(currentItem.system_id, data)
currentItem.imageList.unshift(path)
// 从缓存数据中找到修改对象并替换
const data = cache.getCache(currentItem.system_id)
data.result.forEach(v => {
const index = v.list.findIndex(item => item._id === currentItem._id)
if (index > -1) {
v.list[index] = currentItem
}
})
cache.setCache(currentItem.system_id, data)
},
saveLocal(path){
return new Promise((resolve,reject)=>{
......
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