Files
hhrs/pages/index/index.vue
T
jacobxu666andClaude Fable 5 805596e4a1 style: 全站统一系统字体栈并规整字重为500/600/700三级
App.vue 全局定义字体栈(iOS/鸿蒙/安卓/Windows 系统字体优先),
移除 winners 页衬线体与 index 页局部字体声明;bold 别名统一为 700,
冗余 400 删除;同类元素字重对齐:导航标题/分区标题 600、
hero 主标题与大数字 700、卡片名与按钮 500。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-28 22:22:35 +08:00

283 lines
6.7 KiB
Vue

<template>
<view class="page">
<!-- 顶部 Banner -->
<view class="banner">
<image class="banner-img" src="https://aliyunoss.hn12301.net/hhrs/hhrs_header.png" mode="widthFix"></image>
</view>
<!-- 金刚区 -->
<view class="king-area">
<view class="king-item" v-for="(item, index) in kingList" :key="index" @click="item.isRights ? goRights() : goPage(item.url)">
<image class="king-icon" :src="item.icon" mode="widthFix"></image>
<text class="king-text">{{ item.text }}</text>
</view>
</view>
<!-- 活动指南 -->
<view class="guide-section">
<view class="section-title">
<view class="title-line"></view>
<text class="title-text">活动指南</text>
</view>
<view class="guide-list">
<view class="guide-card" v-for="(item, index) in guideList" :key="index" @click="goPage(item.url)">
<image class="guide-bg" :src="item.bg" mode="scaleToFill"></image>
<view class="guide-info">
<text class="guide-title">{{ item.title }}</text>
<text class="guide-sub">{{ item.sub }}</text>
<view class="guide-tag">官方指南</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
kingList: [
{ icon: 'https://aliyunoss.hn12301.net/hhrs/hhrs_wlcg.png', text: '文旅场馆', url: '/pages/venue/venue' },
{ icon: 'https://aliyunoss.hn12301.net/hhrs/hhrs_shzk.png', text: '商户折扣', url: '/pages/discount/discount' },
{ icon: 'https://aliyunoss.hn12301.net/hhrs/hhrs_qyb.png', text: '权益包', url: '/pages/rights/rights', isRights: true },
{ icon: 'https://aliyunoss.hn12301.net/hhrs/hhrs_zjmd.png', text: '中奖名单', url: '/pages/winners/winners' }
],
guideList: [
{
title: '怀化社保卡惠民活动参加指南',
sub: '本地文旅场馆、商户惠民福利',
bg: 'https://aliyunoss.hn12301.net/hhrs/hhrs_cjzn.png',
url: '/pages/guide/join'
},
{
title: '社保卡领取及使用指南',
sub: '全流程办理及激活指引',
bg: 'https://aliyunoss.hn12301.net/hhrs/hhrs_syzn.png',
url: '/pages/guide/use'
}
]
}
},
onLoad(options) {
if (options.token) {
this.handleTokenLogin(options.token)
}
this.getLocation()
},
methods: {
// xuchao: 云闪付入口 token 自动登录
handleTokenLogin(token) {
this.$u.api.tokenDecode({ token }).then(res => {
if (res.errcode === 0 && res.data && res.data.mobile) {
uni.setStorageSync('phone', res.data.mobile)
this.$u.api.getEligibility({ phone: res.data.mobile, identityNo: res.data.idNo || '', name: res.data.name || '' }).then(eRes => {
if (eRes.errcode === 0) {
uni.setStorageSync('isAuth', eRes.data.isAuth)
uni.setStorageSync('hasWin', eRes.data.hasWin)
uni.setStorageSync('cardNumber', eRes.data.cardNumber)
uni.setStorageSync('expiresTime', eRes.data.expiresTime)
}
})
// xuchao: 清除地址栏 token,防止分享泄露
this.clearUrlToken()
} else {
this.degradeToPhoneLogin()
}
}).catch(() => {
this.degradeToPhoneLogin()
})
},
// xuchao: 解码失败兜底,提示并跳手机号登录
degradeToPhoneLogin() {
uni.showToast({ title: '登录凭证已失效,请使用手机号登录', icon: 'none' })
setTimeout(() => {
uni.navigateTo({ url: '/pages/index/login' })
}, 800)
},
// xuchao: 从 URL hash 中移除 token 参数
clearUrlToken() {
try {
const hash = window.location.hash || ''
const qIndex = hash.indexOf('?')
if (qIndex === -1) return
const params = new URLSearchParams(hash.substring(qIndex + 1))
if (!params.has('token')) return
params.delete('token')
const rest = params.toString()
const base = hash.substring(0, qIndex)
window.history.replaceState(null, '', rest ? `${base}?${rest}` : base)
} catch (e) {}
},
getLocation() {
import('@/common/location.js').then(module => {
module.default.getLocation().then(({ lng, lat }) => {
console.log('定位成功:', lng, lat)
}).catch(err => {
console.log('定位失败:', err)
})
})
},
goPage(url) {
uni.navigateTo({ url })
},
goRights() {
const phone = uni.getStorageSync('phone')
if (!phone) {
uni.navigateTo({ url: '/pages/index/login?redirect=rights' })
return
}
const isAuth = uni.getStorageSync('isAuth')
const hasWin = uni.getStorageSync('hasWin')
// xuchao: 最近发起过认证流程(含取消)时忽略旧认证缓存,一律回认证页
const authFlowStarted = uni.getStorageSync('authFlowStarted')
let status = 'auth'
if (isAuth && !authFlowStarted) {
status = hasWin ? 'info' : 'noWin'
}
uni.navigateTo({ url: `/pages/rights/rights?status=${status}` })
}
}
}
</script>
<style>
page {
height: 100%;
overflow: hidden;
}
.page {
height: 100vh;
background-color: #f5f5f5;
overflow: hidden;
display: flex;
flex-direction: column;
}
.banner-img {
width: 100%;
display: block;
}
/* 金刚区 */
.king-area {
width: 100%;
display: flex;
justify-content: space-between;
align-items: flex-start;
background-color: #ffffff;
padding: 24rpx;
box-sizing: border-box;
}
.king-item {
width: 25%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.king-icon {
width: 100rpx;
height: 132rpx;
margin-bottom: 12rpx;
}
.king-text {
font-size: 24rpx;
color: #333333;
text-align: center;
}
/* 活动指南 */
.guide-section {
flex: 1;
background-color: #ffffff;
margin-top: 10rpx;
overflow: hidden;
display: flex;
flex-direction: column;
}
.section-title {
display: flex;
align-items: center;
margin-bottom: 20rpx;
padding: 24rpx 20rpx 0 24px;
}
.title-line {
width: 6rpx;
height: 32rpx;
background-color: #1890ff;
border-radius: 3rpx;
margin-right: 12rpx;
}
.title-text {
font-size: 14px;
font-weight: 600;
color: #333333;
}
.guide-list {
display: flex;
flex-direction: column;
gap: 12px;
padding: 0 20rpx 30rpx;
}
.guide-card {
position: relative;
width: 100%;
height: 252rpx;
border-radius: 16rpx;
overflow: hidden;
}
.guide-bg {
width: 100%;
height: 252rpx;
border-radius: 16rpx;
}
.guide-info {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100%;
padding: 0 30rpx;
}
.guide-title {
font-size: 16px;
font-weight: 600;
color: #0088FF;
margin-bottom: 10rpx;
}
.guide-sub {
font-size: 12px;
color: #949AA0;
margin-bottom: 16rpx;
}
.guide-tag {
display: inline-block;
width: fit-content;
padding: 4px 10px;
background-color: #e6f2ff;
color: #0088FF;
font-size: 12px;
border-radius: 6rpx;
}
</style>