Commit a00d6730 authored by 罗剑's avatar 罗剑

fix: 澄迈登录页

parent c6cef1d6
Pipeline #65514 passed with stages
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.
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 } from 'antd';
import { Helmet, HelmetProvider } from 'react-helmet-async';
/* eslint-disable */
/*
* @Author: xule;
* @Date: 2021-11-22
* @Description:榆林登录页;
*/
import React from 'react';
import styles from './index.less'
import classNames from 'classnames';
import { connect } from 'react-redux';
import { useHistory, withRouter } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store';
import defaultSetting from '../../../../../../../config/defaultSetting';
import { CheckOutlined } from '@ant-design/icons';
import { withRouter } from '@wisdom-utils/runtime';
import LogoQ from './images/切换.png'
import LogoF from './images/电脑切换.png'
import qrcodeimg from './images/下载二维码.png'
import qrcodeS from './images/扫.png'
import Logo from './images/登录图标.png'
import Logoimg from './images/登录logo.png'
import Code from '@/assets/images/login/榆林/小程序@2x.png'
import MyHead from '@/assets/images/login/榆林/d-我的.png'
import PassWord from '@/assets/images/login/榆林/密码.png'
import Close from '@/assets/oa/login/close.png'
import Open from '@/assets/oa/login/open.png'
import LoginAction from '../../../login';
import styles from './index.less';
import Account from '../../../js/useAccount';
import { defaultApp } from '../../../../../../micro';
import { actionCreators } from '@/containers/App/store';
import Cookies from 'js-cookie';
import QRCode from 'qrcode.react';
import classnames from 'classnames';
const renderQRCode = props => {
const qrcodes = props.qrcode.split('|') || [];
if (qrcodes.length > 0 && qrcodes[0]) {
let value = qrcodes[0].replace(/{ip}/gi, props.ip || window.location.host).split('=')[1];
return <QRCode value={value} />;
}
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 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);
import { defaultApp } from '../../../../../../micro';
const Logger = logger('login');
// 、登录页
class InfoLogin extends React.Component {
state = {
loginStyle: false, //true 账号密码登录 false 扫码登录
isOpen: false, //查看密码
isRember: false, //记住密码
ddOrWeixin: '',
qrcode: '',//二维码
codeLenth: 1,
time: '',
week: '',
date: '',
isQrcode: false
}
componentDidMount() {
let action = new LoginAction(this.props, false, true)
this.loginEvent(action);
this.renderQRcode();
this.renderTime();
}
renderQRcode() {
var me = this;
var list = globalConfig.qrcode ? globalConfig.qrcode.split("|") : [];
let str = [];
if (list.length) {
list.forEach(function (val, index) {
if (val && val.replace(/ /g, "").length > 0) {
str.push(me.creatCodeHtml(val, index));
}
})
} else {
str.push(<span>手持APP下载未配置</span>);
}
this.setState({
qrcode: str,
codeLenth: list.length
})
}
renderTime() {
let me = this;
setInterval(() => {
const date = new Date();
const weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const time = `${date.getHours() < 10 ? `0${date.getHours()}` : date.getHours()
}:${date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes()}`;
me.setState({
time,
week: weekday[date.getDay()],
date: date.pattern('yyyy/MM/dd'),
})
}, 1000);
setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1);
};
}
creatCodeHtml(val, index) {
return (
<div className={('codeCase codeCase' + index)}>
<QRCode value={val.replace(/{ip}/ig, globalConfig.ip).split('=')[0]} />
<div className={styles.codeText}>{val.replace(/{ip}/ig, globalConfig.ip).split('=')[0]}</div>
</div>);
}
// 切换登录方式
changeloginStyle = () => {
const { ddOrWeixin } = this.state
this.setState({
loginStyle: !this.state.loginStyle,
ddOrWeixin: ddOrWeixin ? '' : 'dingding'
}, () => {
Cookies.set('loginMode', `${this.state.ddOrWeixin ? 'dingding' : 'pdw'}`, {
path: '/',
});
if (this.state.ddOrWeixin === 'dingding') {
let action = new LoginAction(this.props, false, true)
action.loginByDD()
}
})
}
// 查看密码
seePassWord = (e) => {
this.setState({
isOpen: !this.state.isOpen
})
}
// 记住密码
remberWord = () => {
this.setState({
isRember: !this.state.isRember
})
}
// 输入框变化
handleForm = (e) => {
const target = e.target
// 判断事件类型,如果是checkbox返回checked值,不是返回文本框的value值
const value = target.type == 'checkbox' ? target.checked : target.value;
// 获取文本框的name值
const name = target.name
this.setState({
[name]: value
})
}
onKeyDownchange(e){
if(e.keyCode == 13){
this.loginToWeb5();
}
}
//
checkLogType = () => {
this.setState({
isQrcode: !this.state.isQrcode
})
}
// 登录
loginToWeb5 = () => {
const { loginName, passWord, isRember } = this.state
let action = new LoginAction(this.props, false, true)
action.loginHandler(loginName, passWord, null, isRember, false)
this.loginEvent(action)
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();
}
// 登录成功事件
loginEvent(action) {
action.globalConfig = this.props.global;
this.props.updateCurrentIndex && this.props.updateCurrentIndex(-1);
action && action.events.on('loginSuccess', event => {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
this.props.history.push(`/?client=${this.props.global.client}`);
// window.share.event.emit('triggerMicro', this.props.global);
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 */
action && action.events.on('loginError', event => {
});
action && action.events.on('loginVisible', status => {
});
}
render() {
const { loginStyle, isOpen, isRember, loginName, passWord, qrcode, codeLenth, time, week, date, isQrcode } = this.state
return (
<HelmetProvider>
<Helmet>
<title>{props.global.title || defaultSetting.title}</title>
<meta name="description" content={props.global.title || defaultSetting.title} />
</Helmet>
<div className={styles.login}>
<div className={styles['inner-wrapper']}>
<div className={styles['inner-center']}>
<div className={styles['img-wrapper']} />
<div className={classnames(styles['inner-bg'], styles['login-part'])} ref={loginFormRef}>
{renderPlatform()}
<div className={styles.InfoBg}>
<div className={styles.IBtimeBox}>
<div className={styles.TitleCont}>
<img src={Logoimg} alt=""></img>
</div>
<div className={styles['APPcodeBox']}>
<p className={styles['APPCtext']}>查看二维码,扫码下载APP</p>
<div className={styles['APPCimg']}>{renderQRCode(props.global)}</div>
<span className={styles.IBTtime}>{time}</span>
<span className={styles.IBTweek}>{week}</span>
<span className={styles.IBTdate}>{date}</span>
</div>
<div className={styles.loginBg}>
{/* 标题 */}
{/* <div className={styles.IBtitle}>
<img src={Logo} alt="" />
</div> */}
<div className={styles.IBcenter}>
<div className={styles.IBCleft}></div>
<div className={styles.IBCright}>
<div className={styles.IBlogoc}>
<img src={isQrcode ? LogoF : LogoQ} alt='' onClick={() => this.checkLogType()}></img>
</div>
<div className={styles.IBLogoForm} style={{ display: isQrcode ? 'none' : '' }}>
<div className={styles.IBlogo}>
<img src={Logo} alt=''></img>
</div>
{/* 登录主题 */}
<form className={styles.loginForm} >
<div className={styles.formgroup}>
<img className={styles.IBCRimg} src={MyHead} alt="" />
<input type="text" className={styles.inputLg} id='loginName' name='loginName' value={loginName} onChange={this.handleForm} placeholder="请输入你的用户名" />
</div>
<div className={styles.formgroup}>
<img className={styles.IBCRimg} src={PassWord} alt="" />
<input type={isOpen ? 'text' : "password"} className={styles.inputLg} onKeyDown={e=> this.onKeyDownchange(e)} id='passWord' name='passWord' value={passWord} onChange={this.handleForm} placeholder="请输入你的密码" />
<img className={styles.eyes} src={isOpen ? Open : Close} alt="" onMouseDown={(e) => this.seePassWord(e)} onMouseUp={(e) => this.seePassWord(e)} />
</div>
<div className={styles.formgroup} style={{ position: 'relative', marginTop: '20px' }}>
<label className={classNames(isRember ? (styles.rmpwdInput, styles.active) : styles.rmpwdInput)} onClick={() => this.remberWord()}>
<CheckOutlined style={{ display: isRember ? '' : 'none' }} />
</label>
<span style={{ color: '#9FA8B3', marginLeft: '10px', fontSize: '14px' }}>记住密码</span>
</div>
<div className={styles.logoBtn}>
<div className={styles.submitBtn} onClick={this.loginToWeb5}>登录</div>
</div>
</form>
</div>
<div className={styles.IBLogoForm} style={{ display: isQrcode ? '' : 'none' }}>
<div className={styles.QrcodeCont}>
<img src={qrcodeimg} alt=''></img>
</div>
<div className={styles.qrcodedis}>
<img src={qrcodeS} alt=''></img>
<div className={styles.textCont}>
<p>打开手机扫一扫</p>
<p>
<span>下载</span>
<span className={styles.lastText}>熊猫掌天下</span>
</p>
</div>
</div>
</div>
</div>
{/* <div className={styles.codeBox}>
<img className={styles.codeImg} src={Code} alt="" />
<div className={styles.codeBig} style={{ width: codeLenth * 148 + 'px' }}>
{qrcode}
</div>
</div> */}
</div>
</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']),
......@@ -149,4 +262,5 @@ const mapDispatchToProps = dispatch => ({
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withRouter(Login));
)(withRouter(InfoLogin));
.login {
.InfoBg{
width: 100%;
height: 100%;
background: url('./images/2.png') no-repeat center;
background-size: 100% 100%;
background-clip: border-box;
background-image: url('./images/背景.png');
background-size: cover;
background-repeat: no-repeat;
position: relative;
min-height: 7.0rem;
overflow: hidden;
}
.login .inner-bg {
.loginBg{
position: absolute;
top: 40%;
left: 40%;
margin-left: -385px;
margin-top: -226px;
width: 1101px;
height: 646px;
background-image: url('./images/标题.png');
background-size: 100% 100%;
background-repeat: no-repeat;
.IBcenter{
width: 100%;
height: 596px;
margin-top: 50px;
.IBCleft{
width: 682px;
height: 100%;
&>div {
width: 70%;
margin: 0 auto;
}
}
.inner-wrapper {
width: 29.6%;
position: absolute;
top: 46%;
right: 0;
transform: translateY(-50%);
}
.img-wrapper {
width: 388px;
height: 134px;
background: url('./images/1.png') no-repeat center;
background-image: url('./images/左图.png');
background-size: 100% 100%;
margin-bottom: 48px;
}
.login .inner-bg img[role="logo"] {
background-repeat: no-repeat;
float: left;
}
.IBCright{
width: 419px;
height: 100%;
float: left;
background: rgba(255,255,255,0.8);
.IBlogoc{
height: 74px;
width: 100%;
text-align: end;
img{
height: 74px;
width: 74px;
cursor: pointer;
}
}
.IBLogoForm{
.IBlogo{
height: 100px;
width: 100%;
text-align: center;
img{
height: 100px;
width: 100px;
}
}
.QrcodeCont{
text-align: center;
height: 360px;
width: 100%;
padding-top: 80px;
img{
width: 211px;
height: 211px;
}
}
.qrcodedis{
display: flex;
padding: 0px 40px 0px 105px;
img{
width: 48px;
height: 40px;
}
margin-top: 10px;
}
.textCont{
margin-left: 25px;
font-size: 16px;
p{
margin-bottom: 5px;
color: #333333;
.lastText{
margin-left: 5px;
color: #1568BA;
}
}
}
}
}
}
}
.login .inner-bg .title {
font-size: 27px;
.IBtitle{
width: 100%;
height: 10.5%;
text-align: center;
img{
width: 70%;
height: 100%;
}
}
.title{
font-family: SourceHanSansCN-Medium;
font-weight: bold;
color: rgba(255, 255, 255, 1);
letter-spacing: 2px;
}
@keyframes waving {
from {
top: 0;
color: #43484D;
position: absolute;
top: 21px;
right: 50%;
margin-right: -285px;
line-height: 1;
width: 570px;
text-align: center;
overflow-wrap: break-word;
font-size: 24px;
img{
margin-right: 14px;
}
to {
top: 10px;
}
}
@keyframes waving2 {
from {
left: 0;
.ddCode{
position: absolute;
top: 50px;
right: -9px;
cursor: pointer;
}
to {
left: -9999px;
.titleImg {
position: absolute;
top: 132px;
right: 133px;
}
}
.form-control:focus {
border-color: #66afe9;
.loginForm{
width: 280px;
margin: 9% auto 25%;
.formgroup{
position: relative;
line-height: 1;
display: flex;
align-items: center;
.IBCRimg{
top: 33px;
}
img{
position: absolute;
left: 10px;
top: 50%;
}
.eyes{
left: 89%;
margin-top: 10px;
cursor: pointer;
}
input[type="checkbox"] {
width: 12px;
height: 12px;
}
input {
font-size: 16px;
outline: 0;
-webkit-box-shadow: none;
}
span {
position: relative;
top: 0px;
}
.formControl{
display: block;
width: 100%;
}
.inputLg{
padding-left: 42px;
color: #2D3033;
border: none;
box-shadow: none;
}
border-radius: 0;
padding: 10px 50px;
line-height: 1.3333333;
margin-top: 21px;
}
.inner-center {
display: flex;
flex-flow: column;
align-items: center;
}
}
.logoBtn{
margin-top: 50px;
height: 45px;
width: 100%;
padding-left: 30px;
.submitBtn {
width: 220px;
background-color: #1568BA !important;
border: none !important;
color: #fff !important;
outline: none !important;
border-color: transparent !important;
height: 45px;
line-height: 45px;
font-size: 18px;
text-align: center;
cursor: pointer;
border-radius: 23px;
}
}
.formgroup2 {
display: flex;
}
.login_container {
position: absolute;
top: 59%;
left: 52%;
margin-left: 150px;
margin-top: -219px;
width: 400px;
height: 500px;
}
.wxlogin_container{
position: absolute;
top: 60%;
left: 55%;
margin-left: 150px;
margin-top: -219px;
width: 300px;
height: 300px;
background: #fff;
}
.changeCode {
position: absolute;
top: 80%;
left: 75%;
align-items: center;
font-size: 14px;
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;
}
.IBCRnamec{
margin-top: 15%;
height: 22px;
font-size: 22px;
letter-spacing: 1px;
font-family: PingFang SC;
font-weight: bold;
color: #0599F4;
line-height: 37px;
text-align: center;
margin-bottom: 0;
}
.IBCRnameE{
height: 9px;
font-size: 1px;
color: #0599F4;
line-height: 32px;
text-align: center;
}
.rmpwdInput{
display: inline-block;
width: 20px;
height: 20px;
border-radius: 10px;
border: 1px solid #0599F4;
position: relative;
cursor: pointer;
margin-left: 8px;
span{
font-size: 12px;
color: #fff;
visibility: hidden;
position: absolute;
top: 3px;
left: -7px;
}
}
.active{
display: inline-block;
width: 20px;
height: 20px;
border-radius: 10px;
border: 1px solid #0599F4;
position: relative;
}
.APPCtext {
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #000000;
line-height: 30px;
opacity: 0.75;
}
.APPCimg {
width: 138px;
cursor: pointer;
background-color: #0599F4;
margin-left: 10px;
span{
visibility: visible;
color: #fff;
font-size: 15px;
color: #fff;
position: absolute;
top: 3px;
left: 1px;
font-weight: bold;
}
}
.codeBox{
width: 34px;
height: 34px;
position: absolute;
right: -34px;
bottom: 0px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
border-radius: 0 3px 3px 0;
cursor: pointer;
}
.codeImg{
width: 23px;
}
.codeBig{
width: 128px;
height: 150px;
background: url('./images/3.png');
background-size: 100% 100%;
background-repeat: no-repeat;
display: none;
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
padding: 23px 11px 12px;
span {
bottom: 0;
left: 0px;
background: rgba(255, 255, 255, 0.7);
padding: 6px;
display: none;
justify-content: space-around;
span{
font-size: 12px;
opacity: 0.75;
font-weight: 100;
}
}
.APPcodeBox:hover .APPCtext {
color: #1685FF;
}
.APPcodeBox:hover .APPCimg {
display: flex;
}
.APPCimg .codeCase {
}
.codeBox:hover .codeBig{
display: block;
}
.codeBox:hover .codeImg{
display: none;
}
.codeText{
font-size: 14px;
font-family: PingFang SC;
font-weight: bold;
color: #121F2B;
text-align: center;
padding-top: 32px;
line-height: 24px;
}
.codeBox:hover .codeBig {
display: flex;
}
.IBtimeBox{
.TitleCont{
padding: 24px 0px 0px 32px;
img{
width: 496px;
height: 56px;
}
}
}
.IBTtime{
position: absolute;
width: 88px;
height: 26px;
font-size: 32px;
font-family: Microsoft YaHei UI;
font-weight: 400;
color: #FFFFFF;
line-height: 34px;
top: 34px;
right: 130px;
}
.IBTweek{
position: absolute;
top: 25px;
right: 69px;
height: 15px;
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 200;
color: #FFFFFF;
line-height: 30px;
}
.IBTdate{
position: absolute;
top: 46px;
right: 36px;
width: 80px;
height: 13px;
font-size: 14px;
font-family: Microsoft YaHei UI;
font-weight: 300;
color: #FFFFFF;
line-height: 30px;
}
}
\ No newline at end of file
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