|
|
@@ -90,9 +90,11 @@ struct InitiatePayPage {
|
|
|
.mixedMode(MixedMode.Compatible)
|
|
|
.fileAccess(true)
|
|
|
.multiWindowAccess(true)
|
|
|
+ // 当Controller成功绑定到Web组件时触发该回调
|
|
|
.onControllerAttached(() => {
|
|
|
this.setupWebViewJavascriptBridge();
|
|
|
})
|
|
|
+ // 导航完成时触发该回调
|
|
|
.onRefreshAccessedHistory((event) => {
|
|
|
//H5页面间的跳转
|
|
|
// if (this.controller.getTitle().length < 5) {
|
|
|
@@ -103,6 +105,7 @@ struct InitiatePayPage {
|
|
|
this.historyCurrIndex = history.currentIndex
|
|
|
}
|
|
|
})
|
|
|
+ // 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问
|
|
|
.onLoadIntercept((event) => {
|
|
|
const isPayment = this.handlePaymentIntercept(event)
|
|
|
return isPayment
|
|
|
@@ -120,6 +123,10 @@ struct InitiatePayPage {
|
|
|
this.pageState = PageState.ERROR
|
|
|
}
|
|
|
})
|
|
|
+ .onBeforeUnload(() => {
|
|
|
+ console.log(`hhhh = ${JSON.stringify('hhhh')}`)
|
|
|
+ return true
|
|
|
+ })
|
|
|
}
|
|
|
.margin({ bottom: this.navBarShow ? this.safeBottom : 0 })
|
|
|
}
|
|
|
@@ -152,8 +159,6 @@ struct InitiatePayPage {
|
|
|
this.onBackPress()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- this.getPaymentResult()
|
|
|
}
|
|
|
|
|
|
// 页面自行处理返回逻辑,不进行页面路由
|
|
|
@@ -184,15 +189,16 @@ struct InitiatePayPage {
|
|
|
}
|
|
|
|
|
|
// todo 获取订单支付结果
|
|
|
- async getPaymentResult(): Promise<void> {
|
|
|
+ async getPaymentResult(catchFail: boolean = false): Promise<void> {
|
|
|
/**
|
|
|
* 前往借阅成功页面
|
|
|
*/
|
|
|
- // yTRouter.router2BorrowAnsPage()
|
|
|
this.orderState = await OrderApi.queryOrderStatus(this.orderId)
|
|
|
console.log(`订单状态 = ${JSON.stringify(this.orderState)}`)
|
|
|
if(this.orderState.flag == '1') {
|
|
|
yTRouter.router2BorrowAnsPage(true)
|
|
|
+ } else if(this.orderState.flag == '2' && catchFail) {
|
|
|
+ yTRouter.router2BorrowAnsPage(false)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -207,8 +213,8 @@ struct InitiatePayPage {
|
|
|
let url = data.getRequestUrl();
|
|
|
console.log(`alipay: url: ${url}`);
|
|
|
// 点击商城回退时会触发该跳转,直接退出就好,不加载
|
|
|
- if (url.includes('js_native://close')) {
|
|
|
- router.back()
|
|
|
+ if (url == 'https://hm-test.ytpm.net/prod-book/api/book/order/zfb/quit') {
|
|
|
+ this.getPaymentResult(true)
|
|
|
return true
|
|
|
}
|
|
|
// 拉起支付宝支付
|