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
00bd838a
Commit
00bd838a
authored
Jul 18, 2020
by
tjy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
4097fe38
88bbcb19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
16 deletions
+145
-16
base.config.json
config/base.config.json
+111
-1
SelectLang.tsx
src/layouts/components/SelectLang.tsx
+34
-15
No files found.
config/base.config.json
View file @
00bd838a
{
"userRegister"
:{
"useType"
:{
"memberType"
:[{
"id"
:
1
,
"typeName"
:
"企业会员"
},{
"id"
:
2
,
"typeName"
:
"个人会员"
},{
"id"
:
3
,
"typeName"
:
"渠道企业会员"
},{
"id"
:
4
,
"typeName"
:
"渠道个人会员"
}],
"businessType"
:[{
"id"
:
1
,
"typeName"
:
"new11"
},{
"id"
:
2
,
"typeName"
:
"王者农药"
}]},
"useDetail"
:[{
"groupName"
:
"企业组"
,
"elements"
:[{
"id"
:
2
,
"fieldName"
:
"company"
,
"fieldCNName"
:
"企业"
,
"fieldType"
:
null
,
"fieldLength"
:
10
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:[]}]},{
"groupName"
:
"企业信息"
,
"elements"
:[{
"id"
:
3
,
"fieldName"
:
"company_name"
,
"fieldCNName"
:
"公司名称"
,
"fieldType"
:
null
,
"fieldLength"
:
128
,
"fieldEmpty"
:
1
,
"fieldOrder"
:
1
,
"fieldRemark"
:
""
,
"checkRules"
:[]},{
"id"
:
4
,
"fieldName"
:
"company_type"
,
"fieldCNName"
:
"公司类型"
,
"fieldType"
:
null
,
"fieldLength"
:
128
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
2
,
"fieldRemark"
:
""
,
"checkRules"
:[]}]},{
"groupName"
:
"444"
,
"elements"
:[{
"id"
:
1
,
"fieldName"
:
"444"
,
"fieldCNName"
:
"44"
,
"fieldType"
:
null
,
"fieldLength"
:
44
,
"fieldEmpty"
:
1
,
"fieldOrder"
:
44
,
"fieldRemark"
:
null
,
"checkRules"
:[]}]}]},
"global"
:{
"logo"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png"
,
"countryList"
:[{
"name"
:
"简体中文-ZH"
,
"key"
:
"cn"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"
},{
"name"
:
"English-EN"
,
"key"
:
"en"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"
},{
"name"
:
"日本語-JP"
,
"key"
:
"jp"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png"
},{
"name"
:
"한국어-KO"
,
"key"
:
"ko"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"
}]}}
{
"userRegister"
:
{
"useType"
:
{
"memberType"
:
[
{
"id"
:
1
,
"typeName"
:
"企业会员"
},
{
"id"
:
2
,
"typeName"
:
"个人会员"
},
{
"id"
:
3
,
"typeName"
:
"渠道企业会员"
},
{
"id"
:
4
,
"typeName"
:
"渠道个人会员"
}
],
"businessType"
:
[
{
"id"
:
1
,
"typeName"
:
"new11"
},
{
"id"
:
2
,
"typeName"
:
"王者农药"
}
]
},
"useDetail"
:
[
{
"groupName"
:
"企业组"
,
"elements"
:
[
{
"id"
:
2
,
"fieldName"
:
"company"
,
"fieldCNName"
:
"企业"
,
"fieldType"
:
null
,
"fieldLength"
:
10
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"企业信息"
,
"elements"
:
[
{
"id"
:
3
,
"fieldName"
:
"company_name"
,
"fieldCNName"
:
"公司名称"
,
"fieldType"
:
null
,
"fieldLength"
:
128
,
"fieldEmpty"
:
1
,
"fieldOrder"
:
1
,
"fieldRemark"
:
""
,
"checkRules"
:
[]
},
{
"id"
:
4
,
"fieldName"
:
"company_type"
,
"fieldCNName"
:
"公司类型"
,
"fieldType"
:
null
,
"fieldLength"
:
128
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
2
,
"fieldRemark"
:
""
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"444"
,
"elements"
:
[
{
"id"
:
1
,
"fieldName"
:
"444"
,
"fieldCNName"
:
"44"
,
"fieldType"
:
null
,
"fieldLength"
:
44
,
"fieldEmpty"
:
1
,
"fieldOrder"
:
44
,
"fieldRemark"
:
null
,
"checkRules"
:
[]
}
]
}
]
},
"global"
:
{
"logo"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png"
,
"countryList"
:
[
{
"name"
:
"简体中文-ZH"
,
"key"
:
"zh-CN"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"
},
{
"name"
:
"English-EN"
,
"key"
:
"en-US"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"
}
]
}
}
\ No newline at end of file
src/layouts/components/SelectLang.tsx
View file @
00bd838a
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Dropdown
,
Space
,
Menu
}
from
'antd'
import
{
setLocale
,
getLocale
}
from
'umi'
import
ChinaImg
from
'../../../mockStatic/china.png'
import
gou
from
'../../../mockStatic/gou.png'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
...
...
@@ -15,33 +16,51 @@ interface countryItem {
const
SelectLang
:
React
.
FC
=
()
=>
{
// 此处暂时无接口, 对接接口后需用枚举类型做补充
const
[
select
,
setSelect
]
=
useState
<
countryItem
>
({
key
:
'cn'
,
name
:
'简体中文-ZH'
,
icon
:
ChinaImg
})
const
[
currentLangKey
,
setCurrentLangKey
]
=
useState
<
string
>
(
'zh-CN'
)
useEffect
(()
=>
{
console
.
log
(
getLocale
(),
"getLocale()"
)
setCurrentLangKey
(
getLocale
())
},
[])
const
setLang
=
(
langItem
:
countryItem
)
=>
{
setLocale
(
langItem
.
key
,
true
)
}
const
menuHeaderDropdown
=
(
<
Menu
selectedKeys=
{
[]
}
>
{
GlobalConfig
.
global
.
countryList
.
map
(
v
=>
<
Menu
.
Item
key=
{
v
.
key
}
onClick=
{
()
=>
set
Select
(
v
)
}
>
GlobalConfig
.
global
.
countryList
.
map
(
v
=>
<
Menu
.
Item
key=
{
v
.
key
}
onClick=
{
()
=>
set
Lang
(
v
)
}
>
<
Space
>
{
select
.
key
===
v
.
key
?
<
img
src=
{
gou
}
style=
{
{
width
:
20
,
height
:
20
}
}
/>
:
<
div
style=
{
{
width
:
20
,
height
:
20
}
}
></
div
>
}
<
img
src=
{
v
.
icon
}
style=
{
{
width
:
24
,
height
:
17
}
}
/>
{
currentLangKey
===
v
.
key
?
<
img
src=
{
gou
}
style=
{
{
width
:
20
,
height
:
20
}
}
/>
:
<
div
style=
{
{
width
:
20
,
height
:
20
}
}
></
div
>
}
<
img
src=
{
v
.
icon
}
style=
{
{
width
:
24
,
height
:
17
}
}
/>
<
span
>
{
v
.
name
}
</
span
>
</
Space
>
</
Menu
.
Item
>)
}
</
Menu
>
);
return
(
<
Dropdown
overlay=
{
menuHeaderDropdown
}
placement=
'bottomRight'
className=
"selectLangBox"
>
<
Space
style=
{
{
cursor
:
'pointer'
}
}
size=
{
5
}
>
<
img
src=
{
select
.
icon
}
style=
{
{
width
:
24
,
height
:
17
}
}
/>
<
span
>
{
select
.
name
}
</
span
>
const
renderCurrentLang
=
()
=>
{
let
currentLang
:
countryItem
GlobalConfig
.
global
.
countryList
.
map
(
item
=>
{
if
(
item
.
key
===
currentLangKey
)
{
currentLang
=
item
}
})
return
(
<
Space
style=
{
{
cursor
:
'pointer'
}
}
size=
{
5
}
>
<
img
src=
{
currentLang
?.
icon
}
style=
{
{
width
:
24
,
height
:
17
}
}
/>
<
span
>
{
currentLang
?.
name
}
</
span
>
<
CaretDownOutlined
/>
</
Space
>
)
}
return
(
<
Dropdown
overlay=
{
menuHeaderDropdown
}
placement=
'bottomRight'
className=
"selectLangBox"
>
{
renderCurrentLang
()
}
</
Dropdown
>
)
}
...
...
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