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
c6be18f0
authored
2025-06-13 16:26:03 +0800
by
lxs
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
通过config.js配置appKey
1 parent
49419e23
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
15 deletions
public/config.js
src/store/modules/user.ts
src/types/global.d.ts
vite.config.ts
public/config.js
View file @
c6be18f
system
.
__APP_CONFIG__
=
{
appKey
:
'672c2c38e4b0cac8732a6106'
,
var
system
=
{
appConfig
:
{
appKey
:
"672c2c38e4b0cac8732a6106"
,
}
}
...
...
src/store/modules/user.ts
View file @
c6be18f
...
...
@@ -30,11 +30,12 @@ const useUserStore = defineStore(
const
idassLoginUrl
=
import
.
meta
.
env
.
VITE_IDASS_BASEURL
;
const
timer
:
any
=
ref
(
null
);
//获取token.
function
getToken
(
data
,
state
)
{
async
function
getToken
(
data
,
state
)
{
const
config
=
system
.
appConfig
;
data
.
platformGuid
=
"7f16f697aec111ef8656fa163e60becd"
;
data
.
userType
=
2
;
data
.
appKey
=
'672c2c38e4b0cac8732a6106'
;
// data.appKey = system.__APP_CONFIG__.appKey
;
//
data.appKey = '672c2c38e4b0cac8732a6106';
data
.
appKey
=
config
.
appKey
;
data
.
validateUri
=
location
.
origin
==
'http://localhost:9000'
?
'http://localhost:9000/'
:
location
.
origin
+
'/'
;
return
getTokenPromise
.
value
=
getTokenByCode
(
data
).
then
((
res
:
any
)
=>
{
getTokenPromise
.
value
=
null
;
...
...
@@ -56,7 +57,7 @@ const useUserStore = defineStore(
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
];
return
getCurrentUserInfo
({
tenantGuid
:
currentTenantGuid
.
value
}).
then
((
res
:
any
)
=>
{
return
getCurrentUserInfo
({
tenantGuid
:
currentTenantGuid
.
value
}).
then
((
res
:
any
)
=>
{
console
.
log
(
res
,
'getCurrentUserInfo'
);
if
(
res
.
code
==
'00000'
)
{
userName
.
value
=
res
.
data
.
staffName
;
...
...
src/types/global.d.ts
View file @
c6be18f
...
...
@@ -275,12 +275,3 @@ declare namespace Menu {
children
:
recordRaw
[]
}
}
// 配置appKey
declare
global
{
interface
System
{
__APP_CONFIG__
:
{
appKey
:
string
};
}
}
...
...
vite.config.ts
View file @
c6be18f
...
...
@@ -61,6 +61,7 @@ export default ({ mode, command }) => {
build
:
{
outDir
:
mode
===
'product'
?
'dist'
:
`dist-
${
mode
}
`
,
sourcemap
:
env
.
VITE_BUILD_SOURCEMAP
===
'true'
,
assetsInlineLimit
:
0
// 确保config.js不会被内联
},
define
:
{
__SYSTEM_INFO__
:
JSON
.
stringify
({
...
...
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