Commit c7afb4af authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修改翻译

parent cc366f1f
......@@ -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())
}, [])
......
......@@ -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 })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment