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
2c95e174
Commit
2c95e174
authored
Mar 21, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/ReactWeb5/CivWeb
parents
c28ae00f
936167e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
71 deletions
+73
-71
initConfig.js
src/initConfig.js
+3
-2
BasicLayout1.js
src/layouts/BasicLayout1.js
+1
-1
micro.js
src/micro.js
+69
-68
No files found.
src/initConfig.js
View file @
2c95e174
...
@@ -60,7 +60,8 @@ export const initGlobalConfig = () => {
...
@@ -60,7 +60,8 @@ export const initGlobalConfig = () => {
}
}
});
});
// eslint-disable-next-line react-hooks/rules-of-hooks
// eslint-disable-next-line react-hooks/rules-of-hooks
const
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
let
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
client
=
client
&&
client
!==
'undefined'
?
client
:
'city'
;
appService
appService
.
queryConfig
({
.
queryConfig
({
client
:
client
||
'city'
,
client
:
client
||
'city'
,
...
@@ -72,7 +73,7 @@ export const initGlobalConfig = () => {
...
@@ -72,7 +73,7 @@ export const initGlobalConfig = () => {
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({})));
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({})));
const
data
=
res
;
const
data
=
res
;
if
(
!
data
.
client
)
{
if
(
!
data
.
client
)
{
data
.
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
;
data
.
client
=
client
;
}
}
// Cookies.set('city', data.client);
// Cookies.set('city', data.client);
store
.
dispatch
(
store
.
dispatch
(
...
...
src/layouts/BasicLayout1.js
View file @
2c95e174
...
@@ -360,7 +360,7 @@ const BasicLayout = props => {
...
@@ -360,7 +360,7 @@ const BasicLayout = props => {
useEffect
(()
=>
{
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
siteAction
.
setGlobalConfig
(
props
.
global
);
if
(
!
Cookies
.
get
(
'token'
))
{
if
(
!
Cookies
.
get
(
'token'
))
{
let
client
=
props
.
global
&&
props
.
global
.
client
;
let
client
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'client'
)
?
props
.
global
.
get
(
'client'
)
:
null
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
let
generateType
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'get'
)
?
props
.
global
.
get
(
'generateType'
)
:
null
;
let
generateType
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'get'
)
?
props
.
global
.
get
(
'generateType'
)
:
null
;
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
...
...
src/micro.js
View file @
2c95e174
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
import
'kit_logger'
;
import
'kit_logger'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
import
{
addGlobalUncaughtErrorHandler
,
addGlobalUncaughtErrorHandler
,
registerMicroApps
,
registerMicroApps
,
runAfterFirstMounted
,
runAfterFirstMounted
,
setDefaultMountApp
,
setDefaultMountApp
,
start
,
start
,
}
from
'qiankun'
;
}
from
'qiankun'
;
import
{
store
as
microStore
}
from
'microser-data'
;
import
{
store
as
microStore
}
from
'microser-data'
;
...
@@ -21,30 +21,30 @@ import actions from './actions';
...
@@ -21,30 +21,30 @@ import actions from './actions';
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'micro'
);
const
Logger
=
logger
(
'micro'
);
const
MICRO_STATUS
=
{
const
MICRO_STATUS
=
{
NOT_LOADED
:
'NOT_LOADED'
,
NOT_LOADED
:
'NOT_LOADED'
,
LOADING_SOURCE_CODE
:
'LOADING_SOURCE_CODE'
,
LOADING_SOURCE_CODE
:
'LOADING_SOURCE_CODE'
,
NOT_BOOTSTRAPPED
:
'NOT_BOOTSTRAPPED'
,
NOT_BOOTSTRAPPED
:
'NOT_BOOTSTRAPPED'
,
BOOTSTRAPPING
:
'BOOTSTRAPPING'
,
BOOTSTRAPPING
:
'BOOTSTRAPPING'
,
NOT_MOUNTED
:
'NOT_MOUNTED'
,
NOT_MOUNTED
:
'NOT_MOUNTED'
,
MOUNTING
:
'MOUNTING'
,
MOUNTING
:
'MOUNTING'
,
MOUNTED
:
'MOUNTED'
,
MOUNTED
:
'MOUNTED'
,
UPDATING
:
'UPDATING'
,
UPDATING
:
'UPDATING'
,
UNMOUNTING
:
'UNMOUNTING'
,
UNMOUNTING
:
'UNMOUNTING'
,
UNLOADING
:
'UNLOADING'
,
UNLOADING
:
'UNLOADING'
,
SKIP_BECAUSE_BROKEN
:
'SKIP_BECAUSE_BROKEN'
,
SKIP_BECAUSE_BROKEN
:
'SKIP_BECAUSE_BROKEN'
,
LOAD_ERROR
:
'LOAD_ERROR'
,
LOAD_ERROR
:
'LOAD_ERROR'
,
};
};
export
const
initMicroApps
=
()
=>
{
export
const
initMicroApps
=
()
=>
{
/* eslint-disable */
/* eslint-disable */
const
config
=
window
.
globalConfig
||
{};
const
config
=
window
.
globalConfig
||
{};
//createStoreage.get('globalConfig');
//createStoreage.get('globalConfig');
const
application
=
config
&&
config
.
products
||
[];
const
application
=
config
&&
config
.
products
||
[];
let
products
=
[];
let
products
=
[];
application
&&
Array
.
isArray
(
application
)
&&
application
.
length
>
0
&&
application
.
map
(
item
=>
{
application
&&
Array
.
isArray
(
application
)
&&
application
.
length
>
0
&&
application
.
map
(
item
=>
{
if
(
item
.
PackageName
===
'report'
)
{
if
(
item
.
PackageName
===
'report'
)
{
products
.
push
({
products
.
push
({
name
:
item
.
PackageName
,
name
:
item
.
PackageName
,
entry
:
item
.
RouteUrl
,
entry
:
item
.
RouteUrl
,
...
@@ -67,13 +67,13 @@ export const initMicroApps = () => {
...
@@ -67,13 +67,13 @@ export const initMicroApps = () => {
}
}
})
})
}
}
});
});
const
entrys
=
const
entrys
=
process
.
env
.
NODE_ENV
!==
'production'
?
process
.
env
.
NODE_ENV
!==
'production'
?
micorConfig
.
dev
:
micorConfig
.
dev
:
products
;
products
;
registerMicroApps
(
registerMicroApps
(
entrys
.
map
(
item
=>
{
entrys
.
map
(
item
=>
{
item
.
loader
=
loader
;
item
.
loader
=
loader
;
...
@@ -83,50 +83,50 @@ export const initMicroApps = () => {
...
@@ -83,50 +83,50 @@ export const initMicroApps = () => {
// eslint-
// eslint-
// disable-next-line no-undef
// disable-next-line no-undef
globalConfig
:
/civweb4/
.
test
(
item
.
name
)
?
Object
.
assign
({},
config
,
{
globalConfig
:
/civweb4/
.
test
(
item
.
name
)
?
Object
.
assign
({},
config
,
{
homepage
:
config
.
homepage
?
config
.
homepage
.
replace
(
/civweb
\/
/
,
''
):
config
.
homepage
homepage
:
config
.
homepage
?
config
.
homepage
.
replace
(
/civweb
\/
/
,
''
)
:
config
.
homepage
}):
config
,
})
:
config
,
//createStoreage.get('globalConfig'),
//createStoreage.get('globalConfig'),
XMLHttpRequest
:
window
.
XMLHttpRequest
,
XMLHttpRequest
:
window
.
XMLHttpRequest
,
};
};
return
item
;
return
item
;
}),
{
}),
{
beforeLoad
:
[
beforeLoad
:
[
app
=>
{
app
=>
{
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
true
));
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
true
));
Logger
.
info
(
'[LifeCycle] before load %c%s'
);
Logger
.
info
(
'[LifeCycle] before load %c%s'
);
},
},
],
],
beforeMount
:
[
beforeMount
:
[
app
=>
{
app
=>
{
Logger
.
info
(
`[LifeCycle] before mount %c%s
${
app
.
name
}
`
);
Logger
.
info
(
`[LifeCycle] before mount %c%s
${
app
.
name
}
`
);
},
},
],
],
afterMount
:
[
afterMount
:
[
app
=>
{
app
=>
{
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
false
));
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
false
));
Logger
.
info
(
`[LifeCycle] after mount %c%s
${
app
.
name
}
`
);
Logger
.
info
(
`[LifeCycle] after mount %c%s
${
app
.
name
}
`
);
},
},
],
],
beforeUnmount
:
[
beforeUnmount
:
[
app
=>
{
app
=>
{
window
.
share
.
event
.
removeAllListeners
(
'changeRoute'
);
window
.
share
.
event
.
removeAllListeners
(
'changeRoute'
);
Logger
.
info
(
`[LifeCycle] after unmount %c%s
${
app
.
name
}
`
);
Logger
.
info
(
`[LifeCycle] after unmount %c%s
${
app
.
name
}
`
);
window
.
globalConfig
=
{}
window
.
globalConfig
=
{}
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
)
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
)
},
},
],
],
afterUnmount
:
[
app
=>
{
}],
afterUnmount
:
[
app
=>
{
}],
},
},
);
);
const
globalStore
=
store
.
getState
().
toJS
();
const
globalStore
=
store
.
getState
().
toJS
();
const
globalConfig
=
window
.
globalConfig
;
const
globalConfig
=
window
.
globalConfig
;
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
actions
.
setGlobalState
({
actions
.
setGlobalState
({
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
globalConfig
:
globalConfig
,
globalConfig
:
globalConfig
,
//createStoreage.get('globalConfig'),
//createStoreage.get('globalConfig'),
});
});
microStore
.
set
(
"props:globalConfig"
,
{
microStore
.
set
(
"props:globalConfig"
,
{
globalConfig
:
globalConfig
,
globalConfig
:
globalConfig
,
global
:
globalStore
.
global
global
:
globalStore
.
global
...
@@ -208,20 +208,20 @@ export const initMicroApps = () => {
...
@@ -208,20 +208,20 @@ export const initMicroApps = () => {
export
const
defaultApp
=
()
=>
{
export
const
defaultApp
=
()
=>
{
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
const
config
=
window
.
globalConfig
;
const
config
=
window
.
globalConfig
;
if
(
config
&&
config
.
token
)
{
if
(
config
&&
config
.
token
)
{
// const basePath =config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?'civweb4' :'civweb4';
// const basePath =config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) ?'civweb4' :'civweb4';
// if(config && config.home) {
// if(config && config.home) {
// setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`);
// setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`);
// } else {
// } else {
// const homepage = _.isNull(config.homepage) ? '/index': '/' + config.homepage;
// const homepage = _.isNull(config.homepage) ? '/index': '/' + config.homepage;
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`);
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`);
// createStoreage.set('init_web4', true)
// createStoreage.set('init_web4', true)
// }
// }
// let homepage = config.homepage.replace('civweb4/', '');
// let homepage = config.homepage.replace('civweb4/', '');
const
url
=
!
config
.
home
?
`/civbase/civweb4/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
).
replace
(
/^civweb4
\/
/
,
''
)}
`
:
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
;
const
url
=
!
config
.
home
?
`/civbase/civweb4/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
).
replace
(
/^civweb4
\/
/
,
''
)}
`
:
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
;
setDefaultMountApp
(
url
);
setDefaultMountApp
(
url
);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
}
...
@@ -236,19 +236,19 @@ export const defaultApp = () => {
...
@@ -236,19 +236,19 @@ export const defaultApp = () => {
*/
*/
window
.
app
=
{
window
.
app
=
{
modules
:
{},
modules
:
{},
require
:
function
(
request
,
method
)
{
require
:
function
(
request
,
method
)
{
if
(
request
!==
'.'
&&
this
.
modules
[
request
])
{
if
(
request
!==
'.'
&&
this
.
modules
[
request
])
{
console
.
log
(
'method'
,
method
);
console
.
log
(
'method'
,
method
);
return
_
.
isFunction
(
this
.
modules
[
request
])
?
this
.
modules
[
request
]():
_
.
isFunction
(
this
.
modules
[
request
][
method
])
&&
this
.
modules
[
request
][
method
]();
return
_
.
isFunction
(
this
.
modules
[
request
])
?
this
.
modules
[
request
]()
:
_
.
isFunction
(
this
.
modules
[
request
][
method
])
&&
this
.
modules
[
request
][
method
]();
}
}
if
(
request
===
'.'
)
{
if
(
request
===
'.'
)
{
return
return
}
}
return
_
.
isFunction
(
this
.
modules
[
request
])
&&
this
.
modules
[
request
]();
return
_
.
isFunction
(
this
.
modules
[
request
])
&&
this
.
modules
[
request
]();
},
},
define
:
function
(
name
,
context
,
index
)
{
define
:
function
(
name
,
context
,
index
)
{
let
keys
=
context
.
keys
();
let
keys
=
context
.
keys
();
for
(
let
key
of
keys
)
{
for
(
let
key
of
keys
)
{
let
parts
=
name
.
indexOf
(
'@'
)
>
-
1
?
[
name
,
...(
key
.
slice
(
1
).
split
(
'/'
))]
:
(
name
+
key
.
slice
(
1
)).
split
(
'/'
);
let
parts
=
name
.
indexOf
(
'@'
)
>
-
1
?
[
name
,
...(
key
.
slice
(
1
).
split
(
'/'
))]
:
(
name
+
key
.
slice
(
1
)).
split
(
'/'
);
...
@@ -267,7 +267,7 @@ window.app = {
...
@@ -267,7 +267,7 @@ window.app = {
this
.
modules
[
name
]
=
this
.
modules
[
name
][
index
];
this
.
modules
[
name
]
=
this
.
modules
[
name
][
index
];
}
}
},
},
init
:
function
(
namespace
,
reducers
)
{
init
:
function
(
namespace
,
reducers
)
{
[
namespace
]
=
reducers
;
[
namespace
]
=
reducers
;
}
}
};
};
...
@@ -483,6 +483,7 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@
...
@@ -483,6 +483,7 @@ window.app.define('@wisdom-utils/components', require.context('../node_modules/@
window
.
app
.
define
(
'@ant-design/pro-form'
,
require
.
context
(
'../node_modules/@ant-design/pro-form/lib'
,
true
,
/^.
\/(
lib
\/)?[^\/]
+
\.
js$/
),
'index.js'
);
window
.
app
.
define
(
'classnames'
,
require
.
context
(
'classnames'
,
true
,
/^.
\/
index
\.
js$/
),
'index.js'
);
window
.
app
.
define
(
'classnames'
,
require
.
context
(
'classnames'
,
true
,
/^.
\/
index
\.
js$/
),
'index.js'
);
window
.
app
.
define
(
'@ant-design/icons'
,
require
.
context
(
'../node_modules/@ant-design/icons/lib'
,
true
,
/^.
\/(
lib
\/)?[^\/]
+
\.
js$/
),
'index.js'
);
window
.
app
.
define
(
'@ant-design/icons'
,
require
.
context
(
'../node_modules/@ant-design/icons/lib'
,
true
,
/^.
\/(
lib
\/)?[^\/]
+
\.
js$/
),
'index.js'
);
...
...
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