diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue index 3e83978..b4ee18c 100644 --- a/pages/mine/mine.vue +++ b/pages/mine/mine.vue @@ -38,6 +38,13 @@ + + + 付款码(测试) + {{ payDiag }} + + @@ -53,13 +60,20 @@ export default { data() { return { isLogin: false, - phone: '' + phone: '', + // xuchao: 付款码测试诊断文本(常驻屏幕显示) + payDiag: '' } }, computed: { maskPhone() { if (!this.phone || this.phone.length < 7) return this.phone return this.phone.substring(0, 3) + '****' + this.phone.substring(7) + }, + // xuchao: 付款码测试白名单(UAT 真机排查用,验证完成后连同按钮一并移除); + // String() 归一防 storage 类型还原成 number + payTestVisible() { + return String(this.phone) === '18684839400' } }, onShow() { @@ -100,6 +114,43 @@ export default { uni.showToast({ title: '拨号失败,客服电话 ' + config.servicePhone, icon: 'none' }) } }) + }, + // xuchao: 付款码真机测试——每步结果写进 payDiag 常驻屏幕;不校验 loginWay(目的即验证容器能力) + onPayTest() { + const diag = [] + const t0 = Date.now() + const flush = (tail) => { + diag.push(tail + ' +' + (Date.now() - t0) + 'ms') + this.payDiag = diag.join(';') + console.warn('[paytest]', this.payDiag) + } + diag.push('UA=' + String(navigator.userAgent || '').slice(-40)) + const s = document.createElement('script') + s.src = 'https://open.95516.com/s/open/js/upsdk.js' + s.setAttribute('data-upsdk', '1') + s.onload = () => after() + s.onerror = () => flush('SDK脚本加载失败') + if (!document.querySelector('script[data-upsdk]')) document.head.appendChild(s) + const self = this + function waitSdk(n) { + if (window.upsdk) return after() + if (n > 40) return flush('window.upsdk 未出现(9s)') + setTimeout(() => waitSdk(n + 1), 200) + } + function after() { + flush('upsdk=' + typeof window.upsdk) + let bridged = false + setTimeout(() => { if (!bridged) flush('桥未就绪(5s超时=非云闪付容器)') }, 5000) + try { + window.upsdk.pluginReady(() => { + bridged = true + flush('桥就绪') + try { window.upsdk.qrCodePay(); flush('qrCodePay已调用') } + catch (e) { flush('qrCodePay异常:' + (e && e.message || e)) } + }) + } catch (e) { flush('pluginReady异常:' + (e && e.message || e)) } + } + waitSdk(0) } } } @@ -198,6 +249,36 @@ export default { margin-left: 12px; } +/* xuchao: 付款码测试入口样式(仅白名单可见) */ +.pay-test { + margin: 16px 12px 0; + display: flex; + flex-direction: column; + align-items: center; +} +.pay-test-btn { + width: 100%; + height: 46px; + border-radius: 23px; + background: linear-gradient(90deg, #D8431F, #E8542F 55%, #F0703C); + color: #fff; + font-size: 16px; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; + letter-spacing: 2px; + box-shadow: 0 4px 9px rgba(216, 67, 31, .28); +} +.pay-test-diag { + margin-top: 10px; + font-size: 11px; + color: #8A6E56; + line-height: 1.6; + word-break: break-all; + padding: 0 6px; +} + /* xuchao: 底部固定导航遮挡留白;.page 必须撑满屏高并自带底色 —— 之前底色只挂在 body 上、 高度等于内容高度,内容短时下方露出 html 白底,在 TabBar 上方形成一条白带两条缝 */ .page {