|
|
|
@ -41,24 +41,20 @@
|
|
|
|
@select="handleStudentMenuSelect"
|
|
|
|
@select="handleStudentMenuSelect"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template v-for="section in currentCourseNav" :key="section.path || section.title">
|
|
|
|
<template v-for="section in currentCourseNav" :key="section.path || section.title">
|
|
|
|
<!-- 一级直跳项 -->
|
|
|
|
<!-- 一级直跳项(工具类,无子项,不分配层级序号) -->
|
|
|
|
<el-menu-item v-if="section.path" :index="section.path">
|
|
|
|
<el-menu-item v-if="section.path" :index="section.path">
|
|
|
|
<el-icon class="student-menu-icon">
|
|
|
|
<span v-if="studentNavNumberMap[section.path]" class="student-menu-index">{{ studentNavNumberMap[section.path] }}</span>
|
|
|
|
<component :is="getStudentNavIcon(section)" />
|
|
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
|
|
<template #title>{{ getCourseNavTitle(section) }}</template>
|
|
|
|
<template #title>{{ getCourseNavTitle(section) }}</template>
|
|
|
|
</el-menu-item>
|
|
|
|
</el-menu-item>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 可折叠分组 -->
|
|
|
|
<!-- 可折叠分组:父级序号 1/2/3…,子级 1.1/1.2… -->
|
|
|
|
<el-sub-menu
|
|
|
|
<el-sub-menu
|
|
|
|
v-else
|
|
|
|
v-else
|
|
|
|
:index="getStudentGroupKey(section)"
|
|
|
|
:index="getStudentGroupKey(section)"
|
|
|
|
popper-class="student-menu-popper"
|
|
|
|
popper-class="student-menu-popper"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #title>
|
|
|
|
<template #title>
|
|
|
|
<el-icon class="student-menu-icon">
|
|
|
|
<span class="student-menu-index">{{ studentNavNumberMap[getStudentGroupKey(section)] }}</span>
|
|
|
|
<component :is="getStudentNavIcon(section)" />
|
|
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
|
|
<span>{{ getCourseNavTitle(section) }}</span>
|
|
|
|
<span>{{ getCourseNavTitle(section) }}</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<el-menu-item
|
|
|
|
<el-menu-item
|
|
|
|
@ -67,9 +63,7 @@
|
|
|
|
:index="child.path || getStudentGroupKey(section) + '-' + child.title"
|
|
|
|
:index="child.path || getStudentGroupKey(section) + '-' + child.title"
|
|
|
|
:disabled="!child.path"
|
|
|
|
:disabled="!child.path"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-icon class="student-menu-icon">
|
|
|
|
<span class="student-menu-index student-menu-index--child">{{ studentNavNumberMap[child.path || (getStudentGroupKey(section) + '-' + child.title)] }}</span>
|
|
|
|
<component :is="getStudentNavIcon(child)" />
|
|
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
|
|
<template #title>{{ getCourseNavTitle(child) }}</template>
|
|
|
|
<template #title>{{ getCourseNavTitle(child) }}</template>
|
|
|
|
</el-menu-item>
|
|
|
|
</el-menu-item>
|
|
|
|
</el-sub-menu>
|
|
|
|
</el-sub-menu>
|
|
|
|
@ -549,6 +543,27 @@ const studentDefaultOpens = computed(() =>
|
|
|
|
.map((section) => getStudentGroupKey(section))
|
|
|
|
.map((section) => getStudentGroupKey(section))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 学生端侧边栏层级序号:分组父级 1/2/3…,子项 1.1/1.2…。
|
|
|
|
|
|
|
|
// 直跳项(无 children,如「AI 智能助手」)视为工具类,不分配序号。
|
|
|
|
|
|
|
|
// 仅学生角色生效;教师端仍走手写导航(保留图标)。
|
|
|
|
|
|
|
|
const studentNavNumberMap = computed(() => {
|
|
|
|
|
|
|
|
const map = {};
|
|
|
|
|
|
|
|
if (!isStudentRole.value) return map;
|
|
|
|
|
|
|
|
let groupCounter = 0;
|
|
|
|
|
|
|
|
currentCourseNav.value.forEach((section) => {
|
|
|
|
|
|
|
|
if (!section.children?.length) return; // 直跳工具项不编号
|
|
|
|
|
|
|
|
groupCounter += 1;
|
|
|
|
|
|
|
|
const top = String(groupCounter);
|
|
|
|
|
|
|
|
const sectionKey = getStudentGroupKey(section);
|
|
|
|
|
|
|
|
map[sectionKey] = top;
|
|
|
|
|
|
|
|
section.children.forEach((child, cIdx) => {
|
|
|
|
|
|
|
|
const childKey = child.path || `${sectionKey}-${child.title}`;
|
|
|
|
|
|
|
|
map[childKey] = `${top}.${cIdx + 1}`;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 异步加载分组后重建菜单,使新分组按 default-openeds 展开
|
|
|
|
// 异步加载分组后重建菜单,使新分组按 default-openeds 展开
|
|
|
|
const studentMenuKey = ref(0);
|
|
|
|
const studentMenuKey = ref(0);
|
|
|
|
function bumpStudentMenu() {
|
|
|
|
function bumpStudentMenu() {
|
|
|
|
|