将按钮的缓存从登录逻辑挪到登录之后的界面(优化)
This commit is contained in:
@@ -45,9 +45,8 @@
|
|||||||
import UserMenu from '../tools/UserMenu'
|
import UserMenu from '../tools/UserMenu'
|
||||||
import SMenu from '../menu/'
|
import SMenu from '../menu/'
|
||||||
import Logo from '../tools/Logo'
|
import Logo from '../tools/Logo'
|
||||||
import { getCurrentSystemConfig, getUserBtnByCurrentUser } from '@/api/api'
|
import { getCurrentSystemConfig } from '@/api/api'
|
||||||
import { mixin } from '@/utils/mixin.js'
|
import { mixin } from '@/utils/mixin.js'
|
||||||
import Vue from 'vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'GlobalHeader',
|
name: 'GlobalHeader',
|
||||||
@@ -166,11 +165,6 @@
|
|||||||
this.companyName = res.data.companyName
|
this.companyName = res.data.companyName
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getUserBtnByCurrentUser().then((res) => {
|
|
||||||
if(res.code === 200 && res.data){
|
|
||||||
Vue.ls.set('winBtnStrList', res.data.userBtn, 7 * 24 * 60 * 60 * 1000)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
//update-begin--author:sunjianlei---date:20190508------for: 顶部导航栏过长时显示更多按钮-----
|
//update-begin--author:sunjianlei---date:20190508------for: 顶部导航栏过长时显示更多按钮-----
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import router from './router'
|
|||||||
import store from './store'
|
import store from './store'
|
||||||
import NProgress from 'nprogress' // progress bar
|
import NProgress from 'nprogress' // progress bar
|
||||||
import 'nprogress/nprogress.css' // progress bar style
|
import 'nprogress/nprogress.css' // progress bar style
|
||||||
import notification from 'ant-design-vue/es/notification'
|
|
||||||
import { USER_ID,INDEX_MAIN_PAGE_PATH } from '@/store/mutation-types'
|
import { USER_ID,INDEX_MAIN_PAGE_PATH } from '@/store/mutation-types'
|
||||||
import { generateIndexRouter } from "@/utils/util"
|
import { generateIndexRouter } from "@/utils/util"
|
||||||
|
|
||||||
@@ -25,6 +24,10 @@ router.beforeEach((to, from, next) => {
|
|||||||
if (menuData === null || menuData === "" || menuData === undefined) {
|
if (menuData === null || menuData === "" || menuData === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 缓存用户的按钮权限
|
||||||
|
store.dispatch('GetUserBtnList').then(res => {
|
||||||
|
Vue.ls.set('winBtnStrList', res.data.userBtn, 7 * 24 * 60 * 60 * 1000)
|
||||||
|
})
|
||||||
let constRoutes = [];
|
let constRoutes = [];
|
||||||
constRoutes = generateIndexRouter(menuData);
|
constRoutes = generateIndexRouter(menuData);
|
||||||
// 添加主界面路由
|
// 添加主界面路由
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||||||
import { login, logout } from "@/api/login"
|
import { login, logout } from "@/api/login"
|
||||||
import { ACCESS_TOKEN, USER_NAME,USER_INFO,UI_CACHE_DB_DICT_DATA,USER_ID,USER_LOGIN_NAME,CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
|
import { ACCESS_TOKEN, USER_NAME,USER_INFO,UI_CACHE_DB_DICT_DATA,USER_ID,USER_LOGIN_NAME,CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
|
||||||
import { welcome } from "@/utils/util"
|
import { welcome } from "@/utils/util"
|
||||||
import { queryPermissionsByUser } from '@/api/api'
|
import { queryPermissionsByUser, getUserBtnByCurrentUser } from '@/api/api'
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction } from '@/api/manage'
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
@@ -104,6 +104,17 @@ const user = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 获取用户的按钮权限
|
||||||
|
GetUserBtnList({ commit }) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getUserBtnByCurrentUser().then(response => {
|
||||||
|
resolve(response)
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 登出
|
// 登出
|
||||||
Logout({ commit, state }) {
|
Logout({ commit, state }) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user