fix(front): tabbar 首页直达角色工作台路径;路由与类型调整(music-room 欢迎页等)
Made-with: Cursor
This commit is contained in:
+12
-2
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view />
|
<router-view />
|
||||||
<van-tabbar route v-if="!hide_bottom_tab && user.enabled && user.is_registered && current_role && user.real_name" :before-change="tab_change_check">
|
<van-tabbar route v-if="!hide_bottom_tab && user.enabled && user.is_registered && current_role && user.real_name" :before-change="tab_change_check">
|
||||||
<van-tabbar-item name="首页" replace to="/" icon="home-o">首页</van-tabbar-item>
|
<van-tabbar-item name="首页" replace :to="home_tab_path" icon="home-o">首页</van-tabbar-item>
|
||||||
<template v-if="is_student">
|
<template v-if="is_student">
|
||||||
<van-tabbar-item name="课程" replace to="/clazz" icon="calendar-o">课程</van-tabbar-item>
|
<van-tabbar-item name="课程" replace to="/clazz" icon="calendar-o">课程</van-tabbar-item>
|
||||||
<van-tabbar-item name="打卡" replace to="/daka" icon="completed-o">打卡</van-tabbar-item>
|
<van-tabbar-item name="打卡" replace to="/daka" icon="completed-o">打卡</van-tabbar-item>
|
||||||
@@ -98,8 +98,18 @@ export default defineComponent({
|
|||||||
|
|
||||||
const hide_bottom_tab = computed(() => getKey("hide_bottom_tab"))
|
const hide_bottom_tab = computed(() => getKey("hide_bottom_tab"))
|
||||||
|
|
||||||
|
const home_tab_path = computed(() => {
|
||||||
|
const role = store.currentRole
|
||||||
|
if (!role) return '/'
|
||||||
|
if (role === HtyBaseRoles.STUDENT) return '/student/home'
|
||||||
|
if (role === HtyBaseRoles.TEACHER) return '/teacher/home'
|
||||||
|
if (role === HtySuperRoles.ADMIN) return '/admin/teachers'
|
||||||
|
if (role === HtySuperRoles.TESTER) return '/tester'
|
||||||
|
if (role === HtySuperRoles.SUPERVISOR) return '/supervisor/subsidiaries'
|
||||||
|
return '/'
|
||||||
|
})
|
||||||
|
|
||||||
return {user, is_student, is_teacher, is_admin, is_tester, is_guest, current_role, loading, badge_props, tab_change_check, hide_bottom_tab}
|
return {user, is_student, is_teacher, is_admin, is_tester, is_guest, current_role, loading, badge_props, tab_change_check, hide_bottom_tab, home_tab_path}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+1
-2
@@ -118,8 +118,7 @@ router.beforeEach(async (to, from , next) => {
|
|||||||
let activeRoles = roles?.filter(r => r.role_status === HtyStates.ACTIVE)
|
let activeRoles = roles?.filter(r => r.role_status === HtyStates.ACTIVE)
|
||||||
if(activeRoles?.length === 1) {
|
if(activeRoles?.length === 1) {
|
||||||
chooseRole(activeRoles[0].role_key)
|
chooseRole(activeRoles[0].role_key)
|
||||||
}
|
} else if (to.path !== '/') {
|
||||||
if (to.path !== '/') {
|
|
||||||
await router.replace('/')
|
await router.replace('/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -630,6 +630,8 @@ export interface Clazz {
|
|||||||
instance?: Clazz;
|
instance?: Clazz;
|
||||||
has_root?: boolean;
|
has_root?: boolean;
|
||||||
is_notified?: boolean;
|
is_notified?: boolean;
|
||||||
|
/** 业务已结课:首次点名落库时间;未点名或未结课为 null */
|
||||||
|
completed_at?: string | Date | null;
|
||||||
course_sections?: import('@authcore/commons').MultiVals<CourseSection>;
|
course_sections?: import('@authcore/commons').MultiVals<CourseSection>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,6 +655,7 @@ export interface ClazzWithRepeat {
|
|||||||
clz_jihuas?: import('@authcore/commons').MultiVals<Jihua>;
|
clz_jihuas?: import('@authcore/commons').MultiVals<Jihua>;
|
||||||
clz_is_delete?: boolean;
|
clz_is_delete?: boolean;
|
||||||
clz_is_repeat: boolean;
|
clz_is_repeat: boolean;
|
||||||
|
clz_completed_at?: string | Date | null;
|
||||||
re_id: string;
|
re_id: string;
|
||||||
re_clazz_id: string;
|
re_clazz_id: string;
|
||||||
re_start_from?: string | Date;
|
re_start_from?: string | Date;
|
||||||
|
|||||||
Reference in New Issue
Block a user