From 73a7df76a31a8c77275de346fe71686f926fa1cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 07 八月 2024 12:31:58 +0800 Subject: [PATCH] 2024-08-07 --- public/options.json | 2 +- src/index.js | 5 ++++- src/pc/components/login/normal-login/options.jsx | 15 +++++++++++++++ src/views/login/loginform.jsx | 11 ++++++----- src/pc/components/login/normal-login/loginform.jsx | 2 +- public/README.txt | 2 +- src/components/header/loginform.jsx | 21 +++++++++++---------- 7 files changed, 39 insertions(+), 19 deletions(-) diff --git a/public/README.txt b/public/README.txt index 685c921..c277902 100644 --- a/public/README.txt +++ b/public/README.txt @@ -20,7 +20,7 @@ storeKey -- 鐢靛瓙妗f鏈湴鎺堟潈鐮侊紝浣跨敤鏈湴璁稿彲瀵嗛挜鏃舵湁鏁� probation -- 璇曠敤鏈燂紙YYYY-MM-DD锛夛紝鍦ㄦ寮忕郴缁熶腑锛岃瘯鐢ㄦ湡鍐呰皟鐢ㄧ郴缁熸帴鍙g殑鑴氭湰浼氳褰曚笅鏉� transfer -- 鏄惁浣跨敤杞帴鍙o紝浣跨敤杞帴鍙f椂璇疯缃负 true, 浣跨敤杞帴鍙f椂锛屽閮ㄦ帴鍙h皟鐢ㄥ墠涓嶄細鍋氱櫥褰曢獙璇� -keepPassword -- 璁颁綇瀵嗙爜锛岄粯璁ゅ紑鍚紝褰撳�间负 false 鏃剁鐢� +keepPwd -- 璁颁綇瀵嗙爜锛岄粯璁ゅ紑鍚紝褰撳�间负 false 鏃剁鐢紝褰撳�间负 invisible 鏃惰浣忓瘑鐮佷絾瀵嗙爜涓嶅彲鏌ョ湅 execType -- 鑴氭湰浼犺緭鏂瑰紡锛屽�间负x鏃讹紝鍚敤AES鍔犲瘑 updateStatus -- 鏄惁鏇存柊寮�鍙戠姸鎬侊紝榛樿寮�鍚紝褰撳�间负 false 鏃剁鐢� forcedUpdate -- 浼犺緭鍙峰崌绾ф椂锛屾槸鍚﹁嚜鍔ㄩ��鍑猴紝鏍煎紡涓猴紙YYYY-MM-DD锛夛紝鐢ㄤ簬鍗囩骇鍚庡埛鏂扮敤鎴锋湰鍦伴厤缃� \ No newline at end of file diff --git a/public/options.json b/public/options.json index 73d5160..0c187d0 100644 --- a/public/options.json +++ b/public/options.json @@ -18,7 +18,7 @@ "storeKey": "", "probation": "", "transfer": "false", - "keepPassword": "true", + "keepPwd": "true", "execType": "x", "host": "http://qingqiumarket.cn", "service": "MKWMS/" diff --git a/src/components/header/loginform.jsx b/src/components/header/loginform.jsx index 5154a9c..cca3f3d 100644 --- a/src/components/header/loginform.jsx +++ b/src/components/header/loginform.jsx @@ -12,9 +12,9 @@ state = { remember: false, + lock: false, username: '', password: '', - oripassword: '', delay: +sessionStorage.getItem('mkDelay') } @@ -39,22 +39,17 @@ this.setState({ remember: true, username: _user.username, - password: _user.password ? '*********' : '', - oripassword: _user.password + password: _user.password, + lock: true }) } } handleConfirm = () => { - const { oripassword } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - if (oripassword && values.password === '*********') { - values.password = oripassword - } - values.username = values.username.replace(/\t+|\v+|\s+/g, '') values.password = values.password.replace(/\t+|\v+|\s+/g, '') @@ -88,6 +83,12 @@ } } + unLock = (e) => { + if (e.target.value) return + + this.setState({ lock: false }) + } + componentDidMount () { const { username, password } = this.state @@ -102,7 +103,7 @@ render() { const { getFieldDecorator } = this.props.form - const { remember, username, password, delay } = this.state + const { remember, username, password, delay, lock } = this.state return ( <Form style={{margin: '0px 10px'}}> @@ -131,7 +132,7 @@ message: '璇疯緭鍏ュ瘑鐮�', } ] - })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder="瀵嗙爜" prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)} + })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder="瀵嗙爜" visibilityToggle={!lock} onChange={this.unLock} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)} </Form.Item> {window.GLOB.keepKey ? <Form.Item style={{marginBottom: '10px'}}> {getFieldDecorator('remember', { diff --git a/src/index.js b/src/index.js index 3487b4a..3aea357 100644 --- a/src/index.js +++ b/src/index.js @@ -37,6 +37,8 @@ } } + config.keepPwd = config.keepPwd || config.keepPassword + let GLOB = {} GLOB.appId = config.appId || '' GLOB.lineColor = config.lineColor || '' @@ -44,7 +46,8 @@ GLOB.probation = false GLOB.watermark = config.watermark + '' !== 'false' GLOB.transfer = config.transfer + '' === 'true' - GLOB.keepKey = config.keepPassword + '' !== 'false' + GLOB.keepKey = config.keepPwd + '' !== 'false' + GLOB.vispwd = config.keepPwd + '' !== 'invisible' GLOB.WXAppID = config.WXAppID || '' GLOB.WXminiAppID = config.WXminiAppID || '' GLOB.WXMerchID = config.WXMerchID || '' diff --git a/src/pc/components/login/normal-login/loginform.jsx b/src/pc/components/login/normal-login/loginform.jsx index 154fadd..8790dd8 100644 --- a/src/pc/components/login/normal-login/loginform.jsx +++ b/src/pc/components/login/normal-login/loginform.jsx @@ -157,7 +157,7 @@ /> </Form.Item> <Form.Item> - <Input.Password placeholder="瀵嗙爜" prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} /> + <Input.Password placeholder="瀵嗙爜" visibilityToggle={wrap.vispwd !== 'false'} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} /> </Form.Item> {!activeWay.shortcut || activeWay.shortcut === 'remember' ? <Form.Item className="minline"> <Checkbox>璁颁綇瀵嗙爜</Checkbox> diff --git a/src/pc/components/login/normal-login/options.jsx b/src/pc/components/login/normal-login/options.jsx index 72dae60..76b6eda 100644 --- a/src/pc/components/login/normal-login/options.jsx +++ b/src/pc/components/login/normal-login/options.jsx @@ -171,6 +171,21 @@ {value: 'none', label: '鏃�'}, {value: 'remember', label: '璁颁綇瀵嗙爜'}, {value: 'autologon', label: '鑷姩鐧诲綍'}, + ], + controlFields: [ + {field: 'vispwd', values: ['remember', 'autologon']}, + ] + }, + { + type: 'radio', + field: 'vispwd', + label: '鏌ョ湅瀵嗙爜', + initval: wrap.vispwd || 'true', + tooltip: '瀵嗙爜鏄惁鍙煡鐪嬶紙瀵嗙爜妗嗗彸渚у浘鏍囨槸鍚︽樉绀猴級銆�', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, ] }, { diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 4f4d150..0a245cf 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -39,6 +39,7 @@ verdisabled: false, hasScan: false, timeout: false, + vispwd: window.GLOB.vispwd, wayLabels: {}, dict: window.GLOB.dict, users: [], @@ -102,14 +103,14 @@ users = [] } - if (users[0]) { + if (users[0] && activeKey === 'uname_pwd') { _user = users[0] } this.setState({ users: users, - username: activeKey === 'uname_pwd' && _user ? _user.username : '', - password: activeKey === 'uname_pwd' && _user ? _user.password : '', + username: _user ? _user.username : '', + password: _user ? _user.password : '', smsId: smsId, loginWays: _loginWays, activeKey, @@ -441,7 +442,7 @@ render() { const { langList } = this.props const { getFieldDecorator } = this.props.form - const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang } = this.state + const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang, vispwd } = this.state return ( <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}> @@ -482,7 +483,7 @@ message: dict['password_required'] || '璇疯緭鍏ュ瘑鐮�', } ] - })(<Input.Password placeholder={dict['password'] || '瀵嗙爜'} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)} + })(<Input.Password placeholder={dict['password'] || '瀵嗙爜'} visibilityToggle={vispwd} prefix={<LockOutlined style={{ color: 'rgba(0,0,0,.25)' }} />} />)} </Form.Item> {window.GLOB.keepKey ? <Form.Item className="minline"> {getFieldDecorator('remember', { -- Gitblit v1.8.0