From dd1b752fa366f48a6e345cb8e27e6b8b77926fc7 Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 26 Jul 2026 21:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/router/index.ts | 9 - web/src/views/DashboardView.vue | 14 +- web/src/views/StudentDashboardView.vue | 948 +++++++++++++++++++++++++ 3 files changed, 961 insertions(+), 10 deletions(-) create mode 100644 web/src/views/StudentDashboardView.vue diff --git a/web/src/router/index.ts b/web/src/router/index.ts index fddab83..81361bf 100644 --- a/web/src/router/index.ts +++ b/web/src/router/index.ts @@ -313,15 +313,6 @@ router.beforeEach((to) => { return { name: 'login', query: { redirect: to.fullPath } } } if (to.name === 'login' && auth.isLoggedIn) return { name: 'dashboard' } - if ( - to.name === 'dashboard' && - auth.user?.roles.includes('Student') && - !auth.user.roles.some((role) => - ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin'].includes(role), - ) - ) { - return { name: 'course-selections' } - } const roles = to.meta.roles as string[] | undefined if (roles && !roles.some((role) => auth.user?.roles.includes(role))) { return { name: 'dashboard' } diff --git a/web/src/views/DashboardView.vue b/web/src/views/DashboardView.vue index ba59d90..715bd30 100644 --- a/web/src/views/DashboardView.vue +++ b/web/src/views/DashboardView.vue @@ -4,6 +4,7 @@ import { useRouter } from 'vue-router' import { Collection, OfficeBuilding, School, UserFilled } from '@element-plus/icons-vue' import http from '../api/http' import { useAuthStore } from '../stores/auth' +import StudentDashboardView from './StudentDashboardView.vue' interface DashboardData { currentTerm?: { name: string; startDate: string; endDate: string } @@ -12,6 +13,12 @@ interface DashboardData { const router = useRouter() const auth = useAuthStore() +const isStudentOverview = computed(() => + auth.user?.roles.includes('Student') && + !auth.user.roles.some((role) => + ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin'].includes(role), + ), +) const loading = ref(true) const data = ref({ counts: {} }) @@ -23,6 +30,10 @@ const stats = computed(() => [ ]) onMounted(async () => { + if (isStudentOverview.value) { + loading.value = false + return + } try { data.value = (await http.get('/dashboard')).data } finally { @@ -32,7 +43,8 @@ onMounted(async () => {