Commit 3d181d5d authored by 杨思琦's avatar 杨思琦

fix: 默认登录页二维码样式修改

parent 6f47cde1
Pipeline #95059 passed with stages
...@@ -7,19 +7,22 @@ import styles from './index.less'; ...@@ -7,19 +7,22 @@ import styles from './index.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const LoginSubmit = ({ className, ...rest }) => { const LoginSubmit = React.memo(
const clsString = classNames(styles.submit, className); ({ className, renderQcode, ...rest }) => {
return ( const clsString = classNames(styles.submit, className);
<FormItem> return (
<Button <FormItem style={renderQcode ? { marginBottom: 15 } : {}}>
size="large" <Button size="large" className={clsString} type="primary" htmlType="submit" {...rest} />
className={clsString} </FormItem>
type="primary" );
htmlType="submit" },
{...rest} (prevProps, nextProps) => {
/> return (
</FormItem> prevProps.className === nextProps.className &&
); prevProps.renderQcode === nextProps.renderQcode &&
}; JSON.stringify(prevProps.rest) === JSON.stringify(nextProps.rest)
);
},
);
export default LoginSubmit; export default LoginSubmit;
import React, { memo } from 'react';
import { Checkbox } from 'antd'; import { Checkbox } from 'antd';
import React from 'react';
import { useIntl } from '@wisdom-utils/components'; import { useIntl } from '@wisdom-utils/components';
import LoginForm from '../components/Login'; import LoginForm from '../components/Login';
import LoginMessage from './loginMessage'; import LoginMessage from './loginMessage';
/* eslint-disable */
const { UserName, Password, Validate, Submit } = LoginForm; const { UserName, Password, Validate, Submit } = LoginForm;
const useAccount = props => (
<LoginForm onSubmit={props.onSubmit} welcome={props.welcome}> const AccountForm = ({
{props.status === 'error' && props.type === 'account' && !props.submitting && ( onSubmit,
welcome,
status,
type,
submitting,
autoLogin,
setAutoLogin,
isValidate,
renderQcode,
}) => (
<LoginForm onSubmit={onSubmit} welcome={welcome}>
{status === 'error' && type === 'account' && !submitting && (
<LoginMessage <LoginMessage
content={useIntl().formatMessage({ content={useIntl().formatMessage({
id: 'pages.login.accountLogin.errorMessage', id: 'pages.login.accountLogin.errorMessage',
...@@ -42,14 +53,28 @@ const useAccount = props => ( ...@@ -42,14 +53,28 @@ const useAccount = props => (
}, },
]} ]}
/> />
{props?.isValidate ? <Validate name="validate" /> : null} {isValidate && <Validate name="validate" />}
<div> <div>
<Checkbox checked={props.autoLogin} onChange={e => props.setAutoLogin(e.target.checked)}> <Checkbox checked={autoLogin} onChange={e => setAutoLogin(e.target.checked)}>
{useIntl().formatMessage({ id: 'pages.login.rememberMe' })} {useIntl().formatMessage({ id: 'pages.login.rememberMe' })}
</Checkbox> </Checkbox>
</div> </div>
<Submit loading={props.submitting}>{useIntl().formatMessage({ id: 'pages.login.submit' })}</Submit> <Submit loading={submitting} renderQcode={renderQcode}>
{useIntl().formatMessage({ id: 'pages.login.submit' })}
</Submit>
</LoginForm> </LoginForm>
); );
export default useAccount; export default memo(AccountForm, (prevProps, nextProps) => {
return (
prevProps.onSubmit === nextProps.onSubmit &&
prevProps.welcome === nextProps.welcome &&
prevProps.status === nextProps.status &&
prevProps.type === nextProps.type &&
prevProps.submitting === nextProps.submitting &&
prevProps.autoLogin === nextProps.autoLogin &&
prevProps.setAutoLogin === nextProps.setAutoLogin &&
prevProps.isValidate === nextProps.isValidate &&
prevProps.renderQcode === nextProps.renderQcode
);
});
\ No newline at end of file
...@@ -139,43 +139,6 @@ const useRenderQcode = (props = {}) => { ...@@ -139,43 +139,6 @@ const useRenderQcode = (props = {}) => {
} }
break; break;
default: default:
if (item && item.replace(/ /g, '').length > 0) {
const indexIndex = element.findIndex(
// eslint-disable-next-line no-shadow
item => item.props.className.indexOf('Android-single') > -1,
);
element.splice(indexIndex, 1);
element.push(
<div
className={classNames(
styles['quickMark-single'],
'Android-single',
)}
key={index}
>
<Popover
placement="top"
content={
<QRCode
value={item.replace(
/{ip}/gi,
props.ip || window.location.host,
)}
/>
}
>
<div className={styles['icon-Container']}>
<span className={styles.Android} />
<span
className={classNames(styles.iconText, styles.AndroidText)}
>
Android
</span>
</div>
</Popover>
</div>,
);
}
break; break;
} }
}); });
......
...@@ -235,6 +235,10 @@ ...@@ -235,6 +235,10 @@
padding: 50px 50px 50px; padding: 50px 50px 50px;
background-color: #ffffff; background-color: #ffffff;
} }
.tip-container {
margin: auto;
display: flex;
}
} }
} }
.caseHide { .caseHide {
...@@ -358,5 +362,13 @@ ...@@ -358,5 +362,13 @@
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
} }
.linkBox {
color: @primary-color;
font-size: 15px;
cursor: pointer;
margin: auto;
line-height: 18px;
}
} }
import 'kit_utils/lib/format'; import 'kit_utils/lib/format';
import React, { forwardRef, useEffect, useRef, useState } from 'react'; import React, { forwardRef, useEffect, useRef, useState, useCallback } from 'react';
import { Modal } from 'antd'; import { Modal, Tooltip } from 'antd';
// eslint-disable-next-line import/no-unresolved // eslint-disable-next-line import/no-unresolved
import classNames from 'classnames'; import classNames from 'classnames';
import { dom } from '@wisdom-utils/utils/lib/helpers'; import { dom } from '@wisdom-utils/utils/lib/helpers';
...@@ -33,6 +33,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -33,6 +33,7 @@ const Login = forwardRef((props, _ref) => {
const [currentDate, setCurrentDate] = useState({}); const [currentDate, setCurrentDate] = useState({});
const [type, setType] = useState('Account'); const [type, setType] = useState('Account');
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [renderQcode, setRenderQcode] = useState(false);
const history = useHistory(); const history = useHistory();
const [action, setAction] = useState(() => new LoginAction(Object.assign({}, props, { history }), setVisible, false)); const [action, setAction] = useState(() => new LoginAction(Object.assign({}, props, { history }), setVisible, false));
const [showVideo, setShowVideo] = useState(false); const [showVideo, setShowVideo] = useState(false);
...@@ -43,7 +44,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -43,7 +44,7 @@ const Login = forwardRef((props, _ref) => {
const loginMode = Cookies.get('loginMode') || null; const loginMode = Cookies.get('loginMode') || null;
if (loginMode && loginMode === 'iotWechat') ddCode = null; if (loginMode && loginMode === 'iotWechat') ddCode = null;
const handleSubmit = values => { const handleSubmit = useCallback((values) => {
/* eslint-disable */ /* eslint-disable */
action && action &&
(type === 'Account' (type === 'Account'
...@@ -56,7 +57,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -56,7 +57,7 @@ const Login = forwardRef((props, _ref) => {
setSubmitting(true); setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1); props.updateCurrentIndex && props.updateCurrentIndex(-1);
}; }, [action, type, isValidate, autoLogin, sliVerify, setSubmitting, props.updateCurrentIndex]);
useEffect(() => { useEffect(() => {
// if (props.loginMode === LOGIN_WAY.WeChart) { // if (props.loginMode === LOGIN_WAY.WeChart) {
...@@ -145,11 +146,15 @@ const Login = forwardRef((props, _ref) => { ...@@ -145,11 +146,15 @@ const Login = forwardRef((props, _ref) => {
videoRef && videoRef.current && videoRef.current.removeEventListener('ended', () => {}); videoRef && videoRef.current && videoRef.current.removeEventListener('ended', () => {});
}; };
}, [videoRef]); }, [videoRef]);
const renderAddons = React.useMemo(() => useRenderQcode(props.global), [props.global]);
useEffect(() => { useEffect(() => {
setSubmitting(false); setSubmitting(false);
}, [visible]); renderAddons && renderAddons.length === 0 && setRenderQcode(true)
const renderAddons = useRenderQcode(props.global); }, [visible, renderAddons]);
const renderPlatform = () => { const toLink = (link) => {
window.open(link);
};
const renderPlatform = (renderQcode) => {
const template = props.global.loginTemplate; const template = props.global.loginTemplate;
const params = { const params = {
fromRef: formRef, fromRef: formRef,
...@@ -163,6 +168,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -163,6 +168,7 @@ const Login = forwardRef((props, _ref) => {
onSubmit: handleSubmit, onSubmit: handleSubmit,
loginMode: props.loginMode, loginMode: props.loginMode,
updateLoginMode: props.updateLoginMode, updateLoginMode: props.updateLoginMode,
renderQcode
}; };
switch (template) { switch (template) {
case 'DarkCloud.html': case 'DarkCloud.html':
...@@ -175,7 +181,6 @@ const Login = forwardRef((props, _ref) => { ...@@ -175,7 +181,6 @@ const Login = forwardRef((props, _ref) => {
} }
}; };
/* eslint-disable */ /* eslint-disable */
return ( return (
<HelmetProvider> <HelmetProvider>
<Helmet> <Helmet>
...@@ -216,9 +221,21 @@ const Login = forwardRef((props, _ref) => { ...@@ -216,9 +221,21 @@ 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> <div>
<img src={require('@/assets/images/login/dark/login.png')} /> <img style={renderQcode ? { height: 'calc(100% - 80px)', width: 'calc(100% - 40px)', margin: '40px 0 40px 40px' } : {}} src={require('@/assets/images/login/dark/login.png')} />
</div>
<div className={styles['login-form']} style={renderQcode ? { padding: '40px 50px' } : {}}>
{renderPlatform(renderQcode)}
{renderQcode && (
<div className={styles['tip-container']}>
<Tooltip title="打开网站下载">
<div className={styles.linkBox} onClick={() => toLink(props?.global?.qrcode)}>
<img style={{ width: '14px', margin: '0 5px 0' }} src={require('./project/jiangxiNew/images/下载.png')} alt="" />
点击下载APP
</div>
</Tooltip>
</div>
)}
</div> </div>
<div className={styles['login-form']}>{renderPlatform()}</div>
</div> </div>
</div> </div>
<div className={classNames(styles.footerCase, styles.caseHide, 'animate__animated')} ref={footerRef}> <div className={classNames(styles.footerCase, styles.caseHide, 'animate__animated')} ref={footerRef}>
......
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