Commit 2cad8ecc authored by 前端-许佳敏's avatar 前端-许佳敏

更新全局配置获取方式

parent 596dcd9c
{ {"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"}]}}
"global": {
"logo": "",
"countryList": [
{
"name": "简体中文-ZH",
"key": "cn",
"icon": ""
},
{
"name": "English-EN",
"key": "en",
"icon": ""
},
{
"name": "日本語-JP",
"key": "jp",
"icon": ""
},
{
"name": "한국어-KO",
"key": "ko",
"icon": ""
}
]
}
}
\ No newline at end of file
...@@ -3,27 +3,27 @@ const mockData = { ...@@ -3,27 +3,27 @@ const mockData = {
code: 1000, code: 1000,
data: { data: {
global: { global: {
logo: '', logo: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png',
countryList: [ countryList: [
{ {
name: '简体中文-ZH', name: '简体中文-ZH',
key: 'cn', key: 'cn',
icon: '' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png'
}, },
{ {
name: 'English-EN', name: 'English-EN',
key: 'en', key: 'en',
icon: '' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png'
}, },
{ {
name: '日本語-JP', name: '日本語-JP',
key: 'jp', key: 'jp',
icon: '' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png'
}, },
{ {
name: '한국어-KO', name: '한국어-KO',
key: 'ko', key: 'ko',
icon: '' icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png'
} }
] ]
} }
......
...@@ -3,6 +3,7 @@ import styles from './styles/UserLayouts.less' ...@@ -3,6 +3,7 @@ import styles from './styles/UserLayouts.less'
import UserHeader from './components/UserHeader'; import UserHeader from './components/UserHeader';
import BaseFooter from './components/BaseFooter'; import BaseFooter from './components/BaseFooter';
import { Row } from 'antd'; import { Row } from 'antd';
import { GlobalConfig } from '@/global/config';
/** /**
* 登录、注册等用户界面布局 * 登录、注册等用户界面布局
...@@ -11,7 +12,7 @@ import { Row } from 'antd'; ...@@ -11,7 +12,7 @@ import { Row } from 'antd';
const UserLayouts:React.FC = (props) => { const UserLayouts:React.FC = (props) => {
return ( return (
<div className={styles.lingxiBusinessUserLayout}> <div className={styles.lingxiBusinessUserLayout}>
<UserHeader/> <UserHeader logo={GlobalConfig.global.logo}/>
<div className={styles.lingxiBusinessUserBg}> <div className={styles.lingxiBusinessUserBg}>
{ props.children } { props.children }
<BaseFooter/> <BaseFooter/>
......
...@@ -6,34 +6,14 @@ import japenImg from '../../../mockStatic/japen.png' ...@@ -6,34 +6,14 @@ import japenImg from '../../../mockStatic/japen.png'
import korenImg from '../../../mockStatic/koren.png' import korenImg from '../../../mockStatic/koren.png'
import us from '../../../mockStatic/us.png' import us from '../../../mockStatic/us.png'
import { CaretDownOutlined } from '@ant-design/icons' import { CaretDownOutlined } from '@ant-design/icons'
import { GlobalConfig } from '@/global/config'
interface countryItem { interface countryItem {
name: string, name: string,
key: string, key: string,
icon: string icon: string
} }
const countryList: countryItem[] = [
{
name: '简体中文-ZH',
key: 'cn',
icon: ChinaImg
},
{
name: 'English-EN',
key: 'en',
icon: us
},
{
name: '日本語-JP',
key: 'jp',
icon: japenImg
},
{
name: '한국어-KO',
key: 'ko',
icon: korenImg
}
]
const HeaderDropdown: React.FC = () => { const HeaderDropdown: React.FC = () => {
// 此处暂时无接口, 对接接口后需用枚举类型做补充 // 此处暂时无接口, 对接接口后需用枚举类型做补充
const [select, setSelect] = useState<countryItem>({ const [select, setSelect] = useState<countryItem>({
...@@ -45,7 +25,7 @@ const HeaderDropdown: React.FC = () => { ...@@ -45,7 +25,7 @@ const HeaderDropdown: React.FC = () => {
const menuHeaderDropdown = ( const menuHeaderDropdown = (
<Menu selectedKeys={[]}> <Menu selectedKeys={[]}>
{ {
countryList.map(v => <Menu.Item key={v.key} onClick={() => setSelect(v)}> GlobalConfig.global.countryList.map(v => <Menu.Item key={v.key} onClick={() => setSelect(v)}>
<Space> <Space>
{select.key === v.key ? <img src={gou} style={{width: 20, height: 20}}/> : <div style={{width: 20, height: 20}}></div> } {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}}/> <img src={v.icon} style={{width: 24, height: 17}}/>
......
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