From 3efeb5fa6be757de7584288021a022a37e9609cf Mon Sep 17 00:00:00 2001 From: ltx <1006158920@qq.com> Date: Thu, 9 Apr 2026 17:59:12 +0800 Subject: [PATCH] =?UTF-8?q?update:=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/detail/detail.js | 89 ++++++++++++++++++-------- pages/home/home.js | 11 ++-- pages/home/home.wxml | 139 ++++++++++++----------------------------- pages/home/home.wxss | 6 +- 4 files changed, 110 insertions(+), 135 deletions(-) diff --git a/pages/detail/detail.js b/pages/detail/detail.js index a99652b..95ff456 100644 --- a/pages/detail/detail.js +++ b/pages/detail/detail.js @@ -116,6 +116,31 @@ function splitLines(text) { .filter(Boolean); } +function normalizePointsRuleDetail(raw) { + const d = raw && typeof raw === 'object' ? raw : null; + if (!d) return null; + const detailsRaw = Array.isArray(d.details) ? d.details : Array.isArray(d.Details) ? d.Details : []; + const details = detailsRaw + .map((x) => { + const startRank = toNonNegInt(pick(x, ['startRank', 'StartRank'])); + const endRank = toNonNegInt(pick(x, ['endRank', 'EndRank'])); + const points = toNonNegInt(pick(x, ['points', 'Points'])); + if (startRank == null && endRank == null && points == null) return null; + return { + startRank: startRank != null ? startRank : endRank, + endRank: endRank != null ? endRank : startRank, + points + }; + }) + .filter(Boolean); + + return { + ruleName: pick(d, ['ruleName', 'RuleName']) || '', + participationPoints: pick(d, ['participationPoints', 'ParticipationPoints']), + details + }; +} + function toNonNegInt(v) { const n = Number(v); if (Number.isNaN(n)) return null; @@ -186,22 +211,8 @@ function normalizeEventDetail(raw) { 'RegistrationMethodDescription' ]) || registrationModeText(pick(d, ['registrationMode', 'RegistrationMode'])); - const feeModeLabel = - pick(d, ['feeModeText', 'FeeModeText', 'feeModeDescription', 'FeeModeDescription', 'pricingModeText', 'PricingModeText']) || - pick(d, ['feeMode', 'FeeMode', 'pricingMode', 'PricingMode']) || - ''; - - const priceRaw = pick(d, [ - 'displayPrice', - 'DisplayPrice', - 'eventPrice', - 'EventPrice', - 'price', - 'Price', - 'minFee', - 'MinFee' - ]); - let priceDisplay = priceRaw != null && priceRaw !== '' ? priceRaw : null; + const feeModeLabel =d.chargeMode == 0 ? '免费' : d.chargeMode == 1 ? '定价模式(赛事)' : d.chargeMode == 2 ? '单价(赛事)' : '单价(项目)'; + let priceDisplay = d && d.feeConfig ? d.feeConfig.price : null; if (priceDisplay == null && projects.length) { const fees = projects.map((p) => p.fee).filter((f) => f != null && f !== ''); if (fees.length) { @@ -222,17 +233,41 @@ function normalizeEventDetail(raw) { ); const refundRulesText = pick(d, ['refundRules', 'RefundRules', 'refundDescription', 'RefundDescription']); - const participationPoints = pick(d, ['participationPoints', 'ParticipationPoints']); - const rankingPointsRaw = pick(d, [ - 'rankingPointsText', - 'RankingPointsText', - 'rankingPointsDescription', - 'RankingPointsDescription', - 'rankingPoints', - 'RankingPoints' - ]); + + const pointsRuleDetailRaw = pick(d, ['pointsRuleDetail', 'PointsRuleDetail']); + const pointsRuleDetail = normalizePointsRuleDetail(pointsRuleDetailRaw); + + const participationPoints = pointsRuleDetail + ? pick(pointsRuleDetail, ['participationPoints', 'ParticipationPoints']) + : pick(d, ['participationPoints', 'ParticipationPoints']); + + const rankingPointsRaw = pointsRuleDetail + ? pointsRuleDetail.details + : pick(d, [ + 'rankingPointsText', + 'RankingPointsText', + 'rankingPointsDescription', + 'RankingPointsDescription', + 'rankingPoints', + 'RankingPoints' + ]); let rankingPointsLines = []; - if (typeof rankingPointsRaw === 'string') { + if (Array.isArray(rankingPointsRaw) && rankingPointsRaw.length && typeof rankingPointsRaw[0] === 'object') { + rankingPointsLines = rankingPointsRaw + .map((it) => { + const sr = toNonNegInt(pick(it, ['startRank', 'StartRank'])); + const er = toNonNegInt(pick(it, ['endRank', 'EndRank'])); + const pts = toNonNegInt(pick(it, ['points', 'Points'])); + if (pts == null) return null; + const a = sr != null ? sr : er; + const b = er != null ? er : sr; + if (a == null && b == null) return `${pts}积分`; + if (a != null && b != null && a === b) return `${a} ${pts}积分`; + if (a != null && b != null) return `${a}--${b} ${pts}积分`; + return `${a != null ? a : b} ${pts}积分`; + }) + .filter(Boolean); + } else if (typeof rankingPointsRaw === 'string') { rankingPointsLines = splitLines(rankingPointsRaw); } else if (Array.isArray(rankingPointsRaw)) { rankingPointsLines = rankingPointsRaw.map((x) => String(x)).filter(Boolean); @@ -393,7 +428,7 @@ Page({ var materialRangeText = n.materialRangeText || fb.materialRangeText; - var uploadMaterialRemark = + var uploadMaterialRemark = pick(detail, [ 'uploadMaterialRemark', 'UploadMaterialRemark', diff --git a/pages/home/home.js b/pages/home/home.js index b141c9b..8a0325f 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -41,12 +41,13 @@ function normalizeBannerItem(raw) { } function canCancelByEventStatus(rawEventStatus) { + return true; // 仅报名中(Enrolling / 1)允许取消 - if (rawEventStatus === 'Enrolling') return true; - const n = Number(rawEventStatus); - if (!Number.isNaN(n)) return n === 1; - const s = rawEventStatus == null ? '' : String(rawEventStatus).toLowerCase(); - return s === 'enrolling' || s === '1'; + // if (rawEventStatus === 'Enrolling') return true; + // const n = Number(rawEventStatus); + // if (!Number.isNaN(n)) return n === 1; + // const s = rawEventStatus == null ? '' : String(rawEventStatus).toLowerCase(); + // return s === 'enrolling' || s === '1'; } Page({ diff --git a/pages/home/home.wxml b/pages/home/home.wxml index 6819374..bce4c56 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -1,97 +1,45 @@ - - + \ No newline at end of file diff --git a/pages/home/home.wxss b/pages/home/home.wxss index 7b31565..fbeef5f 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -304,10 +304,10 @@ page { .action-btn { flex: 1; - height: 64rpx; - line-height: 64rpx; + height: 50rpx; + line-height: 50rpx; text-align: center; - font-size: 24rpx; + font-size: 22rpx; border-radius: 10rpx; border: 2rpx solid #e1e3e6; background: #fff;