From 8d0f7fcc4a961a6a2cd969171066f652cc8e736f Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期五, 18 四月 2025 16:56:52 +0800 Subject: [PATCH] 测试完成 --- src/store/modules/user.js | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 09507cf..c22c873 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -5,7 +5,11 @@ state: { token: getToken(), name: '', + Id: '', avatar: '', + hisUserId:'', + belongWards:[], + belongDepts:[], roles: [], permissions: [], // 鏈嶅姟绫诲瀷 @@ -21,7 +25,7 @@ }, { value: "2", - label: "鐩戞祴璇勪及", + label: "蹇冪數闅忚", route: "followvisit/QuestionnaireTask", raw: { cssClass: "", @@ -30,7 +34,7 @@ }, { value: "3", - label: "澶嶈瘖绠$悊", + label: "浣撴闅忚", route: "followvisit/particty", raw: { cssClass: "", @@ -83,6 +87,11 @@ SET_NAME: (state, name) => { state.name = name }, + SET_Id: (state, Id) => { + state.Id = Id + console.log(state.Id,'user2'); + + }, SET_AVATAR: (state, avatar) => { state.avatar = avatar }, @@ -94,20 +103,40 @@ }, SET_Serviceauthority: (state, Serviceauthority) => { state.Serviceauthority = Serviceauthority + }, + SET_leavehospitaldistrictcodes: (state, belongWards) => { + state.belongWards = belongWards + }, + SET_hisUserId: (state, hisUserId) => { + state.hisUserId = hisUserId + }, + SET_leaveldeptcodes: (state, belongDepts) => { + state.belongDepts = belongDepts } }, actions: { // 鐧诲綍 Login({ commit }, userInfo) { + console.log(userInfo,'user info'); + const username = userInfo.username.trim() const password = userInfo.password const code = userInfo.code - const uuid = userInfo.uuid + + const orgid = userInfo.orgid return new Promise((resolve, reject) => { - login(username, password, code, uuid).then(res => { + login(username, password, code, orgid).then(res => { setToken(res.token) commit('SET_TOKEN', res.token) + localStorage.setItem('orgid', orgid); + if (orgid=='47255004333112711A1001') { + localStorage.setItem('orgname', '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'); + localStorage.setItem('ZuHuID', '1400361376454545408'); + }else if (orgid=='47231022633110211A2101') { + localStorage.setItem('orgname', '涓芥按甯備腑鍖婚櫌'); + localStorage.setItem('ZuHuID', '1400360867068907520'); + } resolve() }).catch(error => { reject(error) @@ -119,6 +148,7 @@ GetInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo().then(res => { + const user = res.user const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁� @@ -128,6 +158,10 @@ commit('SET_ROLES', ['ROLE_DEFAULT']) } commit('SET_NAME', user.userName) + commit('SET_Id', user.userId) + commit('SET_hisUserId', user.hisUserId) + commit('SET_leavehospitaldistrictcodes', user.belongWards) + commit('SET_leaveldeptcodes', user.belongDepts) commit('SET_AVATAR', avatar) resolve(res) }).catch(error => { -- Gitblit v1.9.3