From 505ed1181c5c341ea24de8417f3909009ac68dfa Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 六月 2024 16:56:44 +0800
Subject: [PATCH] 2024-06-17

---
 src/views/login/loginform.jsx |   55 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx
index 33fca8a..e4ebcfc 100644
--- a/src/views/login/loginform.jsx
+++ b/src/views/login/loginform.jsx
@@ -21,7 +21,6 @@
     isDisabled: PropTypes.bool,
     handleSubmit: PropTypes.func,
     authLogin: PropTypes.func,
-    dict: PropTypes.object,
     auth: PropTypes.bool,
     authError: PropTypes.string,
     touristLogin: PropTypes.bool,
@@ -42,6 +41,8 @@
     verdisabled: false,
     hasScan: false,
     timeout: false,
+    wayLabels: {},
+    dict: window.GLOB.dict,
     users: []
   }
 
@@ -63,20 +64,20 @@
     let smsId = ''
     let hasScan = false
     let _loginWays = []
+    let wayLabels = {app_scan: 'APP鎵爜', weixin_scan: '寰俊鎵爜', uname_pwd: '璐﹀彿鐧诲綍', sms_vcode: '鐭俊鐧诲綍'}
+
     loginWays.forEach(item => {
+      item.label = window.GLOB.dict[item.type] || wayLabels[item.type]
+      wayLabels[item.type] = item.label
       if (item.type === 'sms_vcode') {
-        item.label = '鐭俊鐧诲綍'
         smsId = item.smsId
         _loginWays.push(item)
       } else if (item.type === 'uname_pwd') {
-        item.label = '璐﹀彿鐧诲綍'
         _loginWays.push(item)
       } else if (item.type === 'app_scan') {
-        item.label = 'APP鎵爜'
         _loginWays.push(item)
         hasScan = true
       } else if (item.type === 'weixin_scan') {
-        item.label = '寰俊鎵爜'
         _loginWays.push(item)
         hasScan = true
       }
@@ -111,6 +112,7 @@
       scanId: activeKey === 'app_scan' || activeKey === 'weixin_scan' ? Utils.getuuid() : '',
       timeout: false,
       remember,
+      wayLabels,
       hasScan
     })
 
