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 = {
...defaultSetting
},
fastRefresh: true,
useHash: true,
locale: {
default: 'zh-CN',
antd: true,
......
......@@ -17,17 +17,17 @@ export default {
// },
{
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8080/civ_pandawork`,
entry: `//${window.location.hostname}:8081/civ_pandawork`,
container: '#micro-container',
activeRule: '/civbase/civ_pandawork',
},
{
name: 'report',
entry: `//${window.location.hostname}:8345/report/workplatform`,
entry: `//172.16.10.54:8345/report/workplatform`,
container: '#micro-container',
activeRule: '/civbase/report',
props: {
origin: `//${window.location.hostname}:8345`
origin: `//172.16.10.54:8345`
}
},
// {
......
/* eslint-disable */
// 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 = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
......
const { deepmerge, createDebug, winPath, resolve } = require('@umijs/utils');
// const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader');
const terserOptions = require('./terserOptions');
const fs = require('fs');
const terserOptions = require('./terserOptions');
const path = require('path');
const webpack = require('webpack');
const { css, createCSSRule } = require('./css');
......@@ -57,6 +57,7 @@ const defaultConfig = {
type: 'all',
exclude: [],
},
hash: true,
targets: {
node: true,
chrome: 49,
......@@ -65,13 +66,13 @@ const defaultConfig = {
edge: 13,
ios: 10,
ie: 11,
}
},
};
module.exports = options => {
const chainConfig = new Config();
chainConfig.mode(options.mode);
defineConfig = Object.assign(defineConfig, defaultConfig);
const env = process.env;
const {env} = process;
const isDev = process.env.NODE_ENV === 'development';
const isProd = process.env.NODE_ENV === 'production';
const disableCompress = process.env.COMPRESS === 'none';
......@@ -86,7 +87,7 @@ module.exports = options => {
: devtool || 'cheap-module-source-map'
: devtool,
);
const mfsu = defineConfig.mfsu;
const {mfsu} = defineConfig;
const useHash = defineConfig.hash && isProd;
const absOutputPath = process.env.npm_config_releasepath
......@@ -99,28 +100,25 @@ module.exports = options => {
chainConfig.output
.path(absOutputPath)
.filename(useHash ? `[name].[contenthash:8].js` : `[name].js`)
.chunkFilename(
useHash ? `[name].[contenthash:8].async.js` : `[name].js`,
)
.chunkFilename(useHash ? `[name].[contenthash:8].async.js` : `[name].js`)
.publicPath(`/${pkg.name.toLocaleLowerCase()}/`)
// .futureEmitAssets(true)
.crossOriginLoading('anonymous')
.pathinfo(isDev || disableCompress);
if(!isWebpack5) {
chainConfig.output.futureEmitAssets(true)
if (!isWebpack5) {
chainConfig.output.futureEmitAssets(true);
}
if(isWebpack5) {
if (isWebpack5) {
chainConfig.cache({
type: 'filesystem',
buildDependencies: {
config: [
__filename,
path.join(process.cwd(), 'package.json')
]
config: [__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
.add('node_modules')
......@@ -140,7 +138,7 @@ module.exports = options => {
'.ts',
'.web.tsx',
'.tsx',
'.json'
'.json',
])
.end()
.mainFields.merge(['browser', 'jsnext:main', 'main']);
......@@ -178,15 +176,13 @@ module.exports = options => {
type: 'csr',
});
let presetOpts = getBabelPresetOpts({
const presetOpts = getBabelPresetOpts({
config: defineConfig,
env: process.env.NODE_ENV,
targets: targets,
targets,
});
let preset = require('./babel-preset');
const preset = require('./babel-preset');
const getPreset = preset({
...presetOpts,
env: {
......@@ -201,11 +197,11 @@ module.exports = options => {
reactRequire: true,
lockCoreJS3: {},
import: (presetOpts.import || []).concat([
{ libraryName: 'antd', libraryDirectory: 'es', style: true }
{ libraryName: 'antd', libraryDirectory: 'es', style: true },
]),
});
let babelOpts = {
const babelOpts = {
sourceType: 'unambiguous',
babelrc: false,
presets: [...getPreset.presets, ...(defineConfig.extraBabelPresets || [])],
......@@ -219,13 +215,9 @@ module.exports = options => {
chainConfig.module
.rule('js')
.test(/\.(js|mjs|jsx|ts|tsx)$/)
.include
.add([
cwd,
...(process.env.APP_ROOT ? [process.cwd()] : [])
]).end()
.exclude
.add(/node_modules/)
.include.add([cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.end()
.exclude.add(/node_modules/)
.add(/\.mfsu/)
.end()
.use('babel-loader')
......@@ -322,7 +314,7 @@ module.exports = options => {
.use('raw-loader')
.loader(require.resolve('raw-loader'));
if(defineConfig.workerLoader) {
if (defineConfig.workerLoader) {
chainConfig.module
.rule('worker')
.test(/.*worker.(ts|js)/)
......@@ -345,7 +337,7 @@ module.exports = options => {
if (defineConfig.externals) {
chainConfig.externals(defineConfig.externals);
}
if(!isWebpack5) {
if (!isWebpack5) {
chainConfig.node.merge({
setImmediate: false,
module: 'empty',
......@@ -361,7 +353,6 @@ module.exports = options => {
});
}
if (defineConfig.ignoreMomentLocale) {
chainConfig.plugin('ignore-moment-locale').use(webpack.IgnorePlugin, [
{
......@@ -432,7 +423,6 @@ module.exports = options => {
.plugin('replaceTheme')
.use(ThemeColorReplacer, [themePluginOption]);
const copyPatterns = [
fs.existsSync(path.join(process.cwd(), 'public')) && {
from: path.join(cwd, 'public'),
......@@ -532,9 +522,7 @@ module.exports = options => {
rule.include
.add(/node_modules/)
.end()
.exclude.add(path => {
return isMatch({ path, pkgs });
})
.exclude.add(path => isMatch({ path, pkgs }))
.end();
} else {
const pkgs = {
......@@ -542,12 +530,10 @@ module.exports = options => {
...excludeToPkgs({ exclude: nodeModulesTransform.exclude || [] }),
};
rule.include
.add(path => {
return isMatch({
.add(path => isMatch({
path,
pkgs,
});
})
}))
.end();
}
......@@ -578,12 +564,16 @@ module.exports = options => {
if (process.env.PROGRESS !== 'none') {
chainConfig.plugin('progress').use(require.resolve('webpackbar'), [
mfsu ? {
mfsu
? {
name: 'MFSU',
color: '#facc00'
}: defineConfig.ssr ? {
name: type === 'ssr' ? 'Server': 'Client'
}: {}
color: '#facc00',
}
: defineConfig.ssr
? {
name: type === 'ssr' ? 'Server' : 'Client',
}
: {},
]);
}
......@@ -687,8 +677,6 @@ module.exports = options => {
});
}
// if (defineConfig.chunks) {
// chainConfig
// .plugin('htmlPlugins')
......@@ -715,39 +703,38 @@ module.exports = options => {
ret = smp.wrap(ret);
}
let entry = options.entry;
const {entry} = options;
if (defineConfig.runtimePublicPath) {
entry.push(require.resolve('./runtimePublicPathEntry'));
}
const nodeLibs = require('node-libs-browser');
// const ProvidePlugin = webpack.ProvidePlugin;
if(isWebpack5) {
if (isWebpack5) {
ret.plugins.push(
new webpack.ProvidePlugin({
process: nodeLibs['process']
})
process: nodeLibs.process
}),
);
ret.resolve.fallback = {
...ret.resolve.fallback,
...Object.keys(nodeLibs).reduce((memo, key) => {
if(nodeLibs[key]) {
memo[key] = nodeLibs[key]
if (nodeLibs[key]) {
memo[key] = nodeLibs[key];
} else {
memo[key] = false
};
return memo
memo[key] = false;
}
return memo;
}, {}),
http: false,
https: false,
}
};
}
ret = {
...ret,
// mode: options.mode,
entry: entry,
entry,
plugins: options.plugins.concat([...ret.plugins]),
optimization: {
...options.optimization,
......
......@@ -43,8 +43,8 @@ module.exports = require('./webpack.base.babel')({
}),
],
nodeEnv: 'production',
// chunkIds: "deterministic",
// moduleIds: "deterministic",
chunkIds: 'deterministic',
moduleIds: 'deterministic',
usedExports: true,
sideEffects: true,
concatenateModules: true,
......
......@@ -3,14 +3,9 @@ import React, { Suspense } from 'react';
import { Helmet } from 'react-helmet';
import { connect } from 'react-redux';
// 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 {
Router,
Switch,
Route,
Redirect
} from '@wisdom-utils/runtime';
import { dyRoutes } from '../../routes/config';
// import routeContext from '@ant-design/pro-layout/lib/RouteContext';
......@@ -20,10 +15,14 @@ const pkg = require('../../../package.json');
const config = require('../../../config/config');
const defaultSetting = config.layout;
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 (
<>
<Helmet
......@@ -37,9 +36,7 @@ function App(props) {
href={`https://panda-water.cn/web4/${props.global &&
props.global.shortcutIcon}`}
/>
{
metaSecurity
}
{metaSecurity}
<meta
name="description"
content={`${props.global && props.global.title}`}
......
......@@ -517,7 +517,7 @@ const BasicLayout = props => {
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);
return (
<SecurityLayout loading>
......@@ -617,7 +617,7 @@ const BasicLayout = props => {
<img src={require('../assets/basic/图层 998@2x.png')} style={{width: '100%'}}/>
<div className={layoutStyles.header}>
<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>
<div className={layoutStyles.title}>{props.global.title}</div>
{
......
......@@ -3,29 +3,26 @@ import Iframe from 'react-iframe';
import { connect } from 'react-redux';
const ShareFrame = props => {
const state = props.location.state || {};
if(!state.linkUrl) {
if (!state.linkUrl) {
return null;
}
const { token, userInfo } = props.global;
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%"
height="100%"
id="myId"
frameBorder="0"
className="myClassname"
display="initial"
position="relative"/>
)
}
position="relative"
/>
);
};
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig'])
global: state.getIn(['global', 'globalConfig']),
});
export default connect(
mapStateToProps
)(ShareFrame);
\ No newline at end of file
export default connect(mapStateToProps)(ShareFrame);
......@@ -167,14 +167,18 @@ export const transformWidgets = (widgets) => {
const homePageConvertArray = homepage.split("/");
const findIndex = widgets && widgets.findIndex(item => item.label === '系统菜单组');
if(findIndex === -1 && homePageConvertArray[0] !== 'civweb4') {
const index = widgets.findIndex(item => item.label === '首页');
if(index === -1) {
widgets.push({
label: "系统菜单组",
label: "首页",
icon: '',
product: homePageConvertArray[0],
shortName: "首页",
hideInMenu: true,
url: homePageConvertArray.slice(1, homePageConvertArray.length).join("/")
});
item.widgets = widgets;
item.widgets = Array.from(new Set(widgets));
}
}
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