Commit bfd1459f authored by 邓晓峰's avatar 邓晓峰

fix: 修复baseLayout 行业切换

parent d48f7151
File added
......@@ -13,6 +13,6 @@ export default {
iconfontUrl: '',
primaryColor: '#1890ff',
logo:
'https://panda-water.cn/web4/assets/images/logo/%E5%8D%95%E7%8B%AC%E5%9B%BE%E6%A1%88-%E8%93%9D%E7%BB%BF%E8%89%B2.svg',
'https://panda-water.cn/web4/assets/images/logo/%E5%8D%95%E7%8B%AC%E5%9B%BE%E6%A1%88-%E7%99%BD%E8%89%B2.svg',
name: '熊猫智慧城市监控管理解决方案',
};
......@@ -52,8 +52,8 @@ module.exports = {
'/Publish': {
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'http://192.168.10.151:8055',
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
......
......@@ -100,14 +100,14 @@
}
},
"@ant-design/pro-layout": {
"version": "6.11.1",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-layout/-/pro-layout-6.11.1.tgz",
"integrity": "sha1-JhoaNZXz44zwI1fh5RvL/26CQf4=",
"version": "6.13.0",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-layout/-/pro-layout-6.13.0.tgz",
"integrity": "sha1-NlMi5VapNH63uYb+TiwIYQGQzr0=",
"dev": true,
"requires": {
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-provider": "1.4.2",
"@ant-design/pro-utils": "1.11.0",
"@ant-design/pro-provider": "1.4.4",
"@ant-design/pro-utils": "1.11.2",
"@umijs/route-utils": "^1.0.33",
"classnames": "^2.2.6",
"omit.js": "^2.0.2",
......@@ -123,22 +123,22 @@
},
"dependencies": {
"@ant-design/pro-provider": {
"version": "1.4.2",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-provider/-/pro-provider-1.4.2.tgz",
"integrity": "sha1-WUunbdGtswrplqLfwX1zDSXtQOc=",
"version": "1.4.4",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-provider/-/pro-provider-1.4.4.tgz",
"integrity": "sha1-Do0ngQx2fxfSPz7df/RGj429Nkk=",
"dev": true,
"requires": {
"rc-util": "^5.0.1"
}
},
"@ant-design/pro-utils": {
"version": "1.11.0",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-utils/-/pro-utils-1.11.0.tgz",
"integrity": "sha1-I+lL4AMRT23jC+axK6fGFE678QI=",
"version": "1.11.2",
"resolved": "https://g.civnet.cn:4873/@ant-design%2fpro-utils/-/pro-utils-1.11.2.tgz",
"integrity": "sha1-rYgiYhGUiwVtaa01d18Z4eAsAG8=",
"dev": true,
"requires": {
"@ant-design/icons": "^4.3.0",
"@ant-design/pro-provider": "1.4.2",
"@ant-design/pro-provider": "1.4.4",
"classnames": "^2.2.6",
"fast-deep-equal": "^3.1.3",
"moment": "^2.27.0",
......@@ -134,7 +134,7 @@
},
"devDependencies": {
"@ant-design/icons": "^4.0.0",
"@ant-design/pro-layout": "^6.11.1",
"@ant-design/pro-layout": "^6.13.0",
"@ant-design/pro-skeleton": "^1.0.0-beta.2",
"@ant-design/pro-table": "^2.5.3",
"@ant-design/pro-utils": "^1.10.4",
......
......@@ -56,12 +56,12 @@ const services = {
},
getWebSiteConfig: {
url: () => API.GET_WEB_SITE_CONFIG_GEWAY,
// window.globalConfig &&
// window.globalConfig &&
// window.globalConfig.hasGateWay
// ? API.GET_WEB_SITE_CONFIG_GEWAY
// : API.GET_WEB_SITE_CONFIG,
url: () =>
window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......
......@@ -161,7 +161,11 @@ window.share &&
window.share.event.on('triggerMicro', () => {
initMicroApps(loader);
});
// initGlobalConfig();
window.share &&
window.share.event &&
window.share.event.on('triggerLoginout', () => {
initGlobalConfig();
});
if (pwa) {
const appPWA = window.i18n.getI18n('app');
......
......@@ -79,13 +79,18 @@ class AvatarDropdown extends React.Component {
window.location.href = `${window.location.origin}/#login`;
return false;
}
debugger
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
this.props.updateConfig && this.props.updateConfig({});
createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
this.props.history.push(
`/user/login/?client=${window.globalConfig.client}`,
);
window.share.event.emit('triggerLoginout', this.props.global);
// eslint-disable-next-line no-restricted-globals
location.reload();
// location.reload();
};
getRoles = () => {
......
......@@ -191,7 +191,7 @@ const GlobalHeaderRight = props => {
<OrderIcon onClick={handleOrder} title={formatMessage('header.icon.order')} />
</div>
<NoticeIconView title={formatMessage('header.icon.alarm')} />
<Avatar menu global={props.global} updateCurrentIndex={props.updateCurrentIndex}/>
<Avatar menu global={props.global} updateCurrentIndex={props.updateCurrentIndex} updateConfig={props.updateConfig}/>
{/* <SelectLang className={styles.action} /> */}
</div>
);
......@@ -220,8 +220,10 @@ const mapDispatchToProps = dispatch => ({
},
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index))
}
},
updateConfig(config) {
dispatch(actionCreators.getConfig(config))
},
});
export default connect(
mapStateToProps,
......
import React from 'react';
import React, { useEffect, useState } from 'react';
import { Helmet } from 'react-helmet';
import { connect } from 'react-redux';
import { renderRoutes } from 'react-router-config';
......@@ -7,6 +7,7 @@ import defaultSetting from '../../../config/defaultSetting';
import { dyRoutes } from '../../routes/config';
function App(props) {
debugger
return (
<>
<Helmet
......
......@@ -459,7 +459,7 @@ const BasicLayout = props => {
};
const handleLogo = event => {
props.global.get('userInfo.site') ? history.replace(`/industry`) : null;
props.global.get('userInfo.site') ? (history.push(`/industry`)) : null;
};
const transformPopupMenu = useCallback(key => {
......@@ -533,11 +533,13 @@ const BasicLayout = props => {
window.share.event.emit('trigger:route');
}
};
debugger
const title = getPageTitle({
title: props.global && props.global.get('title') || defaultSetting.title
});
const logo = props.global.get('bannerLogo') ? `http://panda-water.cn/web4/${props.global.get('bannerLogo')}` : defaultSetting.logo;
const renderComplexLayout = children => {
const complexConfig = props.complexConfig.toJS
? props.complexConfig.toJS()
......@@ -655,15 +657,10 @@ const BasicLayout = props => {
);
};
const { openKeys } = props;
return (
<SecurityLayout loading updateCurrentIndex={props.updateCurrentIndex}>
<ProLayout
logo={`http://panda-water.cn/web4/${
props.global.get('bannerLogo')
? props.global.get('bannerLogo')
: 'assets/images/logo/单独图案-白色.svg'
}`}
logo={logo}
siderWidth="145px"
title={title}
onCollapse={collapse => handlerCollapsed(collapse)}
......@@ -765,9 +762,8 @@ const BasicLayout = props => {
}}
settings={defaultSetting}
{...others}
{...settings}
>
{renderRoutes(props.route.routes)}
{/*{renderRoutes(props.route.routes)}*/}
<Spin
spinning={pageLoading}
......
......@@ -3,6 +3,7 @@ import Cookies from 'js-cookie';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';
import PageLoading from '@ant-design/pro-layout';
import { stringify } from 'querystring';
import { getBaseName } from '../utils/utils';
class SecurityLayout extends React.Component {
......@@ -14,17 +15,16 @@ class SecurityLayout extends React.Component {
this.setState({
isReady: true,
});
document.title = this.props.global.title;
}
render() {
const { isReady } = this.state;
const { children, global, loading } = this.props;
const isLogin =
Cookies.get('token') !== null ||
((global.qrcodeData &&
global.qrcodeData.state !== '' &&
global.qrcodeData.code !== '') ||
!global.userInfo);
const isLogin = Cookies.get('token') !== null && global.token !== null;
const queryString = stringify({
redirect: window.location.href,
});
// eslint-disable-next-line no-undef
// if(Cookie.get("token")==="") {
......@@ -40,7 +40,9 @@ class SecurityLayout extends React.Component {
window.location.pathname !== `/${getBaseName()}/user/login`
) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
return <Redirect to={`/user/login?client=${global.client}`} />;
return (
<Redirect to={`/user/login?client=${global.client}&${queryString}`} />
);
}
return children;
}
......
import React, { useCallback, useState, useEffect, useMemo } from 'react';
import { useDocumentTitle } from '@ant-design/pro-utils';
import { Space, Spin } from 'antd';
import classNames from 'classnames';
import { connect } from 'react-redux';
import { actionCreators } from '../../containers/App/store';
import SecurityLayout from '../../layouts/SecurityLayout';
import LoginAction from '../user/login/login';
import styles from './index.less';
import i18n from '../../utils/share';
import defaultSetting from '../../../config/defaultSetting';
const pages = i18n.getI18n('app');
const industries = ['供水', '排水', '消防', '暖通', '节水', '实验室'];
const renderIndustries = (config, callback) =>
......@@ -42,6 +42,10 @@ const renderIndustries = (config, callback) =>
const BootPage = props => {
const [loadding, setLoadding] = useState(false);
const [scale, setScale] = useState(1);
useDocumentTitle(
{ title: defaultSetting.title, id: '', pageName: '行业qieh' },
props.global.title || defaultSetting.title,
);
const handlePage = useCallback((event, type) => {
event.persist();
event.preventDefault();
......@@ -60,8 +64,6 @@ const BootPage = props => {
props.history.push(`/?client=${props.global.client}`);
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
// eslint-disable-next-line no-restricted-globals
location.reload();
});
}, []);
useEffect(() => {
......
......@@ -10,13 +10,15 @@ import { dom } from 'kit_utils';
import QRCode from 'qrcode.react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { actionCreators } from '../../../containers/App/store';
import LoginForm from './components/Login';
import WxLogin from './components/WxLogin';
import LoginAction from './login';
import styles from './style.less';
import i18n from '../../../utils/share';
import defaultSetting from '../../../../config/defaultSetting'
import { PageLoading } from '@ant-design/pro-layout';
const { UserName, Password, Mobile, Captcha, Submit } = LoginForm;
const Display = {
Account: 'Account',
......@@ -464,7 +466,7 @@ const Login = forwardRef((props, _ref) => {
}, []);
useEffect(() => {
if (videoRef) {
if (videoRef && videoRef.current) {
videoRef.current.addEventListener('ended', function() {
dom.removeClass(loginRef.current, styles.caseHide);
dom.addClass(loginRef.current, styles.loginTimeShow);
......@@ -519,7 +521,13 @@ const Login = forwardRef((props, _ref) => {
}
};
/* eslint-disable */
return (
<HelmetProvider>
<Helmet>
<title>{props.global.title || defaultSetting.title}</title>
<meta name="description" content={props.global.title || defaultSetting.title} />
</Helmet>
<div className={styles.main}>
<video
src={require("../../../assets/videos/beforPage.mp4") }
......@@ -536,7 +544,7 @@ const Login = forwardRef((props, _ref) => {
>
<img
role="logo"
src={`https://panda-water.cn/web4/${window.globalConfig.logo}`}
src={`https://panda-water.cn/web4/${props.global.logo}`}
/>
<div
className={classNames(
......@@ -546,7 +554,7 @@ const Login = forwardRef((props, _ref) => {
)}
ref={titleRef}
>
<span className={styles.title}>{window.globalConfig.title}</span>
<span className={styles.title}>{props.global.title}</span>
<span className={styles.subtitle}>
{window.globalConfig.subtitle}
</span>
......@@ -626,6 +634,7 @@ const Login = forwardRef((props, _ref) => {
<div ref={sliVerify} />
</Modal>
</div>
</HelmetProvider>
);
});
......
......@@ -25,6 +25,7 @@ export const dyRoutes = routes => {
{
path: '/industry',
component: BootPage,
name: 'industry',
},
{
path: '/',
......
......@@ -70,7 +70,7 @@ const generRotes = (widgets, parent, level = 0) => {
});
} else {
const baseURL = item.product || DEFAULT_APPLICATION;
let url = item.hasOwnProperty('url') ? `/${baseURL}/${item.url.replace(/\s*/g, '')}`
let url = item.hasOwnProperty('url') && item.url !== undefined ? `/${baseURL}/${item.url.replace(/\s*/g, '')}`
: !item.hasOwnProperty('url')
? guid('web_console')
: '';
......
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