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
b708e674
Commit
b708e674
authored
Apr 25, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化子应用注册
parent
3edb22c5
Pipeline
#48651
passed with stages
in 5 minutes 23 seconds
Changes
13
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
53 additions
and
34 deletions
+53
-34
proxy.js
config/proxy.js
+2
-2
app.js
src/app.js
+4
-7
NoticeIconView.js
src/components/GlobalHeader/NoticeIconView.js
+1
-0
index.js
src/containers/App/index.js
+1
-1
actions.js
src/containers/App/store/actions.js
+12
-6
initConfig.js
src/initConfig.js
+14
-2
SecurityLayout.js
src/layouts/SecurityLayout.js
+3
-2
micro.js
src/micro.js
+1
-1
index.js
src/pages/bootpage/index.js
+2
-2
index.js
src/pages/user/login/index.js
+3
-3
baseLogin.js
src/pages/user/login/template/baseLogin.js
+6
-4
infoLogin.js
src/pages/user/login/template/infoLogin.js
+2
-2
yulin.js
src/pages/user/login/template/yulin.js
+2
-2
No files found.
config/proxy.js
View file @
b708e674
/* 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://work.panda-water.cn';
const
proxyURL
=
'http://192.168.12.3:8082'
;
//
const proxyURL = 'http://192.168.12.3:8082';
//
const proxyURL = 'https://panda-water.cn';
const
proxyURL
=
'https://panda-water.cn'
;
module
.
exports
=
{
module
.
exports
=
{
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
...
...
src/app.js
View file @
b708e674
...
@@ -8,9 +8,11 @@ import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/e
...
@@ -8,9 +8,11 @@ import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/e
import
'@wisdom-utils/utils/lib/helpers/format'
;
import
'@wisdom-utils/utils/lib/helpers/format'
;
import
'sanitize.css/sanitize.css'
;
import
'sanitize.css/sanitize.css'
;
import
{
Storeage
}
from
'@wisdom-utils/utils/lib/helpers'
;
import
{
Storeage
}
from
'@wisdom-utils/utils/lib/helpers'
;
import
{
initGlobalConfig
}
from
'./initConfig'
;
import
{
initGlobalConfig
}
from
'./initConfig'
import
'./utils/event'
;
import
'./utils/event'
;
import
{
render
}
from
'./render'
;
// import store from './stores';
// import store from './stores';
// eslint-disable-next-line no-restricted-globals
// eslint-disable-next-line no-restricted-globals
const
namespace
=
`__PANDA_STORE__
${
location
.
hostname
}
`
;
const
namespace
=
`__PANDA_STORE__
${
location
.
hostname
}
`
;
...
@@ -19,11 +21,6 @@ window.createStoreage = new Storeage(namespace);
...
@@ -19,11 +21,6 @@ window.createStoreage = new Storeage(namespace);
const
initLocale
=
()
=>
{
const
initLocale
=
()
=>
{
localStorage
.
setItem
(
'umi_locale'
,
'zh-CN'
);
localStorage
.
setItem
(
'umi_locale'
,
'zh-CN'
);
};
};
// const PRODUCT_NAME = ['civ_water', 'civ_monitor'];
initGlobalConfig
();
initGlobalConfig
();
render
({
appContent
:
''
,
loading
:
true
});
initLocale
();
initLocale
();
// event.on('event:logout', () => {
// store.dispatch(actionCreators.logout());
// });
src/components/GlobalHeader/NoticeIconView.js
View file @
b708e674
...
@@ -37,6 +37,7 @@ class NoticeIconView extends Component {
...
@@ -37,6 +37,7 @@ class NoticeIconView extends Component {
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
removeAllListeners
(
'reloadNotice'
);
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
removeAllListeners
(
'reloadNotice'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
debugger
this
.
notifier
=
new
Notifier
(
this
.
notifier
=
new
Notifier
(
this
.
props
.
global
.
userInfo
,
this
.
props
.
global
.
userInfo
,
this
.
renderVideo
,
this
.
renderVideo
,
...
...
src/containers/App/index.js
View file @
b708e674
...
@@ -26,7 +26,7 @@ function App(props) {
...
@@ -26,7 +26,7 @@ function App(props) {
<
Switch
>
<
Switch
>
{
renderRoutes
(
{
renderRoutes
(
'panda-console-base'
,
'panda-console-base'
,
dyRoutes
(
props
.
menu
||
[],
props
.
global
.
layout
,
props
.
global
.
theme
).
routes
,
dyRoutes
(
props
.
menu
||
[],
props
.
global
&&
props
.
global
.
layout
,
props
.
global
&&
props
.
global
.
theme
||
'dark'
).
routes
,
)}
)}
<
/Switch
>
<
/Switch
>
<
/Router
>
<
/Router
>
...
...
src/containers/App/store/actions.js
View file @
b708e674
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
{
store
}
from
'@wisdom-utils/utils'
;
import
{
import
{
CLEAR_RCENT_KEYWORD
,
CLEAR_RCENT_KEYWORD
,
COMPLEX_CONFIG
,
COMPLEX_CONFIG
,
...
@@ -25,7 +26,6 @@ import {
...
@@ -25,7 +26,6 @@ import {
AMAP_VIEW
,
AMAP_VIEW
,
PD_VIEW
,
PD_VIEW
,
}
from
'./constants'
;
}
from
'./constants'
;
import
{
store
}
from
'@wisdom-utils/utils'
;
export
function
getConfig
(
data
)
{
export
function
getConfig
(
data
)
{
return
{
return
{
type
:
GET_CONFIG
,
type
:
GET_CONFIG
,
...
@@ -164,7 +164,6 @@ export function updateMicroMounted(data) {
...
@@ -164,7 +164,6 @@ export function updateMicroMounted(data) {
};
};
}
}
export
function
updageAMapView
(
data
)
{
export
function
updageAMapView
(
data
)
{
return
{
return
{
type
:
AMAP_VIEW
,
type
:
AMAP_VIEW
,
...
@@ -223,16 +222,23 @@ export function logout(data) {
...
@@ -223,16 +222,23 @@ export function logout(data) {
createStoreage
.
remove
(
`__PANDA_STORE__MICRO_
${
location
.
hostname
}
`
);
createStoreage
.
remove
(
`__PANDA_STORE__MICRO_
${
location
.
hostname
}
`
);
localStorage
.
removeItem
(
'JmReport-Access-Token'
);
localStorage
.
removeItem
(
'JmReport-Access-Token'
);
const
products
=
(
window
.
globalConfig
.
products
||
[]).
map
(
item
=>
{
const
products
=
window
.
globalConfig
&&
(
window
.
globalConfig
.
products
||
[]).
map
(
item
=>
{
if
(
item
.
PackageName
===
'civweb4'
)
{
if
(
item
.
PackageName
===
'civweb4'
)
{
return
'web4_console'
return
'web4_console'
;
}
}
return
`
${
item
.
PackageName
}
-main`
;
return
`
${
item
.
PackageName
}
-main`
;
});
});
if
(
products
)
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
:
store
});
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
});
});
});
}
return
{
return
{
type
:
LOGINOUT
,
type
:
LOGINOUT
,
data
:
{
data
:
{
...
...
src/initConfig.js
View file @
b708e674
...
@@ -80,8 +80,20 @@ export const initGlobalConfig = () => {
...
@@ -80,8 +80,20 @@ export const initGlobalConfig = () => {
// Cookies.set('client', params.getParams('client'))
// Cookies.set('client', params.getParams('client'))
if
(
data
.
loginTemplate
===
'新春 - 智联.html'
)
{
// if (data.loginTemplate === '新春 - 智联.html') {
updateTheme
(
'#ff9600'
);
// updateTheme('#ff9600');
// }
const
products
=
(
data
.
products
||
[]).
map
(
item
=>
{
if
(
item
.
PackageName
===
'civweb4'
)
{
return
'web4_console'
}
return
`
${
item
.
PackageName
}
-main`
;
});
if
(
products
&&
products
.
length
>
0
)
{
Object
.
keys
(
products
).
forEach
(
item
=>
{
window
[
products
[
item
]]
&&
window
[
products
[
item
]]
&&
window
[
products
[
item
]].
unmount
&&
window
[
products
[
item
]].
unmount
({
store
:
store
});
});
initMicroApps
();
}
}
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
if
(
getToken
())
{
if
(
getToken
())
{
...
...
src/layouts/SecurityLayout.js
View file @
b708e674
...
@@ -43,11 +43,12 @@ class SecurityLayout extends React.Component {
...
@@ -43,11 +43,12 @@ class SecurityLayout extends React.Component {
}
}
render
()
{
render
()
{
const
{
isReady
}
=
this
.
state
;
const
{
isReady
}
=
this
.
state
;
const
{
children
,
global
,
loading
}
=
this
.
props
;
const
{
children
,
global
,
loading
}
=
this
.
props
;
const
tk
=
Cookies
.
get
(
'token'
)
||
global
.
token
;
const
tk
=
Cookies
.
get
(
'token'
)
||
global
.
token
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
(
void
0
);
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
(
void
0
);
if
(
!
isLogin
&&
window
.
location
.
pathname
!==
'/civbase/user/login'
)
{
if
(
!
isLogin
&&
window
.
location
.
pathname
!==
'/civbase/user/login'
||
(
global
.
hasOwnProperty
(
'size'
)
&&
global
.
size
===
0
)
)
{
const
{
query
=
{},
search
,
pathname
}
=
history
.
location
;
const
{
query
=
{},
search
,
pathname
}
=
history
.
location
;
const
{
redirect
}
=
query
;
const
{
redirect
}
=
query
;
// const queryString = stringify({
// const queryString = stringify({
...
@@ -63,7 +64,7 @@ class SecurityLayout extends React.Component {
...
@@ -63,7 +64,7 @@ class SecurityLayout extends React.Component {
to
=
{
`/user/login?client=
${
client
}${
generateType
}
`
}
to
=
{
`/user/login?client=
${
client
}${
generateType
}
`
}
/
>
/
>
);
);
}
}
;
if
((
!
isLogin
&&
loading
)
||
!
isReady
)
{
if
((
!
isLogin
&&
loading
)
||
!
isReady
)
{
return
<
PageLoading
/>
;
return
<
PageLoading
/>
;
...
...
src/micro.js
View file @
b708e674
...
@@ -183,7 +183,7 @@ export const initMicroApps = () => {
...
@@ -183,7 +183,7 @@ export const initMicroApps = () => {
Logger
.
info
(
'[MainApp] first app mounted'
);
Logger
.
info
(
'[MainApp] first app mounted'
);
});
});
// eslint-disable-next-line no-use-before-define
// eslint-disable-next-line no-use-before-define
defaultApp
();
//
defaultApp();
addGlobalUncaughtErrorHandler
(
event
=>
{
addGlobalUncaughtErrorHandler
(
event
=>
{
console
.
log
(
event
);
console
.
log
(
event
);
...
...
src/pages/bootpage/index.js
View file @
b708e674
...
@@ -13,7 +13,7 @@ import { actionCreators } from '../../containers/App/store';
...
@@ -13,7 +13,7 @@ import { actionCreators } from '../../containers/App/store';
import
SecurityLayout
from
'../../layouts/SecurityLayout'
;
import
SecurityLayout
from
'../../layouts/SecurityLayout'
;
import
LoginAction
from
'../user/login/login'
;
import
LoginAction
from
'../user/login/login'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
initMicroApps
}
from
'@/micro'
;
import
{
defaultApp
}
from
'@/micro'
;
import
usingIcon
from
'@/assets/bootPage/using-icon.png'
;
import
usingIcon
from
'@/assets/bootPage/using-icon.png'
;
import
{
appService
}
from
'@/api'
;
import
{
appService
}
from
'@/api'
;
...
@@ -102,7 +102,7 @@ const BootPage = props => {
...
@@ -102,7 +102,7 @@ const BootPage = props => {
const
handleToggleIndustry
=
event
=>
{
const
handleToggleIndustry
=
event
=>
{
setLoadding
(
false
);
setLoadding
(
false
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
initMicroApps
();
defaultApp
();
window
.
share
.
event
.
emit
(
'triggerMicro'
,
props
.
global
);
window
.
share
.
event
.
emit
(
'triggerMicro'
,
props
.
global
);
props
.
updateCurrentIndex
(
0
);
props
.
updateCurrentIndex
(
0
);
};
};
...
...
src/pages/user/login/index.js
View file @
b708e674
...
@@ -22,10 +22,10 @@ const LoginTemplate = {
...
@@ -22,10 +22,10 @@ const LoginTemplate = {
/* eslint-disable */
/* eslint-disable */
export
default
(
props
)
=>
{
export
default
(
props
)
=>
{
// const redirect = getParams('redirect');
// const redirect = getParams('redirect');
//
useEffect(() => {
useEffect
(()
=>
{
// if(getParams('loginName') && getParams('password')) return
// if(getParams('loginName') && getParams('password')) return
//
initGlobalConfig();
initGlobalConfig
();
// }, [redirect
]);
},
[
]);
const
template
=
window
.
globalConfig
&&
window
.
globalConfig
.
loginTemplate
;
const
template
=
window
.
globalConfig
&&
window
.
globalConfig
.
loginTemplate
;
const
RenderComponent
=
LoginTemplate
[
template
]
?
LoginTemplate
[
template
]:
LoginTemplate
[
'default'
];
const
RenderComponent
=
LoginTemplate
[
template
]
?
LoginTemplate
[
template
]:
LoginTemplate
[
'default'
];
return
<
RenderComponent
{...
props
}
/
>
return
<
RenderComponent
{...
props
}
/
>
...
...
src/pages/user/login/template/baseLogin.js
View file @
b708e674
...
@@ -15,7 +15,7 @@ import styles from '../style.less';
...
@@ -15,7 +15,7 @@ import styles from '../style.less';
import
useRenderQcode
from
'../js/useRenderQcode'
;
import
useRenderQcode
from
'../js/useRenderQcode'
;
import
Account
from
'../js/useAccount'
;
import
Account
from
'../js/useAccount'
;
import
IotComponent
from
'../js/useIOTComponent'
;
import
IotComponent
from
'../js/useIOTComponent'
;
import
{
initMicroApps
}
from
'../../../../micro'
;
import
{
defaultApp
}
from
'../../../../micro'
;
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
const
videoRef
=
useRef
();
const
videoRef
=
useRef
();
const
loginRef
=
useRef
();
const
loginRef
=
useRef
();
...
@@ -34,7 +34,7 @@ const Login = forwardRef((props, _ref) => {
...
@@ -34,7 +34,7 @@ const Login = forwardRef((props, _ref) => {
const
history
=
useHistory
();
const
history
=
useHistory
();
const
[
action
,
setAction
]
=
useState
(
const
[
action
,
setAction
]
=
useState
(
()
=>
()
=>
new
LoginAction
(
Object
.
assign
({},
props
,
{
history
}),
setVisible
,
tru
e
),
new
LoginAction
(
Object
.
assign
({},
props
,
{
history
}),
setVisible
,
fals
e
),
);
);
// useEffect(() => {
// useEffect(() => {
...
@@ -68,7 +68,9 @@ const Login = forwardRef((props, _ref) => {
...
@@ -68,7 +68,9 @@ const Login = forwardRef((props, _ref) => {
props
.
updateCurrentIndex
&&
props
.
updateCurrentIndex
(
0
);
props
.
updateCurrentIndex
&&
props
.
updateCurrentIndex
(
0
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
// window.share.event.emit('triggerMicro', props.global);
// window.share.event.emit('triggerMicro', props.global);
initMicroApps
();
// initMicroApps();
debugger
defaultApp
();
});
});
action
&&
action
&&
action
.
events
.
on
(
'loginError'
,
event
=>
{
action
.
events
.
on
(
'loginError'
,
event
=>
{
...
@@ -203,7 +205,7 @@ const Login = forwardRef((props, _ref) => {
...
@@ -203,7 +205,7 @@ const Login = forwardRef((props, _ref) => {
>
>
<
span
className
=
{
styles
.
title
}
>
{
props
.
global
.
title
}
<
/span
>
<
span
className
=
{
styles
.
title
}
>
{
props
.
global
.
title
}
<
/span
>
<
span
className
=
{
styles
.
subtitle
}
>
<
span
className
=
{
styles
.
subtitle
}
>
{
window
.
globalConfig
.
subtitle
}
{
window
.
globalConfig
&&
window
.
globalConfig
.
subtitle
}
<
/span
>
<
/span
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/pages/user/login/template/infoLogin.js
View file @
b708e674
...
@@ -24,7 +24,7 @@ import UnSelected from '@/assets/oa/login/unselected.jpg'
...
@@ -24,7 +24,7 @@ import UnSelected from '@/assets/oa/login/unselected.jpg'
import
LoginAction
from
'../login'
;
import
LoginAction
from
'../login'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
{
initMicroApps
}
from
'../../../../micro'
;
import
{
defaultApp
}
from
'../../../../micro'
;
const
Logger
=
logger
(
'login'
);
const
Logger
=
logger
(
'login'
);
// 、登录页
// 、登录页
class
InfoLogin
extends
React
.
Component
{
class
InfoLogin
extends
React
.
Component
{
...
@@ -110,7 +110,7 @@ changeQrCode=(item)=>{
...
@@ -110,7 +110,7 @@ changeQrCode=(item)=>{
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
this
.
props
.
history
.
push
(
`/?client=
${
this
.
props
.
global
.
client
}
`
);
this
.
props
.
history
.
push
(
`/?client=
${
this
.
props
.
global
.
client
}
`
);
// window.share.event.emit('triggerMicro', this.props.global);
// window.share.event.emit('triggerMicro', this.props.global);
initMicroApps
();
defaultApp
();
});
});
action
&&
action
.
events
.
on
(
'loginError'
,
event
=>
{
action
&&
action
.
events
.
on
(
'loginError'
,
event
=>
{
...
...
src/pages/user/login/template/yulin.js
View file @
b708e674
...
@@ -20,7 +20,7 @@ import LoginAction from '../login';
...
@@ -20,7 +20,7 @@ import LoginAction from '../login';
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
QRCode
from
'qrcode.react'
;
import
QRCode
from
'qrcode.react'
;
import
{
initMicroApps
}
from
'../../../../micro'
;
import
{
defaultApp
}
from
'../../../../micro'
;
const
Logger
=
logger
(
'login'
);
const
Logger
=
logger
(
'login'
);
// 、登录页
// 、登录页
class
InfoLogin
extends
React
.
Component
{
class
InfoLogin
extends
React
.
Component
{
...
@@ -141,7 +141,7 @@ class InfoLogin extends React.Component {
...
@@ -141,7 +141,7 @@ class InfoLogin extends React.Component {
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
this
.
props
.
history
.
push
(
`/?client=
${
this
.
props
.
global
.
client
}
`
);
this
.
props
.
history
.
push
(
`/?client=
${
this
.
props
.
global
.
client
}
`
);
// window.share.event.emit('triggerMicro', this.props.global);
// window.share.event.emit('triggerMicro', this.props.global);
initMicroApps
();
defaultApp
();
});
});
action
&&
action
.
events
.
on
(
'loginError'
,
event
=>
{
action
&&
action
.
events
.
on
(
'loginError'
,
event
=>
{
...
...
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