diff --git a/src/permission.js b/src/permission.js
index 5383a51..150e7fa 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -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 {
diff --git a/src/router/index.js b/src/router/index.js
index d1fc9eb..f366f51 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -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",
diff --git a/src/views/index.vue b/src/views/index.vue
index 94efef0..0a1e430 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -37,6 +37,15 @@ export default {
return {
};
},
+ watch:{
+ $router:{
+ handler(newRouter){
+ console.log(newRouter,'newRouter')
+ },
+ deep:true,
+ immediate:true,
+ }
+ },
computed: {
//获取自定义路由
myRouter() {
diff --git a/src/views/portal/index.vue b/src/views/portal/index.vue
new file mode 100644
index 0000000..09a6a32
--- /dev/null
+++ b/src/views/portal/index.vue
@@ -0,0 +1,26 @@
+
+
+
+ 搜索首页
+
+
+
+