fix(class): 教师端班级管理严格按超管组织模式配置渲染

- 5c51a58 让普通路由不再等待学校产品配置接口,班级管理页挂载时配置未就绪,
  一次性 onMounted 判断误按行政班视角定格:列表被 ADMIN 过滤后教学班全部不可见,
  按钮与空态停留在'新增行政班/暂无行政班',配置返回后 Tab 隐藏但过滤已无法纠正
- onMounted 一次性判断改为 watch(adminClassManagementEnabled) 响应式修正,
  行政班管理关闭(TEACHING_CLASS_ONLY)的学校固定教学班视角
- /class/index 路由增加 awaitSchoolProductConfig meta,导航前先等配置接口返回,
  首屏即按配置渲染,消除闪变
dev-QQq
chenyuan 1 month ago
parent a5b5c05424
commit eb665c55ab

@ -1,28 +1,28 @@
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2024-08-16 17:56:32
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-05-16 17:02:23
* @FilePath: \vue3\src\permission.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import router from "./router";
import { ElMessage } from "element-plus";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import { getToken, getUserInfo } from "@/utils/auth";
import { isHttp } from "@/utils/validate";
import { isRelogin } from "@/utils/request";
import useUserStore from "@/store/modules/user";
import useSettingsStore from "@/store/modules/settings";
import usePermissionStore from "@/store/modules/permission";
NProgress.configure({ showSpinner: false });
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2024-08-16 17:56:32
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-05-16 17:02:23
* @FilePath: \vue3\src\permission.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import router from "./router";
import { ElMessage } from "element-plus";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import { getToken, getUserInfo } from "@/utils/auth";
import { isHttp } from "@/utils/validate";
import { isRelogin } from "@/utils/request";
import useUserStore from "@/store/modules/user";
import useSettingsStore from "@/store/modules/settings";
import usePermissionStore from "@/store/modules/permission";
NProgress.configure({ showSpinner: false });
const whiteList = ["/login", "/register", "/student-demo"];
router.beforeEach((to, from, next) => {
NProgress.start();
if (getToken()) {
router.beforeEach((to, from, next) => {
NProgress.start();
if (getToken()) {
if (to.path === "/login") {
if (JSON.parse(getUserInfo()).roleId == 1) {
next({ path: "/index" });
@ -34,15 +34,16 @@ router.beforeEach((to, from, next) => {
next({ path: "/index" });
NProgress.done();
} else if (JSON.parse(getUserInfo()).roleId == 4) {
next({ path: "/index" });
NProgress.done();
}
next({ path: "/index" });
NProgress.done();
}
} else {
const userStore = useUserStore();
const requiresSchoolProductConfig = to.matched.some((record) =>
record.meta?.requiresFacultyManagement
|| record.meta?.requiresMajorManagement
|| record.meta?.requiresAdminClass
|| record.meta?.awaitSchoolProductConfig
);
const continueNavigation = () => {
usePermissionStore()
@ -84,19 +85,19 @@ router.beforeEach((to, from, next) => {
next(false);
NProgress.done();
});
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next();
} else {
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
NProgress.done();
}
}
});
router.afterEach(() => {
NProgress.done();
});
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next();
} else {
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
NProgress.done();
}
}
});
router.afterEach(() => {
NProgress.done();
});

@ -1,92 +1,92 @@
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2025-04-22 14:05:45
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-05-20 17:53:58
* @FilePath: \e-commerce-internet\src\router\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2025-04-22 14:05:45
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-04-28 14:48:41
* @FilePath: \e-commerce-internet\src\router\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2025-04-22 14:05:45
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-05-20 17:53:58
* @FilePath: \e-commerce-internet\src\router\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
/*
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2025-04-22 14:05:45
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-04-28 14:48:41
* @FilePath: \e-commerce-internet\src\router\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { createWebHashHistory, createRouter } from "vue-router";
/* Layout */
import Layout from "@/layout";
/**
* Note: 路由配置项
*
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
* roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : {
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标,对应路径src/asse ts/icons/svg
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
export const constantRoutes = [
{
path: "/redirect",
component: Layout,
hidden: true,
children: [
{
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect/index.vue"),
},
],
},
{
path: "/login",
component: () => import("@/views/login"),
hidden: true,
},
/* Layout */
import Layout from "@/layout";
/**
* Note: 路由配置项
*
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
* roles: ['admin', 'common'] // 访问路由的角色权限
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
* meta : {
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
icon: 'svg-name' // 设置该路由的图标,对应路径src/asse ts/icons/svg
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
export const constantRoutes = [
{
path: "/redirect",
component: Layout,
hidden: true,
children: [
{
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect/index.vue"),
},
],
},
{
path: "/login",
component: () => import("@/views/login"),
hidden: true,
},
{
path: "/register",
component: () => import("@/views/register"),
hidden: true,
},
{
path: "/:pathMatch(.*)*",
component: () => import("@/views/error/404"),
hidden: true,
},
{
path: "/401",
component: () => import("@/views/error/401"),
hidden: true,
},
{
path: "",
component: Layout,
redirect: "/index",
meta: { title: "首页", icon: "首页", affix: true },
children: [
{
path: "/index",
component: () => import("@/views/index"),
name: "Index",
},
],
},
];
// 动态路由,基于用户权限动态去加载
component: () => import("@/views/register"),
hidden: true,
},
{
path: "/:pathMatch(.*)*",
component: () => import("@/views/error/404"),
hidden: true,
},
{
path: "/401",
component: () => import("@/views/error/401"),
hidden: true,
},
{
path: "",
component: Layout,
redirect: "/index",
meta: { title: "首页", icon: "首页", affix: true },
children: [
{
path: "/index",
component: () => import("@/views/index"),
name: "Index",
},
],
},
];
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: "/training-step",
@ -103,48 +103,48 @@ export const dynamicRoutes = [
],
},
{
path: "/ai",
component: Layout,
redirect: "/ai/assistant",
roles: ["student"],
children: [
{
path: "learning-situation-analysis",
hidden: true,
component: () => import("@/views/analysis-of-students/analysis.vue"),
name: "learning-situation-analysis",
meta: { title: "AI学情分析", icon: "ai", affix: true },
},
{
path: "learning-situation-dialogue",
hidden: true,
component: () => import("@/views/analysis-of-students/dialogue.vue"),
name: "learning-situation-dialogue",
meta: { title: "对话", icon: "ai", affix: true },
},
// 实训教案
{
path: "teaching-plan",
hidden: true,
component: () => import("@/views/analysis-of-students/training-lesson-plan"),
name: "teaching-plan",
meta: { title: "AI助手", icon: "ai", affix: true },
},
],
},
// 智能助手
path: "/ai",
component: Layout,
redirect: "/ai/assistant",
roles: ["student"],
children: [
{
path: "learning-situation-analysis",
hidden: true,
component: () => import("@/views/analysis-of-students/analysis.vue"),
name: "learning-situation-analysis",
meta: { title: "AI学情分析", icon: "ai", affix: true },
},
{
path: "learning-situation-dialogue",
hidden: true,
component: () => import("@/views/analysis-of-students/dialogue.vue"),
name: "learning-situation-dialogue",
meta: { title: "对话", icon: "ai", affix: true },
},
// 实训教案
{
path: "teaching-plan",
hidden: true,
component: () => import("@/views/analysis-of-students/training-lesson-plan"),
name: "teaching-plan",
meta: { title: "AI助手", icon: "ai", affix: true },
},
],
},
// 智能助手
{
path: "/assistant",
component: Layout,
redirect: "/assistant/index",
roles: ["student"],
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
children: [
{
path: "index",
component: () => import("@/views/AI/index.vue"),
name: "assistant",
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
children: [
{
path: "index",
component: () => import("@/views/AI/index.vue"),
name: "assistant",
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
},
],
},
@ -214,21 +214,21 @@ export const dynamicRoutes = [
//市场需求挖掘
{
path: "/demand",
component: Layout,
redirect: "/demand/index",
roles: ["student"],
meta: { title: "市场需求挖掘", icon: "需求挖掘", affix: true },
alwaysShow: true,
children: [
//行业需求分析
component: Layout,
redirect: "/demand/index",
roles: ["student"],
meta: { title: "市场需求挖掘", icon: "需求挖掘", affix: true },
alwaysShow: true,
children: [
//行业需求分析
{
path: "index",
component: () => import("@/views/demand/industry-demand-analysis.vue"),
name: "demand",
meta: { title: "行业需求分析", icon: "需求挖掘", affix: true, pageKey: "industry-demand-analysis" },
},
// 竞争环境分析
{
// 竞争环境分析
{
path: "environment",
component: () => import("@/views/demand/competitive-environment-analysis.vue"),
name: "environment",
@ -241,7 +241,7 @@ export const dynamicRoutes = [
name: "people",
meta: { title: "目标用户画像", icon: "需求挖掘", affix: true, pageKey: "target-user-profile" },
},
// 用户数据分析
// 用户数据分析
{
path: "user",
component: () => import("@/views/demand/user.vue"),
@ -274,24 +274,24 @@ export const dynamicRoutes = [
},
],
},
// 产品规划
{
path: "/product",
component: Layout,
redirect: "/product/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品规划", icon: "产品规划", affix: true },
children: [
// 产品定位
{
// 产品规划
{
path: "/product",
component: Layout,
redirect: "/product/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品规划", icon: "产品规划", affix: true },
children: [
// 产品定位
{
path: "index",
component: () => import("@/views/product/market-opportunity-selection.vue"),
name: "product",
meta: { title: "市场机会识别与选品", icon: "产品规划", affix: true, pageKey: "market-opportunity-selection", hideSupplementSteps: true },
},
// 产品定价
{
// 产品定价
{
path: "price",
component: () => import("@/views/product/price.vue"),
name: "price",
@ -304,7 +304,7 @@ export const dynamicRoutes = [
name: "differentiation",
meta: { title: "产品价值主张及定位", icon: "产品规划", affix: true, pageKey: "product-value-positioning" },
},
// 产品结构规划
// 产品结构规划
{
path: "structure",
component: () => import("@/views/product/structure.vue"),
@ -331,125 +331,125 @@ export const dynamicRoutes = [
},
],
},
// 产品投放测试
{
path: "/test",
component: Layout,
redirect: "/test/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品投放测试", icon: "产品投放测试", affix: true },
children: [
// 产品投放测试
{
// 产品投放测试
{
path: "/test",
component: Layout,
redirect: "/test/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品投放测试", icon: "产品投放测试", affix: true },
children: [
// 产品投放测试
{
path: "index",
component: () => import("@/views/test/index.vue"),
name: "test",
meta: { title: "发布渠道评估", icon: "产品投放测试", affix: true, pageKey: "release-channel-evaluation" },
},
// 产品推广测试
{
// 产品推广测试
{
path: "promotion",
component: () => import("@/views/test/promotion.vue"),
name: "promotion",
meta: { title: "产品推广测试", icon: "产品投放测试", affix: true, pageKey: "promotion-effect-optimization" },
},
// 渠道表现分析
{
// 渠道表现分析
{
path: "channelas",
component: () => import("@/views/test/channel.vue"),
name: "channelas",
meta: { title: "渠道表现分析", icon: "产品投放测试", affix: true, pageKey: "release-channel-evaluation" },
},
// 产品营销定位
{
// 产品营销定位
{
path: "marketing",
component: () => import("@/views/test/marketing.vue"),
name: "marketing",
meta: { title: "产品营销定位", icon: "产品投放测试", affix: true, pageKey: "promotion-effect-optimization" },
},
],
},
// 供应渠道管理
{
path: "/channel",
component: Layout,
redirect: "/channel/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "供应渠道管理", icon: "供应渠道管理", affix: true },
children: [
// 供应渠道管理
{
},
],
},
// 供应渠道管理
{
path: "/channel",
component: Layout,
redirect: "/channel/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "供应渠道管理", icon: "供应渠道管理", affix: true },
children: [
// 供应渠道管理
{
path: "index",
component: () => import("@/views/channel/index.vue"),
name: "channel",
meta: { title: "采购需求预测", icon: "供应渠道管理", affix: true, pageKey: "purchase-demand-forecast" },
},
// 采购产品定位
{
// 采购产品定位
{
path: "purchase",
component: () => import("@/views/channel/purchase.vue"),
name: "purchase",
meta: { title: "采购产品定位", icon: "供应渠道管理", affix: true, pageKey: "purchase-demand-forecast" },
},
// 供应商评估与选择
{
// 供应商评估与选择
{
path: "supplier",
component: () => import("@/views/channel/supplier.vue"),
name: "supplier",
meta: { title: "供应商评估与选择", icon: "供应渠道管理", affix: true, pageKey: "supplier-evaluation" },
},
],
},
//产品评估与考核
{
path: "/assessment",
component: Layout,
redirect: "/assessment/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品评估与考核", icon: "产品评估与考核", affix: true },
children: [
// 产品评估与考核
{
},
],
},
//产品评估与考核
{
path: "/assessment",
component: Layout,
redirect: "/assessment/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品评估与考核", icon: "产品评估与考核", affix: true },
children: [
// 产品评估与考核
{
path: "index",
component: () => import("@/views/assessment/index.vue"),
name: "assessment",
meta: { title: "产品表现分析", icon: "产品评估与考核", affix: true, pageKey: "product-diagnosis-iteration" },
},
// 产品问题诊断
{
// 产品问题诊断
{
path: "diagnosis",
component: () => import("@/views/assessment/diagnosis.vue"),
name: "diagnosis",
meta: { title: "产品问题诊断", icon: "产品评估与考核", affix: true, pageKey: "product-diagnosis-iteration" },
},
// 品类结构优化
{
// 品类结构优化
{
path: "optimization",
component: () => import("@/views/assessment/optimization.vue"),
name: "optimization",
meta: { title: "品类结构优化", icon: "产品评估与考核", affix: true, pageKey: "category-optimization" },
},
],
},
// 实验报告
{
path: "/report",
component: Layout,
redirect: "/report/index",
roles: ["student"],
children: [
{
path: "index",
component: () => import("@/views/test-report/index"),
name: "Report",
hidden: true,
meta: { title: "实验报告", icon: "成绩中心", affix: true },
},
],
},
},
],
},
// 实验报告
{
path: "/report",
component: Layout,
redirect: "/report/index",
roles: ["student"],
children: [
{
path: "index",
component: () => import("@/views/test-report/index"),
name: "Report",
hidden: true,
meta: { title: "实验报告", icon: "成绩中心", affix: true },
},
],
},
// 旧实验数据源入口兼容跳转,导航统一收敛到 BI 可视化
{
path: "/data",
@ -457,44 +457,44 @@ export const dynamicRoutes = [
roles: ["student"],
hidden: true,
},
// 学情分析,
{
path: "/analysis",
component: Layout,
redirect: "/analysis/index",
roles: ["student"],
children: [
{
path: "index",
component: () => import("@/views/analysis-of-students/analysis"),
name: "Analysis",
hidden: true,
meta: { title: "学情分析", icon: "成绩中心", affix: true },
},
{
path: "dialogue",
component: () => import("@/views/analysis-of-students/dialogue"),
name: "dialogue",
hidden: true,
meta: { title: "学情分析", icon: "成绩中心", affix: true },
},
],
},
// Bi可视化分析
{
path: "",
component: Layout,
roles: ["student"],
redirect: "/bi",
hidden: true,
children: [
{
path: "/bi",
component: () => import("@/views/visual-analysis/index.vue"),
name: "bi",
meta: { title: "BI可视化分析", icon: "dashboard", affix: true },
},
],
// 学情分析,
{
path: "/analysis",
component: Layout,
redirect: "/analysis/index",
roles: ["student"],
children: [
{
path: "index",
component: () => import("@/views/analysis-of-students/analysis"),
name: "Analysis",
hidden: true,
meta: { title: "学情分析", icon: "成绩中心", affix: true },
},
{
path: "dialogue",
component: () => import("@/views/analysis-of-students/dialogue"),
name: "dialogue",
hidden: true,
meta: { title: "学情分析", icon: "成绩中心", affix: true },
},
],
},
// Bi可视化分析
{
path: "",
component: Layout,
roles: ["student"],
redirect: "/bi",
hidden: true,
children: [
{
path: "/bi",
component: () => import("@/views/visual-analysis/index.vue"),
name: "bi",
meta: { title: "BI可视化分析", icon: "dashboard", affix: true },
},
],
},
{
path: "/examination",
@ -540,81 +540,83 @@ export const teacherRoutes = [
redirect: "/school/index",
roles: ["teacher"],
meta: { title: "院系管系", icon: "院系管系", affix: true, requiresFacultyManagement: true },
children: [
// 院校管理
{
path: "index",
component: () => import("@/views/teacherEnd/school/index.vue"),
name: "school",
meta: { title: "院系管系", icon: "院系管系", affix: true },
},
],
},
// 专业管理
{
children: [
// 院校管理
{
path: "index",
component: () => import("@/views/teacherEnd/school/index.vue"),
name: "school",
meta: { title: "院系管系", icon: "院系管系", affix: true },
},
],
},
// 专业管理
{
path: "/major",
component: Layout,
redirect: "/major/index",
roles: ["teacher"],
meta: { title: "专业管理", icon: "专业管理", affix: true, requiresMajorManagement: true },
children: [
// 专业管理
{
path: "index",
component: () => import("@/views/teacherEnd/major/index.vue"),
name: "major",
meta: { title: "专业管理", icon: "专业管理", affix: true },
},
],
},
// 班级管理
{
path: "/class",
component: Layout,
redirect: "/class/index",
roles: ["teacher"],
meta: { title: "班级管理", icon: "班级管理", affix: true },
children: [
// 班级管理
{
path: "index",
component: () => import("@/views/teacherEnd/class/index.vue"),
name: "class",
meta: { title: "班级管理", icon: "班级管理", affix: true },
},
],
},
// 教师管理
{
children: [
// 专业管理
{
path: "index",
component: () => import("@/views/teacherEnd/major/index.vue"),
name: "major",
meta: { title: "专业管理", icon: "专业管理", affix: true },
},
],
},
// 班级管理
{
path: "/class",
component: Layout,
redirect: "/class/index",
roles: ["teacher"],
meta: { title: "班级管理", icon: "班级管理", affix: true },
children: [
// 班级管理
{
path: "index",
component: () => import("@/views/teacherEnd/class/index.vue"),
name: "class",
// 页面按超管平台组织模式配置渲染行政班/教学班,导航前先等配置接口返回,
// 避免配置晚于挂载导致页面先按行政班渲染再闪变。
meta: { title: "班级管理", icon: "班级管理", affix: true, awaitSchoolProductConfig: true },
},
],
},
// 教师管理
{
path: "/teacher",
component: Layout,
redirect: "/teacher/index",
roles: ["teacher"],
meta: { title: "教师管理", icon: "教师管理", affix: true },
children: [
// 教师管理
{
path: "index",
component: () => import("@/views/teacherEnd/teacher/index.vue"),
name: "teacher",
meta: { title: "教师管理", icon: "教师管理", affix: true },
},
],
},
// 学生管理
children: [
// 教师管理
{
path: "index",
component: () => import("@/views/teacherEnd/teacher/index.vue"),
name: "teacher",
meta: { title: "教师管理", icon: "教师管理", affix: true },
},
],
},
// 学生管理
{
path: "/student",
component: Layout,
redirect: "/student/index",
roles: ["teacher"],
meta: { title: "学生管理", icon: "学生管理", affix: true },
children: [
// 学生管理
{
path: "index",
component: () => import("@/views/teacherEnd/student/index.vue"),
name: "student",
meta: { title: "学生管理", icon: "学生管理", affix: true },
redirect: "/student/index",
roles: ["teacher"],
meta: { title: "学生管理", icon: "学生管理", affix: true },
children: [
// 学生管理
{
path: "index",
component: () => import("@/views/teacherEnd/student/index.vue"),
name: "student",
meta: { title: "学生管理", icon: "学生管理", affix: true },
},
],
},
@ -652,21 +654,21 @@ export const teacherRoutes = [
},
{
path: "/task",
component: Layout,
redirect: "/task/index",
roles: ["teacher"],
meta: { title: "任务分配", icon: "任务分配", affix: true },
children: [
// 任务分配
{
path: "index",
component: () => import("@/views/teacherEnd/task/index.vue"),
name: "task",
meta: { title: "任务分配", icon: "任务分配", affix: true },
},
],
},
// 成绩中心
component: Layout,
redirect: "/task/index",
roles: ["teacher"],
meta: { title: "任务分配", icon: "任务分配", affix: true },
children: [
// 任务分配
{
path: "index",
component: () => import("@/views/teacherEnd/task/index.vue"),
name: "task",
meta: { title: "任务分配", icon: "任务分配", affix: true },
},
],
},
// 成绩中心
{
path: "/task-review",
component: Layout,
@ -684,19 +686,19 @@ export const teacherRoutes = [
},
{
path: "/score",
component: Layout,
redirect: "/score/index",
roles: ["teacher"],
meta: { title: "成绩中心", icon: "成绩中心", affix: true },
children: [
// 成绩中心
{
path: "index",
component: () => import("@/views/teacherEnd/score/index.vue"),
name: "score",
meta: { title: "成绩中心", icon: "成绩中心", affix: true },
},
],
component: Layout,
redirect: "/score/index",
roles: ["teacher"],
meta: { title: "成绩中心", icon: "成绩中心", affix: true },
children: [
// 成绩中心
{
path: "index",
component: () => import("@/views/teacherEnd/score/index.vue"),
name: "score",
meta: { title: "成绩中心", icon: "成绩中心", affix: true },
},
],
},
{
path: "/exam",
@ -900,11 +902,11 @@ const router = createRouter({
history: createWebHashHistory(),
routes: [...constantRoutes, ...dynamicRoutes, ...teacherRoutes, ...platformAdminRoutes, ...schoolAdminRoutes],
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
},
});
export default router;
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
},
});
export default router;

@ -928,13 +928,19 @@ function refreshAllClassList() {
}
onMounted(() => {
if (!adminClassManagementEnabled.value) {
activeClassType.value = "TEACHING"
}
getList()
getAllClassList()
getFacultyList()
})
// 学校配置可能晚于页面挂载才返回(permission.js 仅对带 requires* meta 的路由等待该接口),
// 这里响应式修正:行政班管理关闭(TEACHING_CLASS_ONLY)的学校固定为教学班视角,
// 避免一次性 onMounted 判断在配置未就绪时把页面定格在行政班、过滤掉全部教学班。
watch(adminClassManagementEnabled, (enabled) => {
if (!enabled) {
activeClassType.value = "TEACHING"
}
}, { immediate: true })
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save