diff --git a/src/pages/training/components/TrainingDifficultyPreviewCard.vue b/src/pages/training/components/TrainingDifficultyPreviewCard.vue index 60606e6..10375e4 100644 --- a/src/pages/training/components/TrainingDifficultyPreviewCard.vue +++ b/src/pages/training/components/TrainingDifficultyPreviewCard.vue @@ -20,7 +20,8 @@ const previewLines = computed(() => { : [{ text: line }]; const parts = rawParts .map((part) => ({ - text: String(part?.text ?? part ?? "").trim(), + text: String(part?.text ?? part ?? ""), + highlight: part?.highlight === true, })) .filter((part) => part.text); @@ -48,6 +49,7 @@ const previewLines = computed(() => { {{ part.text }} @@ -89,7 +91,7 @@ const previewLines = computed(() => { } .difficulty-preview__copy { - width: 84%; + width: 100%; margin: 0 auto; display: block; color: #ffffff; @@ -102,4 +104,9 @@ const previewLines = computed(() => { .difficulty-preview__line { display: block; } + +.difficulty-preview__highlight { + color: #ffd543; + font-weight: 500; +} diff --git a/src/pages/training/difficulty.vue b/src/pages/training/difficulty.vue index a85d0e4..160fb31 100644 --- a/src/pages/training/difficulty.vue +++ b/src/pages/training/difficulty.vue @@ -110,50 +110,58 @@ const createDifficultySummary = (item = {}) => { const timeLimit = toNumber(item.time_limit); const hitReq = toNumber(item.hit_req); const totalReq = toNumber(item.total_req); - const energyReqPercent = toNumber(item.energy_req_percent); - const shootingTimeText = - timeLimit > 0 ? `在${timeLimit}秒内进行射箭` : "不限时进行射箭"; - const enduranceTimeText = - timeLimit > 0 - ? `在${timeLimit}秒内完成${arrows}箭` - : `不限时完成${arrows}箭`; + const rhythmRequiredArrows = toNumber(item.total_req, arrows) || arrows; + const timeLine = { + parts: timeLimit > 0 + ? [{ text: "限时" }, { text: `${timeLimit}秒`, highlight: true }] + : [{ text: "不限时" }], + }; const summaryMap = { base: [ - shootingTimeText, - `需要有${arrows}箭命中${hitReq}环内`, + { parts: [ + { text: "需有" }, { text: `${arrows}箭`, highlight: true }, + { text: "命中" }, { text: `≥${hitReq}环`, highlight: true }, + ] }, + timeLine, ], endurance: [ - enduranceTimeText, - `且累计环数大于${totalReq}环`, + { parts: [ + { text: "需射箭数" }, { text: `≥${arrows}箭`, highlight: true }, + { text: ",累计环数" }, { text: `≥${totalReq}环`, highlight: true }, + ] }, + timeLine, ], precision: [ - shootingTimeText, - `需要有${arrows}箭命中高亮区域`, + { parts: [ + { text: "需有" }, { text: `${arrows}箭`, highlight: true }, + { text: "命中高亮区域" }, + ] }, + timeLine, ], rhythm: [ - arrows > 0 - ? `需要在指定时间节点射出${arrows}射箭` - : "需要在指定时间节点射箭", - hitReq > 0 ? `且每箭命中${hitReq}环内` : "且每箭命中指定区域", + { parts: [ + { text: "跟随节拍撒放,共" }, { text: `${arrows}箭`, highlight: true }, + { text: "需" }, { text: `${rhythmRequiredArrows}箭`, highlight: true }, + ] }, + { parts: [ + { text: "命中" }, { text: `≥${hitReq}环`, highlight: true }, + { text: "且踏中节拍区间" }, + ] }, ], stability: [ { parts: [ - { text: timeLimit > 0 ? "在" : "" }, - { - text: timeLimit > 0 ? `${timeLimit}秒` : "不限时", - highlight: true, - }, - { text: timeLimit > 0 ? "内射箭,命中" : "射箭,命中" }, - { text: `${hitReq}环`, highlight: true }, - { text: "可获得能量" }, + { text: "命中" }, + { text: `≥${hitReq}环`, highlight: true }, + { text: "可为能量槽充能" }, ], }, { parts: [ - { text: "计时结束能量需要大于" }, - { text: `${energyReqPercent}%`, highlight: true }, + { text: timeLimit > 0 ? "限时 " : "不限时" }, + { text: timeLimit > 0 ? `${timeLimit}` : "", highlight: true }, + { text: timeLimit > 0 ? " 秒,能量打满即过关" : ",能量打满即过关" }, ], }, ], @@ -628,6 +636,7 @@ const createPracticeQuery = (difficulty) => { }, rhythm: { hitReq: toNumber(difficulty.hit_req), + totalReq: toNumber(difficulty.total_req, toNumber(difficulty.arrows)), mode: toNumber(difficulty.mode), roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime), shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime), diff --git a/src/pages/training/practise-one.vue b/src/pages/training/practise-one.vue index 301dc23..6b4aa15 100644 --- a/src/pages/training/practise-one.vue +++ b/src/pages/training/practise-one.vue @@ -440,10 +440,10 @@ const trainingCopy = computed(() => { return { inline: true, details: [ - { text: "计时结束前需要有" }, + { text: "需有 " }, { text: `(${completedArrows}/${targetArrows})`, highlight: true }, - { text: "箭命中" }, - { text: `${hitReq}环`, highlight: true }, + { text: " 箭命中" }, + { text: `≥${hitReq}环`, highlight: true }, ], }; } @@ -463,11 +463,10 @@ const trainingCopy = computed(() => { return { inline: true, details: [ - { text: "计时结束前完成" }, - { text: `(${currentArrows}/${targetArrows})`, highlight: true }, - { text: "箭且累计命中" }, - { text: `(${currentRings}/${targetRings})`, highlight: true }, - { text: "环" }, + { text: "需射箭数" }, + { text: `≥ (${currentArrows}/${targetArrows}) 支`, highlight: true }, + { text: ",累计环数\n" }, + { text: `≥ (${currentRings}/${targetRings}) 环`, highlight: true }, ], }; } @@ -486,36 +485,42 @@ const trainingCopy = computed(() => { return { inline: true, details: [ - { text: "射箭命中高亮区域需完成" }, + { text: "需有 " }, { text: `(${completedArrows}/${targetArrows})`, highlight: true }, - { text: "箭" }, + { text: " 箭命中高亮区域" }, ], }; } if (trainingType.value === "rhythm") { - const targetArrows = getPositiveInteger(rhythmTargetArrows.value); + const totalArrows = getPositiveInteger(rhythmTargetArrows.value) || total.value; + // 总箭数与达标箭数分别展示,合格进度优先使用服务端快照。 + const targetArrows = + getPositiveInteger(practiceInfo.value.targetArrows) || + getPositiveInteger(trainingParams.value.totalReq) || totalArrows; const arrowsLeft = Math.min( - targetArrows, + totalArrows, Math.max( 0, - getPracticeNumber(practiceInfo.value.arrowsLeft, targetArrows) + getPracticeNumber(practiceInfo.value.arrowsLeft, totalArrows) ) ); - const completedArrows = targetArrows - arrowsLeft; + const completedArrows = Math.max( + 0, + getPracticeNumber(practiceInfo.value.qualifiedArrows, totalArrows - arrowsLeft) + ); const hitReq = rhythmHitReq.value; return { inline: true, details: [ - { text: "在进度条读取到高亮区间时射箭命中" }, - { - text: hitReq > 0 ? `${hitReq}环内` : "指定区域", - highlight: true, - }, - { text: ",需完成" }, - { text: `(${completedArrows}/${targetArrows})`, highlight: true }, - { text: "箭" }, + { text: "跟随节拍撒放,共" }, + { text: `${totalArrows}箭`, highlight: true }, + { text: "需 " }, + { text: `(${completedArrows}/${targetArrows}) 箭`, highlight: true }, + { text: "\n命中" }, + { text: `≥${hitReq}环`, highlight: true }, + { text: "且踏中节拍区间" }, ], }; } @@ -525,26 +530,12 @@ const trainingCopy = computed(() => { practiceInfo.value.hitReq, trainingParams.value.hitReq ); - const stabilityTimeLimit = getPracticeNumber( - practiceInfo.value.timeLimit, - trainingParams.value.timeLimit - ); - return { inline: true, details: [ - { text: stabilityTimeLimit > 0 ? "在" : "" }, - { - text: stabilityTimeLimit > 0 ? `${stabilityTimeLimit}秒` : "不限时", - highlight: true, - }, - { text: stabilityTimeLimit > 0 ? "内射箭,命中" : "射箭,命中" }, - { text: `${hitReq}环`, highlight: true }, - { text: "可获得能量,计时结束能量需要大于" }, - { - text: `${stabilityEnergyReqPercent.value}%`, - highlight: true, - }, + { text: "命中" }, + { text: `≥${hitReq}环`, highlight: true }, + { text: "可为能量槽充能,能量打满即过关" }, ], }; } @@ -2139,7 +2130,7 @@ onBeforeUnmount(() => { font-size: 26rpx; font-weight: 400; line-height: 40rpx; - white-space: normal; + white-space: pre-line; word-break: break-all; } .text1{ @@ -2155,9 +2146,7 @@ onBeforeUnmount(() => { line-height: 36rpx; } .text2-yellow{ - font-size: 30rpx; color: #FFD947; font-weight: 500; - margin: 0 4rpx; }