框架初始化
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import router from "./router.js";
|
||||
import NProgress from "nprogress";
|
||||
import "nprogress/nprogress.css";
|
||||
import store from "../store";
|
||||
NProgress.configure({
|
||||
ease: "ease",
|
||||
speed: 500,
|
||||
});
|
||||
|
||||
const writeNames = ["/login"];
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start();
|
||||
console.log(store.getters);
|
||||
if (sessionStorage.getItem("token")) {
|
||||
if (to.path === "/login") {
|
||||
next("/");
|
||||
}
|
||||
return next();
|
||||
} else {
|
||||
if (writeNames.includes(to.path)) {
|
||||
next();
|
||||
} else {
|
||||
next("/login");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
router.afterEach((transition) => {
|
||||
NProgress.done();
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -0,0 +1,659 @@
|
||||
// 模板自带的功能路由表
|
||||
import login from "../views/login/index.vue";
|
||||
import Layout from "../layout/index.vue";
|
||||
const routerList = [
|
||||
{
|
||||
path: "/login",
|
||||
name: login,
|
||||
component: login,
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
component: Layout,
|
||||
name: "container",
|
||||
redirect: "home",
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "仪表盘",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/home",
|
||||
name: "home",
|
||||
component: () => import("../views/home/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "看板",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/system",
|
||||
component: Layout,
|
||||
name: "system",
|
||||
meta: {
|
||||
name: "系统配置",
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/homeSite",
|
||||
name: "homesite",
|
||||
component: () => import("../views/system/homeSite.vue"),
|
||||
meta: {
|
||||
name: "首页",
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/customer",
|
||||
name: "customer",
|
||||
component: () => import("../views/system/customer.vue"),
|
||||
meta: {
|
||||
name: "客服电话",
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/activity",
|
||||
name: "activity",
|
||||
component: () => import("../views/system/activity.vue"),
|
||||
meta: {
|
||||
name: "活动管理",
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/edit",
|
||||
name: "edit",
|
||||
component: () => import("../views/system/edit.vue"),
|
||||
meta: {
|
||||
name: "编辑资料",
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/goods",
|
||||
component: Layout,
|
||||
redirect: "goods",
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "服务项目",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/goods",
|
||||
name: "goods",
|
||||
component: () => import("../views/goods/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "项目列表",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/order",
|
||||
component: Layout,
|
||||
redirect: "order",
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "订单",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/scheduling",
|
||||
name: "scheduling",
|
||||
component: () => import("../views/order/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "订单列表",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/users",
|
||||
name: "users",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "用户",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/index",
|
||||
name: "index",
|
||||
component: () => import("../views/users/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "用户列表",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/reconnaissance",
|
||||
name: "reconnaissance",
|
||||
component: () => import("../views/users/reconnaissance.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "勘察人员",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/maintain",
|
||||
name: "maintain",
|
||||
component: () => import("../views/users/maintain.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "维修人员",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/engineer",
|
||||
component: Layout,
|
||||
name: "engineer",
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "工程师审核",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/reconnaissance",
|
||||
name: "reconnaissance",
|
||||
component: () => import("../views/engineer/reconnaissance.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "勘察人员审核",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/maintain",
|
||||
name: "maintain",
|
||||
component: () => import("../views/engineer/maintain.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "维修人员审核",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/scheduling",
|
||||
component: Layout,
|
||||
name: "scheduling",
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "工程师审核",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/reconnaissanceScheduling",
|
||||
name: "reconnaissanceScheduling",
|
||||
component: () => import("../views/scheduling/reconnaissance.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "勘察人员排班",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/maintainScheduling",
|
||||
name: "maintainScheduling",
|
||||
component: () => import("../views/scheduling/maintain.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "维修人员排班",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
path: "/form",
|
||||
name: "form",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "表单页",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/baseForm",
|
||||
name: "baseForm",
|
||||
component: () => import("../views/form/baseForm.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "基础表单",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/stepFrom",
|
||||
name: "stepFrom",
|
||||
component: () => import("../views/form/stepFrom.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "分页表单",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/advancedForm",
|
||||
name: "advancedForm",
|
||||
component: () => import("../views/form/advancedForm.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "高级表单",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/system2",
|
||||
name: "system2",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "系统管理",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/Department",
|
||||
name: "Department",
|
||||
component: () => import("../views/system/Department/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "基础表格",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/UserList",
|
||||
name: "UserList",
|
||||
component: () => import("../views/system/UserList/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "内嵌表格",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/RoleList",
|
||||
name: "RoleList",
|
||||
component: () => import("../views/system/RoleList/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "滑动加载",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/MenuList",
|
||||
name: "MenuList",
|
||||
component: () => import("../views/system/MenuList/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "可编辑Table",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/importExcel",
|
||||
name: "importExcel",
|
||||
component: () => import("../views/system/Excel/importExcel.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "Excel",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/ErrorMessage",
|
||||
name: "ErrorMessage",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "异常页面",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/404",
|
||||
name: "404",
|
||||
component: () => import("../views/ErrorMessage/404.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "404",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/500",
|
||||
name: "500",
|
||||
component: () => import("../views/ErrorMessage/500.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "500",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// path: "/goods",
|
||||
// name: "goods",
|
||||
// component: Layout,
|
||||
// meta: {
|
||||
// name: "列表页",
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: "/goodCategory",
|
||||
// name: "goodCategory",
|
||||
// component: () => import("../views/goods/goodCategory.vue"),
|
||||
// meta: {
|
||||
// requiresAuth: true, //有一些页面是否登录才能进去
|
||||
// name: "基础列表",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/cardList",
|
||||
// name: "cardList",
|
||||
// component: () => import("../views/goods/cardList.vue"),
|
||||
// meta: {
|
||||
// requiresAuth: true, //有一些页面是否登录才能进去
|
||||
// name: "卡片列表",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// path: "/searchList",
|
||||
// name: "searchList",
|
||||
// component: () => import("../views/goods/searchList.vue"),
|
||||
// meta: {
|
||||
// requiresAuth: true, //有一些页面是否登录才能进去
|
||||
// name: "搜索列表",
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
path: "/able",
|
||||
name: "able",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "功能",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/watermark",
|
||||
name: "watermark",
|
||||
component: () => import("../views/able/watermark.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "水印",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/countTo",
|
||||
name: "countTo",
|
||||
component: () => import("../views/able/countTo.vue"),
|
||||
meta: {
|
||||
requiresAuth: true, //有一些页面是否登录才能进去
|
||||
name: "数字动画",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/batchImport",
|
||||
name: "batchImport",
|
||||
component: () => import("../views/able/batchImport.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "图片上传",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/fileImport",
|
||||
name: "fileImport",
|
||||
component: () => import("../views/able/fileImport.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "文件上传",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/wangEditor",
|
||||
name: "wangEditor",
|
||||
component: () => import("../views/able/wangEditor.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "富文本编辑器",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/markdown",
|
||||
name: "markdown",
|
||||
component: () => import("../views/able/markdown.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "markdown",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/strength",
|
||||
name: "strength",
|
||||
component: () => import("../views/able/strength.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "密码强度",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/validation",
|
||||
name: "validation",
|
||||
component: () => import("../views/able/validation.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "验证组件",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/guide",
|
||||
name: "guide",
|
||||
component: () => import("../views/able/guide.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "引导页",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/embedded",
|
||||
name: "embedded",
|
||||
component: () => import("../views/able/embedded.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "内嵌页",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/flow",
|
||||
name: "flow",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "图形编辑器",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/flowCat",
|
||||
name: "flowCat",
|
||||
component: () => import("../views/flow/flowCat.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "流程图",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/echarts",
|
||||
name: "echarts",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "图表",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/baidumap",
|
||||
name: "baidumap",
|
||||
component: () => import("../views/echarts/map/baidumap.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "百度地图",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/gaodemap",
|
||||
name: "gaodemap",
|
||||
component: () => import("../views/echarts/map/gaodemap.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "高德地图",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/histogram",
|
||||
name: "histogram",
|
||||
component: () => import("../views/echarts/histogram.vue"),
|
||||
mate: {
|
||||
requiresAuth: true,
|
||||
name: "柱状图",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/line",
|
||||
name: "line",
|
||||
component: () => import("../views/echarts/line.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "折线图",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/radar",
|
||||
name: "radar",
|
||||
component: () => import("../views/echarts/radar.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "雷达图",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/video",
|
||||
name: "video",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "视频播放器",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/video",
|
||||
name: "video",
|
||||
component: () => import("../views/video/index.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "视频播放器",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/DataReport",
|
||||
name: "DataReport",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "数据统计",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/demo1",
|
||||
name: "demo1",
|
||||
component: () => import("../views/DataReport/demo1.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "项目一",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/material",
|
||||
name: "material",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "素材管理",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/materialIndex",
|
||||
name: "materialIndex",
|
||||
component: () => import("../views/material/materialIndex.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "素材管理",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/directives",
|
||||
name: "directives",
|
||||
component: Layout,
|
||||
meta: {
|
||||
name: "自定义指令",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/Drag",
|
||||
name: "Drag",
|
||||
component: () => import("../views/directives/Drag.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "拖拽",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/throttle",
|
||||
name: "throttle",
|
||||
component: () => import("../views/directives/throttle.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "节流",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/copy",
|
||||
name: "copy",
|
||||
component: () => import("../views/directives/copy.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "复制",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/debounceDirect",
|
||||
name: "debounceDirect",
|
||||
component: () => import("../views/directives/debounceDirect.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "防抖",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/longPress",
|
||||
name: "longPress",
|
||||
component: () => import("../views/directives/longPress.vue"),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
name: "长按指令",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
];
|
||||
export default routerList;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createRouter, createWebHashHistory } from "vue-router";
|
||||
import home from "../views/home/index.vue";
|
||||
import login from "../views/login/index.vue";
|
||||
import Layout from "../layout/index.vue";
|
||||
// 原本模板功能路由表
|
||||
import routerList from "./originalRoutingTable.js";
|
||||
|
||||
const routes = routerList;
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes,
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user