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

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

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

Loading…
Cancel
Save