|
@@ -38,194 +38,204 @@ import Layout from "@/layout";
|
|
|
* a base page that does not have permission requirements
|
|
* a base page that does not have permission requirements
|
|
|
* all roles can be accessed
|
|
* all roles can be accessed
|
|
|
*/
|
|
*/
|
|
|
-export const constantRoutes = [
|
|
|
|
|
- {
|
|
|
|
|
- path: "/login",
|
|
|
|
|
- component: () => import("@/views/login/index"),
|
|
|
|
|
- hidden: true,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "/404",
|
|
|
|
|
- component: () => import("@/views/404"),
|
|
|
|
|
- hidden: true,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+export const constantRoutes = [{
|
|
|
|
|
+ path: "/login",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/login/index"),
|
|
|
|
|
+ hidden: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "/404",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/404"),
|
|
|
|
|
+ hidden: true,
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- path: "/",
|
|
|
|
|
- component: Layout,
|
|
|
|
|
- redirect: "/dashboard",
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "dashboard",
|
|
|
|
|
- name: "Dashboard",
|
|
|
|
|
- // component: () => import('@/views/dashboard/editor/index'),
|
|
|
|
|
- component: () => import("@/views/dashboard/index"),
|
|
|
|
|
- meta: { title: "首页", icon: "首页", affix: true },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "/changpwd",
|
|
|
|
|
- component: Layout,
|
|
|
|
|
- redirect: "/changpwd",
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "changpwd",
|
|
|
|
|
- name: "Changpwd",
|
|
|
|
|
- component: () => import("@/views/changpwd/changpwd/index"),
|
|
|
|
|
- meta: { title: "修改密码", icon: "修改密码", affix: false },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- // {
|
|
|
|
|
- // path: "/leftoverUse",
|
|
|
|
|
- // component: Layout,
|
|
|
|
|
- // redirect: "/leftoverUse",
|
|
|
|
|
- // children: [
|
|
|
|
|
- // {
|
|
|
|
|
- // path: "leftoverUse",
|
|
|
|
|
- // name: "leftoverUse",
|
|
|
|
|
- // component: () => import("@/views/basicData/leftoverUse/index.vue"),
|
|
|
|
|
- // meta: { title: "剩料使用", icon: "撒料计划" },
|
|
|
|
|
- // },
|
|
|
|
|
- // ],
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // path: "/leftoverManagement",
|
|
|
|
|
- // component: Layout,
|
|
|
|
|
- // redirect: "/leftoverManagement",
|
|
|
|
|
- // children: [
|
|
|
|
|
- // {
|
|
|
|
|
- // path: "leftoverManagement",
|
|
|
|
|
- // name: "leftoverManagement",
|
|
|
|
|
- // component: () =>
|
|
|
|
|
- // import("@/views/basicData/leftoverManagement/index.vue"),
|
|
|
|
|
- // meta: { title: "剩料配置", icon: "撒料计划" },
|
|
|
|
|
- // },
|
|
|
|
|
- // ],
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // path: '/drawDot',
|
|
|
|
|
- // component: Layout,
|
|
|
|
|
- // redirect: '/drawDot',
|
|
|
|
|
- // children: [{
|
|
|
|
|
- // path: 'drawDot',
|
|
|
|
|
- // name: 'drawDot',
|
|
|
|
|
- // component: () => import('@/views/drawDot/index.vue'),
|
|
|
|
|
- // meta: { title: '画点图',icon: '撒料计划'}
|
|
|
|
|
- // }]
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "/",
|
|
|
|
|
+ component: Layout,
|
|
|
|
|
+ redirect: "/dashboard",
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "dashboard",
|
|
|
|
|
+ name: "Dashboard",
|
|
|
|
|
+ // component: () => import('@/views/dashboard/editor/index'),
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/dashboard/index"),
|
|
|
|
|
+ meta: { title: "首页", icon: "首页", affix: true },
|
|
|
|
|
+ }, ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "/changpwd",
|
|
|
|
|
+ component: Layout,
|
|
|
|
|
+ redirect: "/changpwd",
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "changpwd",
|
|
|
|
|
+ name: "Changpwd",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/changpwd/changpwd/index"),
|
|
|
|
|
+ meta: { title: "修改密码", icon: "修改密码", affix: false },
|
|
|
|
|
+ }, ],
|
|
|
|
|
+ },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: "/Addboard",
|
|
|
|
|
+ // component: Layout,
|
|
|
|
|
+ // redirect: "/Addboard",
|
|
|
|
|
+ // children: [{
|
|
|
|
|
+ // path: "Addboard",
|
|
|
|
|
+ // name: "Addboard",
|
|
|
|
|
+ // component: () =>
|
|
|
|
|
+ // import ("@/views/customboard/addboard/index"),
|
|
|
|
|
+ // meta: { title: "123", icon: "" },
|
|
|
|
|
+ // }, ],
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: "/leftoverUse",
|
|
|
|
|
+ // component: Layout,
|
|
|
|
|
+ // redirect: "/leftoverUse",
|
|
|
|
|
+ // children: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: "leftoverUse",
|
|
|
|
|
+ // name: "leftoverUse",
|
|
|
|
|
+ // component: () => import("@/views/basicData/leftoverUse/index.vue"),
|
|
|
|
|
+ // meta: { title: "剩料使用", icon: "撒料计划" },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: "/leftoverManagement",
|
|
|
|
|
+ // component: Layout,
|
|
|
|
|
+ // redirect: "/leftoverManagement",
|
|
|
|
|
+ // children: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: "leftoverManagement",
|
|
|
|
|
+ // name: "leftoverManagement",
|
|
|
|
|
+ // component: () =>
|
|
|
|
|
+ // import("@/views/basicData/leftoverManagement/index.vue"),
|
|
|
|
|
+ // meta: { title: "剩料配置", icon: "撒料计划" },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // path: '/drawDot',
|
|
|
|
|
+ // component: Layout,
|
|
|
|
|
+ // redirect: '/drawDot',
|
|
|
|
|
+ // children: [{
|
|
|
|
|
+ // path: 'drawDot',
|
|
|
|
|
+ // name: 'drawDot',
|
|
|
|
|
+ // component: () => import('@/views/drawDot/index.vue'),
|
|
|
|
|
+ // meta: { title: '画点图',icon: '撒料计划'}
|
|
|
|
|
+ // }]
|
|
|
|
|
+ // },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* asyncRoutes
|
|
* asyncRoutes
|
|
|
* the routes that need to be dynamically loaded based on user roles
|
|
* the routes that need to be dynamically loaded based on user roles
|
|
|
*/
|
|
*/
|
|
|
-export const asyncRoutes = [
|
|
|
|
|
- {
|
|
|
|
|
- path: "/nested",
|
|
|
|
|
- component: Layout,
|
|
|
|
|
- redirect: "/nested/menu1",
|
|
|
|
|
- name: "Nested",
|
|
|
|
|
- meta: {
|
|
|
|
|
- title: "Nested",
|
|
|
|
|
- icon: "nested",
|
|
|
|
|
- },
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1",
|
|
|
|
|
- component: () => import("@/views/nested/menu1/index"), // Parent router-view
|
|
|
|
|
- name: "Menu1",
|
|
|
|
|
- meta: { title: "Menu1" },
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1-1",
|
|
|
|
|
- component: () => import("@/views/nested/menu1/menu1-1"),
|
|
|
|
|
- name: "Menu1-1",
|
|
|
|
|
- meta: { title: "Menu1-1" },
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1-2",
|
|
|
|
|
- component: () => import("@/views/nested/menu1/menu1-2"),
|
|
|
|
|
- name: "Menu1-2",
|
|
|
|
|
- meta: { title: "Menu1-2" },
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1-2-1",
|
|
|
|
|
|
|
+export const asyncRoutes = [{
|
|
|
|
|
+ path: "/nested",
|
|
|
|
|
+ component: Layout,
|
|
|
|
|
+ redirect: "/nested/menu1",
|
|
|
|
|
+ name: "Nested",
|
|
|
|
|
+ meta: {
|
|
|
|
|
+ title: "Nested",
|
|
|
|
|
+ icon: "nested",
|
|
|
|
|
+ },
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "menu1",
|
|
|
component: () =>
|
|
component: () =>
|
|
|
- import("@/views/nested/menu1/menu1-2/menu1-2-1"),
|
|
|
|
|
- name: "Menu1-2-1",
|
|
|
|
|
- meta: { title: "Menu1-2-1" },
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1-2-2",
|
|
|
|
|
|
|
+ import ("@/views/nested/menu1/index"), // Parent router-view
|
|
|
|
|
+ name: "Menu1",
|
|
|
|
|
+ meta: { title: "Menu1" },
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "menu1-1",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/nested/menu1/menu1-1"),
|
|
|
|
|
+ name: "Menu1-1",
|
|
|
|
|
+ meta: { title: "Menu1-1" },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "menu1-2",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/nested/menu1/menu1-2"),
|
|
|
|
|
+ name: "Menu1-2",
|
|
|
|
|
+ meta: { title: "Menu1-2" },
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "menu1-2-1",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/nested/menu1/menu1-2/menu1-2-1"),
|
|
|
|
|
+ name: "Menu1-2-1",
|
|
|
|
|
+ meta: { title: "Menu1-2-1" },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "menu1-2-2",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/nested/menu1/menu1-2/menu1-2-2"),
|
|
|
|
|
+ name: "Menu1-2-2",
|
|
|
|
|
+ meta: { title: "Menu1-2-2" },
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "menu1-3",
|
|
|
|
|
+ component: () =>
|
|
|
|
|
+ import ("@/views/nested/menu1/menu1-3"),
|
|
|
|
|
+ name: "Menu1-3",
|
|
|
|
|
+ meta: { title: "Menu1-3" },
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "menu2",
|
|
|
component: () =>
|
|
component: () =>
|
|
|
- import("@/views/nested/menu1/menu1-2/menu1-2-2"),
|
|
|
|
|
- name: "Menu1-2-2",
|
|
|
|
|
- meta: { title: "Menu1-2-2" },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu1-3",
|
|
|
|
|
- component: () => import("@/views/nested/menu1/menu1-3"),
|
|
|
|
|
- name: "Menu1-3",
|
|
|
|
|
- meta: { title: "Menu1-3" },
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ import ("@/views/nested/menu2/index"),
|
|
|
|
|
+ meta: { title: "menu2" },
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- path: "menu2",
|
|
|
|
|
- component: () => import("@/views/nested/menu2/index"),
|
|
|
|
|
- meta: { title: "menu2" },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- path: "external-link",
|
|
|
|
|
- component: Layout,
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- path: "https://panjiachen.github.io/vue-element-admin-site/#/",
|
|
|
|
|
- meta: { title: "External Link", icon: "link" },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- // 404 page must be placed at the end !!!
|
|
|
|
|
- { path: "*", redirect: "/404", hidden: true },
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "external-link",
|
|
|
|
|
+ component: Layout,
|
|
|
|
|
+ children: [{
|
|
|
|
|
+ path: "https://panjiachen.github.io/vue-element-admin-site/#/",
|
|
|
|
|
+ meta: { title: "External Link", icon: "link" },
|
|
|
|
|
+ }, ],
|
|
|
|
|
+ },
|
|
|
|
|
+ // 404 page must be placed at the end !!!
|
|
|
|
|
+ { path: "*", redirect: "/404", hidden: true },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
const createRouter = () =>
|
|
const createRouter = () =>
|
|
|
- new Router({
|
|
|
|
|
- // mode: 'history', // require service support
|
|
|
|
|
- scrollBehavior: () => ({ y: 0 }),
|
|
|
|
|
- routes: constantRoutes,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ new Router({
|
|
|
|
|
+ // mode: 'history', // require service support
|
|
|
|
|
+ scrollBehavior: () => ({ y: 0 }),
|
|
|
|
|
+ routes: constantRoutes,
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
const router = createRouter();
|
|
const router = createRouter();
|
|
|
|
|
|
|
|
router.afterEach((to, from) => {
|
|
router.afterEach((to, from) => {
|
|
|
- // 百度统计:单页面应用手动上报页面访问
|
|
|
|
|
- console.log(window._hmt, "0");
|
|
|
|
|
- if (window._hmt) {
|
|
|
|
|
- console.log(window._hmt, "0->1");
|
|
|
|
|
- const referrer = from.fullPath || "direct";
|
|
|
|
|
- window._hmt.push(["_trackPageview", to.fullPath]);
|
|
|
|
|
- window._hmt.push(["_trackEvent", "Navigation", "Referrer", referrer]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 百度统计:单页面应用手动上报页面访问
|
|
|
|
|
+ console.log(window._hmt, "0");
|
|
|
|
|
+ if (window._hmt) {
|
|
|
|
|
+ console.log(window._hmt, "0->1");
|
|
|
|
|
+ const referrer = from.fullPath || "direct";
|
|
|
|
|
+ window._hmt.push(["_trackPageview", to.fullPath]);
|
|
|
|
|
+ window._hmt.push(["_trackEvent", "Navigation", "Referrer", referrer]);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
|
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
|
|
export function resetRouter() {
|
|
export function resetRouter() {
|
|
|
- const newRouter = createRouter();
|
|
|
|
|
- router.matcher = newRouter.matcher; // reset router
|
|
|
|
|
|
|
+ const newRouter = createRouter();
|
|
|
|
|
+ router.matcher = newRouter.matcher; // reset router
|
|
|
}
|
|
}
|
|
|
const originalPush = Router.prototype.push;
|
|
const originalPush = Router.prototype.push;
|
|
|
Router.prototype.push = function push(location, onResolve, onReject) {
|
|
Router.prototype.push = function push(location, onResolve, onReject) {
|
|
|
- if (onResolve || onReject)
|
|
|
|
|
- return originalPush.call(this, location, onResolve, onReject);
|
|
|
|
|
- return originalPush.call(this, location).catch((err) => err);
|
|
|
|
|
|
|
+ if (onResolve || onReject)
|
|
|
|
|
+ return originalPush.call(this, location, onResolve, onReject);
|
|
|
|
|
+ return originalPush.call(this, location).catch((err) => err);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-export default router;
|
|
|
|
|
|
|
+export default router;
|