Commit f412b38773977a41c03d0880fa6f50eec45854dd
1 parent
ac91c75f
1.登录模块 增加语言传参
Showing
1 changed file
with
14 additions
and
8 deletions
src/components/login/Login.js
| @@ -57,7 +57,6 @@ class LoginForm extends Component { | @@ -57,7 +57,6 @@ class LoginForm extends Component { | ||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | handleInit = async () => { | 59 | handleInit = async () => { |
| 60 | - this.handleGetLoginInfo(); /* 根据后台配置获取公司信息 */ | ||
| 61 | const configUrl = `${commonConfig.server_host}sysbrands/getSysbrands`; | 60 | const configUrl = `${commonConfig.server_host}sysbrands/getSysbrands`; |
| 62 | const configReturn = (await commonServices.getService(null, configUrl)).data; | 61 | const configReturn = (await commonServices.getService(null, configUrl)).data; |
| 63 | if (configReturn.code === 1) { | 62 | if (configReturn.code === 1) { |
| @@ -65,11 +64,18 @@ class LoginForm extends Component { | @@ -65,11 +64,18 @@ class LoginForm extends Component { | ||
| 65 | const sParentId = commonUtils.isNotEmptyObject(this.state.sParentId) ? this.state.sParentId : companys[0].sParentId; | 64 | const sParentId = commonUtils.isNotEmptyObject(this.state.sParentId) ? this.state.sParentId : companys[0].sParentId; |
| 66 | const sId = commonUtils.isNotEmptyObject(this.state.sId) ? this.state.sId : companys[0].sId; | 65 | const sId = commonUtils.isNotEmptyObject(this.state.sId) ? this.state.sId : companys[0].sId; |
| 67 | const footer = commonUtils.isNotEmptyObject(this.state.footer) ? this.state.footer : companys[0].footer; | 66 | const footer = commonUtils.isNotEmptyObject(this.state.footer) ? this.state.footer : companys[0].footer; |
| 68 | - this.setState({ companys, sParentId, sId, footer }); | 67 | + const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : ''; |
| 68 | + console.log('sLanguage', sLanguage); | ||
| 69 | + if(commonUtils.isEmptyObject(sLanguage)) { | ||
| 70 | + message.error('未获取到系统设置语言!'); | ||
| 71 | + } | ||
| 72 | + this.setState({ companys, sParentId, sId, footer }, () => { | ||
| 73 | + this.handleGetLoginInfo(sLanguage);/* 根据后台配置获取公司信息 */ | ||
| 74 | + }); | ||
| 69 | } else { | 75 | } else { |
| 70 | message.error(configReturn.msg); | 76 | message.error(configReturn.msg); |
| 71 | } | 77 | } |
| 72 | - }; | 78 | + } |
| 73 | 79 | ||
| 74 | // 获取自定义logo | 80 | // 获取自定义logo |
| 75 | handleGetLogoImage = () => { | 81 | handleGetLogoImage = () => { |
| @@ -103,10 +109,10 @@ class LoginForm extends Component { | @@ -103,10 +109,10 @@ class LoginForm extends Component { | ||
| 103 | }; | 109 | }; |
| 104 | 110 | ||
| 105 | /* 获取登录窗体配置文字 */ | 111 | /* 获取登录窗体配置文字 */ |
| 106 | - handleGetLoginInfo = async () => { | ||
| 107 | - const sModelsId = "16148217740007696998039471379000"; | ||
| 108 | - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=/commonAuto`; | ||
| 109 | - const configReturn = (await commonServices.getService("", configUrl)).data; | 112 | + handleGetLoginInfo = async (sLanguage) => { |
| 113 | + const sModelsId = '16148217740007696998039471379000'; | ||
| 114 | + const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sLanguage=${sLanguage}&sModelsId=${sModelsId}&sName=/commonAuto`; | ||
| 115 | + const configReturn = (await commonServices.getService('', configUrl)).data; | ||
| 110 | if (configReturn.code === 1) { | 116 | if (configReturn.code === 1) { |
| 111 | const dataReturn = configReturn.dataset.rows; | 117 | const dataReturn = configReturn.dataset.rows; |
| 112 | if (commonUtils.isNotEmptyArr(dataReturn)) { | 118 | if (commonUtils.isNotEmptyArr(dataReturn)) { |
| @@ -123,7 +129,7 @@ class LoginForm extends Component { | @@ -123,7 +129,7 @@ class LoginForm extends Component { | ||
| 123 | } else { | 129 | } else { |
| 124 | message.error(configReturn.msg); | 130 | message.error(configReturn.msg); |
| 125 | } | 131 | } |
| 126 | - }; | 132 | + } |
| 127 | 133 | ||
| 128 | handleSelect = (value, option) => { | 134 | handleSelect = (value, option) => { |
| 129 | const sParentId = option.props["data-parentid"]; | 135 | const sParentId = option.props["data-parentid"]; |