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 proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env;
module.exports = {
......@@ -12,7 +11,7 @@ module.exports = {
layout: {
siderWidth: '145px',
locale: true,
...defaultSetting
...defaultSetting,
},
fastRefresh: true,
useHash: true,
......@@ -30,7 +29,11 @@ module.exports = {
ignoreMomentLocale: true,
nodeModulesTransform: {
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'],
// openAPI: {
......@@ -73,10 +76,10 @@ module.exports = {
modifyVars: {
// hack: `true; @import "~@/global.less";`,
'@ant-prefix': 'panda-console-base',
'@iconPrefixCls': 'panda-console-base-icon'
'@iconPrefixCls': 'panda-console-base-icon',
},
javascriptEnabled: true
javascriptEnabled: true,
},
workerLoader: {}
workerLoader: {},
// esbuild: {}
};
/* eslint-disable */
// 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 = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
......
......@@ -40,18 +40,18 @@ class DevCompileDonePlugin {
.filter(Boolean)
.join('\n'),
);
process.send && process.send({
type: 'DONE'
process.send &&
process.send({
type: 'DONE',
});
isFirstCompile = false;
}
// this.opts.onCompileDone && this.opts.onCompileDone({
// isFirstCompile,
// stats,
// });
if(isFirstCompile) {
if (isFirstCompile) {
isFirstCompile = false;
// process.send({
// type: 'DONE'
......
// @ts-ignore
//import { Request, Response } from 'express';
// import { Request, Response } from 'express';
module.exports = {
'GET /api/currentUser': (req, res) => {
res
.status(200)
.send({
res.status(200).send({
name: '韩磊',
avatar: '',
userid: 'de98FdAe-1fcA-985e-7EDe-A79E8FFA854E',
......@@ -36,9 +34,7 @@ module.exports = {
});
},
'GET /api/notices': (req, res) => {
res
.status(200)
.send({
res.status(200).send({
data: [
{
id: '26fd5659-6818-c9Ee-CdCF-Bc69FBf157F5',
......@@ -57,7 +53,8 @@ module.exports = {
extra: '9uQO$Jh',
key: 13,
read: false,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '往条再习价机指北很些参转派。',
status: 'error',
datetime: '1988-12-24',
......@@ -82,7 +79,8 @@ module.exports = {
extra: 'Z@Z^ij',
key: 15,
read: false,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
title: '家不发经得器形如布力到议调采引。',
status: 'processing',
datetime: '1996-11-23',
......@@ -107,7 +105,8 @@ module.exports = {
extra: 't5%p',
key: 17,
read: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '图面济习果然选打儿往并进美。',
status: 'default',
datetime: '1981-07-21',
......@@ -119,7 +118,8 @@ module.exports = {
extra: 'GuGb5',
key: 18,
read: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
title: '海准到团权题时住称即按常火制。',
status: 'error',
datetime: '2014-09-18',
......@@ -143,7 +143,8 @@ module.exports = {
extra: '(DAIG',
key: 20,
read: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
title: '流较术合联风样少节打体中门八。',
status: 'default',
datetime: '1996-01-03',
......@@ -155,7 +156,8 @@ module.exports = {
extra: 'suvQ$O',
key: 21,
read: false,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
title: '为公受条总此类影所提无受万南非事具。',
status: 'default',
datetime: '1975-12-08',
......@@ -167,7 +169,8 @@ module.exports = {
extra: 'HIX9@)',
key: 22,
read: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
title: '展生起而两边断指内布数点铁压具。',
status: 'processing',
datetime: '2004-11-21',
......@@ -179,7 +182,8 @@ module.exports = {
extra: 'Bwlc!Bq',
key: 23,
read: true,
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
avatar:
'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '或内局段花革器规关价快和口音安京。',
status: 'default',
datetime: '1994-08-07',
......
-----BEGIN CERTIFICATE-----
MIIETDCCArSgAwIBAgIQKxt9OXlPUkkQASISMtxezDANBgkqhkiG9w0BAQsFADBh
MR4wHAYDVQQKExVta2NlcnQgZGV2ZWxvcG1lbnQgQ0ExGzAZBgNVBAsMEmpjbEB5
Y2pjbDg2OC5sb2NhbDEiMCAGA1UEAwwZbWtjZXJ0IGpjbEB5Y2pjbDg2OC5sb2Nh
bDAeFw0xOTA2MDEwMDAwMDBaFw0zMDA2MDEwOTMzNTdaMEkxJzAlBgNVBAoTHm1r
Y2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTEeMBwG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wKBgQDmGuIKFHXXqeRJNW+QvJfwQFKNQViqASlY
W4Y5guS6s85inJ3bRKwYtZsczne2uwYqQHlPw8X4TQMXApM+04mJtqwrYDpcX6Ad
VYPmo+J/k917QwlN8VP4AzlDdz8PU+zenmWgpKaG8GMtYia9qCIbWY/+hwwBk0sG
FNpguWnv7QKBgFSGT2ksSwdhAB5tGgoTKrTgNvLDWDDUc8hYI3y4k2R2W+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');
const { writeFileSync, mkdirSync, existsSync } = require('fs');
const rimraf = require('rimraf');
const serveStatic = require('serve-static');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const argv = require('./argv');
const setup = require('./middlewares/frontendMiddleware');
const pkg = require('../package.json');
const { resolve } = require('path');
const { portfinder, chalk, delay } = require('@umijs/utils');
const config = require('../config/config');
const mockMiddewares = require('./mock');
const emitter = require('./event');
......@@ -30,7 +30,7 @@ const { getSchema } = require('./openapi');
const isHTTPS = process.env.HTTPS || (argv && argv.https);
await delay(500);
const absNodeModulesPath = process.cwd() + '/node_modules';
const absNodeModulesPath = `${process.cwd()}/node_modules`;
const openAPIFilesPath = join(absNodeModulesPath, 'civ_open_api');
const loadEnv = () => {
......@@ -58,7 +58,7 @@ const { getSchema } = require('./openapi');
headers: {
'access-control-allow-origin': '*',
},
port: port,
port,
beforeMiddlewares: [
(config.mock || process.env.MOCK !== 'none') && mockMiddewares,
],
......@@ -67,6 +67,7 @@ const { getSchema } = require('./openapi');
...(config.devServer || {}),
});
setup(
server.app,
{
......@@ -76,14 +77,14 @@ const { getSchema } = require('./openapi');
config,
{
port,
homename
}
homename,
},
);
emitter.on('onDevCompileDone', async () => {
try {
const openAPIConfig = config.openAPI;
if(openAPIConfig && openAPIConfig.schemaPath) {
if (openAPIConfig && openAPIConfig.schemaPath) {
const openAPIJson = await getSchema(openAPIConfig.schemaPath);
writeFileSync(
join(openAPIFilesPath, 'civ-plugins_openapi.json'),
......
......@@ -6,7 +6,9 @@ const DevCompileDonePlugin = require('../../internals/webpack/plugins/DevCompile
const emitter = require('../event');
function getIgnoredWatchRegExp() {
// 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) {
return webpackDevMiddleware(compiler, {
......@@ -21,23 +23,33 @@ function createWebpackMiddleware(compiler, output, config) {
});
}
module.exports = function addDevMiddlewares(app, webpackConfig, config, { port= 8080, hostname = '127.0.0.1' }) {
if(!config.mfsu) {
module.exports = function addDevMiddlewares(
app,
webpackConfig,
config,
{ port = 8080, hostname = '127.0.0.1' },
) {
if (!config.mfsu) {
webpackConfig.plugins.push(
new DevCompileDonePlugin({
port: (webpackConfig.devServer && webpackConfig.devServer.port) ? (webpackConfig.devServer.port || port): port,
hostname: (webpackConfig.devServer && webpackConfig.devServer.hostname ) ? (webpackConfig.devServer.hostname || '127.0.0.1'): hostname,
port:
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 }) {
if(isFirstCompile) {
if (isFirstCompile) {
emitter.emit('onDevCompileDone', { isFirstCompile, stats });
}
},
onCompileFail(error) {
console.log(error);
},
}),
)
);
}
const compiler = webpack(webpackConfig);
......@@ -46,10 +58,11 @@ module.exports = function addDevMiddlewares(app, webpackConfig, config, { port=
webpackConfig.output,
config,
);
// console.log(middleware.compiler.watching)
app.use(middleware);
app.use(webpackHotMiddleware(compiler));
const fs = middleware.context.outputFileSystem;
app.get('*', (req, res) => {
......
const {
lodash,
portfinder,
createDebug,
} = require('@umijs/utils');
const { lodash, portfinder, createDebug } = require('@umijs/utils');
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const spdy = require('spdy');
......@@ -12,12 +8,13 @@ const http = require('http');
// const https = require('https');
const sockjs = require('sockjs');
const debug = createDebug('umi:server:Server');
const getCredentials = (options) => {};
const defaultOpts = {
afterMiddlewares: [],
beforeMiddlewares: [],
compilerMiddleware: null,
compress: true,
https: !!process.env.HTTP2 ? true : !!process.env.HTTPS,
https: process.env.HTTP2 ? true : !!process.env.HTTPS,
onListening: argv => argv,
onConnection: () => {},
onConnectionClose: () => {},
......@@ -46,11 +43,11 @@ class Server {
if (this.opts.https) {
const credential = getCredentials(this.opts);
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.',
);
return credential;
} else {
}
return {
spdy: {
protocols: ['h2', 'http/1.1'],
......@@ -59,8 +56,6 @@ class Server {
};
}
}
return;
}
setupFeatures() {
const features = {
......@@ -118,6 +113,7 @@ class Server {
deleteRoutes() {
let startIndex = null;
let endIndex = null;
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.forEach((item, index) => {
if (item.name === 'PROXY_START') startIndex = index;
if (item.name === 'PROXY_END') endIndex = index;
......@@ -128,6 +124,7 @@ class Server {
.join(', ')}`,
);
if (startIndex !== null && endIndex !== null) {
// eslint-disable-next-line no-underscore-dangle
this.app._router.stack.splice(startIndex, endIndex - startIndex + 1);
}
debug(
......@@ -155,7 +152,7 @@ class Server {
};
} else {
proxyOptions = {
...(proxy && proxy[context] || {}),
...((proxy && proxy[context]) || {}),
context: correctedContext,
};
}
......@@ -179,11 +176,11 @@ class Server {
: proxyConfig.target;
const realUrl = new URL(req.url || '', target).href || '';
proxyRes.headers['x-real-url'] = realUrl;
proxyConfig.onProxyRes && proxyConfig.onProxyRes(proxyRes, req, res);
proxyConfig.onProxyRes &&
proxyConfig.onProxyRes(proxyRes, req, res);
},
});
}
return;
};
let startIndex = null;
......@@ -330,4 +327,4 @@ class Server {
}
}
module.exports = Server
\ No newline at end of file
module.exports = Server;
......@@ -33,7 +33,7 @@ const unlisten = history.listen(location => {
if(location.pathname.indexOf('/civbase/user/login') > -1) {
initGlobalConfig();
}
})
});
event.on('event:logout', () => {
store.dispatch(actionCreators.logout())
......
......@@ -13,8 +13,6 @@ export default class Container extends React.Component {
oms(event) {
const omsUrl = `${MaintenanceHost}/${MaintenancePath}`;
console.log(omsUrl)
window.open(omsUrl, '_blank');
}
......
......@@ -122,13 +122,13 @@ const GlobalHeaderRight = props => {
const goHome = event => {
event.stopPropagation();
const url = _.isString(props.global.get('homepage'))
let url = _.isString(props.global.get('homepage'))
? props.global.get('homepage')
: props.global.get('homepage.url');
if(!props.global.get('home')) {
url = `civweb4/${url}`
}
window.share.event.emit('goHome', `/${url}`);
// setDefaultMountApp()
// 1、window.globalConfig product
// 2. 拿到当前product
url ? (
window.share.event.emit('listenerMointer', {
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