Fix:5956 【商城小程序】进入招商项目页面,连续点击多次招商项目文件,阅读文件左滑返回后有报错
This commit is contained in:
@@ -34,6 +34,7 @@ export default {
|
|||||||
pages: 0, // 总页数
|
pages: 0, // 总页数
|
||||||
list: [],
|
list: [],
|
||||||
os: '',
|
os: '',
|
||||||
|
isClick: false, // 防止连续点击重复请求/跳转
|
||||||
pageKeyId: Object.freeze('investmentList')
|
pageKeyId: Object.freeze('investmentList')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -41,6 +42,10 @@ export default {
|
|||||||
this.getOS()
|
this.getOS()
|
||||||
this.getData()
|
this.getData()
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
// 从文件阅读页返回时解锁,允许再次点击
|
||||||
|
this.isClick = false
|
||||||
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.pages >= this.page) this.getData()
|
if (this.pages >= this.page) this.getData()
|
||||||
},
|
},
|
||||||
@@ -67,6 +72,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDetail(id) {
|
getDetail(id) {
|
||||||
|
if (this.isClick) return
|
||||||
|
this.isClick = true
|
||||||
investmentInfo(id).then(({data}) => {
|
investmentInfo(id).then(({data}) => {
|
||||||
const file = data.contents[0];
|
const file = data.contents[0];
|
||||||
if (file.suffix === 'pdf' && this.os === 'android') {
|
if (file.suffix === 'pdf' && this.os === 'android') {
|
||||||
@@ -77,6 +84,8 @@ export default {
|
|||||||
url: '/pkg_common/views/pdf?path=' + encodeURI(path) + '&id=' + id
|
url: '/pkg_common/views/pdf?path=' + encodeURI(path) + '&id=' + id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.isClick = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
viewPdf(url) {
|
viewPdf(url) {
|
||||||
@@ -89,8 +98,10 @@ export default {
|
|||||||
fileType: 'pdf',
|
fileType: 'pdf',
|
||||||
success: result => {
|
success: result => {
|
||||||
//成功
|
//成功
|
||||||
|
this.isClick = false
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
|
this.isClick = false
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: 'openDocument fail',
|
title: 'openDocument fail',
|
||||||
content: JSON.stringify(err)
|
content: JSON.stringify(err)
|
||||||
@@ -99,6 +110,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
|
this.isClick = false
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: 'downloadFile fail',
|
title: 'downloadFile fail',
|
||||||
content: JSON.stringify(err)
|
content: JSON.stringify(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user