From 3274ce07043cbbe1df3b4a9cd92f94e9c9b64752 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Thu, 7 Apr 2022 13:21:49 +0800 Subject: [PATCH] cxw-010203 --- src/api/public/login/index.js | 9 +++++++++ src/mixins/index.js | 4 ++-- src/store/actions.js | 3 +++ src/store/getters.js | 3 +++ src/store/mutations.js | 5 +++++ src/store/state.js | 3 ++- src/views/Layout/index.vue | 8 ++------ src/views/Login/index.vue | 7 +++++-- 8 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/api/public/login/index.js b/src/api/public/login/index.js index 47bbaee..ed0f1f1 100644 --- a/src/api/public/login/index.js +++ b/src/api/public/login/index.js @@ -24,3 +24,12 @@ export function quit(params) { data: params, }) } + +// 获取用户信息 +export function userInfo(params) { + return httpService({ + url: `/user/manageUser/userInfo`, + method: 'post', + data: params, + }) +} diff --git a/src/mixins/index.js b/src/mixins/index.js index 3801619..fa5b6c3 100644 --- a/src/mixins/index.js +++ b/src/mixins/index.js @@ -12,10 +12,10 @@ export default { install(Vue) { Vue.mixin({ computed: { - ...mapGetters(['getToken','getCommunityCode','getSelectedKeys', 'getOpenKeys','getCity']) + ...mapGetters(['getToken','getCommunityCode','getSelectedKeys', 'getOpenKeys','getCity','getUserInfo']) }, methods: { - ...mapActions(['setToken','setCommunityCode','setSelectedKeys', 'setOpenKeys','setCity']) + ...mapActions(['setToken','setCommunityCode','setSelectedKeys', 'setOpenKeys','setCity','setUserInfo']) } }) } diff --git a/src/store/actions.js b/src/store/actions.js index 03f6ea7..c6e2697 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -22,6 +22,9 @@ const actions = { setCity: ({commit}, log) => { commit('setCity', log) }, + setUserInfo: ({commit}, log) => { + commit('setUserInfo', log) + }, } export default actions \ No newline at end of file diff --git a/src/store/getters.js b/src/store/getters.js index 1c58a81..0d574ce 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -22,6 +22,9 @@ const getters = { getCity(state) { return state.cityList }, + getUserInfo(state) { + return state.userInfo + } } export default getters \ No newline at end of file diff --git a/src/store/mutations.js b/src/store/mutations.js index ebd8215..5d7afb4 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -27,6 +27,11 @@ const mutations = { }, setCity (state, data) { // 设置参数 state.cityList = data + }, + setUserInfo (state, log) { + state.userInfo = log + let str = JSON.stringify(log); + sessionStorage.setItem('userInfo', str); } } diff --git a/src/store/state.js b/src/store/state.js index fc35059..13b4db6 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -11,6 +11,7 @@ const state = { openKeys: JSON.parse(sessionStorage.getItem('openKeys')) || [], token: sessionStorage.getItem('token') || "", communityCode: sessionStorage.getItem('communityCode') || "", - cityList:[] + cityList:[], + userInfo: JSON.parse(sessionStorage.getItem('userInfo')) || {}, } export default state \ No newline at end of file diff --git a/src/views/Layout/index.vue b/src/views/Layout/index.vue index 0ce35c9..54aa8f1 100644 --- a/src/views/Layout/index.vue +++ b/src/views/Layout/index.vue @@ -22,7 +22,7 @@ - admin + {{getUserInfo.actualName}}
@@ -85,11 +85,7 @@ export default { { label: "运营管理", value: "operation" - }, - // { - // label: "设置", - // value: "setting" - // } + } ], }; }, diff --git a/src/views/Login/index.vue b/src/views/Login/index.vue index f62d2ac..b66f390 100644 --- a/src/views/Login/index.vue +++ b/src/views/Login/index.vue @@ -227,7 +227,7 @@