李劲龙 1 year ago
commit e9d1202cec

@ -14,8 +14,8 @@ function kickOut() {
const whiteList = [
"/404",
"/401",
'/drugArchives',
"/cosmeticsArchives",
// '/drugArchives',
// "/cosmeticsArchives",
"/cosmeticsDetail",
"/health",
"/zyzj",
@ -25,12 +25,14 @@ router.beforeEach((to, from, next) => {
NProgress.start();
let token = localStorage.getItem('MSSM-LIAONING__TOKEN')
console.log(to.path);
if (whiteList.indexOf(to.path) !== -1) {
if (whiteList.indexOf(to.path) == -1) {
if (token) {
console.log(store.state.myselfPermission.routerList,'store.state.myselfPermission.routerList')
if (store.state.myselfPermission.routerList.length > 0) {
let current = store.state.myselfPermission.routerList.filter(
(item) => item.path == to.path || from.path == "/"
);
console.log(current,'current')
if (current.length > 0) {
next();
} else {
@ -38,6 +40,7 @@ router.beforeEach((to, from, next) => {
if (to.query.type && to.path == '/cosmeticsDetail') {
next();
} else {
next()
Message.error("无权限访问!");
}
}
@ -45,6 +48,7 @@ router.beforeEach((to, from, next) => {
store
.dispatch("GetPermission")
.then((res) => {
console.log(res,'res')
if (res.length > 0) {
next({ path: res });
} else {

@ -64,9 +64,16 @@ export const constantRoutes = [
{
path: '',
component: () => import("@/views/index"),
redirect: "drugArchives",
redirect: "portal",
isDiy: true,
children: [
{
path: "/portal",
name: "portal",
// icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/portal/index.vue"),
meta: { title: "首页", },
},
{
path: "/drugArchives",
name: "drugArchives",

@ -37,6 +37,15 @@ export default {
return {
};
},
watch:{
$router:{
handler(newRouter){
console.log(newRouter,'newRouter')
},
deep:true,
immediate:true,
}
},
computed: {
//
myRouter() {

@ -0,0 +1,26 @@
<!--
* @Descripttion:
* @version:
* @Author: JC9527
* @Date: 2023-11-22 09:55:23
* @LastEditors: JC9527
* @LastEditTime: 2023-11-22 10:00:27
-->
<template>
<div>
搜索首页
</div>
</template>
<script>
export default {
data() {
return {
}
},
methods:{
},
}
</script>
<style lang="scss" scoped>
</style>
Loading…
Cancel
Save