From f412b38773977a41c03d0880fa6f50eec45854dd Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Fri, 22 Aug 2025 10:58:57 +0800 Subject: [PATCH] 1.登录模块 增加语言传参 --- src/components/login/Login.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/login/Login.js b/src/components/login/Login.js index f332df3..4720654 100644 --- a/src/components/login/Login.js +++ b/src/components/login/Login.js @@ -57,7 +57,6 @@ class LoginForm extends Component { } handleInit = async () => { - this.handleGetLoginInfo(); /* 根据后台配置获取公司信息 */ const configUrl = `${commonConfig.server_host}sysbrands/getSysbrands`; const configReturn = (await commonServices.getService(null, configUrl)).data; if (configReturn.code === 1) { @@ -65,11 +64,18 @@ class LoginForm extends Component { const sParentId = commonUtils.isNotEmptyObject(this.state.sParentId) ? this.state.sParentId : companys[0].sParentId; const sId = commonUtils.isNotEmptyObject(this.state.sId) ? this.state.sId : companys[0].sId; const footer = commonUtils.isNotEmptyObject(this.state.footer) ? this.state.footer : companys[0].footer; - this.setState({ companys, sParentId, sId, footer }); + const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : ''; + console.log('sLanguage', sLanguage); + if(commonUtils.isEmptyObject(sLanguage)) { + message.error('未获取到系统设置语言!'); + } + this.setState({ companys, sParentId, sId, footer }, () => { + this.handleGetLoginInfo(sLanguage);/* 根据后台配置获取公司信息 */ + }); } else { message.error(configReturn.msg); } - }; + } // 获取自定义logo handleGetLogoImage = () => { @@ -103,10 +109,10 @@ class LoginForm extends Component { }; /* 获取登录窗体配置文字 */ - handleGetLoginInfo = async () => { - const sModelsId = "16148217740007696998039471379000"; - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=/commonAuto`; - const configReturn = (await commonServices.getService("", configUrl)).data; + handleGetLoginInfo = async (sLanguage) => { + const sModelsId = '16148217740007696998039471379000'; + const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sLanguage=${sLanguage}&sModelsId=${sModelsId}&sName=/commonAuto`; + const configReturn = (await commonServices.getService('', configUrl)).data; if (configReturn.code === 1) { const dataReturn = configReturn.dataset.rows; if (commonUtils.isNotEmptyArr(dataReturn)) { @@ -123,7 +129,7 @@ class LoginForm extends Component { } else { message.error(configReturn.msg); } - }; + } handleSelect = (value, option) => { const sParentId = option.props["data-parentid"]; -- libgit2 0.22.2