feat: 微信jsapi支付成功修复跳转链接为空fix

This commit is contained in:
wolter 2024-12-25 14:07:48 +08:00
parent 74c1039d1c
commit 9397b72a2e
1 changed files with 5 additions and 1 deletions
front/templates

View File

@ -107,7 +107,10 @@
//res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。
document.getElementsByClassName('success')[0].style.display = 'block';
document.getElementsByClassName('error')[0].style.display = 'none';
window.location.href = {{.returnUrl}}; // 跳转
const returnUrl = "{{.returnUrl}}";
if (returnUrl && returnUrl.length > 0 && returnUrl.includes('http')) {
window.location.href = returnUrl; // 跳转
}
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
document.getElementsByClassName('error')[0].style.display = 'block';
document.getElementsByClassName('success')[0].style.display = 'none';
@ -119,6 +122,7 @@
}
});
}
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);