Commit 873f5f91 authored by 周宏民's avatar 周宏民

pref: 弥勒登录页添加跳转到 集成登录

parent beb2947e
Pipeline #92619 waiting for manual action with stages
import styles from './index.less'
import React, { forwardRef, useEffect, useRef, useState } from 'react'; import React, { forwardRef, useEffect, useRef, useState } from 'react';
import LoginAction from '../../../login';
import Account from './useAccount';
import moment from 'moment'; import moment from 'moment';
import classnames from 'classnames'; import classnames from 'classnames';
import { Modal, Popover } from 'antd'; import { Modal, Popover } from 'antd';
...@@ -9,17 +6,20 @@ import { Helmet, HelmetProvider } from 'react-helmet-async'; ...@@ -9,17 +6,20 @@ import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useHistory, withRouter } from '@wisdom-utils/runtime'; import { useHistory, withRouter } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import QRCode from 'qrcode.react';
import defaultSetting from '../../../../../../../config/defaultSetting'; import defaultSetting from '../../../../../../../config/defaultSetting';
import { defaultApp } from '../../../../../../micro'; import { defaultApp } from '../../../../../../micro';
import logo from './images/logo.png'; import logo from './images/logo.png';
import logoBg from './images/loginTitle.png' import logoBg from './images/loginTitle.png';
import Krpano from '../../../components/Krpano'; import Krpano from '../../../components/Krpano';
import QRCode from 'qrcode.react'; import Account from './useAccount';
import LoginAction from '../../../login';
import styles from './index.less';
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]; const value = qrcodes[0].replace(/{ip}/gi, props.ip || window.location.host).split('=')[1];
return <QRCode value={value} />; return <QRCode value={value} />;
} }
return <span>手持APP下载未配置</span>; return <span>手持APP下载未配置</span>;
...@@ -36,16 +36,11 @@ const MiLeLogin = forwardRef((props, _ref) => { ...@@ -36,16 +36,11 @@ const MiLeLogin = forwardRef((props, _ref) => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const history = useHistory(); const history = useHistory();
const [dateObj, setDateObj] = useState({}); const [dateObj, setDateObj] = useState({});
const { projectName} = props.loginParams const { projectName } = props.loginParams;
const [action, setAction] = useState( const [action, setAction] = useState(() => new LoginAction(Object.assign({}, props, { history }), setVisible, false));
() =>
new LoginAction(Object.assign({}, props, { history }), setVisible, false),
);
const qrcodes = props.global?.qrcode?.split('|') ?? []; const qrcodes = props.global?.qrcode?.split('|') ?? [];
const logoImage = const logoImage =
props?.global?.logo?.indexOf('CityTemp') > -1 props?.global?.logo?.indexOf('CityTemp') > -1 ? props?.global?.logo : `civweb4/${props?.global?.logo}`;
? props?.global?.logo
: `civweb4/${props?.global?.logo}`;
const handleSubmit = values => { const handleSubmit = values => {
/* eslint-disable */ /* eslint-disable */
...@@ -87,11 +82,19 @@ const MiLeLogin = forwardRef((props, _ref) => { ...@@ -87,11 +82,19 @@ const MiLeLogin = forwardRef((props, _ref) => {
action.events.on('loginVisible', status => { action.events.on('loginVisible', status => {
setVisible(status); setVisible(status);
}); });
action.events.on('loginHomePage', () => {
props.history.push(`/homePage`);
});
action.events.on('loginIndustry', () => {
props.history.push(`/industry`);
});
// } // }
return () => { return () => {
action && action.events && action.events.removeAllListeners('loginSuccess'); action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError'); action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible'); action && action.events && action.events.removeAllListeners('loginVisible');
action && action.events && action.events.removeAllListeners('loginHomePage');
action && action.events && action.events.removeAllListeners('loginIndustry');
} }
}, [props.loginMode]); }, [props.loginMode]);
......
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