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