教学点名强化

This commit is contained in:
biss committed 2026-07-25 16:16:23 +08:00
1 parent 2c6103d3ae
commit d02b0c56a1
10 files changed
+486 -6

No files matched your search

+7 -1
View File
@@ -25,6 +25,7 @@ http.interceptors.response.use(
export function apiErrorMessage(error: unknown) {
if (!axios.isAxiosError(error)) return '操作失败,请稍后重试。'
const status = error.response?.status
const data = error.response?.data
if (data?.errors && typeof data.errors === 'object') {
const validationMessage = Object.values(data.errors)
@@ -37,7 +38,12 @@ export function apiErrorMessage(error: unknown) {
const detail = typeof data?.detail === 'string' ? data.detail.trim() : ''
if (detail) return detail
const title = typeof data?.title === 'string' ? data.title.trim() : ''
return title || '操作失败,请检查网络连接。'
if (title) return title
if (status === 403) return '您没有权限执行此操作,请联系管理员。'
if (status === 404) return '请求的资源不存在。'
if (status === 401) return '登录已过期,请重新登录。'
if (status && status >= 500) return '服务器繁忙,请稍后重试。'
return '操作失败,请检查网络连接。'
}
export default http
+4 -3
View File
@@ -116,7 +116,8 @@ const navigationGroups = computed<NavigationGroup[]>(() => [
),
...whenVisible(isStudent.value || isTeacher.value, { path: '/my-timetable', label: isTeacher.value ? '我的授课课表' : '我的课表' }),
...whenVisible(isStudent.value, { path: '/free-classrooms', label: '空闲教室' }),
...whenVisible(isTeacher.value || isTeachingAdmin.value, { path: '/teacher-attendance', label: '教学点名' }),
...whenVisible(isTeacher.value || isTeachingAdmin.value || hasAnyRole(['Counselor']), { path: '/teacher-attendance', label: '教学点名' }),
...whenVisible(isStudent.value, { path: '/my-attendance', label: '我的考勤' }),
...whenVisible(isTeacher.value, { path: '/teacher-roster', label: '选课名单' }),
...whenVisible(!isStudent.value, {
path: '/class-timetable',
@@ -130,8 +131,8 @@ const navigationGroups = computed<NavigationGroup[]>(() => [
},
),
...whenVisible(
hasAnyRole(['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher', 'Student']),
{ path: '/grades', label: isStudent.value ? '学业成绩' : '成绩管理' },
hasAnyRole(['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher', 'Student', 'Counselor']),
{ path: '/grades', label: isStudent.value ? '学业成绩' : isTeacher.value ? '成绩录入' : '成绩管理' },
),
...whenVisible(
hasAnyRole(['SuperAdmin', 'AcademicAdmin', 'Teacher', 'Student']),
+8 -2
View File
@@ -159,7 +159,13 @@ const router = createRouter({
path: 'teacher-attendance',
name: 'teacher-attendance',
component: () => import('../views/TeacherAttendanceView.vue'),
meta: { roles: ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher'] },
meta: { roles: ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher', 'Counselor'] },
},
{
path: 'my-attendance',
name: 'my-attendance',
component: () => import('../views/StudentAttendanceView.vue'),
meta: { roles: ['Student'] },
},
{
path: 'free-classrooms',
@@ -180,7 +186,7 @@ const router = createRouter({
name: 'grades',
component: () => import('../views/GradesView.vue'),
meta: {
roles: ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher', 'Student'],
roles: ['SuperAdmin', 'AcademicAdmin', 'CollegeAdmin', 'Teacher', 'Student', 'Counselor'],
},
},
{
Loaded 3 of 10 files, more files were not shown because too many files have changed in this diff. Show more