Browse Source

修改前端,加入登录后 $this.$store.state.user中存入uid信息
加入登录后 $this.$store.state.user中存入uname信息

wukai 2 years ago
parent
commit
06a8ef1417
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/store/modules/user.js

+ 7 - 2
src/store/modules/user.js

@@ -6,6 +6,7 @@ const user = {
     token: getToken(),
     name: '',
     uid: '',
+    uname:'',
     avatar: '',
     roles: [],
     permissions: []
@@ -21,9 +22,12 @@ const user = {
     SET_NAME: (state, name) => {
       state.name = name
     },
-	SET_UID: (state, uid) => {
+    SET_UID: (state, uid) => {
       state.uid = uid
     },
+    SET_UNAME: (state, uname) => {
+      state.uname = uname
+    },
     SET_AVATAR: (state, avatar) => {
       state.avatar = avatar
     },
@@ -70,6 +74,7 @@ const user = {
           }
           commit('SET_NAME', user.userName)
           commit('SET_UID', user.userId)
+          commit('SET_UNAME', user.nickName)
           commit('SET_AVATAR', avatar)
           resolve(res)
         }).catch(error => {
@@ -90,7 +95,7 @@ const user = {
         })
       })
     },
-    
+
     // 退出系统
     LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {