diff --git a/docs/业务进度管理.md b/docs/业务进度管理.md index 8258f569..c9a28435 100644 --- a/docs/业务进度管理.md +++ b/docs/业务进度管理.md @@ -13,6 +13,20 @@ ## 一、已完成事项 +### 126. 历史开奖记录页面数据兼容优化 + +- 状态:代码已完成,待 H5 验收 - 时间:2026-08-03 + +完成内容: + +- 修复开奖记录页对双重 URL 编码参数只解码一次的问题,确保彩种名称和编码正常读取。 +- 兼容开奖记录接口的多种列表响应结构,并统一处理开奖状态、号码及空数据重试状态。 +- 增加无记录和请求失败时的友好空态,避免接口有数据但页面显示空白。 + +涉及模块: + +- `uniapp/src/packages_lottery/pages/draw_list.vue` + ### 125. 个人中心设计稿分组重排 - 状态:代码已完成,待 H5 验收 - 时间:2026-08-03 diff --git a/uniapp/src/packages_lottery/pages/draw_list.vue b/uniapp/src/packages_lottery/pages/draw_list.vue index 3b0e9355..32ccf8c2 100644 --- a/uniapp/src/packages_lottery/pages/draw_list.vue +++ b/uniapp/src/packages_lottery/pages/draw_list.vue @@ -13,16 +13,24 @@ - + + + + 暂无开奖记录 + 该彩种的历史开奖数据暂时不可用 + + 重新加载 + + 第 {{ item.issue }} 期 {{ item.draw_time }} - - {{ item.status === 1 ? '已开奖' : '待开奖' }} + + {{ Number(item.status) === 1 ? '已开奖' : '待开奖' }} - + - + 等待开奖... @@ -153,6 +161,8 @@ const gameTemplate = ref('') const categoryName = ref('') const drawList = ref([]) const latestDraw = ref(null) +const listLoading = ref(false) +const listError = ref(false) const paging = shallowRef() uni.getSystemInfo({ @@ -171,6 +181,25 @@ const formatNum = (n: any) => { 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 () => { try { const data = await getLatestDrawResult({ code: gameCode.value }) @@ -181,20 +210,42 @@ const fetchLatest = async () => { } const queryList = async (pageNo: number, pageSize: number) => { + listLoading.value = true + listError.value = false try { + if (!gameCode.value) { + listError.value = true + paging.value?.complete(false) + return + } const res = await getDrawResultList({ code: gameCode.value, page_no: pageNo, 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 }) paging.value?.complete(lists) } catch (e) { + listError.value = true paging.value?.complete(false) + } finally { + listLoading.value = false } } +const reloadList = () => { + listError.value = false + paging.value?.reload() +} + const goDetail = (item: any) => { uni.navigateTo({ url: `/packages_lottery/pages/detail?code=${item.code}&issue=${item.issue}` }) } @@ -257,9 +308,9 @@ const goBack = () => { } onLoad((options: any) => { - gameCode.value = options.code || '' + gameCode.value = decodeQueryValue(options.code) gameTemplate.value = options.template || '' - categoryName.value = decodeURIComponent(options.name || '开奖记录') + categoryName.value = decodeQueryValue(options.name, '开奖记录') fetchLatest() }) @@ -270,6 +321,49 @@ onLoad((options: any) => { 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 { height: 100vh; overflow: hidden;