diff --git a/src/store/getters.js b/src/store/getters.js index 137c80de..8b3e31ab 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -6,6 +6,7 @@ const getters = { visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, token: state => state.user.token, + phonenumber: state => state.user.phonenumber, avatar: state => state.user.avatar, name: state => state.user.name, introduction: state => state.user.introduction, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a543a1de..5b2b5d4c 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -35,6 +35,7 @@ const buildPayload = ({ loginMethod, username, password, uuid, code, mobile, ver const user = { state: { token: getToken(), + phonenumber: '', id: '', name: '', avatar: '', @@ -46,6 +47,9 @@ const user = { SET_TOKEN(state, token) { state.token = token }, + SET_PHONE(state, phonenumber) { + state.phonenumber = phonenumber + }, SET_EXPIRES_IN(state, time) { state.expires_in = time }, @@ -122,6 +126,7 @@ const user = { commit('SET_ROLES', res.roles && res.roles.length > 0 ? res.roles : ['ROLE_DEFAULT']) commit('SET_PERMISSIONS', res.permissions) commit('SET_ID', user.userId) + commit('SET_PHONE', user.phonenumber) commit('SET_NAME', user.userName) commit('SET_AVATAR', avatar) return res