Commit 980851a3 authored by 邓晓峰's avatar 邓晓峰

fix: 修复logo配置

parent d1f4cd0b
Pipeline #43804 passed with stages
in 4 minutes 21 seconds
...@@ -15,6 +15,7 @@ module.exports = { ...@@ -15,6 +15,7 @@ module.exports = {
...defaultSetting ...defaultSetting
}, },
fastRefresh: true, fastRefresh: true,
useHash: true,
locale: { locale: {
default: 'zh-CN', default: 'zh-CN',
antd: true, antd: true,
......
...@@ -17,17 +17,17 @@ export default { ...@@ -17,17 +17,17 @@ export default {
// }, // },
{ {
name: 'civ_pandawork', name: 'civ_pandawork',
entry: `//${window.location.hostname}:8080/civ_pandawork`, entry: `//${window.location.hostname}:8081/civ_pandawork`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_pandawork', activeRule: '/civbase/civ_pandawork',
}, },
{ {
name: 'report', name: 'report',
entry: `//${window.location.hostname}:8345/report/workplatform`, entry: `//172.16.10.54:8345/report/workplatform`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/report', activeRule: '/civbase/report',
props: { props: {
origin: `//${window.location.hostname}:8345` origin: `//172.16.10.54:8345`
} }
}, },
// { // {
......
/* 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://panda-water.com'; const proxyURL = 'https://work.panda-water.cn';
module.exports = { module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './', assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
......
const { deepmerge, createDebug, winPath, resolve } = require('@umijs/utils'); const { deepmerge, createDebug, winPath, resolve } = require('@umijs/utils');
// const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader'); // const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader');
const terserOptions = require('./terserOptions');
const fs = require('fs'); const fs = require('fs');
const terserOptions = require('./terserOptions');
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const { css, createCSSRule } = require('./css'); const { css, createCSSRule } = require('./css');
...@@ -57,6 +57,7 @@ const defaultConfig = { ...@@ -57,6 +57,7 @@ const defaultConfig = {
type: 'all', type: 'all',
exclude: [], exclude: [],
}, },
hash: true,
targets: { targets: {
node: true, node: true,
chrome: 49, chrome: 49,
...@@ -65,13 +66,13 @@ const defaultConfig = { ...@@ -65,13 +66,13 @@ const defaultConfig = {
edge: 13, edge: 13,
ios: 10, ios: 10,
ie: 11, ie: 11,
} },
}; };
module.exports = options => { module.exports = options => {
const chainConfig = new Config(); const chainConfig = new Config();
chainConfig.mode(options.mode); chainConfig.mode(options.mode);
defineConfig = Object.assign(defineConfig, defaultConfig); defineConfig = Object.assign(defineConfig, defaultConfig);
const env = process.env; const {env} = process;
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isProd = process.env.NODE_ENV === 'production'; const isProd = process.env.NODE_ENV === 'production';
const disableCompress = process.env.COMPRESS === 'none'; const disableCompress = process.env.COMPRESS === 'none';
...@@ -86,50 +87,47 @@ module.exports = options => { ...@@ -86,50 +87,47 @@ module.exports = options => {
: devtool || 'cheap-module-source-map' : devtool || 'cheap-module-source-map'
: devtool, : devtool,
); );
const mfsu = defineConfig.mfsu; const {mfsu} = defineConfig;
const useHash = defineConfig.hash && isProd; const useHash = defineConfig.hash && isProd;
const absOutputPath = process.env.npm_config_releasepath const absOutputPath = 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());
chainConfig.output chainConfig.output
.path(absOutputPath) .path(absOutputPath)
.filename(useHash ? `[name].[contenthash:8].js` : `[name].js`) .filename(useHash ? `[name].[contenthash:8].js` : `[name].js`)
.chunkFilename( .chunkFilename(useHash ? `[name].[contenthash:8].async.js` : `[name].js`)
useHash ? `[name].[contenthash:8].async.js` : `[name].js`,
)
.publicPath(`/${pkg.name.toLocaleLowerCase()}/`) .publicPath(`/${pkg.name.toLocaleLowerCase()}/`)
// .futureEmitAssets(true) // .futureEmitAssets(true)
.crossOriginLoading('anonymous') .crossOriginLoading('anonymous')
.pathinfo(isDev || disableCompress); .pathinfo(isDev || disableCompress);
if(!isWebpack5) { if (!isWebpack5) {
chainConfig.output.futureEmitAssets(true) chainConfig.output.futureEmitAssets(true);
} }
if(isWebpack5) { if (isWebpack5) {
chainConfig.cache({ chainConfig.cache({
type: 'filesystem', type: 'filesystem',
buildDependencies: { buildDependencies: {
config: [ config: [__filename, path.join(process.cwd(), 'package.json')],
__filename,
path.join(process.cwd(), 'package.json')
]
}, },
cacheDirectory: path.resolve(process.cwd(), 'node_modules/.cache') cacheDirectory: path.resolve(process.cwd(), 'node_modules/.cache'),
}) compression: 'gzip',
version: `${process.env.GIT_REV}`,
});
} }
chainConfig.resolve.modules chainConfig.resolve.modules
.add('node_modules') .add('node_modules')
.add('src') .add('src')
.end() .end()
.extensions.merge([ .extensions.merge([
'.js', '.js',
'.jsx', '.jsx',
'.react.js', '.react.js',
'.web.js', '.web.js',
'.wasm', '.wasm',
'.mjs', '.mjs',
...@@ -140,7 +138,7 @@ module.exports = options => { ...@@ -140,7 +138,7 @@ module.exports = options => {
'.ts', '.ts',
'.web.tsx', '.web.tsx',
'.tsx', '.tsx',
'.json' '.json',
]) ])
.end() .end()
.mainFields.merge(['browser', 'jsnext:main', 'main']); .mainFields.merge(['browser', 'jsnext:main', 'main']);
...@@ -178,15 +176,13 @@ module.exports = options => { ...@@ -178,15 +176,13 @@ module.exports = options => {
type: 'csr', type: 'csr',
}); });
const presetOpts = getBabelPresetOpts({
let presetOpts = getBabelPresetOpts({
config: defineConfig, config: defineConfig,
env: process.env.NODE_ENV, env: process.env.NODE_ENV,
targets: targets, targets,
}); });
let preset = require('./babel-preset'); const preset = require('./babel-preset');
const getPreset = preset({ const getPreset = preset({
...presetOpts, ...presetOpts,
env: { env: {
...@@ -201,11 +197,11 @@ module.exports = options => { ...@@ -201,11 +197,11 @@ module.exports = options => {
reactRequire: true, reactRequire: true,
lockCoreJS3: {}, lockCoreJS3: {},
import: (presetOpts.import || []).concat([ import: (presetOpts.import || []).concat([
{ libraryName: 'antd', libraryDirectory: 'es', style: true } { libraryName: 'antd', libraryDirectory: 'es', style: true },
]), ]),
}); });
let babelOpts = { const babelOpts = {
sourceType: 'unambiguous', sourceType: 'unambiguous',
babelrc: false, babelrc: false,
presets: [...getPreset.presets, ...(defineConfig.extraBabelPresets || [])], presets: [...getPreset.presets, ...(defineConfig.extraBabelPresets || [])],
...@@ -219,14 +215,10 @@ module.exports = options => { ...@@ -219,14 +215,10 @@ module.exports = options => {
chainConfig.module chainConfig.module
.rule('js') .rule('js')
.test(/\.(js|mjs|jsx|ts|tsx)$/) .test(/\.(js|mjs|jsx|ts|tsx)$/)
.include .include.add([cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.add([ .end()
cwd, .exclude.add(/node_modules/)
...(process.env.APP_ROOT ? [process.cwd()] : []) .add(/\.mfsu/)
]).end()
.exclude
.add(/node_modules/)
.add(/\.mfsu/)
.end() .end()
.use('babel-loader') .use('babel-loader')
.loader(require.resolve('@umijs/deps/compiled/babel-loader')) .loader(require.resolve('@umijs/deps/compiled/babel-loader'))
...@@ -273,16 +265,16 @@ module.exports = options => { ...@@ -273,16 +265,16 @@ module.exports = options => {
}, },
}, },
}); });
chainConfig.module chainConfig.module
.rule('avif') .rule('avif')
.test(/\.(avif)(\?.*)?$/) .test(/\.(avif)(\?.*)?$/)
.use('file-loader') .use('file-loader')
.loader(require.resolve('file-loader')) .loader(require.resolve('file-loader'))
.options({ .options({
name: `${staticDir}/[name].[hash:8].[ext]`, name: `${staticDir}/[name].[hash:8].[ext]`,
esModule: false, esModule: false,
}); });
chainConfig.module chainConfig.module
...@@ -322,14 +314,14 @@ module.exports = options => { ...@@ -322,14 +314,14 @@ module.exports = options => {
.use('raw-loader') .use('raw-loader')
.loader(require.resolve('raw-loader')); .loader(require.resolve('raw-loader'));
if(defineConfig.workerLoader) { if (defineConfig.workerLoader) {
chainConfig.module chainConfig.module
.rule('worker') .rule('worker')
.test(/.*worker.(ts|js)/) .test(/.*worker.(ts|js)/)
.use('worker-loader') .use('worker-loader')
.loader(require.resolve('@umijs/deps/compiled/worker-loader')) .loader(require.resolve('@umijs/deps/compiled/worker-loader'))
.options(defineConfig.workerLoader); .options(defineConfig.workerLoader);
} }
css({ css({
type: 'csr', type: 'csr',
...@@ -345,7 +337,7 @@ module.exports = options => { ...@@ -345,7 +337,7 @@ module.exports = options => {
if (defineConfig.externals) { if (defineConfig.externals) {
chainConfig.externals(defineConfig.externals); chainConfig.externals(defineConfig.externals);
} }
if(!isWebpack5) { if (!isWebpack5) {
chainConfig.node.merge({ chainConfig.node.merge({
setImmediate: false, setImmediate: false,
module: 'empty', module: 'empty',
...@@ -360,7 +352,6 @@ module.exports = options => { ...@@ -360,7 +352,6 @@ module.exports = options => {
...options.node, ...options.node,
}); });
} }
if (defineConfig.ignoreMomentLocale) { if (defineConfig.ignoreMomentLocale) {
chainConfig.plugin('ignore-moment-locale').use(webpack.IgnorePlugin, [ chainConfig.plugin('ignore-moment-locale').use(webpack.IgnorePlugin, [
...@@ -398,23 +389,23 @@ module.exports = options => { ...@@ -398,23 +389,23 @@ module.exports = options => {
}; };
const htmlPluginOptions = isDev const htmlPluginOptions = isDev
? { ? {
...babelOpts, ...babelOpts,
} }
: { : {
...baseHtmlOptions, ...baseHtmlOptions,
minify: { minify: {
removeComments: true, removeComments: true,
collapseWhitespace: true, collapseWhitespace: true,
removeRedundantAttributes: true, removeRedundantAttributes: true,
useShortDoctype: true, useShortDoctype: true,
removeEmptyAttributes: true, removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true, removeStyleLinkTypeAttributes: true,
keepClosingSlash: true, keepClosingSlash: true,
minifyJS: true, minifyJS: true,
minifyCSS: true, minifyCSS: true,
minifyURLs: true, minifyURLs: true,
}, },
}; };
chainConfig chainConfig
.plugin('htmlPlugins') .plugin('htmlPlugins')
...@@ -432,7 +423,6 @@ module.exports = options => { ...@@ -432,7 +423,6 @@ module.exports = options => {
.plugin('replaceTheme') .plugin('replaceTheme')
.use(ThemeColorReplacer, [themePluginOption]); .use(ThemeColorReplacer, [themePluginOption]);
const copyPatterns = [ const copyPatterns = [
fs.existsSync(path.join(process.cwd(), 'public')) && { fs.existsSync(path.join(process.cwd(), 'public')) && {
from: path.join(cwd, 'public'), from: path.join(cwd, 'public'),
...@@ -443,23 +433,23 @@ module.exports = options => { ...@@ -443,23 +433,23 @@ module.exports = options => {
}, },
...(defineConfig.copy ...(defineConfig.copy
? defineConfig.copy.map(item => { ? defineConfig.copy.map(item => {
if (typeof item === 'string') { if (typeof item === 'string') {
return {
from: path.join(cwd, item),
to: path.resolve(
process.env.npm_config_releasepath || process.cwd(),
pkg.name.toLocaleLowerCase(),
),
};
}
return { return {
from: path.join(cwd, item.from), from: path.join(cwd, item),
to: path.resolve( to: path.resolve(
process.env.npm_config_releasepath || process.cwd(), process.env.npm_config_releasepath || process.cwd(),
pkg.name.toLocaleLowerCase() + '/' + item.to, pkg.name.toLocaleLowerCase(),
), ),
}; };
}) }
return {
from: path.join(cwd, item.from),
to: path.resolve(
process.env.npm_config_releasepath || process.cwd(),
pkg.name.toLocaleLowerCase() + '/' + item.to,
),
};
})
: []), : []),
].filter(Boolean); ].filter(Boolean);
...@@ -486,23 +476,23 @@ module.exports = options => { ...@@ -486,23 +476,23 @@ module.exports = options => {
// prettier-ignore // prettier-ignore
chainConfig.module chainConfig.module
.rule(rule) .rule(rule)
.test(/\.(js|mjs|jsx)$/) .test(/\.(js|mjs|jsx)$/)
.include .include
.add((a) => { .add((a) => {
// 支持绝对路径匹配 // 支持绝对路径匹配
if (path.isAbsolute(include)) { if (path.isAbsolute(include)) {
return path.isAbsolute(include); return path.isAbsolute(include);
} }
// 支持 node_modules 下的 npm 包 // 支持 node_modules 下的 npm 包
if (!a.includes('node_modules')) return false; if (!a.includes('node_modules')) return false;
const pkgPath = getPkgPath(a); const pkgPath = getPkgPath(a);
return shouldTransform(pkgPath, include); return shouldTransform(pkgPath, include);
}) })
.end() .end()
.use('babel-loader') .use('babel-loader')
.loader(require.resolve('babel-loader')) .loader(require.resolve('babel-loader'))
.options(babelOpts); .options(babelOpts);
}); });
} }
...@@ -532,9 +522,7 @@ module.exports = options => { ...@@ -532,9 +522,7 @@ module.exports = options => {
rule.include rule.include
.add(/node_modules/) .add(/node_modules/)
.end() .end()
.exclude.add(path => { .exclude.add(path => isMatch({ path, pkgs }))
return isMatch({ path, pkgs });
})
.end(); .end();
} else { } else {
const pkgs = { const pkgs = {
...@@ -542,12 +530,10 @@ module.exports = options => { ...@@ -542,12 +530,10 @@ module.exports = options => {
...excludeToPkgs({ exclude: nodeModulesTransform.exclude || [] }), ...excludeToPkgs({ exclude: nodeModulesTransform.exclude || [] }),
}; };
rule.include rule.include
.add(path => { .add(path => isMatch({
return isMatch({
path, path,
pkgs, pkgs,
}); }))
})
.end(); .end();
} }
...@@ -578,12 +564,16 @@ module.exports = options => { ...@@ -578,12 +564,16 @@ module.exports = options => {
if (process.env.PROGRESS !== 'none') { if (process.env.PROGRESS !== 'none') {
chainConfig.plugin('progress').use(require.resolve('webpackbar'), [ chainConfig.plugin('progress').use(require.resolve('webpackbar'), [
mfsu ? { mfsu
name: 'MFSU', ? {
color: '#facc00' name: 'MFSU',
}: defineConfig.ssr ? { color: '#facc00',
name: type === 'ssr' ? 'Server': 'Client' }
}: {} : defineConfig.ssr
? {
name: type === 'ssr' ? 'Server' : 'Client',
}
: {},
]); ]);
} }
...@@ -687,8 +677,6 @@ module.exports = options => { ...@@ -687,8 +677,6 @@ module.exports = options => {
}); });
} }
// if (defineConfig.chunks) { // if (defineConfig.chunks) {
// chainConfig // chainConfig
// .plugin('htmlPlugins') // .plugin('htmlPlugins')
...@@ -708,46 +696,45 @@ module.exports = options => { ...@@ -708,46 +696,45 @@ module.exports = options => {
process.env.SPEED_MEASURE === 'CONSOLE' process.env.SPEED_MEASURE === 'CONSOLE'
? { outputFormat: 'human', outputTarget: console.log } ? { outputFormat: 'human', outputTarget: console.log }
: { : {
outputFormat: 'json', outputFormat: 'json',
outputTarget: join(process.cwd(), 'speed-measure.json'), outputTarget: join(process.cwd(), 'speed-measure.json'),
}; };
const smp = new SpeedMeasurePlugin(smpOption); const smp = new SpeedMeasurePlugin(smpOption);
ret = smp.wrap(ret); ret = smp.wrap(ret);
} }
let entry = options.entry; const {entry} = options;
if (defineConfig.runtimePublicPath) { if (defineConfig.runtimePublicPath) {
entry.push(require.resolve('./runtimePublicPathEntry')); entry.push(require.resolve('./runtimePublicPathEntry'));
} }
const nodeLibs = require('node-libs-browser'); const nodeLibs = require('node-libs-browser');
// const ProvidePlugin = webpack.ProvidePlugin; // const ProvidePlugin = webpack.ProvidePlugin;
if(isWebpack5) { if (isWebpack5) {
ret.plugins.push( ret.plugins.push(
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: nodeLibs['process'] process: nodeLibs.process
}) }),
); );
ret.resolve.fallback = { ret.resolve.fallback = {
...ret.resolve.fallback, ...ret.resolve.fallback,
...Object.keys(nodeLibs).reduce((memo, key) => { ...Object.keys(nodeLibs).reduce((memo, key) => {
if(nodeLibs[key]) { if (nodeLibs[key]) {
memo[key] = nodeLibs[key] memo[key] = nodeLibs[key];
} else { } else {
memo[key] = false memo[key] = false;
}; }
return memo return memo;
}, {}), }, {}),
http: false, http: false,
https: false, https: false,
} };
} }
ret = { ret = {
...ret, ...ret,
// mode: options.mode, // mode: options.mode,
entry: entry, entry,
plugins: options.plugins.concat([...ret.plugins]), plugins: options.plugins.concat([...ret.plugins]),
optimization: { optimization: {
...options.optimization, ...options.optimization,
......
...@@ -27,7 +27,7 @@ module.exports = require('./webpack.base.babel')({ ...@@ -27,7 +27,7 @@ module.exports = require('./webpack.base.babel')({
compress: { compress: {
comparisons: false, comparisons: false,
}, },
drop_debugger: true, drop_debugger: true,
drop_console: true, drop_console: true,
pure_funcs: ['console.log'], pure_funcs: ['console.log'],
parse: {}, parse: {},
...@@ -43,8 +43,8 @@ module.exports = require('./webpack.base.babel')({ ...@@ -43,8 +43,8 @@ module.exports = require('./webpack.base.babel')({
}), }),
], ],
nodeEnv: 'production', nodeEnv: 'production',
// chunkIds: "deterministic", chunkIds: 'deterministic',
// moduleIds: "deterministic", moduleIds: 'deterministic',
usedExports: true, usedExports: true,
sideEffects: true, sideEffects: true,
concatenateModules: true, concatenateModules: true,
......
...@@ -3,14 +3,9 @@ import React, { Suspense } from 'react'; ...@@ -3,14 +3,9 @@ import React, { Suspense } 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';
import { renderRoutes } from '../../utils/routes' import { Router, Switch, Route, Redirect } from '@wisdom-utils/runtime';
import { renderRoutes } from '../../utils/routes';
// import BootPage from '../../pages/bootpage'; // import BootPage from '../../pages/bootpage';
import {
Router,
Switch,
Route,
Redirect
} from '@wisdom-utils/runtime';
import { dyRoutes } from '../../routes/config'; import { dyRoutes } from '../../routes/config';
// import routeContext from '@ant-design/pro-layout/lib/RouteContext'; // import routeContext from '@ant-design/pro-layout/lib/RouteContext';
...@@ -20,10 +15,14 @@ const pkg = require('../../../package.json'); ...@@ -20,10 +15,14 @@ const pkg = require('../../../package.json');
const config = require('../../../config/config'); const config = require('../../../config/config');
const defaultSetting = config.layout; const defaultSetting = config.layout;
function App(props) { function App(props) {
// //
const metaSecurity = /https/.test(window.location.protocol) ? <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"></meta>: null; const metaSecurity = /https/.test(window.location.protocol) ? (
<meta
httpEquiv="Content-Security-Policy"
content="upgrade-insecure-requests"
/>
) : null;
return ( return (
<> <>
<Helmet <Helmet
...@@ -37,9 +36,7 @@ function App(props) { ...@@ -37,9 +36,7 @@ function App(props) {
href={`https://panda-water.cn/web4/${props.global && href={`https://panda-water.cn/web4/${props.global &&
props.global.shortcutIcon}`} props.global.shortcutIcon}`}
/> />
{ {metaSecurity}
metaSecurity
}
<meta <meta
name="description" name="description"
content={`${props.global && props.global.title}`} content={`${props.global && props.global.title}`}
......
...@@ -354,7 +354,7 @@ const BasicLayout = props => { ...@@ -354,7 +354,7 @@ const BasicLayout = props => {
// setChildrenRoutes(currentChildrenRoute) // setChildrenRoutes(currentChildrenRoute)
window.share.event.on('goHome', url => { window.share.event.on('goHome', url => {
setChildrenRoutes([ setChildrenRoutes([
{ {
icon: <HomeIcon/>, icon: <HomeIcon/>,
...@@ -362,11 +362,11 @@ const BasicLayout = props => { ...@@ -362,11 +362,11 @@ const BasicLayout = props => {
name: '首页' name: '首页'
} }
]); ]);
setTabActiveKey(url); setTabActiveKey(url);
window.history.pushState(null, '', `/civbase${url}`); window.history.pushState(null, '', `/civbase${url}`);
}); });
/** /**
* web4全屏退出,切换三级菜单高亮 * web4全屏退出,切换三级菜单高亮
...@@ -409,7 +409,7 @@ const BasicLayout = props => { ...@@ -409,7 +409,7 @@ const BasicLayout = props => {
}, []); }, []);
const handlerSecond = (item, index) => { const handlerSecond = (item, index) => {
let current = void 0; let current = void 0;
if(item && item.routes) { if(item && item.routes) {
setChildrenRoutes(item.routes); setChildrenRoutes(item.routes);
...@@ -433,7 +433,7 @@ const BasicLayout = props => { ...@@ -433,7 +433,7 @@ const BasicLayout = props => {
} else { } else {
window.history.pushState(null, '', `/civbase${current.path}`); window.history.pushState(null, '', `/civbase${current.path}`);
} }
} }
...@@ -444,7 +444,7 @@ const BasicLayout = props => { ...@@ -444,7 +444,7 @@ const BasicLayout = props => {
} }
const handleUpdateCurrentIndex = index => { const handleUpdateCurrentIndex = index => {
setSelectIndex(-1) setSelectIndex(-1)
props.updateCurrentIndex(index); props.updateCurrentIndex(index);
window.share && window.share.event.emit('trigger:updateMenuIndex', index); window.share && window.share.event.emit('trigger:updateMenuIndex', index);
...@@ -452,7 +452,7 @@ const BasicLayout = props => { ...@@ -452,7 +452,7 @@ const BasicLayout = props => {
} }
const handleSelectMenuItem = (item) => { const handleSelectMenuItem = (item) => {
setTabActiveKey(item); setTabActiveKey(item);
if(item.indexOf('web_console') === -1) { if(item.indexOf('web_console') === -1) {
window.history.pushState(null, '', `/civbase${item}`); window.history.pushState(null, '', `/civbase${item}`);
...@@ -517,7 +517,7 @@ const BasicLayout = props => { ...@@ -517,7 +517,7 @@ const BasicLayout = props => {
setCollapse(!collapse); setCollapse(!collapse);
} }
// const logo = props.global && props.global.get('bannerLogo')? window.globalConfig.transformDevAssetsBaseURL(props.global.get('bannerLogo')): defaultSetting.logo; const logo = props.global && props.global.get('bannerLogo')? window.globalConfig.transformDevAssetsBaseURL(props.global.get('bannerLogo')): defaultSetting.logo;
console.log("children", props.children, props); console.log("children", props.children, props);
return ( return (
<SecurityLayout loading> <SecurityLayout loading>
...@@ -617,7 +617,7 @@ const BasicLayout = props => { ...@@ -617,7 +617,7 @@ const BasicLayout = props => {
<img src={require('../assets/basic/图层 998@2x.png')} style={{width: '100%'}}/> <img src={require('../assets/basic/图层 998@2x.png')} style={{width: '100%'}}/>
<div className={layoutStyles.header}> <div className={layoutStyles.header}>
<a className={layoutStyles.logo} onClick={handlerIndustry}> <a className={layoutStyles.logo} onClick={handlerIndustry}>
<img src="https://panda-water.com/web4/assets/images/logo/单独图案-白色.svg" alt="logo"/> <img src={`${logo}`} alt="logo"/>
</a> </a>
<div className={layoutStyles.title}>{props.global.title}</div> <div className={layoutStyles.title}>{props.global.title}</div>
{ {
...@@ -693,7 +693,7 @@ const BasicLayout = props => { ...@@ -693,7 +693,7 @@ const BasicLayout = props => {
</PageContainer> </PageContainer>
) )
} }
</SecurityLayout>); </SecurityLayout>);
}; };
......
...@@ -2,30 +2,27 @@ import React from 'react'; ...@@ -2,30 +2,27 @@ import React from 'react';
import Iframe from 'react-iframe'; import Iframe from 'react-iframe';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
const ShareFrame = props => { const ShareFrame = props => {
const state = props.location.state || {}; const state = props.location.state || {};
if(!state.linkUrl) { if (!state.linkUrl) {
return null; return null;
} }
const { token, userInfo } = props.global; const { token, userInfo } = props.global;
return (
<Iframe url={`${state.linkUrl}?token=${token}&loginName=${userInfo.loginName}`}
width="100%"
height="100%"
id="myId"
frameBorder="0"
className="myClassname"
display="initial"
position="relative"/>
)
}
return (
<Iframe
url={`http://172.16.10.54:8345/report/manageView/638220756398120960?token=${token}&loginName=${userInfo.loginName}`}
width="100%"
height="100%"
id="myId"
frameBorder="0"
className="myClassname"
display="initial"
position="relative"
/>
);
};
const mapStateToProps = state => ({ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']) global: state.getIn(['global', 'globalConfig']),
}); });
export default connect( export default connect(mapStateToProps)(ShareFrame);
mapStateToProps
)(ShareFrame);
\ No newline at end of file
...@@ -52,7 +52,7 @@ const getURL = url => { ...@@ -52,7 +52,7 @@ const getURL = url => {
}; };
const generRotes = (widgets, parent, level = 0) => { const generRotes = (widgets, parent, level = 0) => {
const ret = []; const ret = [];
if(!widgets || widgets.length === 0){ if(!widgets || widgets.length === 0){
return return
...@@ -131,7 +131,7 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -131,7 +131,7 @@ const generRotes = (widgets, parent, level = 0) => {
}; };
if(/iframe/.test(url)) { if(/iframe/.test(url)) {
url = url.replace(/\/report/, ''); url = url.replace(/\/report/, '');
common = { common = {
name: item.label, name: item.label,
level: l, level: l,
...@@ -151,7 +151,7 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -151,7 +151,7 @@ const generRotes = (widgets, parent, level = 0) => {
params: getParams(url), params: getParams(url),
parent, parent,
} }
} }
ret.push(common); ret.push(common);
} }
}); });
...@@ -167,16 +167,20 @@ export const transformWidgets = (widgets) => { ...@@ -167,16 +167,20 @@ export const transformWidgets = (widgets) => {
const homePageConvertArray = homepage.split("/"); const homePageConvertArray = homepage.split("/");
const findIndex = widgets && widgets.findIndex(item => item.label === '系统菜单组'); const findIndex = widgets && widgets.findIndex(item => item.label === '系统菜单组');
if(findIndex === -1 && homePageConvertArray[0] !== 'civweb4') { if(findIndex === -1 && homePageConvertArray[0] !== 'civweb4') {
widgets.push({ const index = widgets.findIndex(item => item.label === '首页');
label: "系统菜单组", if(index === -1) {
icon: '', widgets.push({
product: homePageConvertArray[0], label: "首页",
shortName: "首页", icon: '',
url: homePageConvertArray.slice(1, homePageConvertArray.length).join("/") product: homePageConvertArray[0],
}); shortName: "首页",
item.widgets = widgets; hideInMenu: true,
url: homePageConvertArray.slice(1, homePageConvertArray.length).join("/")
});
item.widgets = Array.from(new Set(widgets));
}
} }
return item; return item;
}); });
} }
......
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