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();
...@@ -141,6 +142,9 @@ const Login = forwardRef((props, _ref) => { ...@@ -141,6 +142,9 @@ 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>
{
qrcodes.length > 0 && qrcodes[0]
?
<div className={styles.loginCcode}> <div className={styles.loginCcode}>
<img <img
src={ src={
...@@ -152,6 +156,9 @@ const Login = forwardRef((props, _ref) => { ...@@ -152,6 +156,9 @@ const Login = forwardRef((props, _ref) => {
/> />
<div className={styles.codeBig}>{renderQRCode(props.global)}</div> <div className={styles.codeBig}>{renderQRCode(props.global)}</div>
</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