Commit 39c888b0 authored by 王万里's avatar 王万里

feat: 高要登录页定制开发

parent 2f452290
......@@ -37,6 +37,7 @@ import JiangXiNew from './template/project/jiangxiNew';
import Queshan from './template/project/queshan';
import Queshansl from './template/project/queshansl';
import PiZhouLogin from './template/project/pizhou';
import GaoyaoLogin from './template/project/gaoyao';
import { AppInitState } from '../../../render';
const LoginTemplate = {
'新春.html': baseLoginNewYear,
......@@ -70,6 +71,7 @@ const LoginTemplate = {
'项目 - 确山.html': Queshan,
'项目 - 确山水利.html': Queshansl,
'项目 - 邳州.html': PiZhouLogin,
'项目 - 高要.html': GaoyaoLogin,
default: BaseLogin,
};
/* eslint-disable */
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
import React, { forwardRef, useEffect, useRef, useState } from 'react';
import { Modal, Popover } from 'antd';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux';
import { useHistory, withRouter } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store';
import QRCode from 'qrcode.react';
import classnames from 'classnames';
import moment from 'moment';
import defaultSetting from '../../../../../../../config/defaultSetting';
import LoginAction from '../../../login';
import styles from './index.less';
import Account from '../../../js/useAccount';
import { defaultApp } from '../../../../../../micro';
import logo from './images/5.png';
import loginTitlePng from './images/9.png'
import qrcodePng from './images/1.png'
const PopOvercontent = () =>{
const qrcodes = window.globalConfig && window.globalConfig.qrcode;
if (qrcodes) {
return <QRCode value={qrcodes}/>;
}
return <span>手持APP下载未配置</span>;
}
const Login = forwardRef((props, _ref) => {
const sliVerify = useRef();
const loginFormRef = useRef();
const formRef = useRef(null);
const [status, setStatus] = useState('normal');
const [autoLogin, setAutoLogin] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [type, setType] = useState('Account');
const [visible, setVisible] = useState(false);
const history = useHistory();
const [action, setAction] = useState(() => new LoginAction(Object.assign({}, props, { history }), setVisible, false));
const [dateObj, setDateObj] = useState({});
const handleSubmit = values => {
/* eslint-disable */
action &&
(type === 'Account'
? action.loginHandler(values.userName, values.password, null, autoLogin, sliVerify)
: type === 'Mobile'
? action.phoneLoginFormHandler(values.mobile, values.captcha)
: null);
setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1);
};
useEffect(() => {
action &&
action.events.on('loginSuccess', event => {
setSubmitting(false);
props.updateCurrentIndex && props.updateCurrentIndex(0);
props.history.push(`/?client=${props.global.client}`);
// window.share.event.emit('triggerMicro', props.global);
// initMicroApps();
defaultApp();
});
action &&
action.events.on('loginError', event => {
setVisible(false);
setSubmitting(false);
});
action &&
action.events.on('loginVisible', status => {
setVisible(status);
});
return () => {
action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible');
};
}, [props.loginMode]);
useEffect(() => {
setSubmitting(false);
}, [visible]);
const renderPlatform = () => {
const template = props.global.loginTemplate;
const params = {
fromRef: formRef,
type,
setType,
status,
submitting,
autoLogin,
setAutoLogin,
action,
onSubmit: handleSubmit,
loginMode: props.loginMode,
updateLoginMode: props.updateLoginMode,
welcome: null,
};
return <Account {...params} />;
};
/* eslint-disable */
const handleWeek =() => {
const weekOfDay = Number(moment().format('E'));
console.log(weekOfDay, "weekOfDay")
let weekDayName = ''
switch(weekOfDay){
case 1:
weekDayName = '周一'
break
case 2:
weekDayName = '周二'
break
case 3:
weekDayName = '周三'
break
case 4:
weekDayName = '周四'
break
case 5:
weekDayName = '周五'
break
case 6:
weekDayName = '周六'
break
case 7:
weekDayName = '周日'
break
default:
weekDayName = ''
}
return weekDayName
}
useEffect(()=>{
const timer = setInterval(() => {
setDateObj({
curTime: moment().format('HH:mm:ss'),
week: handleWeek(),
date: moment().format('YYYY/MM/DD')
});
}, 1000);
return () => {
clearInterval(timer);
};
}, [])
return (
<HelmetProvider>
<Helmet>
<title>{props.global.title || defaultSetting.title}</title>
<meta name="description" content={props.global.title || defaultSetting.title} />
</Helmet>
<div className={classnames(styles.gaoyaologin)}>
<div className={styles['login-header']}>
<img
role="logo"
src={
props.global &&
props.global.transformDevAssetsBaseURL &&
props.global.transformDevAssetsBaseURL(props.global.logo)
}
/>
<div className={styles['cn-title']}>肇庆市高要区城乡一体供水智慧化管理平台</div>
</div>
<div className={styles['inner-wrapper']}>
<div className={styles['welcome']}>欢迎登录</div>
<div className={styles['login-form']}>
{renderPlatform()}
</div>
<Popover content={PopOvercontent} title="扫码下载APP" placement="topLeft" overlayClassName={'popover-style'}>
<img src={qrcodePng} alt="APP" className={styles['qrcode-box']}/>
</Popover>
</div>
<Modal centered visible={visible} width={340} footer={null} closable={false} bodyStyle={{ padding: '15px' }}>
<div ref={sliVerify} />
</Modal>
</div>
</HelmetProvider>
);
});
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
loginMode: state.getIn(['global', 'loginMode']),
});
const mapDispatchToProps = dispatch => ({
updateConfig(config) {
dispatch(actionCreators.getConfig(config));
},
createContext(data) {
dispatch(actionCreators.createContext(data));
},
updateLoginMode(mode) {
dispatch(actionCreators.changeLoginMode(mode));
},
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withRouter(Login));
.gaoyaologin {
width: 100%;
height: 100%;
background: url('./images/8.png') no-repeat;
background-size: 100% 100%;
background-clip: border-box;
position: relative;
min-height: 7.0rem;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.login-block {
width: 500px;
margin: 60px 0 150px 0;
position: relative;
.login-form {
background-color: rgba(255, 255, 255, 0.5);
border-radius: 4px;
box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.2);
padding: 50px;
& > div {
width: 100%;
}
.rememberpwd input[type="checkbox"] {
width: 16px;
height: 16px;
}
.form-group input {
font-size: 16px;
}
.rememberpwd span {
position: relative;
top: -3px;
}
button[type="submit"] {
width: 100%;
background-color: #35B2F1 !important;
border: none !important;
color: #fff !important;
outline: none !important;
border-color: transparent !important;
}
.glyphicon {
color: #35B2F1;
}
.input-group-addon {
background-color: #fff;
}
.input-lg,
.btn-lg {
height: 40px;
}
}
.loginCcode {
width: 34px;
height: 34px;
position: absolute;
right: -34px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
border-radius: 0 3px 3px 0;
cursor: pointer;
bottom: 3px;
&:hover {
display: block;
background: transparent;
img {
display: none;
}
.codeBig {
display: block;
}
}
img {
width: 23px;
}
.codeBig {
width: 140px;
height: 140px;
position: absolute;
bottom: 0;
left: 0px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
display: none;
span {
font-size: 12px;
opacity: 0.75;
}
}
}
}
.inner-bg {
width: 100%;
height: 100%;
&>div {
width: 80%;
margin: 10%;
}
}
.inner-wrapper {
position: relative;
width: 500px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 60px 0 150px;
background-color: hsla(0,0%,100%,.5);
border-radius: 4px;
box-shadow: 3px 3px 5px 0 rgba(0,0,0,.2);
padding: 50px;
// top: 43%;
// margin-top: -190px;
// top: 46%;
// right: 0;
// transform: translateY(-50%);
.login-form {
width: 100%;
& > div {
width: 100%;
}
.rememberpwd input[type="checkbox"] {
width: 16px;
height: 16px;
}
.form-group input {
font-size: 16px;
}
.rememberpwd span {
position: relative;
top: -3px;
}
button[type="submit"] {
width: 100%;
background-color: #35B2F1 !important;
border: none !important;
color: #fff !important;
outline: none !important;
border-color: transparent !important;
}
.glyphicon {
color: #35B2F1;
}
.input-group-addon {
background-color: #fff;
}
.input-lg,
.btn-lg {
height: 40px;
}
}
}
.inner-bg .title {
font-size: 27px;
font-weight: bold;
color: rgba(255, 255, 255, 1);
letter-spacing: 2px;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.inner-center {
position: relative;
// width: 480px;
// height: 380px;
// background: rgba(255,255,255,0.9);
// border: 1px solid #FFFFFF;
// box-shadow: 1px 1px 12px -3px #22222277;
// border-radius: 8px 10px 10px 10px;
// width: 500px;
// background-color: hsla(0,0%,100%,.5);
// border-radius: 4px;
// box-shadow: 3px 3px 5px 0 rgba(0,0,0,.2);
// padding: 50px;
}
.welcome{
width: 100%;
text-align: left;
font-size: 20px;
margin-bottom: 15px;
}
.formgroup2 {
display: flex;
align-items: center;
display: flex;
margin: 0px 5.5%;
margin-bottom: 10%;
align-items: center;
margin-bottom: 40px;
}
.APPcodeBox {
width: 100%;
display: flex;
flex-flow: column;
align-items: center;
cursor: pointer;
position: relative;
}
.APPCtext {
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #000000;
line-height: 30px;
opacity: 0.75;
}
.login-header{
width: 100%;
// position: absolute;
// top: 30px;
// padding: 0 38px;
display: flex;
justify-content: center;
align-items: center;
.cn-title{
font-size: 50px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #FFFFFF;
margin-left: 10px;
}
.right-timebox{
display: flex;
justify-content: center;
align-items: center;
height: 60px;
.curr-time{
width: 140px;
font-size: 36px;
font-family: Microsoft YaHei;
font-weight: 300;
color: #FFFFFF;
}
.curr-week-date{
margin-left: 10px;
.curr-week{
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #FFFFFF;
}
.curr-date{
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #FFFFFF;
}
}
}
}
.copyright{
position: absolute;
bottom: 7%;
width: 100%;
margin: 0 auto;
font-size: 12px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #F1F6FD;
text-align: center;
}
.qrcode-box{
position: absolute;
bottom: 0;
right: -23px;
width: 23px;
height: 23px;
background: #FFFFFF;
opacity: 0.8;
cursor: pointer;
}
}
:global{
.popover-style{
.@{ant-prefix}-popover-inner-content{
display: flex;
justify-content: center;
align-items: center;
}
.@{ant-prefix}-popover-title{
display: flex;
justify-content: center;
align-items: center;
}
}
}
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