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,7 +87,7 @@ module.exports = options => { ...@@ -86,7 +87,7 @@ 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
...@@ -99,28 +100,25 @@ module.exports = options => { ...@@ -99,28 +100,25 @@ module.exports = options => {
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')
...@@ -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,13 +215,9 @@ module.exports = options => { ...@@ -219,13 +215,9 @@ 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()] : [])
]).end()
.exclude
.add(/node_modules/)
.add(/\.mfsu/) .add(/\.mfsu/)
.end() .end()
.use('babel-loader') .use('babel-loader')
...@@ -322,7 +314,7 @@ module.exports = options => { ...@@ -322,7 +314,7 @@ 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)/)
...@@ -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',
...@@ -361,7 +353,6 @@ module.exports = options => { ...@@ -361,7 +353,6 @@ module.exports = options => {
}); });
} }
if (defineConfig.ignoreMomentLocale) { if (defineConfig.ignoreMomentLocale) {
chainConfig.plugin('ignore-moment-locale').use(webpack.IgnorePlugin, [ chainConfig.plugin('ignore-moment-locale').use(webpack.IgnorePlugin, [
{ {
...@@ -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'),
...@@ -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', name: 'MFSU',
color: '#facc00' color: '#facc00',
}: defineConfig.ssr ? { }
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')
...@@ -715,39 +703,38 @@ module.exports = options => { ...@@ -715,39 +703,38 @@ module.exports = options => {
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,
......
...@@ -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}`}
......
...@@ -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>
{ {
......
...@@ -3,29 +3,26 @@ import Iframe from 'react-iframe'; ...@@ -3,29 +3,26 @@ 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 ( return (
<Iframe url={`${state.linkUrl}?token=${token}&loginName=${userInfo.loginName}`} <Iframe
url={`http://172.16.10.54:8345/report/manageView/638220756398120960?token=${token}&loginName=${userInfo.loginName}`}
width="100%" width="100%"
height="100%" height="100%"
id="myId" id="myId"
frameBorder="0" frameBorder="0"
className="myClassname" className="myClassname"
display="initial" display="initial"
position="relative"/> 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
...@@ -167,14 +167,18 @@ export const transformWidgets = (widgets) => { ...@@ -167,14 +167,18 @@ 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') {
const index = widgets.findIndex(item => item.label === '首页');
if(index === -1) {
widgets.push({ widgets.push({
label: "系统菜单组", label: "首页",
icon: '', icon: '',
product: homePageConvertArray[0], product: homePageConvertArray[0],
shortName: "首页", shortName: "首页",
hideInMenu: true,
url: homePageConvertArray.slice(1, homePageConvertArray.length).join("/") url: homePageConvertArray.slice(1, homePageConvertArray.length).join("/")
}); });
item.widgets = widgets; 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