Files
hhrs/pages/mine/mine.vue
T
jacobxu666andClaude Fable 5 881526b104 feat:我的页新增付款码测试入口(仅白名单手机号 18684839400 可见)
- 测试按钮点击后每步诊断结果(UA/SDK加载/桥就绪/qrCodePay)常驻显示在按钮下方,
  不依赖弹窗与长按,云闪付真机可直读卡点
- 不校验 loginWay(目的就是验证容器能力);合并修复 mine.vue 双 computed 覆盖笔误
- 验证完成后连同按钮一并移除(临时排查工具)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-27 19:38:06 +08:00

292 lines
7.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<!-- 未登录 -->
<view class="user-section" v-if="!isLogin" @click="goLogin">
<view class="user-info">
<image class="user-avatar" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_tx.png" mode="aspectFill" />
<text class="login-hint">点击登录</text>
</view>
</view>
<!-- 已登录 -->
<view class="user-section" v-else>
<view class="user-info">
<image class="user-avatar" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_tx.png" mode="aspectFill" />
<view class="user-detail">
<text class="user-phone">{{ maskPhone }}</text>
</view>
</view>
<view class="logout-btn" @click="onLogout">退出登录</view>
</view>
<!-- 菜单列表 -->
<view class="menu-list">
<view class="menu-item" @click="goWinners">
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_zjcx.png" mode="aspectFit" />
<text class="menu-label">用户中奖查询</text>
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
</view>
<view class="menu-item" @click="goGuide">
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_syzn.png" mode="aspectFit" />
<text class="menu-label">使用指南</text>
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
</view>
<view class="menu-item" @click="goService">
<image class="menu-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_wd_lxkf.png" mode="aspectFit" />
<text class="menu-label">联系客服</text>
<u-icon name="arrow-right" color="#cccccc" size="28"></u-icon>
</view>
</view>
<!-- xuchao: 付款码真机测试入口——仅白名单手机号可见(UAT 排查云闪付容器链路用);
诊断结果常驻显示在按钮下方,不依赖弹窗/长按 -->
<view class="pay-test" v-if="payTestVisible">
<view class="pay-test-btn" @click="onPayTest">付款码(测试)</view>
<text class="pay-test-diag" v-if="payDiag">{{ payDiag }}</text>
</view>
<!-- xuchao: 首页改版后 我的 页复用同一自定义底部导航 -->
<hhrs-tabbar current="mine"></hhrs-tabbar>
</view>
</template>
<script>
import config from '@/common/config.js'
import account from '@/common/account.js'
import HhrsTabbar from '@/components/hhrs-tabbar/hhrs-tabbar.vue'
export default {
components: { HhrsTabbar },
data() {
return {
isLogin: false,
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() {
this.phone = uni.getStorageSync('phone') || ''
this.isLogin = !!this.phone
},
methods: {
goLogin() {
uni.navigateTo({ url: '/pages/index/login' })
},
onLogout() {
uni.showModal({
title: '提示',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
// xuchao: 原来只清 token/phone,权益缓存(isAuth/hasWin/cardNumber/expiresTime/
// rightsCount 等)残留会被下一个账号当成自己的数据展示
account.clearAccountCache()
this.isLogin = false
this.phone = ''
uni.showToast({ title: '已退出登录', icon: 'success' })
}
}
})
},
goWinners() {
uni.navigateTo({ url: '/pages/winners/winners' })
},
goGuide() {
uni.navigateTo({ url: '/pages/guide/use' })
},
goService() {
// xuchao: 唤起拨号,号码与协议页公示的统一客服电话同源(common/config.js)
uni.makePhoneCall({
phoneNumber: config.servicePhone,
fail: () => {
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)
}
}
}
</script>
<style>
/* xuchao: 配色与改版后首页统一 —— 暖米底 + 品牌红橙头 */
page {
background-color: #FDECE2;
}
</style>
<style>
/* 用户信息(xuchao: 头区渐变改品牌红→页面米色,与首页 KV 同色系) */
.user-section {
display: flex;
align-items: center;
justify-content: space-between;
background: linear-gradient(180deg, #E8542F 0%, #F5B98E 55%, #FDECE2 100%);
padding: 40px 16px 130px;
}
.login-hint {
font-size: 16px;
color: #ffffff;
font-weight: 500;
margin-left: 12px;
}
.user-info {
display: flex;
align-items: center;
gap: 12px;
}
.user-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
background-color: #ffffff;
}
.user-detail {
display: flex;
flex-direction: column;
gap: 4px;
}
.user-name {
font-size: 16px;
font-weight: 500;
color: #ffffff;
}
.user-phone {
font-size: 14px;
color: rgba(255, 255, 255, 0.8);
}
.logout-btn {
background-color: rgba(255, 255, 255, 0.2);
color: #ffffff;
font-size: 13px;
padding: 6px 16px;
border-radius: 4px;
}
/* 菜单列表(xuchao: 圆角与首页卡片同规格 28rpx) */
.menu-list {
margin: -88px 12px 0;
background-color: #ffffff;
border-radius: 14px;
}
.menu-item {
display: flex;
align-items: center;
height: 64px;
padding: 0 16px;
border-bottom: 1px solid #f5f5f5;
}
.menu-item:last-child {
border-bottom: none;
}
.menu-icon {
width: 36rpx;
height: 36rpx;
}
.menu-label {
flex: 1;
font-size: 15px;
color: #333333;
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 {
min-height: 100vh;
background-color: #FDECE2;
padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
</style>