fix: support lottery detail code issue route

This commit is contained in:
hajimi
2026-08-03 15:36:40 +08:00
parent c368a45d11
commit 7d887c89e2
6 changed files with 218 additions and 31 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ export function getLotteryDrawList(data: {
/**
* @description 开奖详情
*/
export function getLotteryDrawDetail(data: { id: number }) {
export function getLotteryDrawDetail(data: { id?: number; code?: string; issue?: string }) {
return request.get({ url: '/lottery/drawDetail', data }, { withToken: false })
}
+9 -5
View File
@@ -36,8 +36,8 @@
</view>
<text class="ball-zodiac">{{ drawData.zodiac?.[i] || '' }}</text>
</view>
<text class="ball__plus">+</text>
<view class="ball-wrap">
<text v-if="drawData.special_number" class="ball__plus">+</text>
<view v-if="drawData.special_number" class="ball-wrap">
<view class="ball ball--special" :class="'ball--' + specialColor">
<text class="ball__num">{{ formatNum(drawData.special_number) }}</text>
</view>
@@ -214,11 +214,11 @@ const formatNum = (n: any) => {
return num < 10 ? '0' + num : String(num)
}
const fetchDetail = async (id: number) => {
const fetchDetail = async (params: { id?: number; code?: string; issue?: string }) => {
loading.value = true
errorMsg.value = ''
try {
const data = await getLotteryDrawDetail({ id })
const data = await getLotteryDrawDetail(params)
drawData.value = data
} catch (e: any) {
errorMsg.value = e?.msg || '加载失败'
@@ -248,8 +248,12 @@ const goBack = () => {
onLoad((options: any) => {
const id = Number(options.id || 0)
const code = String(options.code || '').trim()
const issue = String(options.issue || '').trim()
if (id > 0) {
fetchDetail(id)
fetchDetail({ id })
} else if (code && issue) {
fetchDetail({ code, issue })
} else {
loading.value = false
errorMsg.value = '参数错误'
@@ -16,14 +16,16 @@
<view class="date-filter__previous" @tap="shiftDateWindow(-1)">
<text></text>
</view>
<view class="date-filter__dates">
<view v-for="item in dateTabs" :key="item.key" class="date-filter__date"
:class="{ 'date-filter__date--active': selectedDateKey === item.key }"
@tap="selectMatchDate(item.key)">
<text class="date-filter__date-main">{{ item.label }}</text>
<text class="date-filter__date-week">{{ item.week }}</text>
<scroll-view scroll-x class="date-filter__dates" show-scrollbar="false">
<view class="date-filter__dates-inner">
<view v-for="item in dateTabs" :key="item.key" class="date-filter__date"
:class="{ 'date-filter__date--active': selectedDateKey === item.key }"
@tap="selectMatchDate(item.key)">
<text class="date-filter__date-main">{{ item.label }}</text>
<text class="date-filter__date-week">{{ item.week }}</text>
</view>
</view>
</view>
</scroll-view>
<picker mode="date" :value="selectedDateKey" @change="handleDatePickerChange">
<view class="date-filter__calendar">
<u-icon name="calendar" size="36" color="#20283a"></u-icon>
@@ -361,7 +363,7 @@ const getMatchDateKey = (match: any) => {
const dateTabs = computed(() => {
const anchorKey = dateWindowAnchorKey.value || selectedDateKey.value || formatDateKey(new Date())
return [-1, 0, 1].map((offset) => {
return [-3, -2, -1, 0, 1, 2, 3].map((offset) => {
const key = addDateDays(anchorKey, offset)
const date = parseDateKey(key)
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()]
@@ -896,13 +898,25 @@ onMounted(() => {
&__dates {
flex: 1;
min-width: 0;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
height: 76rpx;
overflow: hidden;
white-space: nowrap;
}
&__dates-inner {
display: inline-flex;
align-items: center;
gap: 8rpx;
height: 76rpx;
min-width: 100%;
padding: 0 2rpx;
box-sizing: border-box;
}
&__date {
position: relative;
width: 112rpx;
flex: 0 0 112rpx;
height: 56rpx;
display: flex;
align-items: center;