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
76b86c75
Commit
76b86c75
authored
Feb 01, 2021
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改静态资源问题
parent
d9fe2826
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
48 deletions
+109
-48
micor.js
config/micor.js
+1
-1
proxy.js
config/proxy.js
+10
-29
index.js
server/index.js
+0
-2
index.js
src/components/TabRoute/index.js
+72
-5
reducer.js
src/containers/App/store/reducer.js
+2
-0
BasicLayout.js
src/layouts/BasicLayout.js
+5
-6
micro.js
src/micro.js
+18
-3
index.js
src/pages/user/login/index.js
+1
-1
utils.js
src/utils/utils.js
+0
-1
No files found.
config/micor.js
View file @
76b86c75
function
genActiveRule
(
routerPrefix
)
{
export
function
genActiveRule
(
routerPrefix
)
{
return
location
=>
location
.
pathname
.
startsWith
(
routerPrefix
);
}
export
default
{
...
...
config/proxy.js
View file @
76b86c75
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const
proxyURL
=
'https://panda-water.cn'
;
module
.
exports
=
{
mock
:
true
,
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
window
.
location
.
origin
,
dev
:
{
'/CityInterface'
:
{
// target: 'http://192.168.10.150:8777'
,
target
:
'https://panda-water.cn'
,
target
:
proxyURL
,
//
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
...
...
@@ -20,9 +24,9 @@ module.exports = {
},
},
'/cityinterface'
:
{
// target: 'http://192.168.10.150:8777'
,
target
:
proxyURL
,
// target: 'http://192.168.10.150:8050',
target
:
'https://panda-water.cn'
,
//
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
...
...
@@ -50,10 +54,11 @@ module.exports = {
},
},
'/Publish'
:
{
target
:
proxyURL
,
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
target
:
'https://panda-water.cn'
,
//
target: 'https://panda-water.cn',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
...
...
@@ -68,15 +73,7 @@ module.exports = {
},
prod
:
{
'/CityInterface'
:
{
// target: 'http://192.168.10.151:8055',
target
:
'https://panda-water.cn'
,
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
// target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
@@ -86,13 +83,7 @@ module.exports = {
},
},
'/cityinterface'
:
{
// target: 'http://192.168.10.151:8055',
// target: 'http://192.168.10.150:8050',
target
:
'https://panda-water.cn'
,
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
@@ -103,10 +94,6 @@ module.exports = {
},
'/cityjson'
:
{
target
:
'https://pv.sohu.com'
,
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
@@ -116,13 +103,7 @@ module.exports = {
},
},
'/Publish'
:
{
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
target
:
'https://panda-water.cn'
,
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.10.150:8050',
changeOrigin
:
true
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
,
...
...
server/index.js
View file @
76b86c75
...
...
@@ -34,8 +34,6 @@ app.get('*.js', (req, res, next) => {
next
();
});
// Start your app.
app
.
listen
(
port
,
host
,
async
err
=>
{
if
(
err
)
{
...
...
src/components/TabRoute/index.js
View file @
76b86c75
import
React
,
{
useState
,
useRef
,
useCallback
}
from
'react'
;
import
React
,
{
useState
,
useRef
,
useCallback
,
useEffect
}
from
'react'
;
import
{
useHistory
,
useLocation
}
from
'react-router-dom'
;
import
{
getKeyName
}
from
'../../utils/utils'
;
const
TabPanes
=
props
=>
{
const
[
activeKey
,
setActiveKey
]
=
useState
(
''
);
const
[
panes
,
setPanes
]
=
useState
([
...
...
@@ -24,9 +25,9 @@ const TabPanes = props => {
}
=
props
;
const
history
=
useHistory
();
const
{
pathn
n
ame
,
search
}
=
useLocation
();
const
{
pathname
,
search
}
=
useLocation
();
const
fullPath
=
pathn
n
ame
+
search
;
const
fullPath
=
pathname
+
search
;
const
storeTabs
=
useCallback
(
ps
=>
{
...
...
@@ -37,6 +38,72 @@ const TabPanes = props => {
);
const
resetTabs
=
useCallback
(()
=>
{
const
initPanes
=
curTab
.
reduce
((
prev
,
next
)
=>
{});
});
const
initPanes
=
curTab
.
reduce
((
prev
,
next
)
=>
{
const
{
title
,
tabKey
,
Content
}
=
getKeyName
(
next
);
return
[
...
prev
,
{
title
,
key
:
tabKey
,
content
:
Content
,
closable
:
tabKey
!==
'home'
,
path
:
next
,
},
];
},
[]);
const
{
tabKey
}
=
getKeyName
(
pathname
);
setPanes
(
initPanes
);
setActiveKey
(
tabKey
);
},
[
curTab
,
pathname
]);
useEffect
(()
=>
{
resetTabs
();
},
[
resetTabs
]);
const
onChange
=
tabKey
=>
{
setActiveKey
(
tabKey
);
};
const
remove
=
targetKey
=>
{
const
delIndex
=
panes
.
findIndex
(
item
=>
item
.
key
===
targetKey
);
panes
.
splice
(
delIndex
,
1
);
if
(
targetKey
!==
activeKey
)
{
const
nextKey
=
activeKey
;
setPanes
(
panes
);
setActiveKey
(
nextKey
);
storeTabs
(
panes
);
return
;
}
const
nextPath
=
curTab
[
delIndex
-
1
];
const
{
tabKey
}
=
getKeyName
(
nextPath
);
if
(
nextPath
!==
'/'
)
{
remove
(
tabKey
);
history
.
push
(
curTab
[
delIndex
-
2
]);
}
else
{
history
.
push
(
nextPath
);
}
setPanes
(
panes
);
storeTabs
(
panes
);
};
const
onEdit
=
(
targetKey
,
action
)
=>
action
===
'remove'
&&
remove
(
targetKey
);
const
onTabClick
=
targetKey
=>
{
const
{
path
}
=
panes
.
filter
(
item
=>
item
.
key
===
targetKey
)[
0
];
history
.
push
({
pathname
:
path
});
};
const
refreshTab
=
()
=>
{
setIsReload
(
true
);
setTimeout
(()
=>
{
setIsReload
(
false
);
},
1000
);
setStoreData
(
'SET_RELOADPATH'
,
pathname
+
search
);
setTimeout
(()
=>
{
setStoreData
(
'SET_RELOADPATH'
,
'null'
);
},
500
);
};
};
src/containers/App/store/reducer.js
View file @
76b86c75
...
...
@@ -27,6 +27,7 @@ import {
VALIDATE_AUTH
,
GET_MICRO_MOUNTED_STATUS
,
}
from
'./constants'
;
const
proxy
=
require
(
'../../../../config/proxy'
);
const
keywordStorage
=
new
Storage
(
`__global_search_keywords__micro_
${
window
.
location
.
hostname
}
`
,
...
...
@@ -76,6 +77,7 @@ const appReducer = (state = initialState, action) => {
// eslint-disable-next-line no-underscore-dangle
action
.
data
,
{
assetsRoot
:
proxy
.
assetsRoot
,
allWidgets
:
action
.
data
.
widgets
||
[],
env
:
process
.
env
.
NODE_ENV
===
'development'
?
'daily'
:
'prod'
,
},
...
...
src/layouts/BasicLayout.js
View file @
76b86c75
...
...
@@ -33,7 +33,7 @@ import SecurityLayout from './SecurityLayout';
import
Site
from
'./Site'
;
import
styles
from
'./UserLayout.less'
;
import
defaultSetting
from
'../../config/defaultSetting'
;
import
Login
from
'../pages/user/login/login'
;
//
import Login from '../pages/user/login/login';
const
antIcon
=
<
LoadingOutlined
style
=
{{
fontSize
:
12
}}
spin
/>
;
const
baseURI
=
isProd
...
...
@@ -54,10 +54,7 @@ const noMatch = (
const
renderIcon
=
(
icon
,
size
,
alias
)
=>
{
const
transformIcon
=
()
=>
icon
.
replace
(
/
\s
*/g
,
''
);
const
isURL
=
/^
(
http|https
)
/
;
const
url
=
isURL
.
test
(
transformIcon
())
?
transformIcon
()
:
`
${
baseURI
}
/
${
alias
}
/
${
transformIcon
()}
`
;
const
url
=
window
.
globalConfig
.
transformDevAssetsBaseURL
(
transformIcon
())
return
(
<
img
src
=
{
url
}
...
...
@@ -75,7 +72,9 @@ const menuExtraRender = currentRoutes => {
if
(
currentRoutes
)
{
const
iconURL
=
currentRoutes
&&
currentRoutes
.
extData
&&
currentRoutes
.
extData
.
icon
?
`
${
baseURI
}
/civweb4/
${
currentRoutes
.
extData
.
icon
}
`
?
window
.
globalConfig
.
transformDevAssetsBaseURL
(
currentRoutes
.
extData
.
icon
,
)
:
''
;
return
(
<>
...
...
src/micro.js
View file @
76b86c75
...
...
@@ -7,7 +7,7 @@ import {
start
,
}
from
'qiankun'
;
import
'kit_logger'
;
import
micorConfig
from
'../config/micor'
;
import
micorConfig
,
{
genActiveRule
}
from
'../config/micor'
;
import
pkg
from
'../package.json'
;
import
{
FILTER_FOLER_REG
}
from
'./utils/constants'
;
import
{
actionCreators
}
from
'./containers/App/store'
;
...
...
@@ -29,8 +29,24 @@ const MICRO_STATUS = {
};
export
const
initMicroApps
=
(
loader
,
store
)
=>
{
/* eslint-disable */
const
config
=
createStoreage
.
get
(
'globalConfig'
);
const
application
=
config
.
products
||
[];
const
entrys
=
process
.
env
.
NODE_ENV
!==
'production'
?
micorConfig
.
dev
:
micorConfig
.
prod
;
process
.
env
.
NODE_ENV
!==
'production'
?
micorConfig
.
dev
:
(
application
&&
Array
.
isArray
(
application
)
&&
application
.
length
>
0
)
?
application
.
map
(
item
=>
{
item
.
name
=
item
.
PackageName
;
item
.
entry
=
item
.
RouteUrl
.
replace
(
// eslint-disable-next-line no-template-curly-in-string
'localhost:${port}'
,
window
.
location
.
host
,
);
item
.
container
=
'#micro-container'
;
item
.
activeRule
=
genActiveRule
(
`/civbase/
${
item
.
PackageName
}
`
);
item
.
props
=
JSON
.
parse
(
item
.
DefaultSetting
);
return
item
;
}):
micorConfig
.
prod
;
registerMicroApps
(
entrys
.
map
(
item
=>
{
...
...
@@ -53,7 +69,6 @@ export const initMicroApps = (loader, store) => {
],
beforeMount
:
[
app
=>
{
debugger
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
false
));
Logger
.
info
(
`[LifeCycle] before mount %c%s
${
app
.
name
}
`
);
},
...
...
src/pages/user/login/index.js
View file @
76b86c75
...
...
@@ -543,7 +543,7 @@ const Login = forwardRef((props, _ref) => {
>
<
img
role
=
"logo"
src
=
{
`https://panda-water.cn/web4/
${
props
.
global
.
logo
}
`
}
src
=
{
props
.
global
.
transformDevAssetsBaseURL
(
props
.
global
.
logo
)
}
/
>
<
div
className
=
{
classNames
(
...
...
src/utils/utils.js
View file @
76b86c75
...
...
@@ -52,7 +52,6 @@ export function getBaseName() {
}
const
cache
=
{};
export
function
findPathByLeafId
(
leafId
,
nodes
,
path
,
key
)
{
debugger
if
(
path
===
undefined
)
{
path
=
{};
}
...
...
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