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

fix: 修复baseLayout 行业切换

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