fix: show comprehensive training in top navigation

dev-QQq
chenyuan 3 weeks ago
parent 98a7bfe620
commit 0b3ce76216

@ -280,7 +280,7 @@ const roleList = computed(() => {
const homeIndex = items.findIndex((item) => item.path === "/index");
return [
...items.slice(0, homeIndex + 1),
studentTopTask.value,
{ ...studentTopTask.value, name: studentTopTask.value.title },
...items.slice(homeIndex + 1),
];
});

@ -47,18 +47,6 @@ export function buildStudentTaskSections(tasks = []) {
path: taskPath(task.taskKey),
});
});
const comprehensiveTask = tasks.find((task) => task?.taskKey === COMPREHENSIVE_TASK_KEY);
if (comprehensiveTask) {
sections.set("综合实训", {
title: "综合实训",
children: [
{
title: comprehensiveTask.taskName || "综合案例实训",
path: "/comprehensive/index",
},
],
});
}
return [...sections.values()];
}

@ -0,0 +1,16 @@
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const navbar = fs.readFileSync(
path.join(__dirname, "..", "src", "layout", "components", "Navbar.vue"),
"utf8"
);
assert.match(
navbar,
/name:\s*studentTopTask\.value\.title/,
"student comprehensive navigation item must provide the name rendered by the top navigation"
);
console.log("student top navigation static test passed");

@ -24,12 +24,7 @@ assert.deepEqual(buildStudentTaskSections([
projectName: "综合实训",
sort: 99,
},
]), [
{
title: "综合实训",
children: [{ title: "综合案例实训", path: "/comprehensive/index" }],
},
]);
]), []);
assert.deepEqual(getComprehensiveTopTask([{ taskKey: "comprehensive-case-training", taskName: "综合实训" }]), {
title: "综合实训",

Loading…
Cancel
Save