从Sesseion读取登陆用户
parent
bf7b6acd52
commit
a4672608d9
@ -1,17 +0,0 @@
|
|||||||
const KEY_USER_ID = 'KEY_USER_ID'
|
|
||||||
|
|
||||||
class Auth {
|
|
||||||
|
|
||||||
// {"errcode":0,"errmsg":"ok","result":{"nick":"廖一军","unionId":"j7cuUCplZe1ZiiqjQNUUmFwiEiE","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","mobile":"18777396951","stateCode":"86","email":"lyj@hainatravel.com","opisn":"383"}}
|
|
||||||
userId = '383'
|
|
||||||
username = '廖一军'
|
|
||||||
avatarUrl = 'https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png'
|
|
||||||
stateCode = '86'
|
|
||||||
email = 'lyj@hainatravel.com'
|
|
||||||
openId = 'iioljiPmZ4RPoOYpkFiSn7IKAiEiE'
|
|
||||||
accountList = ['LYJ', 'LYJAH', 'LYJGH']
|
|
||||||
permissionList = ['view_chat', 'send_msg']
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Auth
|
|
@ -0,0 +1,29 @@
|
|||||||
|
import { create } from 'zustand'
|
||||||
|
import { devtools } from 'zustand/middleware'
|
||||||
|
import { fetchJSON, postJSON } from '@/utils/request'
|
||||||
|
|
||||||
|
const useAuthStore = create((set, get) => ({
|
||||||
|
|
||||||
|
loginUser: {
|
||||||
|
// userId: '354',
|
||||||
|
// username: '廖一军',
|
||||||
|
// avatarUrl: 'https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png',
|
||||||
|
// mobile: '86-18777396951',
|
||||||
|
// email: 'lyj@hainatravel.com',
|
||||||
|
// openId: 'iioljiPmZ4RPoOYpkFiSn7IKAiEiE',
|
||||||
|
// accountList: ['LYJ', 'LYJAH', 'LYJGH'],
|
||||||
|
// permissionList: ['view_chat', 'send_msg'],
|
||||||
|
},
|
||||||
|
|
||||||
|
loadUser: () => {
|
||||||
|
return JSON.parse(window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER'))
|
||||||
|
},
|
||||||
|
|
||||||
|
saveUser: () => {
|
||||||
|
const { loginUser } = get()
|
||||||
|
window.sessionStorage.setItem('GLOBAL_SALES_LOGIN_USER', JSON.stringify(loginUser))
|
||||||
|
},
|
||||||
|
|
||||||
|
}))
|
||||||
|
|
||||||
|
export default useAuthStore
|
Loading…
Reference in New Issue