@@ -188,14 +190,14 @@
   }
 
   handleSubmit = e => {
-    const { activeKey } = this.state
+    const { activeKey, dict } = this.state
     // 鐧诲綍鍙傛暟妫�楠�
     e && e.preventDefault()
     if (!this.props.auth) {
       warning({
-        title: this.props.authError || this.props.dict['login.auth.tip'],
-        okText: this.props.dict['login.ok'],
-        cancelText: this.props.dict['login.cancel'],
+        title: this.props.authError || dict['auth_tip'] || '绯荤粺鏈巿鏉冿紝璇疯仈绯荤鐞嗗憳銆�',
+        okText: dict['ok'] || '纭畾',
+        cancelText: dict['cancel'] || '鍙栨秷',
         onOk() {},
         onCancel() {}
       })
@@ -440,8 +442,7 @@
   render() {
     const { langList } = this.props
     const { getFieldDecorator } = this.props.form
-    const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users } = this.state
-    const wayLabels = {app_scan: 'APP鎵爜', weixin_scan: '寰俊鎵爜', uname_pwd: '璐﹀彿鐧诲綍', sms_vcode: '鐭俊鐧诲綍'}
+    const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict } = this.state
 
     return (
       <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}>
@@ -450,7 +451,7 @@
         {activeKey === 'uname_pwd' ? <div className="form-item-wrap">
           <Form.Item>
             {getFieldDecorator('username', {
-              rules: [{ required: true, message: this.props.dict['login.username.empty'] }],
+              rules: [{ required: true, message: dict['username_required'] || '璇疯緭鍏ョ敤鎴峰悕' }],
               initialValue: this.state.username || '',
             })(
               <AutoComplete
@@ -467,7 +468,7 @@
               >
                 <Input
                   prefix={<UserOutlined style={{ color: 'rgba(0,0,0,.25)' }} />}
-                  placeholder={this.props.dict['login.username']}
+                  placeholder={dict['username'] || '鐢ㄦ埛鍚�'}
                   autoComplete="off"
                 />
               </AutoComplete>
@@ -479,16 +480,16 @@
               rules: [
                 {
                   required: true,
-                  message: this.props.dict['login.password.empty'],
+                  message: dict['password_required'] || '璇疯緭鍏ュ瘑鐮�',
                 }
               ]
-            })(<Input.Password placeholder={this.props.dict['login.password']} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
+            })(<Input.Password placeholder={dict['password'] || '瀵嗙爜'} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)}
           </Form.Item>
           {window.GLOB.keepKey ? <Form.Item className="minline">
             {getFieldDecorator('remember', {
               valuePropName: 'checked',
               initialValue: remember,
-            })(<Checkbox onChange={this.rememberChange}>{this.props.dict['login.remember']}</Checkbox>)}
+            })(<Checkbox onChange={this.rememberChange}>{dict['remember_me'] || '璁颁綇瀵嗙爜'}</Checkbox>)}
           </Form.Item> : <div style={{height: '30px', float: 'left'}}></div>}
           {langList && langList.length > 0 ? <Form.Item className="minline right">
             {getFieldDecorator('lang', {
@@ -506,7 +507,7 @@
           </Form.Item> : null}
           <Form.Item className="btn-login">
             <Button type="primary" htmlType="submit" className="login-form-button" disabled={this.props.isDisabled} loading={this.props.isDisabled}>
-              {this.props.dict['login.submit']}
+              {dict['log_in'] || '鐧诲綍'}
             </Button>
           </Form.Item>
           {window.GLOB.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line">
@@ -517,11 +518,11 @@
         {activeKey === 'sms_vcode' ? <div className="form-item-wrap">
           <Form.Item>
             {getFieldDecorator('phone', {
-              rules: [{ required: true, message: this.props.dict['login.phone.empty'] }],
+              rules: [{ required: true, message: dict['phone_no_required'] || '璇疯緭鍏ユ墜鏈哄彿' }],
               initialValue: '',
             })(
               <Input
-                placeholder={this.props.dict['login.phone']}
+                placeholder={dict['phone_no'] || '鎵嬫満鍙�'}
                 autoComplete="off"
               />
             )}
@@ -532,17 +533,17 @@
               rules: [
                 {
                   required: true,
-                  message: this.props.dict['login.vercode.empty'],
+                  message: dict['vercode_required'] || '璇疯緭鍏ラ獙璇佺爜',
                 }
               ]
             })(
               <Input
                 addonAfter={
                   <Button type="link" className="vercode" size="small" disabled={verdisabled} onClick={this.getvercode}>
-                    {delay ? `${delay}s鍚庨噸鏂拌幏鍙朻 : '鑾峰彇楠岃瘉鐮�'}
+                    {delay ? `${delay}s` : dict['query_vercode'] || '鑾峰彇楠岃瘉鐮�'}
                   </Button>
                 }
-                placeholder={this.props.dict['login.vercode']}
+                placeholder={dict['vercode'] || '楠岃瘉鐮�'}
                 autoComplete="off"
               />
             )}
@@ -563,7 +564,7 @@
           </Form.Item> : null}
           <Form.Item className="btn-login">
             <Button type="primary" htmlType="submit" className="login-form-button" disabled={this.props.isDisabled} loading={this.props.isDisabled}>
-              {this.props.dict['login.submit']}
+              {dict['log_in'] || '鐧诲綍'}
             </Button>
           </Form.Item>
           {window.GLOB.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line">
@@ -577,10 +578,10 @@
               {scanId ? <QrCode card={{qrWidth: 500, color: '#000000'}} value={`https://cloud.mk9h.cn/mob/mknotice.html?originurl=${window.btoa(window.GLOB.baseurl + 'mob/index.html#/wx/' + scanId)}`}/> : null}
               {timeout ? <div className="qrcode-out">
                 <RedoOutlined onClick={this.reCode} />
-                浜岀淮鐮佸凡澶辨晥銆�
+                {dict['code_expired'] || '浜岀淮鐮佸凡澶辨晥銆�'}
               </div> : null}
             </div>
-            <img src={wxicon} alt=""/>璇蜂娇鐢ㄥ井淇℃壂涓�鎵櫥褰�
+            <img src={wxicon} alt=""/>{dict['wechat_scan'] || '璇蜂娇鐢ㄥ井淇℃壂涓�鎵櫥褰�'}
           </div>
         </div> : null}
         {activeKey === 'app_scan' ? <div className="form-item-wrap">
@@ -589,10 +590,10 @@
               {scanId ? <QrCode card={{qrWidth: 500, color: '#000000'}} value={`mkpcscan,${window.GLOB.appkey},${scanId}`}/> : null}
               {timeout ? <div className="qrcode-out">
                 <RedoOutlined onClick={this.reCode} />
-                浜岀淮鐮佸凡澶辨晥銆�
+                {dict['code_expired'] || '浜岀淮鐮佸凡澶辨晥銆�'}
               </div> : null}
             </div>
-            璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰�
+            {dict['client_scan'] || '璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰�'}
           </div>
         </div> : null}
         <div className={'login-ways ' + (activeKey === 'app_scan' || activeKey === 'weixin_scan' ? 'center' : '')}>

--
Gitblit v1.8.0