Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
c7afb4af
Commit
c7afb4af
authored
Dec 20, 2021
by
前端-黄佳鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改翻译
parent
cc366f1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
HeaderDropdown.tsx
src/layouts/components/HeaderDropdown.tsx
+9
-1
auth.ts
src/utils/auth.ts
+2
-0
No files found.
src/layouts/components/HeaderDropdown.tsx
View file @
c7afb4af
...
...
@@ -60,6 +60,9 @@ import korenImg from '../../../mockStatic/koren.png'
import
us
from
'../../../mockStatic/us.png'
import
'../styles/SelectLang.less'
import
{
getCookie
,
removeCookie
}
from
'@/utils/cookie'
import
{
getTopDomainByHost
}
from
'@/utils'
import
{
TOP_DOMAIN_NO_PORT
}
from
'@/constants'
interface
countryItem
{
name
:
string
,
...
...
@@ -69,9 +72,14 @@ interface countryItem {
const
HeaderDropdown
:
React
.
FC
=
()
=>
{
// 此处暂时无接口, 对接接口后需用枚举类型做补充
const
[
currentLangKey
,
setCurrentLangKey
]
=
useState
<
string
>
(
'cn'
)
const
[
currentLangKey
,
setCurrentLangKey
]
=
useState
<
string
>
(
'cn'
);
const
locales
=
getCookie
(
'locales'
);
useEffect
(()
=>
{
console
.
log
(
getLocale
(),
"locale"
)
if
(
locales
)
{
setLocale
(
locales
as
any
,
true
);
removeCookie
(
'locales'
,
{
path
:
'/'
,
domain
:
getTopDomainByHost
(
TOP_DOMAIN_NO_PORT
,
true
)
})
}
setCurrentLangKey
(
getLocale
())
},
[])
...
...
src/utils/auth.ts
View file @
c7afb4af
...
...
@@ -16,6 +16,7 @@ export interface AuthInfo extends GetMemberLoginRegetResponse {
creditPoint
:
number
,
memberRoleType
:
number
,
memberRoleId
:
number
,
locales
?:
string
}
const
AUTH_KEY
=
'AUTH'
...
...
@@ -32,6 +33,7 @@ export const setAuth = (info: AuthInfo) => {
memberRoleType
:
info
.
memberRoleType
,
memberRoleId
:
info
.
memberRoleId
,
memberType
:
info
.
memberType
,
locales
:
info
.
locales
,
}
setCookie
(
AUTH_KEY
,
JSON
.
stringify
(
auth
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setCookie
(
AUTH_ROLES_KEY
,
JSON
.
stringify
(
info
.
roles
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment