Browse Source

刷新获取用户信息

pull/108/head
余菲 1 year ago
parent
commit
c86bc2fdec
4 changed files with 5 additions and 6 deletions
  1. +2
    -2
      .env.localhost
  2. +0
    -1
      src/layout/components/Header/index.vue
  3. +1
    -1
      src/router/guard/permission-guard.js
  4. +2
    -2
      src/views/system-manage/role-manage/components/AuthModal.vue

+ 2
- 2
.env.localhost View File

# mock base api # mock base api
VITE_APP_GLOB_BASE_API_MOCK = '/api-mock' VITE_APP_GLOB_BASE_API_MOCK = '/api-mock'


#VITE_AUTHORITY = 'http://192.168.11.11:8090'
VITE_AUTHORITY = 'https://login-test.t-aaron.com'
VITE_AUTHORITY = 'http://192.168.11.11:8090'
#VITE_AUTHORITY = 'https://login-test.t-aaron.com'
VITE_CLIENT_ID = 'tuoheng-pilot-admin' VITE_CLIENT_ID = 'tuoheng-pilot-admin'
VITE_CLIENT_SECRET = 'WB0CZ1c6bZLiYP6jLtDFsA==' VITE_CLIENT_SECRET = 'WB0CZ1c6bZLiYP6jLtDFsA=='

+ 0
- 1
src/layout/components/Header/index.vue View File

} }


const getUserInfo = computed(() => { const getUserInfo = computed(() => {
console.log(userStore, '==============')
return { return {
hasLogin: userStore.hasLogin, hasLogin: userStore.hasLogin,
// avatar: userStore.avatar, // avatar: userStore.avatar,

+ 1
- 1
src/router/guard/permission-guard.js View File



export function createPermissionGuard(router) { export function createPermissionGuard(router) {
const userStore = useUserStore() const userStore = useUserStore()
// userStore.getUserInfos()
const permissionStore = usePermissionStore() const permissionStore = usePermissionStore()
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
const oidcUser = await getUserInfo() const oidcUser = await getUserInfo()
if (oidcUser) { if (oidcUser) {
userStore.getUserInfos()
const hasRoutes = !!permissionStore.permissionRoutes.length const hasRoutes = !!permissionStore.permissionRoutes.length
if (hasRoutes) { if (hasRoutes) {
next() next()

+ 2
- 2
src/views/system-manage/role-manage/components/AuthModal.vue View File

<n-tabs type="line" animated> <n-tabs type="line" animated>
<n-tab-pane display-directive="show" name="pc" tab="管理端菜单"> <n-tab-pane display-directive="show" name="pc" tab="管理端菜单">
<n-tree <n-tree
v-show="tabsTreeVisible"
v-if="tabsTreeVisible"
ref="adminTreeRef" ref="adminTreeRef"
block-line block-line
cascade cascade
</n-tab-pane> </n-tab-pane>
<n-tab-pane display-directive="show" name="mp" tab="小程序菜单"> <n-tab-pane display-directive="show" name="mp" tab="小程序菜单">
<n-tree <n-tree
v-show="tabsTreeVisible"
v-if="tabsTreeVisible"
ref="miniTreeRef" ref="miniTreeRef"
block-line block-line
cascade cascade

Loading…
Cancel
Save