fix: restore lottery draw history list
This commit is contained in:
@@ -13,6 +13,20 @@
|
|||||||
|
|
||||||
## 一、已完成事项
|
## 一、已完成事项
|
||||||
|
|
||||||
|
### 126. 历史开奖记录页面数据兼容优化
|
||||||
|
|
||||||
|
- 状态:代码已完成,待 H5 验收 - 时间:2026-08-03
|
||||||
|
|
||||||
|
完成内容:
|
||||||
|
|
||||||
|
- 修复开奖记录页对双重 URL 编码参数只解码一次的问题,确保彩种名称和编码正常读取。
|
||||||
|
- 兼容开奖记录接口的多种列表响应结构,并统一处理开奖状态、号码及空数据重试状态。
|
||||||
|
- 增加无记录和请求失败时的友好空态,避免接口有数据但页面显示空白。
|
||||||
|
|
||||||
|
涉及模块:
|
||||||
|
|
||||||
|
- `uniapp/src/packages_lottery/pages/draw_list.vue`
|
||||||
|
|
||||||
### 125. 个人中心设计稿分组重排
|
### 125. 个人中心设计稿分组重排
|
||||||
|
|
||||||
- 状态:代码已完成,待 H5 验收 - 时间:2026-08-03
|
- 状态:代码已完成,待 H5 验收 - 时间:2026-08-03
|
||||||
|
|||||||
@@ -13,16 +13,24 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 开奖列表 -->
|
<!-- 开奖列表 -->
|
||||||
<z-paging ref="paging" v-model="drawList" @query="queryList" :fixed="false">
|
<z-paging ref="paging" v-model="drawList" @query="queryList" :fixed="false" height="calc(100vh - 44px)">
|
||||||
|
<view v-if="!drawList.length && !listLoading" class="draw-list__empty">
|
||||||
|
<text class="draw-list__empty-icon">⌑</text>
|
||||||
|
<text class="draw-list__empty-title">暂无开奖记录</text>
|
||||||
|
<text class="draw-list__empty-desc">该彩种的历史开奖数据暂时不可用</text>
|
||||||
|
<view v-if="listError" class="draw-list__retry" @tap="reloadList">
|
||||||
|
<text>重新加载</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view v-for="item in drawList" :key="item.code + item.issue" class="draw-card">
|
<view v-for="item in drawList" :key="item.code + item.issue" class="draw-card">
|
||||||
<view class="draw-card__header">
|
<view class="draw-card__header">
|
||||||
<text class="draw-card__period">第 {{ item.issue }} 期</text>
|
<text class="draw-card__period">第 {{ item.issue }} 期</text>
|
||||||
<text class="draw-card__date">{{ item.draw_time }}</text>
|
<text class="draw-card__date">{{ item.draw_time }}</text>
|
||||||
<view class="draw-card__badge" :class="{ 'draw-card__badge--pending': item.status !== 1 }">
|
<view class="draw-card__badge" :class="{ 'draw-card__badge--pending': Number(item.status) !== 1 }">
|
||||||
<text>{{ item.status === 1 ? '已开奖' : '待开奖' }}</text>
|
<text>{{ Number(item.status) === 1 ? '已开奖' : '待开奖' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="item.status === 1 && item.numbers?.length" class="draw-card__balls">
|
<view v-if="Number(item.status) === 1 && item.numbers?.length" class="draw-card__balls">
|
||||||
<template v-for="(ball, i) in item.numbers" :key="i">
|
<template v-for="(ball, i) in item.numbers" :key="i">
|
||||||
<text v-if="i === item.numbers.length - 1" class="ball__plus">+</text>
|
<text v-if="i === item.numbers.length - 1" class="ball__plus">+</text>
|
||||||
<view class="ball-wrap">
|
<view class="ball-wrap">
|
||||||
@@ -34,7 +42,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="item.status !== 1" class="draw-card__pending">
|
<view v-if="Number(item.status) !== 1" class="draw-card__pending">
|
||||||
<text>等待开奖...</text>
|
<text>等待开奖...</text>
|
||||||
<view class="ai-predict-btn" @tap.stop="openAiPopup(item)">
|
<view class="ai-predict-btn" @tap.stop="openAiPopup(item)">
|
||||||
<view class="ai-predict-btn__pulse" />
|
<view class="ai-predict-btn__pulse" />
|
||||||
@@ -153,6 +161,8 @@ const gameTemplate = ref('')
|
|||||||
const categoryName = ref('')
|
const categoryName = ref('')
|
||||||
const drawList = ref<any[]>([])
|
const drawList = ref<any[]>([])
|
||||||
const latestDraw = ref<any>(null)
|
const latestDraw = ref<any>(null)
|
||||||
|
const listLoading = ref(false)
|
||||||
|
const listError = ref(false)
|
||||||
const paging = shallowRef()
|
const paging = shallowRef()
|
||||||
|
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
@@ -171,6 +181,25 @@ const formatNum = (n: any) => {
|
|||||||
return num < 10 ? '0' + num : String(num)
|
return num < 10 ? '0' + num : String(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const decodeQueryValue = (value: any, fallback = '') => {
|
||||||
|
let result = String(value ?? fallback)
|
||||||
|
for (let i = 0; i < 3 && /%[0-9a-f]{2}/i.test(result); i++) {
|
||||||
|
try {
|
||||||
|
const decoded = decodeURIComponent(result)
|
||||||
|
if (decoded === result) break
|
||||||
|
result = decoded
|
||||||
|
} catch {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizeDrawList = (res: any) => {
|
||||||
|
const source = res?.lists ?? res?.data?.lists ?? res?.records ?? res?.data?.records ?? res?.data
|
||||||
|
return Array.isArray(source) ? source : []
|
||||||
|
}
|
||||||
|
|
||||||
const fetchLatest = async () => {
|
const fetchLatest = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await getLatestDrawResult({ code: gameCode.value })
|
const data = await getLatestDrawResult({ code: gameCode.value })
|
||||||
@@ -181,20 +210,42 @@ const fetchLatest = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const queryList = async (pageNo: number, pageSize: number) => {
|
const queryList = async (pageNo: number, pageSize: number) => {
|
||||||
|
listLoading.value = true
|
||||||
|
listError.value = false
|
||||||
try {
|
try {
|
||||||
|
if (!gameCode.value) {
|
||||||
|
listError.value = true
|
||||||
|
paging.value?.complete(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
const res = await getDrawResultList({
|
const res = await getDrawResultList({
|
||||||
code: gameCode.value,
|
code: gameCode.value,
|
||||||
page_no: pageNo,
|
page_no: pageNo,
|
||||||
page_size: pageSize
|
page_size: pageSize
|
||||||
})
|
})
|
||||||
const lists = res?.lists || []
|
const lists = normalizeDrawList(res).map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
code: item.code || gameCode.value,
|
||||||
|
status: Number(item.status) === 1 || Boolean(item.draw_code) ? 1 : 0,
|
||||||
|
numbers: Array.isArray(item.numbers)
|
||||||
|
? item.numbers
|
||||||
|
: String(item.draw_code || '').split(',').filter(Boolean)
|
||||||
|
}))
|
||||||
lists.forEach((item: any) => { item.game_name = categoryName.value })
|
lists.forEach((item: any) => { item.game_name = categoryName.value })
|
||||||
paging.value?.complete(lists)
|
paging.value?.complete(lists)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
listError.value = true
|
||||||
paging.value?.complete(false)
|
paging.value?.complete(false)
|
||||||
|
} finally {
|
||||||
|
listLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reloadList = () => {
|
||||||
|
listError.value = false
|
||||||
|
paging.value?.reload()
|
||||||
|
}
|
||||||
|
|
||||||
const goDetail = (item: any) => {
|
const goDetail = (item: any) => {
|
||||||
uni.navigateTo({ url: `/packages_lottery/pages/detail?code=${item.code}&issue=${item.issue}` })
|
uni.navigateTo({ url: `/packages_lottery/pages/detail?code=${item.code}&issue=${item.issue}` })
|
||||||
}
|
}
|
||||||
@@ -257,9 +308,9 @@ const goBack = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options: any) => {
|
onLoad((options: any) => {
|
||||||
gameCode.value = options.code || ''
|
gameCode.value = decodeQueryValue(options.code)
|
||||||
gameTemplate.value = options.template || ''
|
gameTemplate.value = options.template || ''
|
||||||
categoryName.value = decodeURIComponent(options.name || '开奖记录')
|
categoryName.value = decodeQueryValue(options.name, '开奖记录')
|
||||||
fetchLatest()
|
fetchLatest()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -270,6 +321,49 @@ onLoad((options: any) => {
|
|||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.draw-list__empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 180rpx 40rpx 120rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draw-list__empty-icon {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #e9edf5;
|
||||||
|
color: #9aa4b2;
|
||||||
|
font-size: 56rpx;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draw-list__empty-title {
|
||||||
|
color: #4b5563;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draw-list__empty-desc {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
color: #9ca3af;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draw-list__retry {
|
||||||
|
margin-top: 28rpx;
|
||||||
|
padding: 14rpx 40rpx;
|
||||||
|
border-radius: 32rpx;
|
||||||
|
background: #185dff;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.page-no-scroll {
|
.page-no-scroll {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
Reference in New Issue
Block a user