Fix:5956 【商城小程序】进入招商项目页面,连续点击多次招商项目文件,阅读文件左滑返回后有报错

This commit is contained in:
linxi
2026-09-04 11:39:18 +08:00
parent 069f0fa413
commit 88147f3783
+12
View File
@@ -34,6 +34,7 @@ export default {
pages: 0, // 总页数
list: [],
os: '',
isClick: false, // 防止连续点击重复请求/跳转
pageKeyId: Object.freeze('investmentList')
}
},
@@ -41,6 +42,10 @@ export default {
this.getOS()
this.getData()
},
onShow() {
// 从文件阅读页返回时解锁,允许再次点击
this.isClick = false
},
onReachBottom() {
if (this.pages >= this.page) this.getData()
},
@@ -67,6 +72,8 @@ export default {
})
},
getDetail(id) {
if (this.isClick) return
this.isClick = true
investmentInfo(id).then(({data}) => {
const file = data.contents[0];
if (file.suffix === 'pdf' && this.os === 'android') {
@@ -77,6 +84,8 @@ export default {
url: '/pkg_common/views/pdf?path=' + encodeURI(path) + '&id=' + id
})
}
}).catch(() => {
this.isClick = false
})
},
viewPdf(url) {
@@ -89,8 +98,10 @@ export default {
fileType: 'pdf',
success: result => {
//成功
this.isClick = false
},
fail: err => {
this.isClick = false
uni.showModal({
title: 'openDocument fail',
content: JSON.stringify(err)
@@ -99,6 +110,7 @@ export default {
})
},
fail: err => {
this.isClick = false
uni.showModal({
title: 'downloadFile fail',
content: JSON.stringify(err)