Commit 1f24b7fe authored by Damon's avatar Damon

更新拍照项保留图片

parent fee2dee1
...@@ -148,7 +148,6 @@ ...@@ -148,7 +148,6 @@
const data = cache.getCache(this.systemId) const data = cache.getCache(this.systemId)
const globalData = getApp().globalData const globalData = getApp().globalData
if (!globalData.cacheUpdate) { // 无需更新,读取缓存 if (!globalData.cacheUpdate) { // 无需更新,读取缓存
this.loading = false this.loading = false
this.handleData(data.result) this.handleData(data.result)
...@@ -174,21 +173,39 @@ ...@@ -174,21 +173,39 @@
title: res.result.error_msg title: res.result.error_msg
}) })
} else { } else {
const data = { that.diffData(res.result)
classify_id: this.classifyId,
system_id: this.systemId,
brand_id: this.brandId,
loadTime: Date.now(),
result: res.result
}
cache.setCache(this.systemId, data)
that.handleData(res.result)
} }
} }
}) })
}, },
diffData: function(result) {
const data = cache.getCache(this.systemId)
if (data) { // 只更新拍照项,不更新拍照的图片
const lists = data.result.map(v => v.list)
const photoLists = lists[0].concat(lists[1])
result.forEach(a => {
a.list.forEach(b => {
const row = photoLists.find(v => v._id === b._id)
if (row && row.imageList.length > 0) {
b.imageList = row.imageList
}
})
})
}
const cacheData = {
classify_id: this.classifyId,
system_id: this.systemId,
brand_id: this.brandId,
loadTime: Date.now(),
result: result
}
cache.setCache(this.systemId, cacheData)
this.handleData(result)
},
handleData: function(result) { handleData: function(result) {
this.activeTop = 0 this.activeTop = 0
const globalData = getApp().globalData const globalData = getApp().globalData
......
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