You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.4 KiB
JavaScript
59 lines
2.4 KiB
JavaScript
|
4 weeks ago
|
const COMPREHENSIVE_TASK_KEY = "comprehensive-case-training";
|
||
|
|
|
||
|
4 weeks ago
|
const knownTaskPaths = Object.freeze({
|
||
|
4 weeks ago
|
"new-product-survey": "/foundation/new-product-survey",
|
||
|
|
"product-development-factors": "/foundation/product-development-factors",
|
||
|
|
"product-development-process": "/foundation/product-development-process",
|
||
|
|
"industry-demand-analysis": "/demand/index",
|
||
|
|
"competitive-environment-analysis": "/demand/environment",
|
||
|
|
"market-opportunity-selection": "/product/index",
|
||
|
|
"business-feasibility": "/demand/business-feasibility",
|
||
|
|
"target-user-profile": "/demand/people",
|
||
|
|
"consumer-behavior": "/demand/consumer-behavior",
|
||
|
|
"consumer-scenario": "/demand/consumer-scenario",
|
||
|
|
"feature-conversion": "/demand/feature-conversion",
|
||
|
|
"product-value-positioning": "/product/differentiation",
|
||
|
|
"product-structure": "/product/structure",
|
||
|
|
"after-sales-service": "/product/after-sales-service",
|
||
|
|
"requirements-doc": "/product/requirements-doc",
|
||
|
|
"hardware-cost": "/product/hardware-cost",
|
||
|
|
"supplier-evaluation": "/channel/supplier",
|
||
|
|
"purchase-demand-forecast": "/channel/index",
|
||
|
|
"product-pricing": "/product/price",
|
||
|
|
"category-optimization": "/assessment/optimization",
|
||
|
|
"release-channel-evaluation": "/test/index",
|
||
|
|
"promotion-effect-optimization": "/test/promotion",
|
||
|
|
"product-diagnosis-iteration": "/assessment/diagnosis",
|
||
|
|
});
|
||
|
|
|
||
|
4 weeks ago
|
function taskPath(taskKey) {
|
||
|
|
return knownTaskPaths[taskKey] || `/training/task/${encodeURIComponent(taskKey)}`;
|
||
|
4 weeks ago
|
}
|
||
|
|
|
||
|
4 weeks ago
|
function taskSort(task) {
|
||
|
|
return Number.isFinite(Number(task?.sort)) ? Number(task.sort) : Number.MAX_SAFE_INTEGER;
|
||
|
4 weeks ago
|
}
|
||
|
|
|
||
|
4 weeks ago
|
export function buildStudentTaskSections(tasks = []) {
|
||
|
4 weeks ago
|
const sections = new Map();
|
||
|
4 weeks ago
|
[...tasks]
|
||
|
4 weeks ago
|
.filter((task) => task?.taskKey && task.taskKey !== COMPREHENSIVE_TASK_KEY)
|
||
|
|
.sort((left, right) => taskSort(left) - taskSort(right))
|
||
|
|
.forEach((task) => {
|
||
|
|
const title = task.projectName || "其他实训";
|
||
|
|
if (!sections.has(title)) sections.set(title, { title, children: [] });
|
||
|
|
sections.get(title).children.push({
|
||
|
|
title: task.taskName || task.taskKey,
|
||
|
|
path: taskPath(task.taskKey),
|
||
|
|
});
|
||
|
|
});
|
||
|
|
return [...sections.values()];
|
||
|
|
}
|
||
|
|
|
||
|
4 weeks ago
|
export function getComprehensiveTopTask(tasks = []) {
|
||
|
|
const task = tasks.find((item) => item?.taskKey === COMPREHENSIVE_TASK_KEY);
|
||
|
|
return task
|
||
|
|
? { title: task.taskName || "综合实训", path: "/comprehensive/index", activePrefix: "/comprehensive" }
|
||
|
|
: null;
|
||
|
4 weeks ago
|
}
|