Commit bb5c7fc0 authored by Damon's avatar Damon

缓存图片处理调整

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