fix: 修复登录失败被当成功、列表假分页与首页裁切等隐患
1. 登录/验证码改判业务码 data.code(外层 errcode 恒为0),失败不再写入 phone 造成假登录态,并透出后端真实原因;倒计时改为发送成功后才启动;token 按 accessToken 兜底读取,不再写入 undefined 2. 权益包三 Tab 由 pageSize=1000 的假分页改为真实分页 + 页面级触底加载,各 Tab 独立游标与请求序号,合并去重兜底;中奖名单页码改为按期维护,修复切期后重复追加 3. 首页去掉整页 overflow:hidden,小屏不再裁切活动指南卡片;接口表去重并清理 7 个废弃端点;基址/客服电话集中到 common/config.js;删除权益详情不可达的假成功分支
This commit is contained in:
+23
-15
@@ -8,12 +8,12 @@
|
||||
<text class="back-text">返回</text>
|
||||
</view>
|
||||
<view class="banner-header">
|
||||
<image class="banner-icon" src="https://zhihuiyou.oss-cn-shenzhen.aliyuncs.com/hhrs/hhrs_zjgs.png" mode="aspectFit"></image>
|
||||
<image class="banner-icon" src="https://aliyunoss.hn12301.net/hhrs/hhrs_zjgs.png" mode="aspectFit"></image>
|
||||
<text class="banner-title">中奖名单公示</text>
|
||||
</view>
|
||||
<text class="banner-subtitle">总计 10,000份权益包,分三期公证抽取</text>
|
||||
<view class="stats-card">
|
||||
<image class="stats-gift" src="https://zhihuiyou.oss-cn-shenzhen.aliyuncs.com/hhrs/hhrs_xyckr.png" mode="aspectFit"></image>
|
||||
<image class="stats-gift" src="https://aliyunoss.hn12301.net/hhrs/hhrs_xyckr.png" mode="aspectFit"></image>
|
||||
<text class="stats-label">已产生</text>
|
||||
<text class="stats-number">{{ totalWinners.toLocaleString() }}</text>
|
||||
<text class="stats-label">名幸运持卡人</text>
|
||||
@@ -78,7 +78,8 @@ export default {
|
||||
currentTab: 0,
|
||||
tabs: [],
|
||||
winnerData: {},
|
||||
pageNo: 1,
|
||||
// xuchao: 页码改为按期维护(原单一 pageNo 在切期后会被沿用,导致同一页重复追加/跳页)
|
||||
pageNos: {},
|
||||
pageSize: 10,
|
||||
totals: {},
|
||||
totalWinners: 0,
|
||||
@@ -123,11 +124,13 @@ export default {
|
||||
data[index] = []
|
||||
})
|
||||
this.winnerData = data
|
||||
// xuchao: 预置各期 key,保证 totals/loadStatusMap 的响应式
|
||||
// xuchao: 预置各期 key,保证 totals/pageNos/loadStatusMap 的响应式
|
||||
this.totals = {}
|
||||
this.pageNos = {}
|
||||
this.loadStatusMap = {}
|
||||
dates.forEach((date, index) => {
|
||||
this.$set(this.totals, index, 0)
|
||||
this.$set(this.pageNos, index, 1)
|
||||
this.$set(this.loadStatusMap, index, 'loading')
|
||||
})
|
||||
// xuchao: 预取各期第一页,汇总已产生总人数
|
||||
@@ -142,21 +145,24 @@ export default {
|
||||
loadWinnerList(tabIndex, pageNo, allowConcurrent) {
|
||||
if (!this.tabs[tabIndex]) return
|
||||
if (this.inFlight > 0 && !allowConcurrent) return
|
||||
// xuchao: 本期页码独立计算,缺省续拉该期下一页
|
||||
const page = pageNo || (this.pageNos[tabIndex] || 1)
|
||||
this.inFlight++
|
||||
this.$set(this.loadStatusMap, tabIndex, 'loading')
|
||||
const drawDate = this.tabs[tabIndex].date
|
||||
this.$u.api.getWinnerList({
|
||||
pageNo: pageNo || this.pageNo,
|
||||
pageNo: page,
|
||||
pageSize: this.pageSize,
|
||||
drawDate: drawDate
|
||||
}).then(res => {
|
||||
if (res.errcode === 0 && res.data) {
|
||||
const list = res.data.list || []
|
||||
const page = pageNo || this.pageNo
|
||||
const prev = this.winnerData[tabIndex] || []
|
||||
this.$set(this.pageNos, tabIndex, page)
|
||||
if (page === 1) {
|
||||
this.$set(this.winnerData, tabIndex, list)
|
||||
} else {
|
||||
this.winnerData[tabIndex] = this.winnerData[tabIndex].concat(list)
|
||||
this.$set(this.winnerData, tabIndex, prev.concat(list))
|
||||
}
|
||||
this.$set(this.totals, tabIndex, res.data.total || 0)
|
||||
// xuchao: 各期总人数求和,用于顶部幸运持卡人数
|
||||
@@ -164,23 +170,25 @@ export default {
|
||||
}
|
||||
}).finally(() => {
|
||||
this.inFlight--
|
||||
const len = this.winnerData[tabIndex].length
|
||||
const len = (this.winnerData[tabIndex] || []).length
|
||||
const total = this.totals[tabIndex] || 0
|
||||
this.$set(this.loadStatusMap, tabIndex, len === 0 || len >= total ? 'nomore' : 'loadmore')
|
||||
})
|
||||
},
|
||||
loadMore() {
|
||||
const total = this.totals[this.currentTab] || 0
|
||||
if (this.winnerData[this.currentTab].length < total && this.inFlight === 0) {
|
||||
this.pageNo++
|
||||
this.loadWinnerList(this.currentTab)
|
||||
const tab = this.currentTab
|
||||
const total = this.totals[tab] || 0
|
||||
const len = (this.winnerData[tab] || []).length
|
||||
if (len < total && this.inFlight === 0) {
|
||||
this.loadWinnerList(tab, (this.pageNos[tab] || 1) + 1)
|
||||
}
|
||||
},
|
||||
switchTab(index) {
|
||||
this.currentTab = index
|
||||
this.pageNo = 1
|
||||
if (this.winnerData[index].length === 0) {
|
||||
this.loadWinnerList(index, 1)
|
||||
// xuchao: 不再重置全局 pageNo(各期游标自带);空列表补拉首页时允许并发,
|
||||
// 避免首屏预取仍在途时切期被丢弃后一直显示“暂无数据”
|
||||
if ((this.winnerData[index] || []).length === 0) {
|
||||
this.loadWinnerList(index, 1, true)
|
||||
} else {
|
||||
const total = this.totals[index] || 0
|
||||
this.$set(this.loadStatusMap, index, this.winnerData[index].length >= total ? 'nomore' : 'loadmore')
|
||||
|
||||
Reference in New Issue
Block a user