Lvtianfang
杜函宇 2 years ago
parent 4da1aca2f1
commit a2931feea2

@ -6,11 +6,11 @@ import "nprogress/nprogress.css";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
// 踢出系统 // 踢出系统
function kickOut() { // function kickOut() {
if (process.env.NODE_ENV === "production") { // if (process.env.NODE_ENV === "production") {
location.href = location.origin + "/login"; // location.href = location.origin + "/login";
} // }
} // }
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });
const whiteList = [ const whiteList = [
"/login", "/login",
@ -55,20 +55,22 @@ router.beforeEach((to, from, next) => {
if (res.length > 0) { if (res.length > 0) {
next({ path: res }); next({ path: res });
} else { } else {
kickOut(); // kickOut();
} }
}) })
.catch((error) => { .catch((error) => {
kickOut(); // kickOut();
}); });
} }
} else { } else {
//没有token踢出去 // //没有token踢出去
Message.error("获取令牌失败!"); // Message.error("获取令牌失败!");
kickOut(); // kickOut();
next();
} }
} else { } else {
kickOut(); // kickOut();
NProgress.done(); NProgress.done();
} }
} }

@ -120,6 +120,34 @@ export const constantRoutes = [
component: () => import("@/views/changePassword/index"), component: () => import("@/views/changePassword/index"),
meta: { title: "修改密码", icon: "netWork" }, meta: { title: "修改密码", icon: "netWork" },
}, },
{
path: "/changePassword",
name: "行政审批",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "行政审批", icon: "netWork" },
},
{
path: "/changePassword",
name: "企业档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "企业档案", icon: "netWork" },
},
{
path: "/changePassword",
name: "产品档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "产品档案", icon: "netWork" },
},
{
path: "/changePassword",
name: "依法注销",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "依法注销", icon: "netWork" },
},
], ],
}, },
]; ];

@ -38,11 +38,13 @@ export default {
computed: { computed: {
// //
myRouter() { myRouter() {
console.log(this.$router.options.routes);
// let staticRouter = router.options.routes.filter( // let staticRouter = router.options.routes.filter(
// (item) => item.isDiy == true // (item) => item.isDiy == true
// )[0].children; // )[0].children;
// return staticRouter; // return staticRouter;
return this.$store.state.myselfPermission.routerList; // return this.$store.state.myselfPermission.routerList;
return this.$router.options.routes[6].children;
}, },
}, },
created() {}, created() {},

Loading…
Cancel
Save