From f64155f6ad27c50451bb7d4a15f553bc72ead7de Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期五, 12 九月 2025 14:35:26 +0800
Subject: [PATCH] 年龄计算相关
---
src/store/modules/user.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 60821f0..3ec749b 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,18 +1,33 @@
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 = {
state: {
token: getToken(),
name: '',
avatar: '',
+ code: '',
+ msg: '',
roles: [],
- permissions: []
+ rolesor: [],
+ 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
@@ -23,8 +38,17 @@
SET_ROLES: (state, roles) => {
state.roles = roles
},
+ SET_ROLESor: (state, rolesor) => {
+ state.rolesor = rolesor
+ },
+ SET_addressArray: (state, addressArray) => {
+ state.addressArray = addressArray
+ },
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
+ },
+ SET_organization: (state, organization) => {
+ state.organization = organization
}
},
@@ -35,13 +59,23 @@
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)
+ // this.$message.error('鐧婚檰淇℃伅閿欒璇烽噸璇�');
+ Message({
+ message: error.message,
+ type: 'error'
+ })
})
})
},
@@ -59,6 +93,7 @@
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_NAME', user.userName)
+ commit('SET_ROLESor', user.roles)
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
@@ -66,7 +101,7 @@
})
})
},
-
+
// 閫�鍑虹郴缁�
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
@@ -81,6 +116,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