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
6cda9a0f
Commit
6cda9a0f
authored
Dec 09, 2021
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复运维隐藏菜单配置
parent
3bcbac2d
Pipeline
#39810
passed with stages
in 24 minutes 21 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
175 additions
and
134 deletions
+175
-134
micor.js
config/micor.js
+1
-1
proxy.js
config/proxy.js
+1
-1
index.js
src/api/index.js
+2
-0
base.js
src/api/service/base.js
+28
-3
app.js
src/app.js
+9
-119
actions.js
src/containers/App/store/actions.js
+1
-1
initConfig.js
src/initConfig.js
+123
-0
SecurityLayout.js
src/layouts/SecurityLayout.js
+2
-0
login.js
src/pages/user/login/login.js
+8
-9
No files found.
config/micor.js
View file @
6cda9a0f
...
@@ -17,7 +17,7 @@ export default {
...
@@ -17,7 +17,7 @@ export default {
// },
// },
{
{
name
:
'civ_pandawork'
,
name
:
'civ_pandawork'
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
2
/civ_pandawork`
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
1
/civ_pandawork`
,
container
:
'#micro-container'
,
container
:
'#micro-container'
,
activeRule
:
'/civbase/civ_pandawork'
,
activeRule
:
'/civbase/civ_pandawork'
,
},
},
...
...
config/proxy.js
View file @
6cda9a0f
/* 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://
mis
.panda-water.cn'
;
const
proxyURL
=
'https://
work
.panda-water.cn'
;
module
.
exports
=
{
module
.
exports
=
{
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
dev
:
{
dev
:
{
...
...
src/api/index.js
View file @
6cda9a0f
...
@@ -9,6 +9,8 @@ const { warning } = Modal;
...
@@ -9,6 +9,8 @@ const { warning } = Modal;
// eslint-disable-next-line no-return-await
// eslint-disable-next-line no-return-await
instanceRequest
.
reportCodeError
=
true
;
instanceRequest
.
reportCodeError
=
true
;
instanceRequest
.
transformRequestURL
=
function
(
url
)
{
instanceRequest
.
transformRequestURL
=
function
(
url
)
{
// url = url.replace(/\/GateWay/, '')
const
excludeURL
=
[
'/PandaCore/GCK/Basis/GateWayConfig'
,
'/CityInterface/rest/services.svc/GetConfig'
];
const
excludeURL
=
[
'/PandaCore/GCK/Basis/GateWayConfig'
,
'/CityInterface/rest/services.svc/GetConfig'
];
if
(
excludeURL
.
includes
(
url
))
{
if
(
excludeURL
.
includes
(
url
))
{
return
url
;
return
url
;
...
...
src/api/service/base.js
View file @
6cda9a0f
...
@@ -87,9 +87,9 @@ const services = {
...
@@ -87,9 +87,9 @@ const services = {
},
},
getUserInfo
:
{
getUserInfo
:
{
url
:
()
=>
window
.
globalConfig
&&
url
:
()
=>
{
window
.
globalConfig
&&
return
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
?
API
.
GET_GATEWAY_USER_INFO
:
API
.
GET_USER_INFO
window
.
globalConfig
.
hasGateWay
?
API
.
GET_GATEWAY_USER_INFO
:
API
.
GET_USER_INFO
,
}
,
method
:
constants
.
REQUEST_METHOD_GET
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
type
:
constants
.
REQUEST_HTTP
,
},
},
...
@@ -218,6 +218,31 @@ export const searchAutoCity = keywords => {
...
@@ -218,6 +218,31 @@ export const searchAutoCity = keywords => {
return
jsonp
(
url
,
params
,
options
);
return
jsonp
(
url
,
params
,
options
);
};
};
export
const
getUserInfo
=
(
params
)
=>
{
const
url
=
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
?
API
.
GET_GATEWAY_USER_INFO
:
API
.
GET_USER_INFO
return
request
({
url
:
url
,
method
:
constants
.
REQUEST_METHOD_GET
,
params
:
params
,
// params: param.query,
});
}
export
const
getWebSiteConfig
=
(
params
)
=>
{
const
url
=
window
.
globalConfig
&&
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
?
API
.
GET_WEB_SITE_CONFIG_GEWAY
:
API
.
GET_WEB_SITE_CONFIG
;
return
request
({
url
:
url
,
method
:
constants
.
REQUEST_METHOD_GET
,
params
:
params
,
// params: param.query,
});
}
// 更新常用页
// 更新常用页
export
const
savePagePartInfo
=
param
=>
export
const
savePagePartInfo
=
param
=>
request
({
request
({
...
...
src/app.js
View file @
6cda9a0f
...
@@ -33,6 +33,7 @@ import { LocaleContainer } from './locales/locale';
...
@@ -33,6 +33,7 @@ import { LocaleContainer } from './locales/locale';
import
{
initMicroApps
}
from
'./micro'
;
import
{
initMicroApps
}
from
'./micro'
;
import
Login
from
'./pages/user/login/login'
;
import
Login
from
'./pages/user/login/login'
;
import
{
getToken
,
isString
}
from
'./utils/utils'
;
import
{
getToken
,
isString
}
from
'./utils/utils'
;
import
{
initGlobalConfig
}
from
'./initConfig'
import
'./utils/event'
;
import
'./utils/event'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
// eslint-disable-next-line no-restricted-globals
// eslint-disable-next-line no-restricted-globals
...
@@ -72,121 +73,6 @@ const initLocale = () => {
...
@@ -72,121 +73,6 @@ const initLocale = () => {
};
};
const
PRODUCT_NAME
=
[
'civ_water'
,
'civ_monitor'
];
const
PRODUCT_NAME
=
[
'civ_water'
,
'civ_monitor'
];
const
initGlobalConfig
=
()
=>
{
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-undef
let
config
=
createStoreage
.
get
(
'globalConfig'
)
||
{};
store
.
dispatch
(
actionCreators
.
updateComplexConfig
({}));
if
(
!
getToken
()
||
config
.
token
==
null
)
{
// eslint-disable-next-line no-undef
createStoreage
.
remove
(
namespace
);
config
=
{};
}
if
(
!
params
.
getParams
(
'client'
,
window
.
location
.
search
)
&&
config
)
{
// eslint-disable-next-line no-undef
createStoreage
.
remove
(
namespace
);
}
// eslint-disable-next-line no-undef
if
(
!
createStoreage
.
get
(
'globalConfig'
))
{
window
.
createStoreage
=
new
Storeage
(
namespace
);
}
if
(
!
getToken
())
{
localStorage
.
removeItem
(
'loginSite'
);
}
if
(
config
.
token
!==
null
&&
Object
.
keys
(
config
).
length
>
0
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
config
));
// render({ appContent: '', loading: true });
initMicroApps
(
loader
,
store
);
if
(
config
.
isNewYear
)
{
updateTheme
(
'#ff9600'
);
}
}
else
{
appService
.
getWateWayConfig
().
then
(
res
=>
{
const
hasGateWay
=
res
&&
res
.
data
&&
isString
(
res
.
data
)
?
JSON
.
parse
(
res
.
data
)
:
res
.
data
;
if
(
res
.
code
===
0
&&
res
.
data
===
'true'
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
hasGateWay
,
apiGatewayDomain
:
`
${
window
.
location
.
origin
}
/PandaCore`
,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const
client
=
!
_
.
isNull
(
params
.
getParams
(
'client'
))
?
params
.
getParams
(
'client'
)
:
Cookies
.
get
(
'city'
)
?
Cookies
.
get
(
'city'
):
'city'
;
appService
.
queryConfig
({
client
:
client
,
})
.
then
(
res
=>
{
if
(
res
)
{
const
data
=
res
;
if
(
!
data
.
client
)
{
data
.
client
=
params
.
getParams
(
'client'
)
||
'city'
;
}
// Cookies.set('city', data.client);
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
data
),
),
);
//Cookies.set('city', params.getParams('client'))
if
(
data
.
loginTemplate
===
'新春 - 智联.html'
)
{
updateTheme
(
'#ff9600'
);
}
// eslint-disable-next-line no-new
if
(
getToken
())
{
// eslint-disable-next-line no-new
new
Login
(
{
global
:
Object
.
assign
({},
data
,
{
token
:
getToken
(),
}),
// eslint-disable-next-line no-shadow
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
()),
},
()
=>
{
(
async
()
=>
{
(
await
(
getToken
()
&&
window
.
globalConfig
&&
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
,
store
);
})();
},
true
,
);
}
// eslint-disable-next-line no-shadow
}
return
res
;
})
// eslint-disable-next-line no-shadow
.
then
(
res
=>
{
// eslint-disable-next-line no-use-before-define
// initSensorType();
// eslint-disable-next-line no-use-before-define
// initIsMock();
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
console
.
log
(
error
);
store
.
dispatch
(
actionCreators
.
getConfigError
(
error
));
});
}
};
const
initSensorType
=
()
=>
{
const
initSensorType
=
()
=>
{
let
filterProduct
=
let
filterProduct
=
...
@@ -223,14 +109,18 @@ const initIsMock = () => {
...
@@ -223,14 +109,18 @@ const initIsMock = () => {
});
});
};
};
initGlobalConfig
();
initGlobalConfig
(
loader
,
store
,
render
);
initLocale
();
initLocale
();
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'triggerMicro'
,
()
=>
{
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'triggerMicro'
,
()
=>
{
initMicroApps
(
loader
,
store
);
initMicroApps
(
loader
,
store
);
});
});
event
.
on
(
'event:initConfig'
,
()
=>
{
initGlobalConfig
();
const
unlisten
=
history
.
listen
(
location
=>
{
});
if
(
location
.
pathname
.
indexOf
(
'/civbase/user/login'
)
>
-
1
)
{
initGlobalConfig
(
loader
,
store
,
render
);
}
})
event
.
on
(
'event:logout'
,
()
=>
{
event
.
on
(
'event:logout'
,
()
=>
{
store
.
dispatch
(
actionCreators
.
logout
())
store
.
dispatch
(
actionCreators
.
logout
())
});
});
src/containers/App/store/actions.js
View file @
6cda9a0f
...
@@ -204,7 +204,7 @@ export function logout(data) {
...
@@ -204,7 +204,7 @@ export function logout(data) {
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'access_token'
);
// eslint-disable-next-line no-undef,no-restricted-globals
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
event
.
emit
(
'event:initConfig'
);
return
{
return
{
type
:
LOGINOUT
,
type
:
LOGINOUT
,
data
:
{
data
:
{
...
...
src/initConfig.js
0 → 100644
View file @
6cda9a0f
import
{
appService
}
from
'./api'
;
import
{
initMicroApps
}
from
'./micro'
;
import
{
params
,
Storeage
}
from
'kit_utils'
;
import
{
actionCreators
}
from
'./containers/App/store'
;
import
{
getToken
,
isString
}
from
'./utils/utils'
;
const
namespace
=
`__PANDA_STORE__
${
location
.
hostname
}
`
;
window
.
createStoreage
=
new
Storeage
(
namespace
);
export
const
initGlobalConfig
=
(
loader
,
store
,
render
)
=>
{
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-undef
let
config
=
createStoreage
.
get
(
'globalConfig'
)
||
{};
store
.
dispatch
(
actionCreators
.
updateComplexConfig
({}));
if
(
!
getToken
()
||
config
.
token
==
null
)
{
// eslint-disable-next-line no-undef
createStoreage
.
remove
(
namespace
);
config
=
{};
}
if
(
!
params
.
getParams
(
'client'
,
window
.
location
.
search
)
&&
config
)
{
// eslint-disable-next-line no-undef
createStoreage
.
remove
(
namespace
);
}
// eslint-disable-next-line no-undef
if
(
!
createStoreage
.
get
(
'globalConfig'
))
{
window
.
createStoreage
=
new
Storeage
(
namespace
);
}
if
(
!
getToken
())
{
localStorage
.
removeItem
(
'loginSite'
);
}
if
(
config
.
token
!==
null
&&
Object
.
keys
(
config
).
length
>
0
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
config
));
// render({ appContent: '', loading: true });
initMicroApps
(
loader
,
store
);
if
(
config
.
isNewYear
)
{
updateTheme
(
'#ff9600'
);
}
}
else
{
appService
.
getWateWayConfig
().
then
(
res
=>
{
const
hasGateWay
=
res
&&
res
.
data
&&
isString
(
res
.
data
)
?
JSON
.
parse
(
res
.
data
)
:
res
.
data
;
if
(
res
.
code
===
0
&&
res
.
data
===
'true'
)
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
hasGateWay
,
apiGatewayDomain
:
`
${
window
.
location
.
origin
}
/PandaCore`
,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const
client
=
params
.
getParams
(
'client'
)
appService
.
queryConfig
({
client
:
client
,
})
.
then
(
res
=>
{
if
(
res
)
{
const
data
=
res
;
if
(
!
data
.
client
)
{
data
.
client
=
params
.
getParams
(
'client'
)
||
'city'
;
}
// Cookies.set('city', data.client);
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
data
),
),
);
//Cookies.set('city', params.getParams('client'))
if
(
data
.
loginTemplate
===
'新春 - 智联.html'
)
{
updateTheme
(
'#ff9600'
);
}
// eslint-disable-next-line no-new
if
(
getToken
())
{
// eslint-disable-next-line no-new
new
Login
(
{
global
:
Object
.
assign
({},
data
,
{
token
:
getToken
(),
}),
// eslint-disable-next-line no-shadow
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
()),
},
()
=>
{
(
async
()
=>
{
(
await
(
getToken
()
&&
window
.
globalConfig
&&
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
,
store
);
})();
},
true
,
);
}
// eslint-disable-next-line no-shadow
}
return
res
;
})
// eslint-disable-next-line no-shadow
.
then
(
res
=>
{
// eslint-disable-next-line no-use-before-define
// initSensorType();
// eslint-disable-next-line no-use-before-define
// initIsMock();
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
console
.
log
(
error
);
store
.
dispatch
(
actionCreators
.
getConfigError
(
error
));
});
}
};
\ No newline at end of file
src/layouts/SecurityLayout.js
View file @
6cda9a0f
...
@@ -3,6 +3,7 @@ import Cookies from 'js-cookie';
...
@@ -3,6 +3,7 @@ import Cookies from 'js-cookie';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
Redirect
}
from
'@wisdom-utils/runtime'
;
import
{
Redirect
}
from
'@wisdom-utils/runtime'
;
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
{
event
}
from
'microser-data'
;
import
{
stringify
}
from
'querystring'
;
import
{
stringify
}
from
'querystring'
;
import
{
getBaseName
}
from
'../utils/utils'
;
import
{
getBaseName
}
from
'../utils/utils'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
...
@@ -32,6 +33,7 @@ class SecurityLayout extends React.Component {
...
@@ -32,6 +33,7 @@ class SecurityLayout extends React.Component {
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
this
.
props
.
updateCurrentIndex
&&
this
.
props
.
updateCurrentIndex
(
0
);
let
client
=
global
.
client
||
Cookies
.
get
(
'city'
);
let
client
=
global
.
client
||
Cookies
.
get
(
'city'
);
client
=
client
!==
'undefined'
||
!
_
.
isNull
(
client
)
||
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
client
=
client
!==
'undefined'
||
!
_
.
isNull
(
client
)
||
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
// event.emit(?'event:initConfig');
return
(
return
(
<
Redirect
to
=
{
`/user/login?client=
${
client
}
`
}
/
>
<
Redirect
to
=
{
`/user/login?client=
${
client
}
`
}
/
>
);
);
...
...
src/pages/user/login/login.js
View file @
6cda9a0f
...
@@ -6,6 +6,7 @@ import Cookies from 'js-cookie';
...
@@ -6,6 +6,7 @@ import Cookies from 'js-cookie';
import
sha1
from
'sha1'
;
import
sha1
from
'sha1'
;
import
{
appService
}
from
'@/api'
;
import
{
appService
}
from
'@/api'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
import
{
import
{
SERVICE_APP_LOGIN_MODE
,
SERVICE_APP_LOGIN_MODE
,
SERVICE_INTERFACE_SUCCESS_CODE
,
SERVICE_INTERFACE_SUCCESS_CODE
,
...
@@ -74,8 +75,7 @@ class Login {
...
@@ -74,8 +75,7 @@ class Login {
const
self
=
this
;
const
self
=
this
;
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
appService
getUserInfo
({
.
getUserInfo
({
token
:
this
.
globalConfig
.
token
,
token
:
this
.
globalConfig
.
token
,
subOID
:
'subOID'
,
subOID
:
'subOID'
,
site
:
this
.
getLocalSiteBytoken
(
token
),
site
:
this
.
getLocalSiteBytoken
(
token
),
...
@@ -192,8 +192,8 @@ class Login {
...
@@ -192,8 +192,8 @@ class Login {
getWebConfig
(
token
,
getIndustry
)
{
getWebConfig
(
token
,
getIndustry
)
{
const
self
=
this
;
const
self
=
this
;
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
appService
.
getWebSiteConfig
({
getWebSiteConfig
({
client
:
self
.
globalConfig
.
client
,
client
:
self
.
globalConfig
.
client
,
token
,
token
,
'request.preventCache'
:
Date
.
now
(),
'request.preventCache'
:
Date
.
now
(),
...
@@ -242,8 +242,8 @@ class Login {
...
@@ -242,8 +242,8 @@ class Login {
self
.
globalConfig
.
userInfo
.
site
.
length
>
0
self
.
globalConfig
.
userInfo
.
site
.
length
>
0
)
{
)
{
// eslint-disable-next-line no-undef,no-underscore-dangle
// eslint-disable-next-line no-undef,no-underscore-dangle
appService
.
getWebSiteConfig
(
getWebSiteConfig
(
{
{
client
:
self
.
globalConfig
.
client
,
client
:
self
.
globalConfig
.
client
,
token
,
token
,
...
@@ -589,8 +589,7 @@ class Login {
...
@@ -589,8 +589,7 @@ class Login {
const
tk
=
response
.
token
;
const
tk
=
response
.
token
;
this
.
globalConfig
.
token
=
tk
;
this
.
globalConfig
.
token
=
tk
;
// eslint-disable-next-line no-undef,no-debugger
// eslint-disable-next-line no-undef,no-debugger
appService
getUserInfo
(
.
getUserInfo
(
{
{
token
:
tk
,
token
:
tk
,
subOID
:
'subOID'
,
subOID
:
'subOID'
,
...
@@ -668,7 +667,7 @@ class Login {
...
@@ -668,7 +667,7 @@ class Login {
if
(
self
.
isSignIn
||
!!
industry
)
{
if
(
self
.
isSignIn
||
!!
industry
)
{
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
appService
.
getUserInfo
(
getUserInfo
(
{
{
token
,
token
,
subOID
:
'subOID'
,
subOID
:
'subOID'
,
...
...
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