Commit 2675e99c by 张立顺

bug修复中

1 parent 33266a7b
......@@ -9,22 +9,23 @@ Component({
item: {
type: Object,
observer(n) {
this.check(n)
.then(res => {
if (res)
this.setData({
poster: res,
show: true
})
else this.begin()
})
.catch(() => this.begin())
n.posterUrl && this.checkUrl()
// this.check(n)
// .then(res => {
// if (res)
// this.setData({
// poster: res,
// show: true
// })
// else this.begin()
// })
// .catch(() => this.begin())
}
},
findKey: {
type: String,
value: 'activityId'
},
// findKey: {
// type: String,
// value: 'url'
// },
scrollImg: {
type: Boolean,
value: true
......@@ -35,13 +36,49 @@ Component({
* 组件的初始数据
*/
data: {
_item_: null
_item_: null,
findKey: 'urlLink'
},
/**
* 组件的方法列表
*/
methods: {
checkUrl() {
let { item } = this.data
const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager(),
{ findKey } = this.data
// url
// return new Promise((resolve, reject) => {
if (fileList.length) {
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({ files }) {
console.log(files, '文件列表')
if (files.length < 21) {
let item = fileList.find(e => e[findKey] === n[findKey])
if (item) {
const poster = files.find(s => s.includes(item.fileId))
wx.hideLoading()
if (poster) resolve(`${wx.env.USER_DATA_PATH}/${poster}`)
else reject()
} else reject()
} else {
wx.$storage.rm('fileList')
files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
})
reject()
}
}
})
}
// else reject()
// })
},
begin() {
let { item } = this.data
item.posterUrl && this.getImageInfo(item)
......@@ -50,36 +87,6 @@ Component({
this.setData({
_item_: n
})
const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager(),
{ findKey } = this.data
return new Promise((resolve, reject) => {
if (fileList.length) {
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({ files }) {
console.log(files, '文件列表')
if (files.length < 21) {
let item = fileList.find(e => e[findKey] === n[findKey])
if (item) {
const poster = files.find(s => s.includes(item.fileId))
wx.hideLoading()
if (poster) resolve(`${wx.env.USER_DATA_PATH}/${poster}`)
else reject()
} else reject()
} else {
wx.$storage.rm('fileList')
files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
})
reject()
}
}
})
} else reject()
})
},
getImageInfo(n) {
console.log(n)
......@@ -204,8 +211,8 @@ Component({
let fileList = wx.$storage.get('fileList') || []
fileList.push({
fileId: res.fileId,
path: res.path,
[findKey]: n[findKey]
path: res.path
// [findKey]: n[findKey]
})
wx.$storage.set('fileList', fileList)
},
......
......@@ -36,7 +36,7 @@ Component({
list: 'messageList'
}
},
findKey: '',
// findKey: '',
warReportList: [],
messageList: [],
serviceMerchantId: ''
......@@ -89,7 +89,7 @@ Component({
showPoster(e) {
const { item } = e.currentTarget.dataset
this.setData({
findKey: 'crowdFundActivityId',
// findKey: 'crowdFundActivityId',
posterItem: {
activityName: item.activityName,
posterUrl: item.valueUrl,
......@@ -101,9 +101,9 @@ Component({
async copyLink(e) {
const { item } = e.currentTarget.dataset,
posterObj = this.selectComponent('#poster')
this.setData({
findKey: 'activityId'
})
// this.setData({
// findKey: 'activityId'
// })
try {
let flag = await posterObj.check(item)
posterObj.setData({
......
......@@ -118,6 +118,7 @@
</scroll-view>
</view>
</view>
<crowdfund-poster findKey="{{findKey}}" id="poster" item="{{posterItem}}" />
<!-- findKey="{{findKey}}" -->
<crowdfund-poster id="poster" item="{{posterItem}}" />
<canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" />
{
"component": true,
"usingComponents": {
"poster": "../poster/poster"
}
"usingComponents": {}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!