|
|
|
|
@ -7,19 +7,27 @@
|
|
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div :class="[{ 'has-logo': showLogo }, { 'student-sidebar-shell': isCourseStyleSidebar }]" :style="sidebarStyle">
|
|
|
|
|
<div :class="[{ 'has-logo': showLogo }, { 'student-sidebar-shell': isCourseStyleSidebar }, { 'is-collapse': isCollapse }]" :style="sidebarStyle">
|
|
|
|
|
<!-- <logo v-if="showLogo" :collapse="isCollapse" /> -->
|
|
|
|
|
<template v-if="isCourseStyleSidebar">
|
|
|
|
|
<button
|
|
|
|
|
v-if="isTeacherRole"
|
|
|
|
|
class="teacher-sidebar-toggle"
|
|
|
|
|
type="button"
|
|
|
|
|
:aria-label="isCollapse ? '展开导航' : '收起导航'"
|
|
|
|
|
:title="isCollapse ? '展开导航' : '收起导航'"
|
|
|
|
|
@click="toggleTeacherSidebar"
|
|
|
|
|
>{{ isCollapse ? '›' : '‹' }}</button>
|
|
|
|
|
<el-scrollbar class="theme-dark student-sidebar-scroll" wrap-class="scrollbar-wrapper">
|
|
|
|
|
<nav class="student-course-nav">
|
|
|
|
|
<template v-for="section in currentCourseNav" :key="section.path || section.title">
|
|
|
|
|
<button v-if="section.path" type="button" :class="['student-course-heading', { active: isStudentNavActive(section) }]" @click="goStudentNav(section.path)">
|
|
|
|
|
<button v-if="section.path" type="button" :class="['student-course-heading', { active: isStudentNavActive(section) }]" :title="getCourseNavTitle(section)" @click="goStudentNav(section.path)">
|
|
|
|
|
<span class="student-course-icon student-course-icon--heading">
|
|
|
|
|
<component :is="getStudentNavIcon(section)" />
|
|
|
|
|
</span>
|
|
|
|
|
<span class="student-course-text">{{ getCourseNavTitle(section) }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
<div v-else class="student-course-heading">
|
|
|
|
|
<div v-else class="student-course-heading" :title="getCourseNavTitle(section)">
|
|
|
|
|
<span class="student-course-icon student-course-icon--heading">
|
|
|
|
|
<component :is="getStudentNavIcon(section)" />
|
|
|
|
|
</span>
|
|
|
|
|
@ -27,13 +35,13 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="section.children?.length" class="student-course-list">
|
|
|
|
|
<template v-for="child in section.children" :key="child.path || child.title">
|
|
|
|
|
<button v-if="child.path" type="button" :class="['student-course-link', { active: isStudentNavActive(child) }]" @click="goStudentNav(child.path)">
|
|
|
|
|
<button v-if="child.path" type="button" :class="['student-course-link', { active: isStudentNavActive(child) }]" :title="getCourseNavTitle(child)" @click="goStudentNav(child.path)">
|
|
|
|
|
<span class="student-course-icon">
|
|
|
|
|
<component :is="getStudentNavIcon(child)" />
|
|
|
|
|
</span>
|
|
|
|
|
<span class="student-course-text">{{ getCourseNavTitle(child) }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
<div v-else class="student-course-link disabled">
|
|
|
|
|
<div v-else class="student-course-link disabled" :title="getCourseNavTitle(child)">
|
|
|
|
|
<span class="student-course-icon">
|
|
|
|
|
<component :is="getStudentNavIcon(child)" />
|
|
|
|
|
</span>
|
|
|
|
|
@ -273,6 +281,9 @@ const isCollapse = computed(() => !appStore.sidebar.opened);
|
|
|
|
|
const isTeacherRole = computed(() => Number(userStore.userInfo.roleId) === 3);
|
|
|
|
|
const isStudentRole = computed(() => ![1, 2, 3].includes(Number(userStore.userInfo.roleId)));
|
|
|
|
|
const isCourseStyleSidebar = computed(() => isStudentRole.value || isTeacherRole.value);
|
|
|
|
|
function toggleTeacherSidebar() {
|
|
|
|
|
appStore.toggleSideBar(false);
|
|
|
|
|
}
|
|
|
|
|
const sidebarStyle = computed(() => {
|
|
|
|
|
if (isCourseStyleSidebar.value) return {};
|
|
|
|
|
return {
|
|
|
|
|
|