/* * @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 { createWebHistory, 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' // 设定路由的名字,一定要填写不然使用时会出现各种问题 * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数 * roles: ['admin', 'common'] // 访问路由的角色权限 * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限 * meta : { noCache: true // 如果设置为true,则不会被 缓存(默认 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", }, ], }, ]; // 动态路由,基于用户权限动态去加载 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: "/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 }, }, ], }, //市场需求挖掘 { path: "/demand", component: Layout, redirect: "/demand/index", roles: ["student"], meta: { title: "市场需求挖掘", icon: "需求挖掘", affix: true }, alwaysShow: true, children: [ //行业需求分析 { path: "index", component: () => import("@/views/demand/index.vue"), name: "demand", meta: { title: "行业需求分析", icon: "需求挖掘", affix: true }, }, // 竞争环境分析 { path: "environment", component: () => import("@/views/demand/environment.vue"), name: "environment", meta: { title: "竞争环境分析", icon: "需求挖掘", affix: true }, }, // 消费人群分析 { path: "people", component: () => import("@/views/demand/people.vue"), name: "people", meta: { title: "消费人群分析", icon: "需求挖掘", affix: true }, }, // 用户数据分析 { path: "user", component: () => import("@/views/demand/user.vue"), name: "user", meta: { title: "用户数据分析", icon: "需求挖掘", affix: true }, }, ], }, // 产品规划 { path: "/product", component: Layout, redirect: "/product/index", roles: ["student"], alwaysShow: true, meta: { title: "产品规划", icon: "产品规划", affix: true }, children: [ // 产品定位 { path: "index", component: () => import("@/views/product/index.vue"), name: "product", meta: { title: "数据化选品", icon: "产品规划", affix: true }, }, // 产品定价 { path: "price", component: () => import("@/views/product/price.vue"), name: "price", meta: { title: "产品定价", icon: "产品规划", affix: true }, }, // 产品差异化定位 { path: "differentiation", component: () => import("@/views/product/differentiation.vue"), name: "differentiation", meta: { title: "产品差异化定位", icon: "产品规划", affix: true }, }, // 产品结构规划 { path: "structure", component: () => import("@/views/product/structure.vue"), name: "structure", meta: { title: "产品结构规划", icon: "产品规划", affix: true }, }, ], }, // 产品投放测试 { 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 }, }, // 产品推广测试 { path: "promotion", component: () => import("@/views/test/promotion.vue"), name: "promotion", meta: { title: "产品推广测试", icon: "产品投放测试", affix: true }, }, // 渠道表现分析 { path: "channelas", component: () => import("@/views/test/channel.vue"), name: "channelas", meta: { title: "渠道表现分析", icon: "产品投放测试", affix: true }, }, // 产品营销定位 { path: "marketing", component: () => import("@/views/test/marketing.vue"), name: "marketing", meta: { title: "产品营销定位", icon: "产品投放测试", affix: true }, }, ], }, // 供应渠道管理 { 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 }, }, // 采购产品定位 { path: "purchase", component: () => import("@/views/channel/purchase.vue"), name: "purchase", meta: { title: "采购产品定位", icon: "供应渠道管理", affix: true }, }, // 供应商评估与选择 { path: "supplier", component: () => import("@/views/channel/supplier.vue"), name: "supplier", meta: { title: "供应商评估与选择", icon: "供应渠道管理", affix: true }, }, ], }, //产品评估与考核 { 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 }, }, // 产品问题诊断 { path: "diagnosis", component: () => import("@/views/assessment/diagnosis.vue"), name: "diagnosis", meta: { title: "产品问题诊断", icon: "产品评估与考核", affix: true }, }, // 品类结构优化 { path: "optimization", component: () => import("@/views/assessment/optimization.vue"), name: "optimization", 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 }, }, ], }, // 实验数据源 { path: "/data", component: Layout, redirect: "/data/index", roles: ["student"], children: [ { path: "index", component: () => import("@/views/digitalMarketingAlgorithms/components/bigData"), name: "index", hidden: true, meta: { title: "实验数据源", icon: "成绩中心", 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 }, }, ], }, ]; // 教师端路由 export const teacherRoutes = [ { path: "/school", component: Layout, redirect: "/school/index", roles: ["teacher"], 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 }, 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 }, }, ], }, // 教师管理 { 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 }, }, ], }, // 学生管理 { 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 }, }, ], }, // 任务分配 { 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 }, }, ], }, // 成绩中心 { 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 }, }, ], }, ]; export const platformAdminRoutes = [ { path: "/platform-schools", component: Layout, redirect: "/platform-schools/index", roles: ["platformAdmin"], meta: { title: "学校管理", icon: "学校", affix: true }, children: [ { path: "index", component: () => import("@/views/platformAdmin/school/index.vue"), name: "platformSchools", meta: { title: "学校管理", icon: "学校", affix: true }, }, ], }, { path: "/platform-teachers", component: Layout, redirect: "/platform-teachers/index", roles: ["platformAdmin"], meta: { title: "教师管理", icon: "用户", affix: true }, children: [ { path: "index", component: () => import("@/views/platformAdmin/schoolAdmin/index.vue"), name: "platformTeachers", meta: { title: "教师管理", icon: "用户", affix: true }, }, ], }, ]; export const schoolAdminRoutes = [ { path: "/admin-school", component: Layout, redirect: "/admin-school/index", roles: ["schoolAdmin"], meta: { title: "学校管理", icon: "学校", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/school/index.vue"), name: "adminSchool", meta: { title: "学校管理", icon: "学校", affix: true }, }, ], }, { path: "/admin-faculty", component: Layout, redirect: "/admin-faculty/index", roles: ["schoolAdmin"], meta: { title: "院系管理", icon: "院系管理", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/faculty/index.vue"), name: "adminFaculty", meta: { title: "院系管理", icon: "院系管理", affix: true }, }, ], }, { path: "/admin-major", component: Layout, redirect: "/admin-major/index", roles: ["schoolAdmin"], meta: { title: "专业管理", icon: "专业管理", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/major/index.vue"), name: "adminMajor", meta: { title: "专业管理", icon: "专业管理", affix: true }, }, ], }, { path: "/admin-class", component: Layout, redirect: "/admin-class/index", roles: ["schoolAdmin"], meta: { title: "班级管理", icon: "班级管理", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/class/index.vue"), name: "adminClass", meta: { title: "班级管理", icon: "班级管理", affix: true }, }, ], }, { path: "/admin-teacher", component: Layout, redirect: "/admin-teacher/index", roles: ["schoolAdmin"], meta: { title: "教师管理", icon: "教师管理", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/teacher/index.vue"), name: "adminTeacher", meta: { title: "教师管理", icon: "教师管理", affix: true }, }, ], }, { path: "/admin-student", component: Layout, redirect: "/admin-student/index", roles: ["schoolAdmin"], meta: { title: "学生管理", icon: "学生管理", affix: true }, children: [ { path: "index", component: () => import("@/views/schoolAdmin/student/index.vue"), name: "adminStudent", meta: { title: "学生管理", icon: "学生管理", affix: true }, }, ], }, ]; const router = createRouter({ history: createWebHistory(), routes: [...constantRoutes, ...dynamicRoutes, ...teacherRoutes, ...platformAdminRoutes], scrollBehavior(to, from, savedPosition) { if (savedPosition) { return savedPosition; } else { return { top: 0 }; } }, }); export default router;