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

fix: 修复civweb4首页跳转

parent 3bd4c46d
Pipeline #43885 passed with stages
in 4 minutes 9 seconds
const proxy = require('./proxy');
const slash = require('slash2'); const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting'); const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env; const { REACT_APP_ENV } = process.env;
module.exports = { module.exports = {
...@@ -12,7 +11,7 @@ module.exports = { ...@@ -12,7 +11,7 @@ module.exports = {
layout: { layout: {
siderWidth: '145px', siderWidth: '145px',
locale: true, locale: true,
...defaultSetting ...defaultSetting,
}, },
fastRefresh: true, fastRefresh: true,
useHash: true, useHash: true,
...@@ -30,7 +29,11 @@ module.exports = { ...@@ -30,7 +29,11 @@ module.exports = {
ignoreMomentLocale: true, ignoreMomentLocale: true,
nodeModulesTransform: { nodeModulesTransform: {
type: 'none', type: 'none',
exclude: ['@wisdom-map/arcgismap', '@wisdom-map/arcgismap/lib/arcgisapi', 'swagger-ui-react'], exclude: [
'@wisdom-map/arcgismap',
'@wisdom-map/arcgismap/lib/arcgisapi',
'swagger-ui-react',
],
}, },
proxy: proxy[REACT_APP_ENV || 'dev'], proxy: proxy[REACT_APP_ENV || 'dev'],
// openAPI: { // openAPI: {
...@@ -73,10 +76,10 @@ module.exports = { ...@@ -73,10 +76,10 @@ module.exports = {
modifyVars: { modifyVars: {
// hack: `true; @import "~@/global.less";`, // hack: `true; @import "~@/global.less";`,
'@ant-prefix': 'panda-console-base', '@ant-prefix': 'panda-console-base',
'@iconPrefixCls': 'panda-console-base-icon' '@iconPrefixCls': 'panda-console-base-icon',
}, },
javascriptEnabled: true javascriptEnabled: true,
}, },
workerLoader: {} workerLoader: {},
// esbuild: {} // esbuild: {}
}; };
/* 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://work.panda-water.cn'; const proxyURL = 'https://panda-water.com';
module.exports = { module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './', assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
......
...@@ -40,22 +40,22 @@ class DevCompileDonePlugin { ...@@ -40,22 +40,22 @@ class DevCompileDonePlugin {
.filter(Boolean) .filter(Boolean)
.join('\n'), .join('\n'),
); );
process.send && process.send({ process.send &&
type: 'DONE' process.send({
}); type: 'DONE',
});
isFirstCompile = false; isFirstCompile = false;
} }
// this.opts.onCompileDone && this.opts.onCompileDone({ // this.opts.onCompileDone && this.opts.onCompileDone({
// isFirstCompile, // isFirstCompile,
// stats, // stats,
// }); // });
if(isFirstCompile) { if (isFirstCompile) {
isFirstCompile = false; isFirstCompile = false;
// process.send({ // process.send({
// type: 'DONE' // type: 'DONE'
// }) // })
} }
}); });
} }
......
This diff is collapsed.
-----BEGIN CERTIFICATE-----
MIIETDCCArSgAwIBAgIQKxt9OXlPUkkQASISMtxezDANBgkqhkiG9w0BAQsFADBh
MR4wHAYDVQQKExVta2NlcnQgZGV2ZWxvcG1lbnQgQ0ExGzAZBgNVBAsMEmpjbEB5
Y2pjbDg2OC5sb2NhbDEiMCAGA1UEAwwZbWtjZXJ0IGpjbEB5Y2pjbDg2OC5sb2Nh
bDAeFw0xOTA2MDEwMDAwMDBaFw0zMDA2MDEwOTMzNTdaMEkxJzAlBgNVBAoTHm1r
Y2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTEeMBwGA1UECwwVamNsQHVtaWpz
LmxvY2FsICh1bWkpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvKA/
Oz9az6kEZ5zSZyufpYXt5gOAnE/f8VY2hP3g7JDRCMk6w0XgkmGDJ45nY9fVVhCy
oqg8bIkLcLbvp69/I5O8ae0TbyS95mgBflhgsqjSkydhn7bZmAe5OdZv+JtGBjd2
2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4k2R2W+nPFmSa
sYgCY0Si1aEqbSgR3BQE5LNW7DCAMoJYRUVOUNnJ6Ohclor1R15/DjZ5/RQioztB
k2tM/DzMoRDt7iU6F7DCAyMoglNMCKMjhWhJudFC/BOtx02EUXENFjifAoGAD966
yEcw+XbWL9Zno2vebsuA5g0juFXsLBPj5gOJEvdjvJlgqcbKt8mOsSXsS8YKXs+j
jkTKWp21INkknqioS781kKhKXiSaPmuvdTDIZlQkamPtOFr0l55hTK3kw4HeTFxQ
VgwFEDl0HaUvVtVJxOkgbUWTJmiqO/kkNpeTHuECgYEAtD4dRK3w65d9BWHqgeOV
IVSDeYjA6gNuC3tuGzk9bA70U0X/T8+EQMuKNvRZC61/JzAlzEH1oGIw8md8Ki86
aRT96Gce7Q0FA3SaQ+h+w+kgsJG/aly3IThaJh/mx6HN7Xry6BFO1vlYlgdlm/1G
iKX/ppCt7bJYqfrptWs42u4=
-----END PRIVATE KEY-----
...@@ -2,11 +2,11 @@ const { join } = require('path'); ...@@ -2,11 +2,11 @@ const { join } = require('path');
const { writeFileSync, mkdirSync, existsSync } = require('fs'); const { writeFileSync, mkdirSync, existsSync } = require('fs');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const serveStatic = require('serve-static'); const serveStatic = require('serve-static');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const argv = require('./argv'); const argv = require('./argv');
const setup = require('./middlewares/frontendMiddleware'); const setup = require('./middlewares/frontendMiddleware');
const pkg = require('../package.json'); const pkg = require('../package.json');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const config = require('../config/config'); const config = require('../config/config');
const mockMiddewares = require('./mock'); const mockMiddewares = require('./mock');
const emitter = require('./event'); const emitter = require('./event');
...@@ -30,9 +30,9 @@ const { getSchema } = require('./openapi'); ...@@ -30,9 +30,9 @@ const { getSchema } = require('./openapi');
const isHTTPS = process.env.HTTPS || (argv && argv.https); const isHTTPS = process.env.HTTPS || (argv && argv.https);
await delay(500); await delay(500);
const absNodeModulesPath = process.cwd() + '/node_modules'; const absNodeModulesPath = `${process.cwd()}/node_modules`;
const openAPIFilesPath = join(absNodeModulesPath, 'civ_open_api'); const openAPIFilesPath = join(absNodeModulesPath, 'civ_open_api');
const loadEnv = () => { const loadEnv = () => {
const basePath = join(process.cwd(), '.env'); const basePath = join(process.cwd(), '.env');
const localPath = `${basePath}.local`; const localPath = `${basePath}.local`;
...@@ -41,7 +41,7 @@ const { getSchema } = require('./openapi'); ...@@ -41,7 +41,7 @@ const { getSchema } = require('./openapi');
}; };
loadEnv(); loadEnv();
// const absNodeModulesPath = cwd + '/node_modules'; // const absNodeModulesPath = cwd + '/node_modules';
try { try {
if (existsSync(openAPIFilesPath)) { if (existsSync(openAPIFilesPath)) {
...@@ -58,7 +58,7 @@ const { getSchema } = require('./openapi'); ...@@ -58,7 +58,7 @@ const { getSchema } = require('./openapi');
headers: { headers: {
'access-control-allow-origin': '*', 'access-control-allow-origin': '*',
}, },
port: port, port,
beforeMiddlewares: [ beforeMiddlewares: [
(config.mock || process.env.MOCK !== 'none') && mockMiddewares, (config.mock || process.env.MOCK !== 'none') && mockMiddewares,
], ],
...@@ -67,6 +67,7 @@ const { getSchema } = require('./openapi'); ...@@ -67,6 +67,7 @@ const { getSchema } = require('./openapi');
...(config.devServer || {}), ...(config.devServer || {}),
}); });
setup( setup(
server.app, server.app,
{ {
...@@ -76,14 +77,14 @@ const { getSchema } = require('./openapi'); ...@@ -76,14 +77,14 @@ const { getSchema } = require('./openapi');
config, config,
{ {
port, port,
homename homename,
} },
); );
emitter.on('onDevCompileDone', async () => { emitter.on('onDevCompileDone', async () => {
try { try {
const openAPIConfig = config.openAPI; const openAPIConfig = config.openAPI;
if(openAPIConfig && openAPIConfig.schemaPath) { if (openAPIConfig && openAPIConfig.schemaPath) {
const openAPIJson = await getSchema(openAPIConfig.schemaPath); const openAPIJson = await getSchema(openAPIConfig.schemaPath);
writeFileSync( writeFileSync(
join(openAPIFilesPath, 'civ-plugins_openapi.json'), join(openAPIFilesPath, 'civ-plugins_openapi.json'),
......
...@@ -6,7 +6,9 @@ const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompile ...@@ -6,7 +6,9 @@ const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompile
const emitter = require('../event'); const emitter = require('../event');
function getIgnoredWatchRegExp() { function getIgnoredWatchRegExp() {
// const absOutputPath = winPath(path.join(process.cwd(), outputPath)); // const absOutputPath = winPath(path.join(process.cwd(), outputPath));
return process.env.WATCH_IGNORED === 'none' ? undefined: new RegExp(process.env.WATCH_IGNORED || `(node_modules)`) return process.env.WATCH_IGNORED === 'none'
? undefined
: new RegExp(process.env.WATCH_IGNORED || `(node_modules)`);
} }
function createWebpackMiddleware(compiler, output, config) { function createWebpackMiddleware(compiler, output, config) {
return webpackDevMiddleware(compiler, { return webpackDevMiddleware(compiler, {
...@@ -21,35 +23,46 @@ function createWebpackMiddleware(compiler, output, config) { ...@@ -21,35 +23,46 @@ function createWebpackMiddleware(compiler, output, config) {
}); });
} }
module.exports = function addDevMiddlewares(app, webpackConfig, config, { port= 8080, hostname = '127.0.0.1' }) { module.exports = function addDevMiddlewares(
if(!config.mfsu) { app,
webpackConfig,
config,
{ port = 8080, hostname = '127.0.0.1' },
) {
if (!config.mfsu) {
webpackConfig.plugins.push( webpackConfig.plugins.push(
new DevCompileDonePlugin({ new DevCompileDonePlugin({
port: (webpackConfig.devServer && webpackConfig.devServer.port) ? (webpackConfig.devServer.port || port): port, port:
hostname: (webpackConfig.devServer && webpackConfig.devServer.hostname ) ? (webpackConfig.devServer.hostname || '127.0.0.1'): hostname, webpackConfig.devServer && webpackConfig.devServer.port
? webpackConfig.devServer.port || port
: port,
hostname:
webpackConfig.devServer && webpackConfig.devServer.hostname
? webpackConfig.devServer.hostname || '127.0.0.1'
: hostname,
onCompileDone({ isFirstCompile, stats }) { onCompileDone({ isFirstCompile, stats }) {
if(isFirstCompile) { if (isFirstCompile) {
emitter.emit('onDevCompileDone', { isFirstCompile, stats }); emitter.emit('onDevCompileDone', { isFirstCompile, stats });
} }
}, },
onCompileFail(error) { onCompileFail(error) {
console.log(error); console.log(error);
}, },
}), }),
) );
} }
const compiler = webpack(webpackConfig); const compiler = webpack(webpackConfig);
const middleware = createWebpackMiddleware( const middleware = createWebpackMiddleware(
compiler, compiler,
webpackConfig.output, webpackConfig.output,
config, config,
); );
// console.log(middleware.compiler.watching)
app.use(middleware); app.use(middleware);
app.use(webpackHotMiddleware(compiler)); app.use(webpackHotMiddleware(compiler));
const fs = middleware.context.outputFileSystem; const fs = middleware.context.outputFileSystem;
app.get('*', (req, res) => { app.get('*', (req, res) => {
......
const { const { lodash, portfinder, createDebug } = require('@umijs/utils');
lodash,
portfinder,
createDebug,
} = require('@umijs/utils');
const express = require('express'); const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware'); const { createProxyMiddleware } = require('http-proxy-middleware');
const spdy = require('spdy'); const spdy = require('spdy');
const compress = require('compression'); const compress = require('compression');
const url = require('url'); const url = require('url');
const http = require('http'); const http = require('http');
// const https = require('https'); // const https = require('https');
const sockjs = require('sockjs'); const sockjs = require('sockjs');
const debug = createDebug('umi:server:Server'); const debug = createDebug('umi:server:Server');
const getCredentials = (options) => {};
const defaultOpts = { const defaultOpts = {
afterMiddlewares: [], afterMiddlewares: [],
beforeMiddlewares: [], beforeMiddlewares: [],
compilerMiddleware: null, compilerMiddleware: null,
compress: true, compress: true,
https: !!process.env.HTTP2 ? true : !!process.env.HTTPS, https: process.env.HTTP2 ? true : !!process.env.HTTPS,
onListening: argv => argv, onListening: argv => argv,
onConnection: () => {}, onConnection: () => {},
onConnectionClose: () => {}, onConnectionClose: () => {},
...@@ -46,20 +43,18 @@ class Server { ...@@ -46,20 +43,18 @@ class Server {
if (this.opts.https) { if (this.opts.https) {
const credential = getCredentials(this.opts); const credential = getCredentials(this.opts);
if (typeof this.opts.https === 'object' && this.opts.https.spdy) { if (typeof this.opts.https === 'object' && this.opts.https.spdy) {
logger.warn( console.warn(
'Providing custom spdy server options is deprecated and will be removed in the next major version.', 'Providing custom spdy server options is deprecated and will be removed in the next major version.',
); );
return credential; return credential;
} else {
return {
spdy: {
protocols: ['h2', 'http/1.1'],
},
...credential,
};
} }
return {
spdy: {
protocols: ['h2', 'http/1.1'],
},
...credential,
};
} }
return;
} }
setupFeatures() { setupFeatures() {
...@@ -118,6 +113,7 @@ class Server { ...@@ -118,6 +113,7 @@ class Server {
deleteRoutes() { deleteRoutes() {
let startIndex = null; let startIndex = null;
let endIndex = null; let endIndex = null;
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.forEach((item, index) => { this.app._router.stack.forEach((item, index) => {
if (item.name === 'PROXY_START') startIndex = index; if (item.name === 'PROXY_START') startIndex = index;
if (item.name === 'PROXY_END') endIndex = index; if (item.name === 'PROXY_END') endIndex = index;
...@@ -128,6 +124,7 @@ class Server { ...@@ -128,6 +124,7 @@ class Server {
.join(', ')}`, .join(', ')}`,
); );
if (startIndex !== null && endIndex !== null) { if (startIndex !== null && endIndex !== null) {
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.splice(startIndex, endIndex - startIndex + 1); this.app._router.stack.splice(startIndex, endIndex - startIndex + 1);
} }
debug( debug(
...@@ -155,7 +152,7 @@ class Server { ...@@ -155,7 +152,7 @@ class Server {
}; };
} else { } else {
proxyOptions = { proxyOptions = {
...(proxy && proxy[context] || {}), ...((proxy && proxy[context]) || {}),
context: correctedContext, context: correctedContext,
}; };
} }
...@@ -179,11 +176,11 @@ class Server { ...@@ -179,11 +176,11 @@ class Server {
: proxyConfig.target; : proxyConfig.target;
const realUrl = new URL(req.url || '', target).href || ''; const realUrl = new URL(req.url || '', target).href || '';
proxyRes.headers['x-real-url'] = realUrl; proxyRes.headers['x-real-url'] = realUrl;
proxyConfig.onProxyRes && proxyConfig.onProxyRes(proxyRes, req, res); proxyConfig.onProxyRes &&
proxyConfig.onProxyRes(proxyRes, req, res);
}, },
}); });
} }
return;
}; };
let startIndex = null; let startIndex = null;
...@@ -330,4 +327,4 @@ class Server { ...@@ -330,4 +327,4 @@ class Server {
} }
} }
module.exports = Server module.exports = Server;
\ No newline at end of file
...@@ -33,7 +33,7 @@ const unlisten = history.listen(location => { ...@@ -33,7 +33,7 @@ const unlisten = history.listen(location => {
if(location.pathname.indexOf('/civbase/user/login') > -1) { if(location.pathname.indexOf('/civbase/user/login') > -1) {
initGlobalConfig(); initGlobalConfig();
} }
}) });
event.on('event:logout', () => { event.on('event:logout', () => {
store.dispatch(actionCreators.logout()) store.dispatch(actionCreators.logout())
......
...@@ -13,8 +13,6 @@ export default class Container extends React.Component { ...@@ -13,8 +13,6 @@ export default class Container extends React.Component {
oms(event) { oms(event) {
const omsUrl = `${MaintenanceHost}/${MaintenancePath}`; const omsUrl = `${MaintenanceHost}/${MaintenancePath}`;
console.log(omsUrl)
window.open(omsUrl, '_blank'); window.open(omsUrl, '_blank');
} }
......
...@@ -122,13 +122,13 @@ const GlobalHeaderRight = props => { ...@@ -122,13 +122,13 @@ const GlobalHeaderRight = props => {
const goHome = event => { const goHome = event => {
event.stopPropagation(); event.stopPropagation();
const url = _.isString(props.global.get('homepage')) let url = _.isString(props.global.get('homepage'))
? props.global.get('homepage') ? props.global.get('homepage')
: props.global.get('homepage.url'); : props.global.get('homepage.url');
if(!props.global.get('home')) {
url = `civweb4/${url}`
}
window.share.event.emit('goHome', `/${url}`); window.share.event.emit('goHome', `/${url}`);
// setDefaultMountApp()
// 1、window.globalConfig product
// 2. 拿到当前product
url ? ( url ? (
window.share.event.emit('listenerMointer', { window.share.event.emit('listenerMointer', {
label: '首页', label: '首页',
......
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