Commit 0c65e1d6 authored by 徐乐's avatar 徐乐

feat: 增加集成登录中间页

parent b175aa24
/* eslint-disable */ /* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin; // const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
// const proxyURL = 'https://work.panda-water.cn'; // const proxyURL = 'https://work.panda-water.cn';
const proxyURL = 'http://192.168.12.3:8082'; const proxyURL = 'http://localhost:8085';
// const proxyURL = 'https://panda-water.cn' // const proxyURL = 'https://panda-water.cn'
//const proxyURL = 'http://192.168.12.189:8816/' //const proxyURL = 'http://192.168.12.189:8816/'
module.exports = { module.exports = {
...@@ -81,6 +81,16 @@ module.exports = { ...@@ -81,6 +81,16 @@ module.exports = {
'/Cityinterface': '/CityInterface', '/Cityinterface': '/CityInterface',
}, },
}, },
'/center': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/center': '/center',
},
},
'/cityjson': { '/cityjson': {
target: 'https://pv.sohu.com', target: 'https://pv.sohu.com',
// target: 'http://192.168.19.102:8055', // target: 'http://192.168.19.102:8055',
......
...@@ -115,9 +115,9 @@ ...@@ -115,9 +115,9 @@
"@wisdom-map/arcgismap": "1.4.0-164", "@wisdom-map/arcgismap": "1.4.0-164",
"@wisdom-map/basemap": "1.1.0-24", "@wisdom-map/basemap": "1.1.0-24",
"@wisdom-map/util": "^1.0.28-0", "@wisdom-map/util": "^1.0.28-0",
"@wisdom-utils/components": "0.1.300", "@wisdom-utils/components": "0.1.319",
"@wisdom-utils/runtime": "0.0.46", "@wisdom-utils/runtime": "0.0.46",
"@wisdom-utils/utils": "0.1.340", "@wisdom-utils/utils": "0.1.359",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "4.21.2", "antd": "4.21.2",
"compression": "1.7.4", "compression": "1.7.4",
......
...@@ -45,6 +45,8 @@ export const API = { ...@@ -45,6 +45,8 @@ export const API = {
GET_InOnLine: '/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', // 广州登陆接口 GET_InOnLine: '/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', // 广州登陆接口
GET_UserMobile: '/PandaEnergy/GZshuiwuju/SingleLogin/SingleLoginByAccess_token', // 获取登录手机号 GET_UserMobile: '/PandaEnergy/GZshuiwuju/SingleLogin/SingleLoginByAccess_token', // 获取登录手机号
GET_JIANGXI_MANAGE: '/PandaWorkFlow/WorkFlow/JiangXiManage/Login', // 江西登录接口 GET_JIANGXI_MANAGE: '/PandaWorkFlow/WorkFlow/JiangXiManage/Login', // 江西登录接口
GET_INTEGRATION_CONFIG: '/PandaCore/GCK/IntegrationAuth/GetIntegrationConfig', // 获取集成站点数据
}; };
const services = { const services = {
...@@ -58,6 +60,11 @@ const services = { ...@@ -58,6 +60,11 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
GetIntegrationConfig: {
url: API.GET_INTEGRATION_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getUserMobile: { getUserMobile: {
url: API.GET_UserMobile, url: API.GET_UserMobile,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
...@@ -157,8 +164,8 @@ const services = { ...@@ -157,8 +164,8 @@ const services = {
generateToken: { generateToken: {
url: () => url: () =>
window.globalConfig && window.globalConfig &&
(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' || (window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ||
window.globalConfig.loginTemplate === '新春 - 智联.html') window.globalConfig.loginTemplate === '新春 - 智联.html')
? API.GENERATE_IOT_TOKEN ? API.GENERATE_IOT_TOKEN
: API.GENERATE_TOKEN, : API.GENERATE_TOKEN,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
...@@ -167,8 +174,8 @@ const services = { ...@@ -167,8 +174,8 @@ const services = {
changePassword: { changePassword: {
url: () => url: () =>
window.globalConfig && window.globalConfig &&
(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' || (window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ||
window.globalConfig.loginTemplate === '新春 - 智联.html') window.globalConfig.loginTemplate === '新春 - 智联.html')
? API.IOT_CHANGE_PASSWORD ? API.IOT_CHANGE_PASSWORD
: API.CHANGE_PASSWORD, : API.CHANGE_PASSWORD,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -216,6 +216,9 @@ export function logout(data) { ...@@ -216,6 +216,9 @@ export function logout(data) {
Cookies.set('site', '', { Cookies.set('site', '', {
path: '/', path: '/',
}); });
Cookies.set('singleToken', '', {
path: '/',
});
localStorage.removeItem('access_token'); localStorage.removeItem('access_token');
localStorage.removeItem('password_token'); localStorage.removeItem('password_token');
localStorage.removeItem('password_pwdRegex'); localStorage.removeItem('password_pwdRegex');
......
...@@ -50,7 +50,7 @@ const arrowSvg = ({ fillColor = '#fff' }) => ( ...@@ -50,7 +50,7 @@ const arrowSvg = ({ fillColor = '#fff' }) => (
<path <path
d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z" d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z"
p-id="8626" p-id="8626"
// fill={fillColor} // fill={fillColor}
/> />
</svg> </svg>
); );
...@@ -86,8 +86,8 @@ const OnlyFocusStations = props => { ...@@ -86,8 +86,8 @@ const OnlyFocusStations = props => {
<ul> <ul>
{Array.isArray(data) {Array.isArray(data)
? data.map(item => ? data.map(item =>
StationsItem(item, props.action, props.setVisible, props.actionRef, props.setMenuLoading), StationsItem(item, props.action, props.setVisible, props.actionRef, props.setMenuLoading),
) )
: null} : null}
</ul> </ul>
</div> </div>
...@@ -118,8 +118,8 @@ const AllStations = props => { ...@@ -118,8 +118,8 @@ const AllStations = props => {
<ul> <ul>
{Array.isArray(data) {Array.isArray(data)
? data.map(item => ? data.map(item =>
StationsItem(item, props.action, props.setVisible, props.actionRef, props.setMenuLoading), StationsItem(item, props.action, props.setVisible, props.actionRef, props.setMenuLoading),
) )
: null} : null}
</ul> </ul>
</div> </div>
...@@ -339,7 +339,7 @@ const Layout = props => { ...@@ -339,7 +339,7 @@ const Layout = props => {
return () => { return () => {
const marks = document.querySelectorAll('.pandawatermark_mask_div'); const marks = document.querySelectorAll('.pandawatermark_mask_div');
if (marks && marks.length) { if (marks && marks.length) {
Array.prototype.forEach.call(marks, function(dom, index) { Array.prototype.forEach.call(marks, function (dom, index) {
document.body.removeChild(dom); document.body.removeChild(dom);
}); });
} }
...@@ -347,6 +347,11 @@ const Layout = props => { ...@@ -347,6 +347,11 @@ const Layout = props => {
}, [props.global.isHaveMark, props.global.userInfo]); }, [props.global.isHaveMark, props.global.userInfo]);
const onMenuHeaderClick = event => { const onMenuHeaderClick = event => {
//集成网站
if (window.globalConfig.isIntegration >= 1) {
// window.qiankunIsCache = false;
history.push('/Industry');
}
// 非云平台不做响应 // 非云平台不做响应
if (!props.global.get('userInfo.site')) return; if (!props.global.get('userInfo.site')) return;
...@@ -370,8 +375,8 @@ const Layout = props => { ...@@ -370,8 +375,8 @@ const Layout = props => {
const logo = const logo =
props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo') props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo')
? props.global && ? props.global &&
_.isFunction(props.global.transformDevAssetsBaseURL) && _.isFunction(props.global.transformDevAssetsBaseURL) &&
props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo')) props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))
: defaultSetting.logo; : defaultSetting.logo;
// 添加一个路由跳转事件 // 添加一个路由跳转事件
...@@ -417,7 +422,7 @@ const Layout = props => { ...@@ -417,7 +422,7 @@ const Layout = props => {
if (url.indexOf('|') > -1) { if (url.indexOf('|') > -1) {
const params = url.split('|')[1]; const params = url.split('|')[1];
params.split('&').map(function(item) { params.split('&').map(function (item) {
return (ret[item.split('=')[0]] = item.split('=')[1]); return (ret[item.split('=')[0]] = item.split('=')[1]);
}); });
return ret; return ret;
...@@ -500,13 +505,13 @@ const Layout = props => { ...@@ -500,13 +505,13 @@ const Layout = props => {
{/* ) */} {/* ) */}
{/* ) : null} */} {/* ) : null} */}
{/* <AliveScope> */} {/* <AliveScope> */}
{window.location.pathname.startsWith('/civbase/civ_3d/map') || isHaveMap() ? ( {window.location.pathname.startsWith('/civbase/civ_3d/map') || isHaveMap() ? (
<KeepAlive when={true}> <KeepAlive when={true}>
<CesiumMap /> <CesiumMap />
</KeepAlive> </KeepAlive>
) : ( ) : (
window.location.pathname.startsWith('/civbase/civ_webgis') && null window.location.pathname.startsWith('/civbase/civ_webgis') && null
)} )}
{/* </AliveScope> */} {/* </AliveScope> */}
</Suspense> </Suspense>
......
...@@ -4,11 +4,14 @@ import SecurityLayout from '@/layouts/SecurityLayout'; ...@@ -4,11 +4,14 @@ import SecurityLayout from '@/layouts/SecurityLayout';
import { appService } from '@/api'; import { appService } from '@/api';
import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants'; import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants';
import PandaBootPage from './panda'; import PandaBootPage from './panda';
import IntegrationPage from './integration';
const systemItemName = '引导页模板'; // 系统配置项名称 const systemItemName = '引导页模板'; // 系统配置项名称
const BootPageTemplate = { const BootPageTemplate = {
default: PandaBootPage, default: PandaBootPage,
integration: IntegrationPage
}; };
const BootPage = props => { const BootPage = props => {
...@@ -18,9 +21,23 @@ const BootPage = props => { ...@@ -18,9 +21,23 @@ const BootPage = props => {
error: false, error: false,
}); });
const [template, setTemplate] = useState('default'); const [template, setTemplate] = useState('default');
const RenderComponent = useMemo(() => BootPageTemplate[template] || BootPageTemplate.default, [template]);
const RenderComponent = useMemo(() => {
if (window.globalConfig.isIntegration >= 1) {
//集成登录
return BootPageTemplate.integration
} else {
//云平台
return BootPageTemplate[template] || BootPageTemplate.default
}
}, [template]);
useEffect(() => { useEffect(() => {
if (window?.globalConfig?.isIntegration >= 1) {
setInfo({ first: false, loading: false, error: false });
return false;
}
appService appService
.sysConfiguration({ .sysConfiguration({
moduleName: systemItemName, moduleName: systemItemName,
......
/* eslint-disable global-require */
// 集成登录引导页
import React, { useCallback, useEffect, useMemo, useState, useRef } from 'react';
import { notification } from 'antd';
import classNames from 'classnames';
import { connect } from 'react-redux';
import { useDocumentTitle } from '@ant-design/pro-utils';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
import { actionCreators } from '@/containers/App/store';
import LoginAction from '@/pages/user/login/login';
import { defaultApp } from '@/micro';
import { appService } from '@/api';
import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants';
import styles from './index.less';
const Integration = props => {
const dataRef = useRef();
const [percentBottom, setPercentBottom] = useState(-40);
const [currentType, setCurrentType] = useState('');
const [scale, setScale] = useState(1);
const [loginAction, setAction] = useState(() => new LoginAction(props));
const [num, setNum] = useState(0);
const [dataList, setDataList] = useState([]);
const [client, setClient] = useState('');
const handlePage = (item, loginAction) => {
let count = 1;
setPercentBottom(-40 + Math.ceil(Math.random() * 8 * count));
process.current = setInterval(() => {
setTimeout(() => {
const perBottom = -40 + 8 * count + Math.ceil(Math.random() * 8);
const perNum = 10 * count + Math.ceil(Math.random() * 10);
if (perNum >= 80 || dataRef.current >= 80 || count === 10) {
return clearInterval(process.current);
}
setPercentBottom(perBottom);
count += 1;
}, 0);
}, 3000);
if (item.subType == '外链') {
window.open(item.url, "_blank");
} else {
let cli = item.url?.indexOf('client=') >= 0 ? item.url.split('client=')[1] : '';
setClient(cli);
setCurrentType(item.name);
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
if (cli) {
config.client = cli
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type, cli);
}
};
useEffect(() => {
const handleToggleIndustry = event => {
setPercentBottom(38);
clearInterval(process.current);
props.history.push(`/?client=${client ? client : props.global.client}`);
props.updateCurrentIndex(0);
defaultApp();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => {
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
};
}, [loginAction.events, props, currentType]);
//获取集成站点数据
useEffect(() => {
appService
.GetIntegrationConfig({
type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true,
})
.then(res => {
const { code, data } = res;
if (code !== SERVICE_INTERFACE_SUCCESS_CODE) {
notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' });
return;
} else {
setNum(data.length);
setDataList(data);
const config = props.global;
config.isIntegration = data.length;
props.updateConfig && props.updateConfig(config);
if (data.length == 1) {
handlePage(data[0], loginAction)
}
}
})
.catch(err => {
notification.error({ message: '提示', duration: 3, description: '集成站点配置错误' });
});
}, [props.global.token]);
return (
<div className={styles.bootPage}>
<div className={styles.bootPageMain}>
<header className={styles.bootPageHead}>
<img src={require(`@/assets/bootPage/熊猫图标.png`)} />
<div className={styles.bootPageTitle}>
<span className={styles.bootPageZh}>熊猫智慧水务一体化解决方案</span>
<span className={styles.bootPageEn}>Panda Smart Water Integration Platform & Solution</span>
</div>
</header>
<section className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')} >
<ul className={classNames(styles.bootPageUl, 'animate__animated')}
style={{ transform: `scale(${scale})`, left: '300px', bottom: '105px', opacity: 1, width: num === 5 ? 960 : num === 9 || num === 10 ? 1600 : 1280, }} >
{dataList.map(item => (
<li className={styles.bootPageLi} key={item.name} onClick={event => handlePage(item, loginAction)} >
<div className={styles.bootPageList}>
<div className={styles.listMain}>
{/* <img src={require(`@/assets/bootPage/供水.png`)} alt="" /> */}
<img src={window.location.origin + '/' + (item.icon ? item.icon : 'center/images/科技风/二供.png')} alt="" />
<span className={styles.bootPageName}>{item.name}</span>
</div>
</div>
{currentType === item.name && (
<div className={styles.bootProgress}>
<div className={styles.inner} style={{ bottom: percentBottom }}>
<svg className={styles.wave} xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 68" preserveAspectRatio="none" >
<defs>
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
</defs>
<g className={styles.parallax}>
<use xlinkHref="#gentle-wave" x="50" y="0" fill={'rgb(16,104,239)'} opacity="0.1" />
<use xlinkHref="#gentle-wave" x="50" y="-1" fill={'rgb(16,104,239)'} opacity="0.2" />
</g>
</svg>
</div>
</div>
)}
</li>
),
)}
</ul>
</section>
</div>
</div>
);
};
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
instance: state.getIn(['global', 'instance']),
});
const mapDispatchToProps = dispatch => ({
updateConfig(config) {
dispatch(actionCreators.getConfig(config));
},
createContext(data) {
dispatch(actionCreators.createContext(data));
},
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Integration);
@import '~antd/es/style/themes/default.less';
@-webkit-keyframes move {
0% {
-webkit-transform: translate(-90px, 0%);
transform: translate(-90px, 0%);
}
100% {
-webkit-transform: translate(85px, 0%);
transform: translate(85px, 0%);
}
}
@keyframes move {
0% {
-webkit-transform: translate(-90px, 0%);
transform: translate(-90px, 0%);
}
100% {
-webkit-transform: translate(85px, 0%);
transform: translate(85px, 0%);
}
}
.bootPage {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background: url('https://panda-water.cn/web4/assets/images/bootPage/背景.jpg') no-repeat top center;
background-size: cover;
.bootPageMain {
display: flex;
align-items: center;
flex-direction: column;
height: 100%;
width: 100%;
.bootPageHead {
height: 150px;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
flex: none;
padding-top: 50px;
.bootPageTitle {
display: flex;
flex-direction: column;
margin-left: 20px;
.bootPageZh,
.bootPageEn {
font-weight: 500;
}
.bootPageZh {
font-size: 34px;
letter-spacing: 5px;
}
.bootPageEn {
font-size: 16px;
font-family: -webkit-body;
letter-spacing: 1px;
}
}
}
.bootPageSection {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
height: calc(100% - 160px);
margin: 20px 0;
&::-webkit-scrollbar {
width: 0px;
height: 0px;
}
.bootPageUl {
display: flex;
width: 1280px;
flex-wrap: wrap;
justify-content: center;
list-style: none;
transition: all .5s ease-out;
margin-top: -120px;
.bootPageLi {
position: relative;
width: 298px;
height: 268.8px;
margin: 10px;
&:hover {
.listMain {
transform: scale(1.1);
}
.bootProgress {
transform: scale(1.1);
bottom: -10px;
}
}
.bootPageList {
width: 100%;
height: 100%;
border-radius: 4px;
transition: all .2s ease-out;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
font-size: 24px;
cursor: pointer;
position: relative;
span {
margin-top: 20px;
font-weight: 500;
color: #fff;
}
.listMain {
transition: all 0.2s ease-out;
display: flex;
align-items: center;
flex-direction: column;
background: url('@/assets/bootPage/bg.png');
background-size: 100%;
background-repeat: no-repeat;
padding: 30px 54px 48px 43px;
img {
// width: 298px;
// height: 269px;
width: 110px;
height: 110px;
border-radius: 20px;
vertical-align: middle;
}
span {
font-weight: 500;
color: #fff;
}
.bootPageName {
// position: absolute;
// bottom: 31px;
font-weight: 500;
font-size: 22px;
margin-top: -4px;
}
.bootPageNameEng {
font-size: 14px;
position: absolute;
bottom: 11px;
}
}
}
}
&.bootPageUl_5 {
width: 960px;
}
&.bootPageUl_9,
&.bootPageUl_10 {
width: 1600px;
}
}
}
}
.abs {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.cloudMonitorBtns {
position: fixed;
height: 120px;
width: 100%;
bottom: 0px;
padding: 0 20px;
display: flex;
justify-content: end;
:global {
.cloud-using-anaylysis-btn {
cursor: pointer;
width: 100px;
display: flex;
flex-direction: column;
justify-content: center;
&>img {
width: 50px;
margin: 0 25px;
}
&>span {
color: #fff;
font-size: 14px;
width: 100%;
text-align: center;
}
}
}
}
:global {
.@{ant-prefix}-spin-nested-loading,
.@{ant-prefix}-spin-container {
height: 100%;
}
}
.bootProgress {
transition: all .2s ease-out;
position: absolute;
height: 80px;
margin: 0;
width: 100%;
border-radius: 0 0 14% 14%;
overflow: hidden;
bottom: 0px;
}
.bootProgress .inner {
transition: all .2s ease-out;
position: absolute;
height: 100%;
width: 100%;
bottom: 10%;
}
.bootProgress .wave {
display: block;
width: 100%;
height: 10em;
max-height: 100vh;
margin: 0;
}
.bootProgress .wave .parallax>use {
animation: move 2s linear infinite;
}
.bootProgress .wave .parallax>use:nth-child(2) {
animation-delay: -0.1s;
}
}
@media screen and (max-width: 1440px) {
.bootPage {
.bootPageHead {
.bootPageZh {
font-size: 26px;
}
.bootPageEn {
font-size: 12px;
}
}
}
}
@media screen and (min-width: 1440px) and (max-width: 1600px) {
.bootPage {
.bootPageHead {
.bootPageZh {
font-size: 30px;
}
.bootPageEn {
font-size: 14px;
}
}
}
}
\ No newline at end of file
...@@ -79,8 +79,8 @@ class Login { ...@@ -79,8 +79,8 @@ class Login {
(response.token (response.token
? response.token ? response.token
: response.access_token !== null && response.user_token !== null : response.access_token !== null && response.user_token !== null
? response.user_token ? response.user_token
: ''); : '');
if (token) { if (token) {
const exp = 86400000; const exp = 86400000;
self.globalConfig.token = token; self.globalConfig.token = token;
...@@ -133,7 +133,7 @@ class Login { ...@@ -133,7 +133,7 @@ class Login {
getIpone() { getIpone() {
const self = this; const self = this;
return appService.getUserMobile({ return appService.getUserMobile({
// isTest: true, // isTest: true,
}); });
} }
...@@ -246,7 +246,7 @@ class Login { ...@@ -246,7 +246,7 @@ class Login {
? this.globalConfig.userInfo.fullName ? this.globalConfig.userInfo.fullName
: '', : '',
}) })
.catch(error => {}); .catch(error => { });
} }
if (window.location.host === 'panda-water.com') { if (window.location.host === 'panda-water.com') {
...@@ -260,7 +260,7 @@ class Login { ...@@ -260,7 +260,7 @@ class Login {
? this.globalConfig.userInfo.fullName ? this.globalConfig.userInfo.fullName
: '', : '',
}) })
.catch(error => {}); .catch(error => { });
} }
} }
...@@ -273,18 +273,17 @@ class Login { ...@@ -273,18 +273,17 @@ class Login {
} }
}); });
} }
if ( if (!flag && this.isSignIn && this.globalConfig.userInfo.Industries.length && this.globalConfig.userInfo.Industries.length > 1) {
!flag &&
this.isSignIn &&
this.globalConfig.userInfo.Industries.length &&
this.globalConfig.userInfo.Industries.length > 1
) {
this.createContext(this); this.createContext(this);
// console.log('云平台');
this.updateConfig && this.updateConfig(this.globalConfig); this.updateConfig && this.updateConfig(this.globalConfig);
this.history.push('/industry'); this.history.push('/industry');
return false; return false;
} }
//跳转到集成登录引导页_xule_2023-08-28
if (!flag && this.isSignIn && this.globalConfig.isIntegration >= 1) {
this.history.push('/industry');
return false;
}
this.getWebConfig(token, getIndustry); this.getWebConfig(token, getIndustry);
} }
...@@ -296,6 +295,7 @@ class Login { ...@@ -296,6 +295,7 @@ class Login {
noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }), noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }),
getWebSiteConfig({ getWebSiteConfig({
client: self.globalConfig.client, client: self.globalConfig.client,
// client: window.globalConfig.client,
token, token,
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
}), }),
...@@ -342,9 +342,8 @@ class Login { ...@@ -342,9 +342,8 @@ class Login {
mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT; mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT;
mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort}`; mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort}`;
} }
mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${ mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort ? mqttConfig.mqtt_mess.TcpPort : '443'
mqttConfig.mqtt_mess.TcpPort ? mqttConfig.mqtt_mess.TcpPort : '443' }`;
}`;
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
...mqttConfig, ...mqttConfig,
...@@ -379,6 +378,7 @@ class Login { ...@@ -379,6 +378,7 @@ class Login {
// mapsettings: config.mapsettings // mapsettings: config.mapsettings
}); });
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
self.getProjectItems().then(res => { self.getProjectItems().then(res => {
window.subSysCfg = {}; window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
...@@ -670,7 +670,7 @@ class Login { ...@@ -670,7 +670,7 @@ class Login {
height: '400', height: '400',
}); });
const handleMessage = function(event) { const handleMessage = function (event) {
const { origin } = event; const { origin } = event;
// Logger.log('origin', event.origin); // Logger.log('origin', event.origin);
if (origin === 'https://login.dingtalk.com') { if (origin === 'https://login.dingtalk.com') {
...@@ -859,18 +859,22 @@ class Login { ...@@ -859,18 +859,22 @@ class Login {
}); });
} }
getUserInfoAndConfig(failCallback, flag, industry) { getUserInfoAndConfig(failCallback, flag, industry, client) {
const { token: tk } = this.globalConfig; const { token: tk } = this.globalConfig;
const token = tk || Cookies.get('token'); const token = tk || Cookies.get('token');
const site = Cookies.get('site'); const site = Cookies.get('site');
const self = this; const self = this;
if (client) {
self.globalConfig.client = client;
}
/* eslint-disable */ /* eslint-disable */
let _industrySite = null; let _industrySite = null;
if (industry) { if (industry) {
const userInfo = const userInfo =
self.globalConfig.userInfo && self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups && self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups.find(enter => enter.industry === industry) ? self.globalConfig.userInfo.Groups.find(enter => enter.industry === industry)
: null; : null;
...@@ -894,13 +898,14 @@ class Login { ...@@ -894,13 +898,14 @@ class Login {
site: decodeURIComponent(decode(site)), site: decodeURIComponent(decode(site)),
Groups: Groups:
self.globalConfig.userInfo && self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups && self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups ? self.globalConfig.userInfo.Groups
: null, : null,
}; };
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
} }
console.log('globalConfig', self.globalConfig)
if (self.isSignIn || !!industry) { if (self.isSignIn || !!industry) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
getUserInfo({ getUserInfo({
...@@ -975,8 +980,8 @@ class Login { ...@@ -975,8 +980,8 @@ class Login {
(response.token (response.token
? response.token ? response.token
: response.access_token !== null && response.user_token !== null : response.access_token !== null && response.user_token !== null
? response.user_token ? response.user_token
: ''); : '');
if (token) { if (token) {
const exp = 86400000; const exp = 86400000;
self.globalConfig.token = token; self.globalConfig.token = token;
...@@ -1116,24 +1121,24 @@ class Login { ...@@ -1116,24 +1121,24 @@ class Login {
} }
} }
} }
loginJiang(usr, pwd, userPhone, isRememberPWD, mode = SERVICE_APP_LOGIN_MODE.password) { loginJiang(usr, pwd, userPhone, isRememberPWD, mode = SERVICE_APP_LOGIN_MODE.password) {
this.globalConfig = getGlobalConfig(); this.globalConfig = getGlobalConfig();
const self = this; const self = this;
appService appService
.getJiangXiManage({ .getJiangXiManage({
username: usr, username: usr,
password: btoa(pwd), password: btoa(pwd),
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
}) })
.then(response => { .then(response => {
self.transformLoginHander({token: response.data.user_token}, isRememberPWD, pwd); self.transformLoginHander({ token: response.data.user_token }, isRememberPWD, pwd);
}) })
.catch(error => { .catch(error => {
self.hasTry = true; self.hasTry = true;
self.handleLoginError(); self.handleLoginError();
self.events.emit('loginError', error.message); self.events.emit('loginError', error.message);
message.error('登录服务异常'); message.error('登录服务异常');
}); });
} }
phoneLoginFormHandler(userPhone, captcha) { phoneLoginFormHandler(userPhone, captcha) {
this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone); this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone);
......
...@@ -45,7 +45,7 @@ function getStyle(prefixCls, theme) { ...@@ -45,7 +45,7 @@ function getStyle(prefixCls, theme) {
`.trim(); `.trim();
} }
const registerTheme = function(prefixCls, theme) { const registerTheme = function (prefixCls, theme) {
const style = getStyle(prefixCls, theme); const style = getStyle(prefixCls, theme);
if (canUseDom()) { if (canUseDom()) {
updateCSS(style, `${dynamicStyleMark}-dynamic-theme`); updateCSS(style, `${dynamicStyleMark}-dynamic-theme`);
...@@ -139,6 +139,10 @@ export const AppInitState = () => { ...@@ -139,6 +139,10 @@ export const AppInitState = () => {
} else { } else {
localStorage.removeItem('password_pwdRegexTip'); localStorage.removeItem('password_pwdRegexTip');
} }
if (data.webState === '1' || data.webState === '3') {
data.isIntegration = '1';
}
store.dispatch( store.dispatch(
actionCreators.getConfig( actionCreators.getConfig(
Object.assign( Object.assign(
...@@ -229,7 +233,7 @@ export const AppInitState = () => { ...@@ -229,7 +233,7 @@ export const AppInitState = () => {
// 语音播报全局拦截 // 语音播报全局拦截
const initMessageVoice = () => { const initMessageVoice = () => {
const rawSpeak = window.speechSynthesis.speak; const rawSpeak = window.speechSynthesis.speak;
window.speechSynthesis.speak = function(...args) { window.speechSynthesis.speak = function (...args) {
if ( if (
window.globalConfig && window.globalConfig &&
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
...@@ -256,9 +260,9 @@ export const AppInitState = () => { ...@@ -256,9 +260,9 @@ export const AppInitState = () => {
return true; return true;
}; };
store.subscribe( store.subscribe(
(function() { (function () {
const preVariableTheme = store.getState().toJS().global?.globalConfig?.variableTheme; const preVariableTheme = store.getState().toJS().global?.globalConfig?.variableTheme;
return function() { return function () {
// if (!preVariableTheme) // if (!preVariableTheme)
const variableTheme = store.getState().toJS().global?.globalConfig?.variableTheme; const variableTheme = store.getState().toJS().global?.globalConfig?.variableTheme;
if (!hasThemeChanged(preVariableTheme, variableTheme)) return false; if (!hasThemeChanged(preVariableTheme, variableTheme)) return false;
......
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