From 8022f7036945b75f82f2dfc43055623f81ed98f6 Mon Sep 17 00:00:00 2001 From: yxh <172933527@qq.com> Date: 星期五, 23 五月 2025 22:42:56 +0800 Subject: [PATCH] yxh --- src/store/modules/user.js | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 822f6f9..f0c77c0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,6 +1,8 @@ import { login, logout, getInfo } from '@/api/login' import { getToken, setToken, removeToken } from '@/utils/auth' import { Message } from 'element-ui' +import { listOrganization } from "@/api/project/organization"; + const user = { @@ -8,13 +10,23 @@ token: getToken(), name: '', avatar: '', + code: '', + msg: '', roles: [], - permissions: [] + permissions: [], + organization:[], + addressArray:[], }, mutations: { SET_TOKEN: (state, token) => { state.token = token + }, + SET_LOGCODE: (state, code) => { + state.code = code + }, + SET_LOGMSG: (state, msg) => { + state.msg = msg }, SET_NAME: (state, name) => { state.name = name @@ -25,8 +37,14 @@ SET_ROLES: (state, roles) => { state.roles = roles }, + SET_addressArray: (state, addressArray) => { + state.addressArray = addressArray + }, SET_PERMISSIONS: (state, permissions) => { state.permissions = permissions + }, + SET_organization: (state, organization) => { + state.organization = organization } }, @@ -37,10 +55,15 @@ const password = userInfo.password const code = userInfo.code const uuid = userInfo.uuid + const authCode = userInfo.authCode + console.log(authCode,'authCode'); return new Promise((resolve, reject) => { - login(username, password, code, uuid).then(res => { + login(username, password, code, uuid, authCode).then(res => { + console.log(res,'log'); setToken(res.token) commit('SET_TOKEN', res.token) + commit('SET_LOGCODE', res.code) + commit('SET_LOGMSG', res.msg) resolve() }).catch(error => { reject(error) @@ -73,7 +96,7 @@ }) }) }, - + // 閫�鍑虹郴缁� LogOut({ commit, state }) { return new Promise((resolve, reject) => { @@ -88,6 +111,21 @@ }) }) }, + // 鎷垮彇鏈烘瀯淇℃伅 + getdataList({commit}){ + return new Promise((resolve, reject) => { + listOrganization({ + organizationtype: 4, //浼犲叆鐨勭被鍨� + pageNum: 1, + pageSize: 100000 + }).then((res) => { + commit('SET_organization', res.rows) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, // 鍓嶇 鐧诲嚭 FedLogOut({ commit }) { -- Gitblit v1.9.3