Commit d786ddff by 李伟康

海报缓存

1 parent 17cfcddc
......@@ -17,6 +17,10 @@ Component({
else this.begin()
}).catch(() => this.begin())
}
},
findKey: {
type: String,
value: 'activityId'
}
},
......@@ -37,7 +41,10 @@ Component({
},
check(n) {
const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager()
fn = wx.getFileSystemManager(),
{
findKey
} = this.data
return new Promise((resolve, reject) => {
if (fileList.length) {
fn.readdir({
......@@ -45,9 +52,9 @@ Component({
success({
files
}) {
console.log(files,'文件列表')
console.log(files, '文件列表')
if (files.length < 21) {
let item = fileList.find(e => e.activityId === n.activityId)
let item = fileList.find(e => e[findKey] === n[findKey])
if (item) {
const poster = files.find(s => s.includes(item.fileId))
wx.hideLoading()
......@@ -56,7 +63,7 @@ Component({
} else reject()
} else {
wx.$storage.rm('fileList')
files.map(e =>{
files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
......@@ -101,6 +108,9 @@ Component({
userInfo
} = wx.$storage.get(),
merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName,
{
findKey
} = this.data,
res = await drawfun.begin({
imageList: [{
x: 0,
......@@ -161,7 +171,7 @@ Component({
fileList.push({
fileId: res.fileId,
path: res.path,
activityId: n.activityId
[findKey]: n[findKey]
})
wx.$storage.set('fileList', fileList)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!