Commit c452305a authored by 徐乐's avatar 徐乐

perf: 修改默认登录页不配置二维码时不显示二维码框

parent be7099fd
Pipeline #83879 passed with stages
...@@ -19,7 +19,7 @@ import { defaultApp } from '../../../../../micro'; ...@@ -19,7 +19,7 @@ import { defaultApp } from '../../../../../micro';
import QRCode from 'qrcode.react'; import QRCode from 'qrcode.react';
const renderQRCode = props => { const renderQRCode = props => {
const qrcodes = props.qrcode.split('|') || []; const qrcodes = props?.qrcode?.split('|') ?? [];
if (qrcodes.length > 0 && qrcodes[0]) { if (qrcodes.length > 0 && qrcodes[0]) {
let value = qrcodes[0].replace(/{ip}/gi, props.ip || window.location.host).split('=')[1]; let value = qrcodes[0].replace(/{ip}/gi, props.ip || window.location.host).split('=')[1];
return <QRCode value={value} />; return <QRCode value={value} />;
...@@ -35,6 +35,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -35,6 +35,7 @@ const Login = forwardRef((props, _ref) => {
const [status, setStatus] = useState('normal'); const [status, setStatus] = useState('normal');
const [autoLogin, setAutoLogin] = useState(false); const [autoLogin, setAutoLogin] = useState(false);
const [submitting, setSubmitting] = useState(false); const [submitting, setSubmitting] = useState(false);
const qrcodes = props.global?.qrcode?.split('|') ?? [];
const [type, setType] = useState('Account'); const [type, setType] = useState('Account');
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const history = useHistory(); const history = useHistory();
...@@ -46,8 +47,8 @@ const Login = forwardRef((props, _ref) => { ...@@ -46,8 +47,8 @@ const Login = forwardRef((props, _ref) => {
(type === 'Account' (type === 'Account'
? action.loginHandler(values.userName, values.password, null, autoLogin, sliVerify) ? action.loginHandler(values.userName, values.password, null, autoLogin, sliVerify)
: type === 'Mobile' : type === 'Mobile'
? action.phoneLoginFormHandler(values.mobile, values.captcha) ? action.phoneLoginFormHandler(values.mobile, values.captcha)
: null); : null);
setSubmitting(true); setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1); props.updateCurrentIndex && props.updateCurrentIndex(-1);
...@@ -141,17 +142,23 @@ const Login = forwardRef((props, _ref) => { ...@@ -141,17 +142,23 @@ const Login = forwardRef((props, _ref) => {
</div> </div>
<div className={classNames(styles['login-block'], styles.caseHide, 'animate__animated')} ref={loginFormRef}> <div className={classNames(styles['login-block'], styles.caseHide, 'animate__animated')} ref={loginFormRef}>
<div className={styles['login-form']}>{renderPlatform()}</div> <div className={styles['login-form']}>{renderPlatform()}</div>
<div className={styles.loginCcode}> {
<img qrcodes.length > 0 && qrcodes[0]
src={ ?
props.global && <div className={styles.loginCcode}>
props.global.transformDevAssetsBaseURL && <img
props.global.transformDevAssetsBaseURL('assets/images/login/石家庄/小程序@2x.png') src={
} props.global &&
alt="" props.global.transformDevAssetsBaseURL &&
/> props.global.transformDevAssetsBaseURL('assets/images/login/石家庄/小程序@2x.png')
<div className={styles.codeBig}>{renderQRCode(props.global)}</div> }
</div> alt=""
/>
<div className={styles.codeBig}>{renderQRCode(props.global)}</div>
</div>
: ''
}
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment