新增搜索页

Lvtianfang
吕天方 1 year ago
parent 71b5694e9e
commit 8441316198

@ -11,62 +11,50 @@ function kickOut() {
location.href = location.origin + "/login"; location.href = location.origin + "/login";
} }
} }
const whiteList = [ // const whiteList = [
"/404", // "/404",
"/401", // "/401",
// '/drugArchives', // '/drugArchives',
// "/cosmeticsArchives", // "/cosmeticsArchives",
"/cosmeticsDetail", // "/cosmeticsDetail",
"/health", // "/health",
"/zyzj", // "/zyzj",
]; // ];
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); NProgress.start();
let token = localStorage.getItem('MSSM-LIAONING__TOKEN') let token = localStorage.getItem('MSSM-LIAONING__TOKEN')
console.log(to.path); console.log(to.path);
if (whiteList.indexOf(to.path) == -1) { if (token) {
if (token) { if (store.state.myselfPermission.routerList.length == 0) {
console.log(store.state.myselfPermission.routerList,'store.state.myselfPermission.routerList')
if (store.state.myselfPermission.routerList.length > 0) { store.dispatch("GetPermission").then((res) => {
let current = store.state.myselfPermission.routerList.filter( next({path:to.path});
(item) => item.path == to.path || from.path == "/" }).catch((error) => {
); kickOut();
console.log(current,'current') });
if (current.length > 0) {
} else {
let current = store.state.myselfPermission.routerList.filter(
(item) => item.path == to.path || from.path == "/"
);
if (current.length > 0) {
next();
} else {
//根据参数判断是否可以跳
if (to.query.type && to.path == '/cosmeticsDetail') {
next(); next();
} else { } else {
//根据参数判断是否可以跳 Message.error("无权限访问!");
if (to.query.type && to.path == '/cosmeticsDetail') {
next();
} else {
next()
Message.error("无权限访问!");
}
} }
} else {
store
.dispatch("GetPermission")
.then((res) => {
console.log(res,'res')
if (res.length > 0) {
next({ path: res });
} else {
kickOut();
}
})
.catch((error) => {
kickOut();
});
} }
} else {
// 没有token
Message.error("获取令牌失败!");
kickOut();
} }
} else { } else {
// 没有token
Message.error("获取令牌失败!");
kickOut(); kickOut();
} }
}); });
router.afterEach(() => { router.afterEach(() => {

@ -89,8 +89,8 @@ export const constantRoutes = [
meta: { title: "化妆品档案", }, meta: { title: "化妆品档案", },
}, },
{ {
path: "/productInfo", path: "/cosmeticsDetail",
name: "productInfo", name: "cosmeticsDetail",
icon: require("@/assets/images/tree4.svg"), icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/productsMsg/components/productInfo.vue"), component: () => import("@/views/productsMsg/components/productInfo.vue"),
meta: { title: "详情", }, meta: { title: "详情", },

@ -62,9 +62,19 @@ const selfPermission = {
(item) => item.appCode == "CPGL" (item) => item.appCode == "CPGL"
); );
let fileTreeOut = filterTree(menuTree[0].childMenuList, []); let fileTreeOut = filterTree(menuTree[0].childMenuList, []);
fileTreeOut[0].meta.affix = true // let fileTreeOut = [];
// menuTree[0].childMenuList.forEach((item) => {
// staticRouter.forEach((router, index) => {
// if (item.menuUrl == router.path) {
// fileTreeOut.push(router);
// }
// });
// });
fileTreeOut[4].meta.affix = true
commit("SET_ROUTER", fileTreeOut); commit("SET_ROUTER", fileTreeOut);
resolve(fileTreeOut.length > 0 ? fileTreeOut[0].path : []); resolve(fileTreeOut.length > 0 ? fileTreeOut[4].path : []);
}) })
.catch((error) => { .catch((error) => {
reject(error); reject(error);

@ -1,7 +1,10 @@
<template> <template>
<div class="container"> <div class="container">
<myHeader></myHeader> <myHeader></myHeader>
<div class="body-container"> <div v-if="$route.meta.title && $route.meta.title == '首页'">
<router-view />
</div>
<div class="body-container" v-else>
<div class="tree-menu"> <div class="tree-menu">
<router-link <router-link
tag="div" tag="div"
@ -37,19 +40,11 @@ export default {
return { return {
}; };
}, },
watch:{
$router:{
handler(newRouter){
console.log(newRouter,'newRouter')
},
deep:true,
immediate:true,
}
},
computed: { computed: {
// //
myRouter() { myRouter() {
return this.$store.state.myselfPermission.routerList; return this.$store.state.myselfPermission.routerList.slice(0,this.$store.state.myselfPermission.routerList.length-1);
// return this.$store.state.myselfPermission.routerList;
}, },
}, },
created() {}, created() {},

@ -1,14 +1,6 @@
<!--
* @Descripttion:
* @version:
* @Author: JC9527
* @Date: 2023-11-22 09:55:23
* @LastEditors: JC9527
* @LastEditTime: 2023-11-22 10:00:27
-->
<template> <template>
<div> <div class="portal-L">
搜索首页
</div> </div>
</template> </template>
<script> <script>
@ -18,9 +10,14 @@ export default {
} }
}, },
methods:{ methods:{
pushRouter(){
this.$router.push('/drugArchives')
}
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.portal-L {
}
</style> </style>

Loading…
Cancel
Save