You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-qianduan/src/router/index.js

803 lines
26 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* @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 的时候该路由不会再侧边栏出现 如401login等页面或者如一些编辑页面/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",
},
],
},
];
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: "/training-step",
component: Layout,
roles: ["student"],
hidden: true,
children: [
{
path: ":taskKey/:stepId",
component: () => import("@/views/training/CustomTrainingStepPage.vue"),
name: "CustomTrainingStep",
meta: { title: "自定义实训步骤", 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 },
},
],
},
{
path: "/student-demo",
component: () => import("@/views/studentDemo/index.vue"),
hidden: true,
},
{
path: "/comprehensive",
component: Layout,
redirect: "/comprehensive/index",
roles: ["student"],
hidden: true,
children: [
{
path: "index",
component: () => import("@/views/training/GenericTrainingPage.vue"),
name: "ComprehensiveCaseTraining",
meta: { title: "综合实训", icon: "Finished", affix: true, pageKey: "comprehensive-case-training" },
},
],
},
{
path: "/training",
component: Layout,
redirect: "/index",
roles: ["student"],
hidden: true,
children: [
{
path: "task/:pageKey",
component: () => import("@/views/training/GenericTrainingPage.vue"),
name: "StudentDynamicTrainingTask",
meta: { title: "实训任务", icon: "Document", affix: true },
},
],
},
// 互联网产品开发基础
{
path: "/foundation",
component: Layout,
redirect: "/foundation/new-product-survey",
roles: ["student"],
hidden: true,
children: [
{
path: "new-product-survey",
component: () => import("@/views/foundation/new-product-survey.vue"),
name: "NewProductSurvey",
meta: { title: "新产品调查与分析", icon: "需求挖掘", affix: true, pageKey: "new-product-survey" },
},
{
path: "product-development-factors",
component: () => import("@/views/foundation/product-development-factors.vue"),
name: "ProductDevelopmentFactors",
meta: { title: "产品开发关键因素", icon: "需求挖掘", affix: true, pageKey: "product-development-factors" },
},
{
path: "product-development-process",
component: () => import("@/views/foundation/product-development-process.vue"),
name: "ProductDevelopmentProcess",
meta: { title: "产品开发主要流程", icon: "需求挖掘", affix: true, pageKey: "product-development-process" },
},
],
},
//市场需求挖掘
{
path: "/demand",
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",
meta: { title: "竞争环境分析", icon: "需求挖掘", affix: true, pageKey: "competitive-environment-analysis" },
},
// 目标用户画像
{
path: "people",
component: () => import("@/views/demand/people.vue"),
name: "people",
meta: { title: "目标用户画像", icon: "需求挖掘", affix: true, pageKey: "target-user-profile" },
},
// 用户数据分析
{
path: "user",
component: () => import("@/views/demand/user.vue"),
name: "user",
meta: { title: "用户数据分析", icon: "需求挖掘", affix: true, pageKey: "target-user-profile" },
},
{
path: "business-feasibility",
component: () => import("@/views/demand/business-feasibility.vue"),
name: "BusinessFeasibility",
meta: { title: "商业可行性论证", icon: "需求挖掘", affix: true, pageKey: "business-feasibility" },
},
{
path: "consumer-behavior",
component: () => import("@/views/demand/consumer-behavior.vue"),
name: "ConsumerBehavior",
meta: { title: "消费者需求与行为", icon: "需求挖掘", affix: true, pageKey: "consumer-behavior" },
},
{
path: "consumer-scenario",
component: () => import("@/views/demand/consumer-scenario.vue"),
name: "ConsumerScenario",
meta: { title: "消费场景解构", icon: "需求挖掘", affix: true, pageKey: "consumer-scenario" },
},
{
path: "feature-conversion",
component: () => import("@/views/demand/feature-conversion.vue"),
name: "FeatureConversion",
meta: { title: "需求转化为功能", icon: "需求挖掘", affix: true, pageKey: "feature-conversion" },
},
],
},
// 产品规划
{
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" },
},
// 产品定价
{
path: "price",
component: () => import("@/views/product/price.vue"),
name: "price",
meta: { title: "产品定价", icon: "产品规划", affix: true, pageKey: "product-pricing" },
},
// 产品价值主张及定位
{
path: "differentiation",
component: () => import("@/views/product/differentiation.vue"),
name: "differentiation",
meta: { title: "产品价值主张及定位", icon: "产品规划", affix: true, pageKey: "product-value-positioning" },
},
// 产品结构规划
{
path: "structure",
component: () => import("@/views/product/structure.vue"),
name: "structure",
meta: { title: "产品结构规划", icon: "产品规划", affix: true, pageKey: "product-structure" },
},
{
path: "after-sales-service",
component: () => import("@/views/product/after-sales-service.vue"),
name: "AfterSalesService",
meta: { title: "售后服务流程设计", icon: "产品规划", affix: true, pageKey: "after-sales-service" },
},
{
path: "requirements-doc",
component: () => import("@/views/product/requirements-doc.vue"),
name: "RequirementsDoc",
meta: { title: "产品需求说明书", icon: "产品规划", affix: true, pageKey: "requirements-doc" },
},
{
path: "hardware-cost",
component: () => import("@/views/product/hardware-cost.vue"),
name: "HardwareCost",
meta: { title: "智能硬件成本估算", icon: "产品规划", affix: true, pageKey: "hardware-cost" },
},
],
},
// 产品投放测试
{
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: "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: "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 },
},
],
},
// 旧实验数据源入口兼容跳转,导航统一收敛到 BI 可视化
{
path: "/data",
redirect: "/bi",
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 },
},
],
},
];
// 教师端路由
export const teacherRoutes = [
{
path: "/school",
component: Layout,
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 },
},
],
},
// 专业管理
{
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 },
},
],
},
// 教师管理
{
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: "/training-task",
component: Layout,
redirect: "/training-task/index",
roles: ["teacher"],
meta: { title: "实训任务管理", icon: "实训任务管理", affix: true },
children: [
{
path: "index",
component: () => import("@/views/teacherEnd/trainingTask/index.vue"),
name: "trainingTask",
meta: { title: "实训任务管理", icon: "实训任务管理", affix: true },
},
],
},
// 任务分配
{
path: "/default-task",
component: Layout,
redirect: "/default-task/index",
roles: ["teacher"],
meta: { title: "默认实训任务配置", icon: "任务分配", affix: true, requiresManagerTeacher: true },
children: [
{
path: "index",
component: () => import("@/views/teacherEnd/defaultTask/index.vue"),
name: "defaultTask",
meta: { title: "默认实训任务配置", icon: "任务分配", affix: true, requiresManagerTeacher: 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 },
},
],
},
{
path: "/platform-training-task",
component: Layout,
redirect: "/platform-training-task/index",
roles: ["platformAdmin"],
meta: { title: "实训任务管理", icon: "实训任务管理", affix: true },
children: [
{
path: "index",
component: () => import("@/views/schoolAdmin/trainingTask/index.vue"),
name: "platformTrainingTask",
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, requiresFacultyManagement: 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, requiresMajorManagement: 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, requiresAdminClass: 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, requiresAdminClass: 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, ...schoolAdminRoutes],
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
},
});
export default router;