Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8a653196
authored
2026-05-20 15:35:29 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改登录进去时获取当前公司从缓存中取
1 parent
7a43a111
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
21 deletions
src/api/modules/dataIdentify.ts
src/store/modules/user.ts
src/api/modules/dataIdentify.ts
View file @
8a65319
...
...
@@ -87,6 +87,11 @@ export const getUserTenant = () => request({
method
:
'get'
})
export
const
getCurrentTenantCache
=
()
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_PERSONAL_URL
}
/tenant/get-current-user-tenant-from-cache`
,
method
:
'get'
})
// 获取企业信息
export
const
getEnterpriseData
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_DIGITAL_CONTRACT_URL
}
/enterprise/detail-by-logonUser`
,
...
...
src/store/modules/user.ts
View file @
8a65319
...
...
@@ -6,6 +6,7 @@ import apiUser from '@/api/modules/user'
import
{
getCurrentTime
}
from
'@/utils/common'
import
{
getSystemMenu
,
getUserInfo
,
getTokenByCode
,
loginOut
,
refreshToken
,
editPasswordInterface
,
getCurrentUserInfo
,
getTenantDetailInfo
}
from
'@/api/modules/queryService'
import
{
getConnectorStatus
}
from
'@/api/modules/dataRequire'
import
{
getCurrentTenantCache
}
from
'@/api/modules/dataIdentify'
const
useUserStore
=
defineStore
(
// 唯一ID
...
...
@@ -55,33 +56,49 @@ const useUserStore = defineStore(
refreshUserToken
(
false
);
//获取用户信息
account
.
value
=
res
.
data
.
logonUser
userId
.
value
=
res
.
data
.
userId
currentTenantGuid
.
value
=
res
.
data
.
tenantInfoList
&&
res
.
data
.
tenantInfoList
.
length
?
res
.
data
.
tenantInfoList
[
0
].
guid
:
''
;
localStorage
.
setItem
(
'currentTenantGuid'
,
currentTenantGuid
.
value
);
let
currentTenant
=
res
.
data
.
tenantInfoList
?.[
0
];
getTenantDetailInfo
(
currentTenantGuid
.
value
).
then
((
res
:
any
)
=>
{
if
(
res
.
code
==
'00000'
)
{
localStorage
.
setItem
(
'tenantInfo'
,
JSON
.
stringify
(
res
.
data
));
userId
.
value
=
res
.
data
.
userId
;
let
exec
=
(
currTenantGuid
)
=>
{
currentTenantGuid
.
value
=
currTenantGuid
?
currTenantGuid
:
(
res
.
data
.
tenantInfoList
&&
res
.
data
.
tenantInfoList
.
length
?
res
.
data
.
tenantInfoList
[
0
].
guid
:
""
);
localStorage
.
setItem
(
"currentTenantGuid"
,
currentTenantGuid
.
value
,
);
getTenantDetailInfo
(
currentTenantGuid
.
value
).
then
(
(
res
:
any
)
=>
{
if
(
res
.
code
==
"00000"
)
{
localStorage
.
setItem
(
"tenantInfo"
,
JSON
.
stringify
(
res
.
data
),
);
}
else
{
ElMessage
.
error
(
res
.
msg
)
ElMessage
.
error
(
res
.
msg
);
}
})
},
);
getConnectorStatus
().
then
((
res
:
any
)
=>
{
if
(
res
.
code
==
'00000'
)
{
isLogOutConnector
.
value
=
res
.
data
?.
isLogOut
||
'N'
;
localStorage
.
setItem
(
'isLogOutConnector'
,
isLogOutConnector
.
value
);
if
(
res
.
code
==
"00000"
)
{
isLogOutConnector
.
value
=
res
.
data
?.
isLogOut
||
"N"
;
localStorage
.
setItem
(
"isLogOutConnector"
,
isLogOutConnector
.
value
,
);
}
else
{
// 暂不弹错误提示
}
})
return
getCurrentUserInfo
({
tenantGuid
:
currentTenantGuid
.
value
}).
then
((
res
:
any
)
=>
{
console
.
log
(
res
,
'getCurrentUserInfo'
);
if
(
res
.
code
==
'00000'
)
{
});
return
getCurrentUserInfo
({
tenantGuid
:
currentTenantGuid
.
value
,
}).
then
((
res
:
any
)
=>
{
console
.
log
(
res
,
"getCurrentUserInfo"
);
if
(
res
.
code
==
"00000"
)
{
userName
.
value
=
res
.
data
.
staffName
;
localStorage
.
setItem
(
'userName'
,
res
.
data
?.
staffName
);
localStorage
.
setItem
(
'userData'
,
JSON
.
stringify
(
res
.
data
));
userData
.
value
=
localStorage
.
getItem
(
'userData'
);
isGetCurrUserInfo
.
value
=
true
localStorage
.
setItem
(
"userName"
,
res
.
data
?.
staffName
);
localStorage
.
setItem
(
"userData"
,
JSON
.
stringify
(
res
.
data
));
userData
.
value
=
localStorage
.
getItem
(
"userData"
);
isGetCurrUserInfo
.
value
=
true
;
// return getSystemMenu({ tenantGuid: currentTenantGuid.value }, res.data?.isAdmin == 'Y' && (!res.data?.superTubeFlag || res.data?.superTubeFlag == 'Y')).then((info: any) => { //解决页面调用流程接口传递staffGuid,为空的问题
// if (info.code == '00000') {
// localStorage.setItem('userInfoData', JSON.stringify(info.data));
...
...
@@ -92,8 +109,19 @@ const useUserStore = defineStore(
// }
// })
}
else
{
ElMessage
.
error
(
res
.
msg
)
ElMessage
.
error
(
res
.
msg
);
}
});
};
getCurrentTenantCache
().
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
'00000'
)
{
exec
(
res
.
data
||
null
);
}
else
{
exec
(
null
);
res
?.
msg
&&
ElMessage
.
error
(
res
.
msg
);
}
}).
catch
(()
=>
{
exec
(
null
);
})
}
else
{
isLogin
.
value
=
false
;
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment