Browse Source

登录后获取用户信息

pull/101/head
余菲 1 year ago
parent
commit
8201e08476
3 changed files with 5 additions and 2 deletions
  1. +1
    -0
      src/layout/components/Header/index.vue
  2. +3
    -1
      src/store/modules/user.js
  3. +1
    -1
      src/views/login/index.vue

+ 1
- 0
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,

+ 3
- 1
src/store/modules/user.js View File

state() { state() {
return { return {
userInfo: { userInfo: {
hasLogin: false
hasLogin: false,
realname: '',
avatar: ''
} }
} }
}, },

+ 1
- 1
src/views/login/index.vue View File

updateLoginTime().then(res => {}) updateLoginTime().then(res => {})
// router.push({ path: getPath() }) // router.push({ path: getPath() })
// removePath() // removePath()
// userStore.getUserInfos()
userStore.getUserInfos()
const authority = res.profile.authority const authority = res.profile.authority
const { VITE_PLATFORM } = import.meta.env const { VITE_PLATFORM } = import.meta.env
if (authority && (authority.includes(VITE_PLATFORM) || authority.includes('admin'))) { if (authority && (authority.includes(VITE_PLATFORM) || authority.includes('admin'))) {

Loading…
Cancel
Save