学生视图

This commit is contained in:
2026-07-26 21:53:00 +08:00 Unverified
parent b39a57ebdf
commit dd1b752fa3
3 changed files with 961 additions and 10 deletions
+13 -1
View File
@@ -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<DashboardData>({ 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 () => {
</script>
<template>
<div v-loading="loading" class="dashboard">
<StudentDashboardView v-if="isStudentOverview" />
<div v-else v-loading="loading" class="dashboard">
<section class="term-hero">
<div>
<span class="section-kicker">CURRENT TERM</span>