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

perf: 优化layout

parent f4023914
File added
...@@ -12,5 +12,7 @@ export default { ...@@ -12,5 +12,7 @@ export default {
title: '熊猫智慧城市监控管理解决方案', title: '熊猫智慧城市监控管理解决方案',
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',
name: '熊猫智慧城市监控管理解决方案',
}; };
...@@ -12,7 +12,7 @@ module.exports = options => ({ ...@@ -12,7 +12,7 @@ module.exports = options => ({
{ {
path: process.env.npm_config_releasepath path: process.env.npm_config_releasepath
? path.resolve( ? path.resolve(
process.env.npm_config_releasepath, process.env.npm_config_releasepath,
pkg.name.toLocaleLowerCase(), pkg.name.toLocaleLowerCase(),
) : path.resolve(process.cwd(), pkg.name.toLocaleLowerCase()), ) : path.resolve(process.cwd(), pkg.name.toLocaleLowerCase()),
publicPath: `/${pkg.name.toLocaleLowerCase()}`, publicPath: `/${pkg.name.toLocaleLowerCase()}`,
...@@ -160,7 +160,8 @@ module.exports = options => ({ ...@@ -160,7 +160,8 @@ module.exports = options => ({
loader: 'url-loader', loader: 'url-loader',
options: { options: {
limit: 10000, limit: 10000,
outputPath: '/video/', // outputPath: '/video/',
outputPath: process.env.NODE_ENV === 'production' ? '/video/' : '',
}, },
}, },
}, },
......
...@@ -14046,7 +14046,7 @@ ...@@ -14046,7 +14046,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -16099,7 +16099,7 @@ ...@@ -16099,7 +16099,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -18793,9 +18793,9 @@ ...@@ -18793,9 +18793,9 @@
"dev": true "dev": true
}, },
"kit_global_config": { "kit_global_config": {
"version": "1.0.20", "version": "1.0.21",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.20.tgz", "resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.21.tgz",
"integrity": "sha512-A0WcLLgEPRsclPUj7iRE4ZVh5QhchZL7vioYaULagDDNfwZs/NVU5a58wOunO2mBGDpgvhjfyVkqWFuxyhPeYA==", "integrity": "sha512-iMSXpoYdFAKPHf1we0f0KZo5DJFYa+Bwz3shEcPdiD1hwttalVnvLTP6tW7RHFLgktZMcnx24HclDukeFAPbug==",
"requires": { "requires": {
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
...@@ -18813,9 +18813,9 @@ ...@@ -18813,9 +18813,9 @@
} }
}, },
"kit_utils": { "kit_utils": {
"version": "1.3.6", "version": "1.3.8",
"resolved": "https://g.civnet.cn:4873/kit_utils/-/kit_utils-1.3.6.tgz", "resolved": "https://g.civnet.cn:4873/kit_utils/-/kit_utils-1.3.8.tgz",
"integrity": "sha512-C3dk8yogQD3ID61FgpToVx7BGXPsbNB0aLf1jzDAWd29WMXVNdHiZNbq+aJ49t4CmX5TEEAKDapGF+DC8ulLUA==", "integrity": "sha512-QIJgLwGCqpGR6YQs9D0TNHGtZ2BLI+qOweYSpUV8w+hszMOjeEmLmtLQZs0u0Q5tqFK4TNhWa4PG48w7E1S4sA==",
"requires": { "requires": {
"@babel/runtime": "^7.10.5" "@babel/runtime": "^7.10.5"
} }
...@@ -20380,7 +20380,7 @@ ...@@ -20380,7 +20380,7 @@
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-diff": "^4.0.0", "arr-diff": "^4.0.0",
...@@ -28512,7 +28512,7 @@ ...@@ -28512,7 +28512,7 @@
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-diff": "^4.0.0", "arr-diff": "^4.0.0",
...@@ -28737,7 +28737,7 @@ ...@@ -28737,7 +28737,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -106,9 +106,9 @@ ...@@ -106,9 +106,9 @@
"ip": "1.1.5", "ip": "1.1.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"kit_global_config": "^1.0.20", "kit_global_config": "^1.0.21",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.6", "kit_utils": "^1.3.8",
"lodash": "4.17.11", "lodash": "4.17.11",
"minimist": "1.2.0", "minimist": "1.2.0",
"mqtt-client": "^1.0.11", "mqtt-client": "^1.0.11",
......
...@@ -69,7 +69,7 @@ const initGlobalConfig = () => { ...@@ -69,7 +69,7 @@ const initGlobalConfig = () => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove(namespace); createStoreage.remove(namespace);
} }
if (!params.getParams('client') && config) { if (!params.getParams('client', window.location.search) && config) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove(namespace); createStoreage.remove(namespace);
} }
...@@ -78,7 +78,32 @@ const initGlobalConfig = () => { ...@@ -78,7 +78,32 @@ const initGlobalConfig = () => {
if (!createStoreage.get('globalConfig')) { if (!createStoreage.get('globalConfig')) {
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
} }
if (params.getParams('client')) {
appService
.queryConfig({ client: params.getParams('client') || 'city' })
.then(res => {
if (res) {
const data = res;
if (!data.client) {
delete data.client;
}
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, data),
),
);
// eslint-disable-next-line no-shadow
}
return res;
})
// eslint-disable-next-line no-shadow
.then(res => {
render({ appContent: '', loading: true });
})
.catch(error => {
store.dispatch(actionCreators.getConfigError(error));
});
}
if (config.title !== null && Object.keys(config).length > 0) { if (config.title !== null && Object.keys(config).length > 0) {
store.dispatch(actionCreators.getConfig(config)); store.dispatch(actionCreators.getConfig(config));
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
......
...@@ -3,20 +3,18 @@ import React, { useMemo } from 'react'; ...@@ -3,20 +3,18 @@ import React, { useMemo } from 'react';
import { Result } from 'antd'; import { Result } from 'antd';
import check from './CheckPermissions'; import check from './CheckPermissions';
// <Result
// status="403"
// title="403"
// subTitle="Sorry, you are not authorized to access this page."
// />
const Authorized = ({ const Authorized = ({
children, children,
authority, authority,
flatMenu, flatMenu,
updateAuthValidate, updateAuthValidate,
global, global,
noMatch = ( noMatch = <div />,
<Result
status="403"
title="403"
subTitle="Sorry, you are not authorized to access this page."
/>
),
}) => { }) => {
const childrenRender = typeof children === 'undefined' ? null : children; const childrenRender = typeof children === 'undefined' ? null : children;
......
...@@ -68,6 +68,10 @@ class AvatarDropdown extends React.Component { ...@@ -68,6 +68,10 @@ class AvatarDropdown extends React.Component {
path: '/', path: '/',
}); });
Cookies.set('site', '', {
path: '/',
});
if ( if (
window.globalConfig.style === 'ios' && window.globalConfig.style === 'ios' &&
window.globalConfig.loginTemplate === 'IOSCloud.html' window.globalConfig.loginTemplate === 'IOSCloud.html'
...@@ -77,7 +81,7 @@ class AvatarDropdown extends React.Component { ...@@ -77,7 +81,7 @@ class AvatarDropdown extends React.Component {
} }
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
debugger
this.props.history.push( this.props.history.push(
`/user/login/?client=${window.globalConfig.client}`, `/user/login/?client=${window.globalConfig.client}`,
); );
......
...@@ -180,13 +180,19 @@ const Stations = props => { ...@@ -180,13 +180,19 @@ const Stations = props => {
targetOffset={targetOffset} targetOffset={targetOffset}
getContainer={() => cityContent.current} getContainer={() => cityContent.current}
> >
<ul className={styles.py}>{props.data.siteCityList.letters}</ul> <ul className={styles.py}>
{props.data &&
props.data.siteCityList &&
props.data.siteCityList.letters}
</ul>
<div <div
className={styles.cityContent} className={styles.cityContent}
style={{ height: '335px' }} style={{ height: '335px' }}
ref={cityContent} ref={cityContent}
> >
{props.data.siteCityList.content} {props.data &&
props.data.siteCityList &&
props.data.siteCityList.content}
</div> </div>
</Anchor> </Anchor>
</div> </div>
...@@ -316,7 +322,7 @@ const BasicLayout = props => { ...@@ -316,7 +322,7 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
setTimeout(() => { setTimeout(() => {
if (isMounted) setPageLoading(!pageLoading); if (isMounted) setPageLoading(!pageLoading);
}, 500); }, 1000);
}, []); }, []);
useEffect(() => { useEffect(() => {
...@@ -747,9 +753,10 @@ const BasicLayout = props => { ...@@ -747,9 +753,10 @@ const BasicLayout = props => {
onChange={index => props.updateCurrentIndex(index)} onChange={index => props.updateCurrentIndex(index)}
onSelect={item => handleSelectedKey(item)} onSelect={item => handleSelectedKey(item)}
/> />
{/*noMatch={noMatch*/}
{renderComplexLayout( {renderComplexLayout(
<> <>
<Authorized authority={authorized} {...props} noMatch={noMatch}> <Authorized authority={authorized} {...props}>
{children} {children}
</Authorized> </Authorized>
<div id="micro-container" className="subapp-container" /> <div id="micro-container" className="subapp-container" />
......
...@@ -25,7 +25,7 @@ class Site { ...@@ -25,7 +25,7 @@ class Site {
} }
init(config) { init(config) {
this.initWeatherCity(); // this.initWeatherCity();
} }
initWeatherCity() { initWeatherCity() {
...@@ -335,7 +335,6 @@ class Site { ...@@ -335,7 +335,6 @@ class Site {
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
self.props.updateCurrentIndex && self.props.updateCurrentIndex(0); self.props.updateCurrentIndex && self.props.updateCurrentIndex(0);
window.history.replaceState('', '', `/civbase/`); window.history.replaceState('', '', `/civbase/`);
window.location.reload(); window.location.reload();
}); });
login.init(); login.init();
......
...@@ -7,7 +7,7 @@ const packs = { ...@@ -7,7 +7,7 @@ const packs = {
pwa, pwa,
pages, pages,
settings, settings,
} };
function registerLanguge() { function registerLanguge() {
Object.keys(packs).forEach(pack => { Object.keys(packs).forEach(pack => {
const script = document.createElement('script'); const script = document.createElement('script');
......
...@@ -142,7 +142,7 @@ export const defaultApp = () => { ...@@ -142,7 +142,7 @@ export const defaultApp = () => {
? 'civweb4' ? 'civweb4'
: 'civweb4'; : 'civweb4';
setDefaultMountApp( setDefaultMountApp(
`/${pkg.name.toLocaleLowerCase()}/${basePath}/?client=${config.client}`, `/${pkg.name.toLocaleLowerCase()}/${basePath}?client=${config.client}`,
); );
} }
}; };
...@@ -12,28 +12,40 @@ import i18n from '../../utils/share'; ...@@ -12,28 +12,40 @@ import i18n from '../../utils/share';
const pages = i18n.getI18n('app'); const pages = i18n.getI18n('app');
const industries = ['供水', '排水', '消防', '暖通', '节水', '实验室']; const industries = ['供水', '排水', '消防', '暖通', '节水', '实验室'];
const renderIndustries = (config, callback) => const renderIndustries = (config, callback) =>
industries.map(item => ( industries.map(item => {
<li // if (
className={styles.bootPageLi} // config &&
key={item} // config.userInfo &&
onClick={event => callback(event, item)} // config.userInfo.Industries &&
> // config.userInfo.Industries instanceof Array &&
<div className={styles.bootPageList}> // config.userInfo.Industries.indexOf(item) > -1
<div className={styles.listMain}> // ) {
<img //
src={`https://panda-water.cn/web4/assets/images/bootPage/${item}.png`} // }
alt="" return (
/> <li
<span>{item}</span> className={styles.bootPageLi}
key={item}
onClick={event => callback(event, item)}
>
<div className={styles.bootPageList}>
<div className={styles.listMain}>
<img
src={`https://panda-water.cn/web4/assets/images/bootPage/${item}.png`}
alt=""
/>
<span>{item}</span>
</div>
</div> </div>
</div> </li>
</li> );
)); });
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);
const handlePage = useCallback((event, type) => { const handlePage = useCallback((event, type) => {
event.persist(); event.persist();
event.preventDefault();
setLoadding(true); setLoadding(true);
const config = props.global; const config = props.global;
const loginAction = new LoginAction(props); const loginAction = new LoginAction(props);
...@@ -51,7 +63,7 @@ const BootPage = props => { ...@@ -51,7 +63,7 @@ const BootPage = props => {
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 // eslint-disable-next-line no-restricted-globals
location.reload(); // location.reload();
}); });
}, []); }, []);
useEffect(() => { useEffect(() => {
......
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