Commit 2675e99c by 张立顺

bug修复中

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