diff --git a/src/layout/index.vue b/src/layout/index.vue
index f95c8b9..30ad4f9 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -6,12 +6,8 @@
- - 工作台
- - 内控管理
- - 预算绩效管理
- - 图书管理
- - 安全生产
- - 系统设置
+ - {{ item.name }}
+ - 系统设置
@@ -41,7 +37,7 @@
-
+
@@ -103,10 +99,18 @@ import worker from "./components/worker"
this.$store.dispatch('app/closeSideBar', {
withoutAnimation: false
})
+ },
+
+
+ menuClick(item){
+ this.$router.push(item.path)
+
+ console.log(this.$route.path)
}
},
mounted() {
- }
+
+ },
}
diff --git a/src/router/index.js b/src/router/index.js
index 5b11d53..0096aec 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -45,9 +45,9 @@ export const constantRoutes = [{
{
path: '/',
component: Layout,
- redirect: '/dashboard',
+ redirect: '/worker',
children: [{
- path: 'dashboard',
+ path: 'contract/dashboard',
name: '系统首页',
component: () => import('@/views/dashboard/index'),
meta: {
@@ -63,7 +63,7 @@ export const constantRoutes = [{
* the routes that need to be dynamically loaded based on user roles
*/
export const asyncRoutes = [
-
+
// 404 page must be placed at the end !!!
{
path: '*',
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 87d7a23..6336839 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -53,6 +53,7 @@ export function filterAsyncRoutes(routes, roles) {
const state = {
routes: [],
+ rootMenu:[],
addRoutes: []
}
@@ -66,7 +67,7 @@ export function generaMenu(routes, data) {
routes.push({
path: '/',
component: Layout,
- redirect: '/dashboard',
+ redirect: '/worker',
children: [{
path: 'dashboard',
name: '系统首页',
@@ -84,16 +85,16 @@ export function generaMenu(routes, data) {
}
const menu = {
path: (path === '#' ? item.id + '_key' : path),
- redirect: (item.children.length > 0 ? "noRedirect" : ""),
+ redirect: (item.children?.length > 0 ? "noRedirect" : ""),
component: item.url === '#' ? Layout : loadView(item.url),
- // hidden: true,
+ hidden: item.hidden ?? false,
children: [],
name: 'menu_' + item.id,
meta: {
title: item.name,
id: item.id,
roles: ['admin'],
-
+
icon: item.icon
}
}
@@ -109,6 +110,9 @@ const mutations = {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
+ },
+ SET_ROOTMENU:(state,menu) => {
+ state.rootMenu = menu
}
}
@@ -124,11 +128,19 @@ const actions = {
getAuthMenu(state.token).then(response => {
let data = response
- //console.log(JSON.stringify(data))
+ commit('SET_ROOTMENU',data)
- Object.assign(loadMenuData, data)
+ let routes = data.filter(item => item.path === '/contract')[0]?.children
+ let root = data.map(item => {
+ delete item.children
+ item.hidden = true
+ return item
+ })
+ Object.assign(loadMenuData, [...routes,...root])
asyncRoutes.length=0;
generaMenu(asyncRoutes, loadMenuData)
+
+ console.log(asyncRoutes)
let accessedRoutes
if (roles.includes('admin')) {
// alert(JSON.stringify(asyncRoutes))
diff --git a/src/utils/auth.js b/src/utils/auth.js
index cda8307..a19f6cd 100644
--- a/src/utils/auth.js
+++ b/src/utils/auth.js
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie'
-const TokenKey = 'HeTongGuanli_NEW_token'
+const TokenKey = 'HeTongGuanli_hjjc_token'
export function getToken() {
//return Cookies.get(TokenKey)
@@ -21,4 +21,4 @@ export function removeToken() {
sessionStorage.clear();
return Cookies.remove(TokenKey)
-}
\ No newline at end of file
+}
diff --git a/src/utils/request.js b/src/utils/request.js
index 7a2af0d..1620175 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -69,7 +69,8 @@ service.interceptors.response.use(
Message({
message: res.errmsg || 'Error',
type: 'error',
- duration: 5 * 1000
+ duration: 5 * 1000,
+ offset:50
})
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
@@ -99,7 +100,8 @@ service.interceptors.response.use(
Message({
message: error.message,
type: 'error',
- duration: 5 * 1000
+ duration: 5 * 1000,
+ offset: 50
})
return Promise.reject(error)
}