Commit bb5c7fc0 authored by Damon's avatar Damon

缓存图片处理调整

parent 6ebba4ea
...@@ -83,10 +83,14 @@ export default { ...@@ -83,10 +83,14 @@ export default {
// 系统自动登录 // 系统自动登录
await this.autoLogin(); await this.autoLogin();
this.deleteTempImg()
}, },
onShow: async function () { onShow: async function () {
// 应用启动,或从后台进入前台显示 // 应用启动,或从后台进入前台显示
this.handleImageTask() if (this.uploadTask.length > 0) {
upload.uploadImageTask(this)
}
}, },
onHide: function () { onHide: function () {
// 应用从前台进入后台 // 应用从前台进入后台
...@@ -97,20 +101,16 @@ export default { ...@@ -97,20 +101,16 @@ export default {
} }
}, },
methods: { methods: {
// 处理上传图片队列数据 // 处理已上传完成的图片
handleImageTask() { deleteTempImg() {
if (this.uploadTask.length > 0) { const result = uni.getStorageSync('delImg')
upload.uploadImageTask(this) if (result.length > 0) {
} else { // 定时清理缓存在本地的文件 for (let i of result) {
const result = uni.getStorageSync('delImg') uni.removeSavedFile({
if (result.length > 0) { filePath: i
for (let i of result) { })
uni.removeSavedFile({
filePath: i
})
}
uni.setStorageSync('delImg', [])
} }
uni.setStorageSync('delImg', [])
} }
}, },
getSystemInfo() { getSystemInfo() {
......
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