update:更新训练的说明文案

This commit is contained in:
2026-10-12 14:57:11 +08:00
parent 21ed8066aa
commit bad336c7d4
3 changed files with 76 additions and 71 deletions
@@ -20,7 +20,8 @@ const previewLines = computed(() => {
: [{ text: line }]; : [{ text: line }];
const parts = rawParts const parts = rawParts
.map((part) => ({ .map((part) => ({
text: String(part?.text ?? part ?? "").trim(), text: String(part?.text ?? part ?? ""),
highlight: part?.highlight === true,
})) }))
.filter((part) => part.text); .filter((part) => part.text);
@@ -48,6 +49,7 @@ const previewLines = computed(() => {
<text <text
v-for="(part, partIndex) in line.parts" v-for="(part, partIndex) in line.parts"
:key="partIndex" :key="partIndex"
:class="{ 'difficulty-preview__highlight': part.highlight }"
>{{ part.text }}</text> >{{ part.text }}</text>
</view> </view>
</view> </view>
@@ -89,7 +91,7 @@ const previewLines = computed(() => {
} }
.difficulty-preview__copy { .difficulty-preview__copy {
width: 84%; width: 100%;
margin: 0 auto; margin: 0 auto;
display: block; display: block;
color: #ffffff; color: #ffffff;
@@ -102,4 +104,9 @@ const previewLines = computed(() => {
.difficulty-preview__line { .difficulty-preview__line {
display: block; display: block;
} }
.difficulty-preview__highlight {
color: #ffd543;
font-weight: 500;
}
</style> </style>
+36 -27
View File
@@ -110,50 +110,58 @@ const createDifficultySummary = (item = {}) => {
const timeLimit = toNumber(item.time_limit); const timeLimit = toNumber(item.time_limit);
const hitReq = toNumber(item.hit_req); const hitReq = toNumber(item.hit_req);
const totalReq = toNumber(item.total_req); const totalReq = toNumber(item.total_req);
const energyReqPercent = toNumber(item.energy_req_percent); const rhythmRequiredArrows = toNumber(item.total_req, arrows) || arrows;
const shootingTimeText = const timeLine = {
timeLimit > 0 ? `在${timeLimit}秒内进行射箭` : "不限时进行射箭"; parts: timeLimit > 0
const enduranceTimeText = ? [{ text: "限时" }, { text: `${timeLimit}秒`, highlight: true }]
timeLimit > 0 : [{ text: "不限时" }],
? `在${timeLimit}秒内完成${arrows}箭` };
: `不限时完成${arrows}箭`;
const summaryMap = { const summaryMap = {
base: [ base: [
shootingTimeText, { parts: [
`需要有${arrows}箭命中${hitReq}环内`, { text: "需有" }, { text: `${arrows}箭`, highlight: true },
{ text: "命中" }, { text: `≥${hitReq}环`, highlight: true },
] },
timeLine,
], ],
endurance: [ endurance: [
enduranceTimeText, { parts: [
`且累计环数大于${totalReq}环`, { text: "需射箭数" }, { text: `≥${arrows}箭`, highlight: true },
{ text: ",累计环数" }, { text: `≥${totalReq}环`, highlight: true },
] },
timeLine,
], ],
precision: [ precision: [
shootingTimeText, { parts: [
`需要有${arrows}箭命中高亮区域`, { text: "需有" }, { text: `${arrows}箭`, highlight: true },
{ text: "命中高亮区域" },
] },
timeLine,
], ],
rhythm: [ rhythm: [
arrows > 0 { parts: [
? `需要在指定时间节点射出${arrows}射箭` { text: "跟随节拍撒放,共" }, { text: `${arrows}箭`, highlight: true },
: "需要在指定时间节点射箭", { text: "需" }, { text: `${rhythmRequiredArrows}箭`, highlight: true },
hitReq > 0 ? `且每箭命中${hitReq}环内` : "且每箭命中指定区域", ] },
{ parts: [
{ text: "命中" }, { text: `≥${hitReq}环`, highlight: true },
{ text: "且踏中节拍区间" },
] },
], ],
stability: [ stability: [
{ {
parts: [ parts: [
{ text: timeLimit > 0 ? "在" : "" }, { text: "命中" },
{ { text: `≥${hitReq}环`, highlight: true },
text: timeLimit > 0 ? `${timeLimit}秒` : "不限时", { text: "可为能量槽充能" },
highlight: true,
},
{ text: timeLimit > 0 ? "内射箭,命中" : "射箭,命中" },
{ text: `${hitReq}环`, highlight: true },
{ text: "可获得能量" },
], ],
}, },
{ {
parts: [ parts: [
{ text: "计时结束能量需要大于" }, { text: timeLimit > 0 ? "限时 " : "不限时" },
{ text: `${energyReqPercent}%`, highlight: true }, { text: timeLimit > 0 ? `${timeLimit}` : "", highlight: true },
{ text: timeLimit > 0 ? " 秒,能量打满即过关" : ",能量打满即过关" },
], ],
}, },
], ],
@@ -628,6 +636,7 @@ const createPracticeQuery = (difficulty) => {
}, },
rhythm: { rhythm: {
hitReq: toNumber(difficulty.hit_req), hitReq: toNumber(difficulty.hit_req),
totalReq: toNumber(difficulty.total_req, toNumber(difficulty.arrows)),
mode: toNumber(difficulty.mode), mode: toNumber(difficulty.mode),
roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime), roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime),
shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime), shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime),
+31 -42
View File
@@ -440,10 +440,10 @@ const trainingCopy = computed(() => {
return { return {
inline: true, inline: true,
details: [ details: [
{ text: "计时结束前需要有" }, { text: "需有 " },
{ text: `(${completedArrows}/${targetArrows})`, highlight: true }, { text: `(${completedArrows}/${targetArrows})`, highlight: true },
{ text: "箭命中" }, { text: " 箭命中" },
{ text: `${hitReq}环`, highlight: true }, { text: `≥${hitReq}环`, highlight: true },
], ],
}; };
} }
@@ -463,11 +463,10 @@ const trainingCopy = computed(() => {
return { return {
inline: true, inline: true,
details: [ details: [
{ text: "计时结束前完成" }, { text: "需射箭数" },
{ text: `(${currentArrows}/${targetArrows})`, highlight: true }, { text: `≥ (${currentArrows}/${targetArrows}) 支`, highlight: true },
{ text: "箭且累计命中" }, { text: ",累计环数\n" },
{ text: `(${currentRings}/${targetRings})`, highlight: true }, { text: `≥ (${currentRings}/${targetRings}) 环`, highlight: true },
{ text: "环" },
], ],
}; };
} }
@@ -486,36 +485,42 @@ const trainingCopy = computed(() => {
return { return {
inline: true, inline: true,
details: [ details: [
{ text: "射箭命中高亮区域需完成" }, { text: "需有 " },
{ text: `(${completedArrows}/${targetArrows})`, highlight: true }, { text: `(${completedArrows}/${targetArrows})`, highlight: true },
{ text: "箭" }, { text: " 箭命中高亮区域" },
], ],
}; };
} }
if (trainingType.value === "rhythm") { 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( const arrowsLeft = Math.min(
targetArrows, totalArrows,
Math.max( Math.max(
0, 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; const hitReq = rhythmHitReq.value;
return { return {
inline: true, inline: true,
details: [ details: [
{ text: "在进度条读取到高亮区间时射箭命中" }, { text: "跟随节拍撒放,共" },
{ { text: `${totalArrows}箭`, highlight: true },
text: hitReq > 0 ? `${hitReq}环内` : "指定区域", { text: "需 " },
highlight: true, { text: `(${completedArrows}/${targetArrows}) 箭`, highlight: true },
}, { text: "\n命中" },
{ text: ",需完成" }, { text: `≥${hitReq}环`, highlight: true },
{ text: `(${completedArrows}/${targetArrows})`, highlight: true }, { text: "且踏中节拍区间" },
{ text: "箭" },
], ],
}; };
} }
@@ -525,26 +530,12 @@ const trainingCopy = computed(() => {
practiceInfo.value.hitReq, practiceInfo.value.hitReq,
trainingParams.value.hitReq trainingParams.value.hitReq
); );
const stabilityTimeLimit = getPracticeNumber(
practiceInfo.value.timeLimit,
trainingParams.value.timeLimit
);
return { return {
inline: true, inline: true,
details: [ details: [
{ text: stabilityTimeLimit > 0 ? "在" : "" }, { text: "命中" },
{ { text: `≥${hitReq}环`, highlight: true },
text: stabilityTimeLimit > 0 ? `${stabilityTimeLimit}秒` : "不限时", { text: "可为能量槽充能,能量打满即过关" },
highlight: true,
},
{ text: stabilityTimeLimit > 0 ? "内射箭,命中" : "射箭,命中" },
{ text: `${hitReq}环`, highlight: true },
{ text: "可获得能量,计时结束能量需要大于" },
{
text: `${stabilityEnergyReqPercent.value}%`,
highlight: true,
},
], ],
}; };
} }
@@ -2139,7 +2130,7 @@ onBeforeUnmount(() => {
font-size: 26rpx; font-size: 26rpx;
font-weight: 400; font-weight: 400;
line-height: 40rpx; line-height: 40rpx;
white-space: normal; white-space: pre-line;
word-break: break-all; word-break: break-all;
} }
.text1{ .text1{
@@ -2155,9 +2146,7 @@ onBeforeUnmount(() => {
line-height: 36rpx; line-height: 36rpx;
} }
.text2-yellow{ .text2-yellow{
font-size: 30rpx;
color: #FFD947; color: #FFD947;
font-weight: 500; font-weight: 500;
margin: 0 4rpx;
} }
</style> </style>