diff --git a/components/activity/LotteryResultPopup.vue b/components/activity/LotteryResultPopup.vue index 2a3a939..1d3b9b8 100644 --- a/components/activity/LotteryResultPopup.vue +++ b/components/activity/LotteryResultPopup.vue @@ -76,6 +76,32 @@ const props = defineProps({ const emit = defineEmits(['update:visible', 'close']) +function cleanUrl(u) { + if (!u) return '/static/logo.png' + let s = String(u).trim() + + // 尝试解析 JSON 数组字符串 (针对后端返回的 JSON 字符串图片地址) + if (s.startsWith('[') && s.endsWith(']')) { + try { + const arr = JSON.parse(s) + if (Array.isArray(arr) && arr.length > 0) { + s = arr[0] + } + } catch (e) { + console.warn('JSON parse failed for prize image:', s) + } + } + + // 清理反引号、引号和空格 + s = s.replace(/[`'"]/g, '').trim() + + // 提取 http 链接 + const m = s.match(/https?:\/\/[^\s]+/) + if (m && m[0]) return m[0] + + return s || '/static/logo.png' +} + const groupedResults = computed(() => { const map = new Map() const arr = Array.isArray(props.results) ? props.results : [] @@ -90,7 +116,7 @@ const groupedResults = computed(() => { } else { map.set(key, { title: item.title || item.name || '神秘奖品', - image: item.image || item.img || item.pic || '', + image: cleanUrl(item.image || item.img || item.pic || ''), reward_id: rewardId, quantity: 1 }) diff --git a/components/activity/RewardsPreview.vue b/components/activity/RewardsPreview.vue index 973c8ff..d48160e 100644 --- a/components/activity/RewardsPreview.vue +++ b/components/activity/RewardsPreview.vue @@ -14,7 +14,7 @@ - {{ item.boss ? 'BOSS' : group.level }} + BOSS {{ item.title }} diff --git a/pages-activity/activity/duiduipeng/index.vue b/pages-activity/activity/duiduipeng/index.vue index 0aa32b2..2b7c943 100644 --- a/pages-activity/activity/duiduipeng/index.vue +++ b/pages-activity/activity/duiduipeng/index.vue @@ -317,13 +317,21 @@ const currentIssueRewards = computed(() => { const rewardGroups = computed(() => { const groups = {} currentIssueRewards.value.forEach(item => { - const level = item.level || '赏' + let level = item.level || '赏' + if (item.min_score > 0 && level !== 'BOSS') { + level = `${item.min_score}对子` + } if (!groups[level]) groups[level] = [] groups[level].push(item) }) return Object.keys(groups).sort((a, b) => { - if (a === 'BOSS') return -1 - if (b === 'BOSS') return 1 + if (a === 'Last' || a === 'BOSS') return -1 + if (b === 'Last' || b === 'BOSS') return 1 + const numA = parseInt(a) + const numB = parseInt(b) + if (!isNaN(numA) && !isNaN(numB)) { + return numB - numA + } return a.localeCompare(b) }).map(key => { const rewards = groups[key] @@ -506,11 +514,13 @@ function normalizeIssues(list) { function normalizeRewards(list) { const arr = unwrap(list) const items = arr.map((i, idx) => ({ + ...i, // Spread original properties first id: i.product_id ?? i.id ?? String(idx), title: i.name ?? i.title ?? '', image: cleanUrl(i.product_image ?? i.image ?? i.img ?? i.pic ?? i.banner ?? ''), weight: Number(i.weight) || 0, boss: detectBoss(i), + min_score: Number(i.min_score) || 0, // Extract min_score level: levelToAlpha(i.prize_level ?? i.level ?? (detectBoss(i) ? 'BOSS' : '赏')) })) const total = items.reduce((acc, it) => acc + (it.weight > 0 ? it.weight : 0), 0) @@ -518,7 +528,8 @@ function normalizeRewards(list) { ...it, percent: total > 0 ? Math.round((it.weight / total) * 1000) / 10 : 0 })) - enriched.sort((a, b) => (b.percent - a.percent)) + // 移除前端按百分比强制排序逻辑,保留后端原始排序 + // enriched.sort((a, b) => (b.percent - a.percent)) return enriched } async function fetchRewardsForIssues(activityId) { @@ -974,7 +985,7 @@ async function finishAndReport() { ) return { title: item.title || item.name || found?.name || found?.title || '神秘奖励', - image: item.image || item.img || found?.image || found?.pic || found?.product_image || '', + image: cleanUrl(item.image || item.img || found?.image || found?.pic || found?.product_image || ''), reward_id: item.reward_id || item.id } }) diff --git a/pages/login/index.vue b/pages/login/index.vue index 8f57a72..2b55baa 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -22,14 +22,14 @@ :class="{ active: loginMode === 'wechat' }" @tap="switchMode('wechat')" > - 微信快捷登录 + 手机号快捷登录 - 手机号登录 + 验证码登录 @@ -43,8 +43,8 @@ 💬 - 微信一键授权 - 使用微信授权获取手机号,安全快速 + 一键获取手机号 + 授权获取本机手机号,安全快速登录 @@ -146,6 +146,8 @@