diff --git a/activity/wheel/index.html b/activity/wheel/index.html index 90e864c..fbcb182 100644 --- a/activity/wheel/index.html +++ b/activity/wheel/index.html @@ -370,7 +370,20 @@ type="button" @click="startLottery" > - {{ t('drawAgain') }} + + + + + diff --git a/activity/wheel/script.js b/activity/wheel/script.js index 8cd468f..3d327c8 100644 --- a/activity/wheel/script.js +++ b/activity/wheel/script.js @@ -604,14 +604,31 @@ } function rewardDisplayValue(reward) { + var metadata = parseJSON( + firstPresentValue(reward, ['metadataJson', 'metadata_json']) + ); return Number( firstPresentValue(reward, [ 'value', + 'displayValue', + 'display_value', 'displayGoldAmount', 'goldAmount', 'rewardValue', + 'reward_value', + 'rewardCoins', + 'reward_coins', 'amount', - ]) || 0 + ]) || + firstPresentValue(metadata, [ + 'display_value', + 'displayValue', + 'coin_price', + 'coinPrice', + 'price', + 'value', + ]) || + 0 ); } @@ -856,6 +873,35 @@ asset: function (name) { return ASSET_BASE + name; }, + rewardTotalValue: function (drawResult) { + drawResult = drawResult || {}; + var directValue = Number( + firstPresentValue(drawResult, [ + 'rewardValue', + 'reward_value', + 'totalValue', + 'total_value', + ]) || 0 + ); + if (directValue > 0) return directValue; + // 弹窗展示必须以当前聚合奖品为准:多抽会先合并相同资源,兜底重算可覆盖旧接口未返回总价值的情况。 + return (drawResult.rewards || []).reduce(function (sum, item) { + return ( + sum + rewardDisplayValue(item) * rewardCountValue(item) + ); + }, 0); + }, + formatRewardValue: function (value) { + var number = Number(value || 0); + return Number.isFinite(number) + ? Math.floor(number).toLocaleString('en-US') + : '0'; + }, + rewardTotalText: function (drawResult) { + return this.formatRewardValue( + this.rewardTotalValue(drawResult) + ); + }, ensurePreviewPlayer: function () { var target = this.$refs.previewEffect; if (!target || !window.HyAppEffectPlayer) return null; diff --git a/activity/wheel/style.css b/activity/wheel/style.css index 770b0cb..4dfd24b 100644 --- a/activity/wheel/style.css +++ b/activity/wheel/style.css @@ -837,21 +837,60 @@ button { } .again-btn { - display: block; + display: flex; flex: 0 0 auto; + align-items: center; + justify-content: center; + flex-direction: column; + gap: calc(2 * var(--wheel-vw)); width: 85%; - height: calc(48 * var(--wheel-vw)); + height: calc(56 * var(--wheel-vw)); margin: calc(8 * var(--wheel-vw)) auto 0; color: #fff; font-size: calc(16 * var(--wheel-vw)); font-weight: 700; - line-height: calc(48 * var(--wheel-vw)); + line-height: 1.05; text-align: center; border: calc(2 * var(--wheel-vw)) solid #fff; border-radius: calc(10 * var(--wheel-vw)); background: linear-gradient(to right, #1897ff, #2472ff); } +.again-total { + display: flex; + align-items: center; + justify-content: center; + max-width: 92%; + gap: calc(4 * var(--wheel-vw)); + overflow: hidden; + color: #fff35a; + font-size: calc(13 * var(--wheel-vw)); + font-weight: 800; + line-height: 1; + text-shadow: 0 calc(1 * var(--wheel-vw)) calc(2 * var(--wheel-vw)) + rgba(116, 38, 0, 0.7); +} + +.again-total img { + width: calc(16 * var(--wheel-vw)); + height: calc(16 * var(--wheel-vw)); + flex: 0 0 auto; +} + +.again-total span { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.again-label { + display: block; + max-width: 92%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .wheel-luxury .rule-content { padding: calc(40 * var(--wheel-vw)) calc(20 * var(--wheel-vw)) calc(20 * var(--wheel-vw)); @@ -990,8 +1029,7 @@ button { } .wheel-luxury .again-btn { - height: calc(38 * var(--wheel-vw)); - line-height: calc(38 * var(--wheel-vw)); + height: calc(50 * var(--wheel-vw)); background: linear-gradient(to bottom, #ff85b4, #db2e6c); }