update:新增稳定训练
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from "@/apis";
|
||||
|
||||
// 难度页接口数据源:
|
||||
// 1. 接口:GET /training/difficulty/list?type=base/endurance/precision/rhythm
|
||||
// 1. 接口:GET /training/difficulty/list?type=base/endurance/precision/rhythm/stability
|
||||
// 2. 当前进度:接口 user_levels / list.completed,路由参数可覆盖选中难度
|
||||
const trainingDifficultyStorageKey = "training-selection";
|
||||
const defaultTrainingType = "precision";
|
||||
@@ -35,6 +35,10 @@ const trainingTypeMetaMap = {
|
||||
key: "rhythm",
|
||||
title: "节奏训练",
|
||||
},
|
||||
stability: {
|
||||
key: "stability",
|
||||
title: "稳定训练",
|
||||
},
|
||||
};
|
||||
const routeModeTypeMap = {
|
||||
basic: "base",
|
||||
@@ -42,6 +46,9 @@ const routeModeTypeMap = {
|
||||
endurance: "endurance",
|
||||
precision: "precision",
|
||||
rhythm: "rhythm",
|
||||
stability: "stability",
|
||||
// 兼容历史上已经分享出去的 power 深链,实际创建仍统一传 stability。
|
||||
power: "stability",
|
||||
};
|
||||
const defaultTargetType = 1;
|
||||
|
||||
@@ -103,6 +110,7 @@ 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 =
|
||||
@@ -129,6 +137,26 @@ const createDifficultySummary = (item = {}) => {
|
||||
: "需要在指定时间节点射箭",
|
||||
hitReq > 0 ? `且每箭命中${hitReq}环内` : "且每箭命中指定区域",
|
||||
],
|
||||
stability: [
|
||||
{
|
||||
parts: [
|
||||
{ text: timeLimit > 0 ? "在" : "" },
|
||||
{
|
||||
text: timeLimit > 0 ? `${timeLimit}秒` : "不限时",
|
||||
highlight: true,
|
||||
},
|
||||
{ text: timeLimit > 0 ? "内射箭,命中" : "射箭,命中" },
|
||||
{ text: `${hitReq}环`, highlight: true },
|
||||
{ text: "可获得能量" },
|
||||
],
|
||||
},
|
||||
{
|
||||
parts: [
|
||||
{ text: "计时结束能量需要大于" },
|
||||
{ text: `${energyReqPercent}%`, highlight: true },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return (summaryMap[type] || [desc]).filter(Boolean);
|
||||
@@ -604,6 +632,21 @@ const createPracticeQuery = (difficulty) => {
|
||||
roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime),
|
||||
shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime),
|
||||
},
|
||||
stability: {
|
||||
hitReq: toNumber(difficulty.hit_req),
|
||||
scoreSlot: toNumber(
|
||||
difficulty.score_slot ?? difficulty.scoreSlot
|
||||
),
|
||||
energyPerHit: toNumber(
|
||||
difficulty.energy_per_hit ?? difficulty.energyPerHit
|
||||
),
|
||||
energyCostPerSec: toNumber(
|
||||
difficulty.energy_cost_per_sec ?? difficulty.energyCostPerSec
|
||||
),
|
||||
energyReqPercent: toNumber(
|
||||
difficulty.energy_req_percent ?? difficulty.energyReqPercent
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -638,6 +681,19 @@ const saveTrainingContext = (practice = {}) => {
|
||||
targetPaperType: difficulty.targetPaperType,
|
||||
roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime),
|
||||
shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime),
|
||||
hitReq: toNumber(difficulty.hit_req ?? difficulty.hitReq),
|
||||
scoreSlot: toNumber(
|
||||
difficulty.score_slot ?? difficulty.scoreSlot
|
||||
),
|
||||
energyPerHit: toNumber(
|
||||
difficulty.energy_per_hit ?? difficulty.energyPerHit
|
||||
),
|
||||
energyCostPerSec: toNumber(
|
||||
difficulty.energy_cost_per_sec ?? difficulty.energyCostPerSec
|
||||
),
|
||||
energyReqPercent: toNumber(
|
||||
difficulty.energy_req_percent ?? difficulty.energyReqPercent
|
||||
),
|
||||
practiceId: practice.id || "",
|
||||
serverAddr: practice.serverAddr || "",
|
||||
createdAt: practice.id ? Date.now() : 0,
|
||||
|
||||
Reference in New Issue
Block a user