Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
bcc5dbef
Commit
bcc5dbef
authored
Feb 14, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复civweb4首页跳转
parent
3bd4c46d
Pipeline
#43885
passed with stages
in 4 minutes 9 seconds
Changes
12
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
128 additions
and
64 deletions
+128
-64
config.js
config/config.js
+10
-7
proxy.js
config/proxy.js
+1
-1
DevCompileDonePlugin.js
internals/webpack/plugins/DevCompileDonePlugin.js
+9
-9
api.mock.js
mock/api.mock.js
+0
-0
cert.pem
server/cert/cert.pem
+25
-0
key.pem
server/cert/key.pem
+28
-0
index.js
server/index.js
+10
-9
addDevMiddlewares.js
server/middlewares/addDevMiddlewares.js
+23
-10
server.js
server/server.js
+17
-21
app.js
src/app.js
+1
-1
index.js
src/components/Container/index.js
+0
-2
ExtendRightContent.js
src/components/GlobalHeader/ExtendRightContent.js
+4
-4
No files found.
config/config.js
View file @
bcc5dbef
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: {}
};
config/proxy.js
View file @
bcc5dbef
/* 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
:
'./'
,
...
...
internals/webpack/plugins/DevCompileDonePlugin.js
View file @
bcc5dbef
...
...
@@ -40,22 +40,22 @@ 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
)
{
isFirstCompile
=
false
;
// process.send({
// type: 'DONE'
// })
if
(
isFirstCompile
)
{
isFirstCompile
=
false
;
// process.send({
// type: 'DONE'
// })
}
});
}
...
...
mock/api.mock.js
View file @
bcc5dbef
This diff is collapsed.
Click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Uh/p20w5uCp8iSKGtVM+HvulrWXwUGRkUl
jnukYeMwl4tONzwHeUV1oVT8DATFLAFIHE4ikGDM7V+Ximxv5yQQ9hD8fzeOWdYO
SKA5eDjd+ut+HiSfItqgM+8t1RxPxsYlGeOMp65cKt1NaIdRxQHwESGba6H0sez7
p5Eu95pXp/BUy7lnvqudXgfTAUpSzxpSG+49hzMKuN/CAZyFNp52qDDHpRtuxHns
q0pjGHBOC2aYc1eXNgn2g0wMDp3+BYh9yjoWNkMKqY7hpcB9PY5zw0u8R0wG8z+n
d915bZT3FKjx5sxmDmVaDNdARwi9ExqFvIs+hje1IUrszR7pnT7EUcUOhWNbKKkf
jRH3sy+TyA+TsYm1AAcnnY/Ne/Ce4OcMGcYwjb1L/gu/PWoup4f/GIziEw8cbPti
1+Exm+AOSjcSspPPfQmpHqupNaDJSjo6xYX3wn3oIb34WvH8INL3liiVedn+LTy4
-----END CERTIFICATE-----
server/cert/key.pem
0 → 100644
View file @
bcc5dbef
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8oD87P1rPqQRn
nNJnK5+lhe3mA4CcT9/xVjaE/eDskNEIyTrDReCSYYMnjmdj19VWELKiqDxsiQtw
tu+nr38jk7xp7RNvJL3maAF+WGCyqNKTJ2GfttmYB7k51m/4m0YGN3bZgOnOx4rT
PVWRfGAQApg6zGzNoKPpqS0CFNC8RHYNgajRdozrZI5A0viouf3tmuD6DwZKNL8K
D+9v6Tja0KCE6bQqzboIMGX3YPCXmah0SR/N7CuMLZY2V62Jm6mxfqmudEMFwZge
X5L/4P+IcJK7zciTGiiuwiKAaVJqH+dV962wocFNcVedLEvzpP0wDVHllxehW/Vx
Zk2KIwxrAgMBAAECggEAUdiitz2dVN/85kyYy2WVZ0g+2wCIDMtn25tSGtDiiSOp
YEuYsOSgNkQTmdVjrWIY0rh6GrQvS9UHXsgyIyu2WiSfq8LQHPjvYYudokoM41j3
zhxXcurvbdV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BFO1vlYlgdlm/1G
iKX/ppCt7bJYqfrptWs42u4=
-----END PRIVATE KEY-----
server/index.js
View file @
bcc5dbef
...
...
@@ -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,9 +30,9 @@ 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
=
()
=>
{
const
basePath
=
join
(
process
.
cwd
(),
'.env'
);
const
localPath
=
`
${
basePath
}
.local`
;
...
...
@@ -41,7 +41,7 @@ const { getSchema } = require('./openapi');
};
loadEnv
();
// const absNodeModulesPath = cwd + '/node_modules';
try
{
if
(
existsSync
(
openAPIFilesPath
))
{
...
...
@@ -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'
),
...
...
server/middlewares/addDevMiddlewares.js
View file @
bcc5dbef
...
...
@@ -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,35 +23,46 @@ 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
);
const
middleware
=
createWebpackMiddleware
(
compiler
,
webpackConfig
.
output
,
config
,
);
// console.log(middleware.compiler.watching)
app
.
use
(
middleware
);
app
.
use
(
webpackHotMiddleware
(
compiler
));
const
fs
=
middleware
.
context
.
outputFileSystem
;
app
.
get
(
'*'
,
(
req
,
res
)
=>
{
...
...
server/server.js
View file @
bcc5dbef
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'
);
const
compress
=
require
(
'compression'
);
const
url
=
require
(
'url'
);
const
url
=
require
(
'url'
);
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,20 +43,18 @@ 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'
],
},
...
credential
,
};
}
return
{
spdy
:
{
protocols
:
[
'h2'
,
'http/1.1'
],
},
...
credential
,
};
}
return
;
}
setupFeatures
()
{
...
...
@@ -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
;
src/app.js
View file @
bcc5dbef
...
...
@@ -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
())
...
...
src/components/Container/index.js
View file @
bcc5dbef
...
...
@@ -13,8 +13,6 @@ export default class Container extends React.Component {
oms
(
event
)
{
const
omsUrl
=
`
${
MaintenanceHost
}
/
${
MaintenancePath
}
`
;
console
.
log
(
omsUrl
)
window
.
open
(
omsUrl
,
'_blank'
);
}
...
...
src/components/GlobalHeader/ExtendRightContent.js
View file @
bcc5dbef
...
...
@@ -122,13 +122,13 @@ const GlobalHeaderRight = props => {
const
goHome
=
event
=>
{
event
.
stopPropagation
();
cons
t
url
=
_
.
isString
(
props
.
global
.
get
(
'homepage'
))
le
t
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
:
'首页'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment