From a2eb30c9bbaf58967c51c3abfdf6311ed36bd37a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 28 四月 2025 22:52:16 +0800 Subject: [PATCH] 2025-04-28 --- src/index.js | 2 src/views/login/loginform.jsx | 95 ++++++++++++++++++++++++++++--- src/views/login/index.scss | 23 +++++++ src/views/login/index.jsx | 13 ++++ 4 files changed, 121 insertions(+), 12 deletions(-) diff --git a/src/index.js b/src/index.js index aae8007..0c670ea 100644 --- a/src/index.js +++ b/src/index.js @@ -243,6 +243,8 @@ GLOB.mainlogo = _systemMsg.mainlogo GLOB.doclogo = _systemMsg.doclogo GLOB.webSite = _systemMsg.webSite + GLOB.prolType = _systemMsg.prolType || '' + GLOB.prolCont = _systemMsg.prolCont || '' GLOB.style = _systemMsg.style || 'bg_black_style_blue' GLOB.showline = _systemMsg.showline || '' GLOB.navBar = _systemMsg.navBar || 'shutter' diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 850d770..796b520 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -27,6 +27,8 @@ ICP: window.GLOB.ICP || '', lineColor: window.GLOB.lineColor || '', webSite: window.GLOB.webSite || '', + prolType: window.GLOB.prolType || '', + prolCont: window.GLOB.prolCont || '', langList: [], syncApp: false, loginWays: null, @@ -627,12 +629,19 @@ style: res.CSS || '', showline: res.split_line_show || 'true', webSite: res.WebSite || '', + prolType: '', + prolCont: '', navBar: res.menu_type, // shutter 鐧惧彾绐椼�乴inkage_navigation 鑱斿姩鑿滃崟銆乴inkage 鑱斿姩鑿滃崟_鏃犲鑸爮銆乵enu_board 鑿滃崟闈㈡澘銆乵enu_board_navigation 鑿滃崟闈㈡澘_鏍囩椤� app_version: res.app_version, Member_Level: 0, appname: res.appname || '', loginOtop: loginOtop, loginOleft: loginOleft + } + + if (['every_time', 'once', 'not_required'].includes(res.require_legal_consent) && res.legal_documents) { + systemMsg.prolType = res.require_legal_consent + systemMsg.prolCont = res.legal_documents } if ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100].includes(res.member_level)) { @@ -920,7 +929,7 @@ } render () { - const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays } = this.state + const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays, prolType, prolCont } = this.state let wrapStyle = {} @@ -945,6 +954,8 @@ auth={this.state.auth} authError={this.state.authError} loginWays={loginWays} + prolType={prolType} + prolCont={prolCont} langList={this.state.langList} isDisabled={this.state.isDisabled} handleSubmit={() => this.handleSubmit()} diff --git a/src/views/login/index.scss b/src/views/login/index.scss index cb8b3af..7a5ef76 100644 --- a/src/views/login/index.scss +++ b/src/views/login/index.scss @@ -48,6 +48,13 @@ background-color: var(--mk-sys-color5); border-color: var(--mk-sys-color5); } + .login-form-button.disabled { + background-color: var(--mk-sys-color5); + border-color: var(--mk-sys-color5); + color: #ffffff; + cursor: not-allowed; + opacity: 0.9; + } .login-way-wrap { .login-way.active, .login-way:hover { @@ -195,6 +202,22 @@ } } } + .proline { + display: inline-block; + margin-bottom: 10px; + height: auto; + margin-top: calc(-3vh + 10px); + font-size: 14px; + .ant-form-item-children { + display: flex; + align-items: center; + line-height: 1.5; + + a { + color: var(--mk-sys-color); + } + } + } button.vercode { border: 0; color: var(--mk-sys-color); diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 55df6ad..8d19904 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Input, Button, Checkbox, Select, Modal, message, AutoComplete } from 'antd' +import { Form, Input, Button, Checkbox, Select, Modal, message, AutoComplete, Tooltip } from 'antd' import { UserOutlined, LockOutlined, QrcodeOutlined, RedoOutlined, CloseCircleOutlined } from '@ant-design/icons' import md5 from 'md5' import moment from 'moment' @@ -15,6 +15,25 @@ const { warning } = Modal let LoginVerCodeTimer = null const QrCode = asyncLoadComponent(() => import('@/components/qrcode')) + +const CheckWrap = ({checked, prolType, onChange, prolCont}) => { + const change = (e) => { + onChange(e.target.checked) + + if (prolType === 'once') { + localStorage.setItem(window.GLOB.sysSign + 'protocol', e.target.checked) + } + } + + let content = window.decodeURIComponent(window.atob(prolCont)) + + return ( + <> + {prolType !== 'not_required' ? <Checkbox defaultChecked={checked} onChange={change} style={{marginRight: '8px'}}></Checkbox> : null} + <span dangerouslySetInnerHTML={{__html: content}}></span> + </> + ) +} class LoginTabForm extends Component { static propTpyes = { @@ -33,6 +52,7 @@ username: '', password: '', remember: true, + protocol: null, delay: null, loginWays: [], smsId: '', @@ -48,9 +68,21 @@ timer = null splitTime = 0 + scanParam = null UNSAFE_componentWillMount () { - const { loginWays } = this.props + const { loginWays, prolType } = this.props + + let protocol = null + + if (prolType === 'once') { + protocol = localStorage.getItem(window.GLOB.sysSign + 'protocol') === 'true' + } else if (prolType === 'every_time') { + protocol = false + } else if (prolType === 'not_required') { + protocol = true + } + let remember = true if (localStorage.getItem(window.GLOB.sysSign + 'remember') === 'false') { @@ -111,6 +143,7 @@ scanId: activeKey === 'app_scan' || activeKey === 'weixin_scan' ? Utils.getuuid() : '', timeout: false, remember, + protocol, wayLabels, hasScan }) @@ -124,9 +157,10 @@ } checkResult = () => { - const { scanId } = this.state + const { scanId, protocol, dict } = this.state this.splitTime += 10000 + this.scanParam = null let _param = { func: 'webapi_get_binding_key', @@ -150,6 +184,14 @@ message.warning(res.message) return } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) { + if (protocol === false) { + this.scanParam = { + ...res, + scanId + } + message.warning(dict['protocol_check'] || '璇烽槄璇诲苟鍚屾剰鍗忚锛�') + return + } this.props.authLogin(res.thd_party_appid, res.thd_party_openid, res.thd_party_member_id, scanId) } else { this.timer = setTimeout(() => { @@ -160,7 +202,10 @@ } handleConfirm = () => { - const { activeKey } = this.state + const { activeKey, protocol } = this.state + + if (protocol === false) return Promise.reject() + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -423,6 +468,14 @@ localStorage.setItem(window.GLOB.sysSign + 'users', window.btoa(window.encodeURIComponent(JSON.stringify(_users)))) } + changeAgree = (val) => { + this.setState({protocol: val}) + + if (this.scanParam && val) { + this.props.authLogin(this.scanParam.thd_party_appid, this.scanParam.thd_party_openid, this.scanParam.thd_party_member_id, this.scanParam.scanId) + } + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -434,9 +487,9 @@ } render() { - const { langList } = this.props + const { langList, isDisabled, prolType, prolCont } = this.props const { getFieldDecorator } = this.props.form - const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang, vispwd } = this.state + const { activeKey, verdisabled, delay, loginWays, remember, scanId, timeout, hasScan, users, wayLabels, dict, lang, vispwd, protocol } = this.state return ( <Form className="login-form" id="login-form" onSubmit={this.handleSubmit}> @@ -500,10 +553,17 @@ )} </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}> - {dict['log_in'] || '鐧诲綍'} - </Button> + {protocol === false ? <Tooltip placement="top" trigger="click" title={dict['protocol_check'] || '璇烽槄璇诲苟鍚屾剰鍗忚锛�'}> + <Button type="primary" htmlType="submit" className="login-form-button disabled"> + {dict['log_in'] || '鐧诲綍'} + </Button> + </Tooltip> : <Button type="primary" htmlType="submit" className="login-form-button" disabled={isDisabled} loading={isDisabled}> + {dict['log_in'] || '鐧诲綍'} + </Button>} </Form.Item> + {prolType ? <Form.Item className="proline"> + <CheckWrap checked={protocol} onChange={(val) => this.setState({protocol: val})} prolCont={prolCont} prolType={prolType}/> + </Form.Item> : null} {window.GLOB.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line"> <a href="http://www.minkesoft.com/signup" target="_blank" rel="noopener noreferrer" className="register">娉ㄥ唽</a> <a href="http://www.minkesoft.com/forgotPwd" target="_blank" rel="noopener noreferrer" className="forgot">蹇樿瀵嗙爜锛�</a> @@ -557,10 +617,17 @@ )} </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}> + {protocol === false ? <Tooltip placement="top" trigger="click" title={dict['protocol_check'] || '璇烽槄璇诲苟鍚屾剰鍗忚锛�'}> + <Button type="primary" htmlType="submit" className="login-form-button disabled"> + {dict['log_in'] || '鐧诲綍'} + </Button> + </Tooltip> : <Button type="primary" htmlType="submit" className="login-form-button" disabled={isDisabled} loading={isDisabled}> {dict['log_in'] || '鐧诲綍'} - </Button> + </Button>} </Form.Item> + {prolType ? <Form.Item className="proline"> + <CheckWrap checked={protocol} onChange={(val) => this.setState({protocol: val})} prolCont={prolCont} prolType={prolType}/> + </Form.Item> : null} {window.GLOB.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line"> <a href="http://www.minkesoft.com/signup" target="_blank" rel="noopener noreferrer" className="register">娉ㄥ唽</a> <a href="http://www.minkesoft.com/forgotPwd" target="_blank" rel="noopener noreferrer" className="forgot">蹇樿瀵嗙爜锛�</a> @@ -577,6 +644,9 @@ </div> <img src={wxicon} alt=""/>{dict['wechat_scan'] || '璇蜂娇鐢ㄥ井淇℃壂涓�鎵櫥褰�'} </div> + {prolType ? <Form.Item className="proline"> + <CheckWrap checked={protocol} onChange={this.changeAgree} prolCont={prolCont} prolType={prolType}/> + </Form.Item> : null} </div> : null} {activeKey === 'app_scan' ? <div className="form-item-wrap"> <div className="form-scan-wrap"> @@ -589,6 +659,9 @@ </div> {dict['client_scan'] || '璇蜂娇鐢ㄥ鎴风鎵竴鎵櫥褰�'} </div> + {prolType ? <Form.Item className="proline"> + <CheckWrap checked={protocol} onChange={this.changeAgree} prolCont={prolCont} prolType={prolType}/> + </Form.Item> : null} </div> : null} <div className={'login-ways ' + (activeKey === 'app_scan' || activeKey === 'weixin_scan' ? 'center' : '')}> {loginWays.map(item => { -- Gitblit v1.8.0