Commit c6b9a586 authored by 邓超's avatar 邓超

fix: 新增江西登录模板

parent 9c711051
Pipeline #74348 passed with stages
......@@ -44,9 +44,15 @@ export const API = {
VALID_DEFAULT_PWD: '/PandaCore/GCK/BussinessAuth/ValidToken', // 校验是否是默认密码
GET_InOnLine: '/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', // 广州登陆接口
GET_UserMobile: '/PandaEnergy/GZshuiwuju/SingleLogin/SingleLoginByAccess_token', // 获取登录手机号
GET_JIANGXI_MANAGE: '/PandaWorkFlow/WorkFlow/JiangXiManage/Login', // 江西登录接口
};
const services = {
getJiangXiManage: {
url: API.GET_JIANGXI_MANAGE,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
getInOnLine: {
url: API.GET_InOnLine,
method: constants.REQUEST_METHOD_GET,
......
......@@ -30,6 +30,7 @@ import YixianLogin from './template/project/yixian';
import LixianLogin from './template/project/lixian';
import DazuLogin from './template/project/dazu';
import PanoramaLogin from './template/panorama';
import JiangXi from './template/project/jiangxi';
import { AppInitState } from '../../../render';
const LoginTemplate = {
'新春.html': baseLoginNewYear,
......@@ -56,6 +57,7 @@ const LoginTemplate = {
'项目 - 南宁绿城.html': LvchengLogin,
'项目 - 浦口.html': PukouLogin,
'全景图.html': PanoramaLogin,
'项目 - 江西.html': JiangXi,
default: BaseLogin,
};
/* eslint-disable */
......
......@@ -1102,7 +1102,39 @@ class Login {
}
}
}
loginHandlerJiangXi(user, pwd, userPhone, isRememberPWD, ref) {
const self = this;
if (user && pwd) {
if (self.loginFailed && self.captchaObj) {
self.captchaObj.verify();
} else if (self.hasTry) {
self.slideVerify(ref, () => {
self.loginJiang(user, pwd, userPhone, isRememberPWD);
});
} else {
self.loginJiang(user, pwd, userPhone, isRememberPWD);
}
}
}
loginJiang(usr, pwd, userPhone, isRememberPWD, mode = SERVICE_APP_LOGIN_MODE.password) {
this.globalConfig = getGlobalConfig();
const self = this;
appService
.getJiangXiManage({
username: usr,
password: btoa(pwd),
'request.preventCache': Date.now(),
})
.then(response => {
self.transformLoginHander({token: response.data.user_token}, isRememberPWD, pwd);
})
.catch(error => {
self.hasTry = true;
self.handleLoginError();
self.events.emit('loginError', error.message);
message.error('登录服务异常');
});
}
phoneLoginFormHandler(userPhone, captcha) {
this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone);
}
......
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, 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 moment from 'moment';
import classnames from 'classnames';
import QRCode from 'qrcode.react';
import defaultSetting from '../../../../../../../config/defaultSetting';
import LoginAction from '../../../login';
import styles from './index.less';
import Account from '../../../js/useAccount';
import { defaultApp } from '../../../../../../micro';
import logoPng from './images/8.png';
import qrcodePng from './images/1.png';
import welcomePng from './images/4.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 [loginType, setLoginType] = useState('4a平台');
const handleSubmit = values => {
/* eslint-disable */
action &&
(type === 'Account'
? loginType === '4a平台'
? action.loginHandlerJiangXi(values.userName, values.password, null, autoLogin, sliVerify)
: 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'));
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 0:
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);
};
}, []);
const toLink = () => {
window.open('http://gis.panda-water.cn/jiangxi/index.html');
};
return (
<HelmetProvider>
<Helmet>
<title>{props.global.title || defaultSetting.title}</title>
<meta name="description" content={props.global.title || defaultSetting.title} />
</Helmet>
<div className={classnames(styles.lvchenglogin, 'lvcheng')}>
<div className={styles['inner-wrapper']}>
<div className={styles['title-image-box']}>
<img src={logoPng} alt="" className={styles['title-image']} />
<span className={styles['title-name']}>江西省水务集团有限公司 - 智慧水务平台</span>
</div>
<div className={styles['inner-center']}>
<div className={styles['welcome-title']}>
<div
className={classnames(styles.tabItem, { [styles.tabActive]: loginType === '4a平台' })}
onClick={() => setLoginType('4a平台')}
>
4a平台
</div>
<div
className={classnames(styles.tabItem, { [styles.tabActive]: loginType === '熊猫平台' })}
onClick={() => setLoginType('熊猫平台')}
>
熊猫平台
</div>
</div>
<div className={classnames(styles['inner-bg'], styles['login-part'])} ref={loginFormRef}>
{renderPlatform()}
</div>
{/* <Popover content={PopOvercontent} title="扫码下载APP" overlayClassName={'popover-style'}>
<img src={qrcodePng} alt="APP" className={styles['qrcode-box']} />
</Popover> */}
</div>
</div>
<div className={styles['login-header']}>
{/* <div className={styles['left-title']}>
<img src={logoPng} alt='logo' className={styles['logo-png']}/>
<div className={styles['cn-title']}>南宁市二次供水管理平台</div>
</div> */}
<div className={styles['right-timebox']}>
<div className={styles['curr-time']}>{dateObj.curTime}</div>
<div className={styles['curr-week-date']}>
<div className={styles['curr-week']}>{dateObj.week}</div>
<div className={styles['curr-date']}>{dateObj.date}</div>
</div>
</div>
</div>
<div className={styles.linkBox} onClick={toLink}>
<img src={require('./images/9.png')} alt="" />
APP下载
</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));
@font-face {
font-family: PingFang SC;
src: url('@/assets/fonts/PingFang.ttf');
}
.lvchenglogin {
width: 100%;
height: 100%;
background: url('./images/2.jpg') no-repeat;
background-size: 100% 100%;
background-clip: border-box;
position: relative;
min-height: 7.0rem;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
.inner-bg {
width: 100%;
// height: 100%;
&>div {
width: 70%;
margin: 0 auto;
}
}
.inner-wrapper {
position: relative;
width: 100%;
// height: 380px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 10px;
margin-top: -100px;
// margin-bottom: 100px;
}
.title-image-box {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 50px;
}
.title-image {
width: 59px;
margin-right: 20px;
}
.title-name {
font-size: 36px;
font-family: PingFang SC;
font-weight: 500;
color: #FFFFFF;
text-shadow: 0px 1px 5px rgba(6, 27, 54, 0.8);
letter-spacing: 2px;
}
.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: 600px;
// height: 316px;
// background: rgba(255,255,255, 0.3);
// border: 1px solid #FFFFFF;
// box-shadow: 0px 15px 15px 3px rgba(140,142,145,0.52);
border-radius: 10px;
background: rgba(255, 255, 255, 0.3);
border-radius: 15px 15px 0px 15px;
box-shadow: 0px 6px 18px 0px rgb(25 61 79 / 35%);
padding: 20px 0;
}
.welcome-title {
width: 100%;
height: 50px;
// background: linear-gradient(0deg, rgba(9, 128, 238, 1) 0%, rgba(0, 182, 251, 1) 100%);
border-radius: 10px 10px 0 0;
padding: 16px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40px;
.tabItem {
padding: 5px 15px;
cursor: pointer;
text-align: center;
font-size: 20px;
font-weight: bold;
color: #B4AEAE;
margin-left: 15px;
}
.tabActive {
border-bottom: 3px solid #1E77D3;
color: #080A10;
}
}
.welcome-img {
width: 480px;
}
.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: 0;
height: 90px;
padding: 0 70px;
display: flex;
justify-content: flex-end;
align-items: center;
box-shadow: 0px 1px 3px 0px rgba(235, 235, 235, 0.55);
.left-title {
display: flex;
justify-content: center;
align-items: center;
.cn-title {
font-size: 28px;
font-family: PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
.logo-png {
width: 54px;
margin-right: 20px;
}
}
.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: #5f718c;
}
.curr-week-date {
margin-left: 10px;
.curr-week {
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #5f718c;
}
.curr-date {
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #5f718c;
}
}
}
}
.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;
}
.linkBox {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
left: 50%;
transform: translateX(-50%);
bottom: 100px;
color: #FF8F1F;
font-size: 20px;
cursor: pointer;
img {
width: 35px;
margin-bottom: 5px;
}
}
}
: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;
}
}
}
@keyframes waving {
from {
top: 0;
}
to {
top: 10px;
}
}
@keyframes waving2 {
from {
left: 0;
}
to {
left: -9999px;
}
}
\ 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