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

perf: 优化layout

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