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

523 lines
16 KiB
JavaScript

2 months ago
/*
* @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";
5 years ago
/**
* 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'] // 访问路由的菜单权限
5 years ago
* meta : {
noCache: true // 如果设置为true则不会被 <keep-alive> 缓存(默认 false)
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
1 year ago
icon: 'svg-name' // 设置该路由的图标对应路径src/asse ts/icons/svg
5 years ago
breadcrumb: false // 如果设置为false则不会在breadcrumb面包屑中显示
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
}
*/
// 公共路由
export const constantRoutes = [
{
path: "/redirect",
5 years ago
component: Layout,
hidden: true,
children: [
{
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect/index.vue"),
},
],
5 years ago
},
{
path: "/login",
component: () => import("@/views/login"),
hidden: true,
5 years ago
},
{
path: "/register",
component: () => import("@/views/register"),
hidden: true,
5 years ago
},
{
path: "/:pathMatch(.*)*",
component: () => import("@/views/error/404"),
hidden: true,
},
{
path: "/401",
component: () => import("@/views/error/401"),
hidden: true,
},
2 months ago
{
path: "",
component: Layout,
redirect: "/index",
meta: { title: "首页", icon: "首页", affix: true },
children: [
{
path: "/index",
component: () => import("@/views/index"),
name: "Index",
},
],
},
2 years ago
];
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
2 months ago
path: "/ai",
component: Layout,
2 months ago
redirect: "/ai/assistant",
roles: ["student"],
children: [
{
2 months ago
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 },
2 years ago
},
{
2 months ago
path: "learning-situation-dialogue",
2 years ago
hidden: true,
2 months ago
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 },
},
],
5 years ago
},
2 months ago
// 智能助手
5 years ago
{
2 months ago
path: "/assistant",
component: Layout,
2 months ago
redirect: "/assistant/index",
roles: ["student"],
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
children: [
{
2 months ago
path: "index",
component: () => import("@/views/AI/index.vue"),
name: "assistant",
meta: { title: "AI智能助手", icon: "智能助手", affix: true },
},
],
5 years ago
},
2 months ago
//市场需求挖掘
5 years ago
{
2 months ago
path: "/demand",
5 years ago
component: Layout,
2 months ago
redirect: "/demand/index",
roles: ["student"],
meta: { title: "市场需求挖掘", icon: "需求挖掘", affix: true },
alwaysShow: true,
5 years ago
children: [
2 months ago
//行业需求分析
5 years ago
{
2 months ago
path: "index",
component: () => import("@/views/demand/index.vue"),
name: "demand",
meta: { title: "行业需求分析", icon: "需求挖掘", affix: true },
},
2 months ago
// 竞争环境分析
{
2 months ago
path: "environment",
component: () => import("@/views/demand/environment.vue"),
name: "environment",
meta: { title: "竞争环境分析", icon: "需求挖掘", affix: true },
},
2 months ago
// 消费人群分析
{
2 months ago
path: "people",
component: () => import("@/views/demand/people.vue"),
name: "people",
meta: { title: "消费人群分析", icon: "需求挖掘", affix: true },
},
2 months ago
// 用户数据分析
{
2 months ago
path: "user",
component: () => import("@/views/demand/user.vue"),
name: "user",
meta: { title: "用户数据分析", icon: "需求挖掘", affix: true },
},
],
5 years ago
},
2 months ago
// 产品规划
2 years ago
{
2 months ago
path: "/product",
2 years ago
component: Layout,
2 months ago
redirect: "/product/index",
roles: ["student"],
alwaysShow: true,
2 months ago
meta: { title: "产品规划", icon: "产品规划", affix: true },
2 years ago
children: [
2 months ago
// 产品定位
2 years ago
{
2 months ago
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 },
},
2 months ago
// 产品差异化定位
{
2 months ago
path: "differentiation",
component: () => import("@/views/product/differentiation.vue"),
name: "differentiation",
meta: { title: "产品差异化定位", icon: "产品规划", affix: true },
},
2 months ago
// 产品结构规划
{
2 months ago
path: "structure",
component: () => import("@/views/product/structure.vue"),
name: "structure",
meta: { title: "产品结构规划", icon: "产品规划", affix: true },
},
2 months ago
],
},
// 产品投放测试
{
path: "/test",
component: Layout,
redirect: "/test/index",
roles: ["student"],
alwaysShow: true,
meta: { title: "产品投放测试", icon: "产品投放测试", affix: true },
children: [
// 产品投放测试
{
2 months ago
path: "index",
component: () => import("@/views/test/index.vue"),
name: "test",
meta: { title: "发布渠道评估", icon: "产品投放测试", affix: true },
},
2 months ago
// 产品推广测试
{
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: [
// 供应渠道管理
{
2 months ago
path: "index",
component: () => import("@/views/channel/index.vue"),
name: "channel",
meta: { title: "采购需求预测", icon: "供应渠道管理", affix: true },
},
2 months ago
// 采购产品定位
{
2 months ago
path: "purchase",
component: () => import("@/views/channel/purchase.vue"),
name: "purchase",
meta: { title: "采购产品定位", icon: "供应渠道管理", affix: true },
},
2 months ago
// 供应商评估与选择
{
2 months ago
path: "supplier",
component: () => import("@/views/channel/supplier.vue"),
name: "supplier",
meta: { title: "供应商评估与选择", icon: "供应渠道管理", affix: true },
},
],
5 years ago
},
2 months ago
//产品评估与考核
{
2 months ago
path: "/assessment",
component: Layout,
2 months ago
redirect: "/assessment/index",
roles: ["student"],
alwaysShow: true,
2 months ago
meta: { title: "产品评估与考核", icon: "产品评估与考核", affix: true },
children: [
2 months ago
// 产品评估与考核
{
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 },
},
// 品类结构优化
{
2 months ago
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,
2 months ago
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 },
},
],
},
2 years ago
// Bi可视化分析
2 years ago
{
path: "",
component: Layout,
2 months ago
roles: ["student"],
2 years ago
redirect: "/bi",
2 months ago
hidden: true,
2 years ago
children: [
{
2 years ago
path: "/bi",
component: () => import("@/views/visual-analysis/index.vue"),
name: "bi",
meta: { title: "BI可视化分析", icon: "dashboard", affix: true },
2 years ago
},
],
},
2 months ago
];
// 教师端路由
export const teacherRoutes = [
2 years ago
{
2 months ago
path: "/school",
2 years ago
component: Layout,
2 months ago
redirect: "/school/index",
roles: ["teacher"],
meta: { title: "院系管系", icon: "院系管系", affix: true },
2 years ago
children: [
2 months ago
// 院校管理
2 years ago
{
2 months ago
path: "index",
component: () => import("@/views/teacherEnd/school/index.vue"),
name: "school",
meta: { title: "院系管系", icon: "院系管系", affix: true },
2 years ago
},
],
},
2 months ago
// 专业管理
2 years ago
{
2 months ago
path: "/major",
2 years ago
component: Layout,
2 months ago
redirect: "/major/index",
roles: ["teacher"],
meta: { title: "专业管理", icon: "专业管理", affix: true },
2 years ago
children: [
2 months ago
// 专业管理
2 years ago
{
2 months ago
path: "index",
component: () => import("@/views/teacherEnd/major/index.vue"),
name: "major",
meta: { title: "专业管理", icon: "专业管理", affix: true },
2 years ago
},
],
2 years ago
},
2 months ago
// 班级管理
2 years ago
{
2 months ago
path: "/class",
2 years ago
component: Layout,
2 months ago
redirect: "/class/index",
roles: ["teacher"],
meta: { title: "班级管理", icon: "班级管理", affix: true },
2 years ago
children: [
2 months ago
// 班级管理
2 years ago
{
2 months ago
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 },
2 years ago
},
],
},
];
5 years ago
const router = createRouter({
history: createWebHistory(),
2 months ago
routes: [...constantRoutes, ...dynamicRoutes, ...teacherRoutes],
5 years ago
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
5 years ago
} else {
return { top: 0 };
5 years ago
}
},
});
export default router;