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
4fc185fd
Commit
4fc185fd
authored
Mar 31, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复开启网关后获取全局配置
parent
68952f56
Pipeline
#47012
passed with stages
in 8 minutes 49 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
45 deletions
+53
-45
micro.js
src/micro.js
+1
-1
login.js
src/pages/user/login/login.js
+50
-42
routes.js
src/utils/routes.js
+2
-2
No files found.
src/micro.js
View file @
4fc185fd
...
@@ -211,7 +211,7 @@ export const defaultApp = () => {
...
@@ -211,7 +211,7 @@ export const defaultApp = () => {
// createStoreage.set('init_web4', true)
// createStoreage.set('init_web4', true)
// }
// }
// let homepage = config.homepage.replace('civweb4/', '');
// let homepage = config.homepage.replace('civweb4/', '');
let
url
=
!
config
.
home
?
(
config
.
homepage
===
''
?
`/civbase/civweb4`
:
`/civbase/civweb4/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
).
replace
(
/^civweb4
\/
/
,
''
)}
`
)
:
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
;
let
url
=
!
config
.
home
?
(
(
config
.
homepage
===
''
||
_
.
isNull
(
config
.
homepage
))
?
`/civbase/civweb4`
:
`/civbase/civweb4/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
).
replace
(
/^civweb4
\/
/
,
''
)}
`
)
:
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
;
/**
/**
* issue 处理监听路由规则
* issue 处理监听路由规则
*/
*/
...
...
src/pages/user/login/login.js
View file @
4fc185fd
...
@@ -5,14 +5,14 @@ import { decode, encode } from 'js-base64';
...
@@ -5,14 +5,14 @@ import { decode, encode } from 'js-base64';
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
sha1
from
'sha1'
;
import
sha1
from
'sha1'
;
import
{
SlideVerify
}
from
'@wisdom-utils/components'
;
import
{
appService
}
from
'@/api'
;
import
{
appService
}
from
'@/api'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
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
,
WX_REDIRECT_URI
,
WX_REDIRECT_URI
,
}
from
'@/constants'
;
}
from
'@/constants'
;
import
{
SlideVerify
}
from
'@wisdom-utils/components'
;
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'login'
);
const
Logger
=
logger
(
'login'
);
...
@@ -41,19 +41,23 @@ class Login {
...
@@ -41,19 +41,23 @@ class Login {
let
{
ddCode
}
=
this
.
globalConfig
;
let
{
ddCode
}
=
this
.
globalConfig
;
let
{
loginName
}
=
this
.
globalConfig
;
let
{
loginName
}
=
this
.
globalConfig
;
let
{
password
}
=
this
.
globalConfig
;
let
{
password
}
=
this
.
globalConfig
;
loginName
=
params
.
getParams
(
'loginName'
)
?
params
.
getParams
(
'loginName'
):
loginName
;
loginName
=
params
.
getParams
(
'loginName'
)
?
params
.
getParams
(
'loginName'
)
:
loginName
;
const
redirect
=
params
.
getParams
(
'redirect'
);
const
redirect
=
params
.
getParams
(
'redirect'
);
const
generateType
=
params
.
getParams
(
'generateType'
);
const
generateType
=
params
.
getParams
(
'generateType'
);
if
(
redirect
)
{
if
(
redirect
)
{
this
.
globalConfig
.
homepage
=
redirect
;
this
.
globalConfig
.
homepage
=
redirect
;
// this.globalConfig.layout = 'blank';
// this.globalConfig.layout = 'blank';
}
}
if
(
generateType
)
{
if
(
generateType
)
{
this
.
globalConfig
.
generateType
=
generateType
;
this
.
globalConfig
.
generateType
=
generateType
;
}
}
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
password
=
params
.
getParams
(
'password'
)
?
params
.
getParams
(
'password'
):
password
;
password
=
params
.
getParams
(
'password'
)
?
params
.
getParams
(
'password'
)
:
password
;
const
loginMode
=
Cookies
.
get
(
'loginMode'
)
||
null
;
const
loginMode
=
Cookies
.
get
(
'loginMode'
)
||
null
;
if
(
loginMode
&&
loginMode
===
'iotWechat'
)
ddCode
=
null
;
if
(
loginMode
&&
loginMode
===
'iotWechat'
)
ddCode
=
null
;
// self.qrcodeLogin(self.globalConfig.qrcodeData.code);
// self.qrcodeLogin(self.globalConfig.qrcodeData.code);
...
@@ -65,7 +69,6 @@ class Login {
...
@@ -65,7 +69,6 @@ class Login {
}
else
if
(
ddCode
&&
loginMode
===
'qywx'
)
{
}
else
if
(
ddCode
&&
loginMode
===
'qywx'
)
{
self
.
qywxLoginIn
(
ddCode
);
self
.
qywxLoginIn
(
ddCode
);
}
else
if
(
!!
loginName
&&
!!
password
)
{
}
else
if
(
!!
loginName
&&
!!
password
)
{
self
.
otherLoginIn
(
loginName
,
password
);
self
.
otherLoginIn
(
loginName
,
password
);
}
else
if
(
}
else
if
(
self
.
globalConfig
.
qrcodeData
&&
self
.
globalConfig
.
qrcodeData
&&
...
@@ -95,8 +98,7 @@ class Login {
...
@@ -95,8 +98,7 @@ class Login {
site
:
this
.
getLocalSiteBytoken
(
token
),
site
:
this
.
getLocalSiteBytoken
(
token
),
'request.preventCache'
:
Date
.
now
(),
'request.preventCache'
:
Date
.
now
(),
ignoreSite
:
true
,
ignoreSite
:
true
,
})
}).
then
(
response
=>
{
.
then
(
response
=>
{
if
(
response
&&
!
response
.
errMsg
)
{
if
(
response
&&
!
response
.
errMsg
)
{
self
.
globalConfig
.
userInfo
=
{};
self
.
globalConfig
.
userInfo
=
{};
if
(
if
(
...
@@ -127,7 +129,6 @@ class Login {
...
@@ -127,7 +129,6 @@ class Login {
});
});
}
}
writeLogs
()
{
writeLogs
()
{
if
(
this
.
globalConfig
.
userInfo
.
UserImge
===
''
)
{
if
(
this
.
globalConfig
.
userInfo
.
UserImge
===
''
)
{
// _config.userInfo.UserImge = __webpack_public_path__ + "assets/images/icon/熊猫新2.png";
// _config.userInfo.UserImge = __webpack_public_path__ + "assets/images/icon/熊猫新2.png";
...
@@ -153,7 +154,7 @@ class Login {
...
@@ -153,7 +154,7 @@ class Login {
.
catch
(
error
=>
{});
.
catch
(
error
=>
{});
}
}
if
(
window
.
location
.
host
===
'panda-water.com'
)
{
if
(
window
.
location
.
host
===
'panda-water.com'
)
{
appService
appService
.
loginLogs
({
.
loginLogs
({
origin
:
window
.
location
.
origin
,
origin
:
window
.
location
.
origin
,
...
@@ -169,7 +170,6 @@ class Login {
...
@@ -169,7 +170,6 @@ class Login {
})
})
.
catch
(
error
=>
{});
.
catch
(
error
=>
{});
}
}
}
}
getIndustry
(
flag
,
token
,
getIndustry
)
{
getIndustry
(
flag
,
token
,
getIndustry
)
{
...
@@ -213,35 +213,44 @@ class Login {
...
@@ -213,35 +213,44 @@ class Login {
'request.preventCache'
:
Date
.
now
(),
'request.preventCache'
:
Date
.
now
(),
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
debugger
const
result
=
response
&&
response
.
code
===
SERVICE_INTERFACE_SUCCESS_CODE
?
Array
.
isArray
(
response
.
data
)?
response
.
data
:
[]
:
response
;
const
result
=
response
&&
response
.
code
===
SERVICE_INTERFACE_SUCCESS_CODE
?
Array
.
isArray
(
response
.
data
)
?
response
.
data
:
[]
:
response
;
if
(
result
&&
result
.
length
>
0
)
{
if
(
result
&&
result
.
length
>
0
)
{
const
config
=
result
.
shift
();
const
config
=
result
.
shift
();
const
homeType
=
config
.
productType
||
'civweb4'
;
const
homeType
=
config
.
productType
||
'civweb4'
;
// 产品类型和首页路径同时有才行
// 产品类型和首页路径同时有才行
const
homepage
=
homeType
&&
(
params
.
getParams
(
'redirect'
)
||
config
.
homepage
)
?
homeType
+
'/'
+
(
params
.
getParams
(
'redirect'
)
||
config
.
homepage
)
:
''
;
const
homepage
=
homeType
&&
(
params
.
getParams
(
'redirect'
)
||
config
.
homepage
)
?
`
${
homeType
}
/
${
params
.
getParams
(
'redirect'
)
||
config
.
homepage
}
`
:
''
;
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
config
,
{
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
config
,
{
theme
:
self
.
globalConfig
.
theme
,
theme
:
self
.
globalConfig
.
theme
,
menu
:
self
.
globalConfig
.
menu
,
menu
:
self
.
globalConfig
.
menu
,
style
:
self
.
globalConfig
.
style
,
style
:
self
.
globalConfig
.
style
,
homepage
:
homepage
homepage
:
homepage
||
''
,
// mapsettings: config.mapsettings
// mapsettings: config.mapsettings
});
});
if
(
self
.
globalConfig
.
hasOwnProperty
(
'webConfig'
))
{
// eslint-disable-next-line no-prototype-builtins
self
.
globalConfig
=
{
if
(
self
.
globalConfig
.
hasOwnProperty
(
'webConfig'
))
{
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,{
// ...self.globalConfig,
// ...self.globalConfig,
...
self
.
globalConfig
.
webConfig
.
basicConfig
,
...
self
.
globalConfig
.
webConfig
.
basicConfig
,
...
self
.
globalConfig
.
webConfig
.
optionalConfig
...
self
.
globalConfig
.
webConfig
.
optionalConfig
,
}
}
);
}
}
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
getProjectItems
().
then
(
(
res
)
=>
{
self
.
getProjectItems
().
then
(
res
=>
{
window
.
subSysCfg
=
{};
window
.
subSysCfg
=
{};
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
mapsettings
:
res
mapsettings
:
res
,
})
})
;
result
.
forEach
(
item
=>
{
result
.
forEach
(
item
=>
{
window
.
subSysCfg
[
item
.
client
]
=
item
;
window
.
subSysCfg
[
item
.
client
]
=
item
;
});
});
...
@@ -255,7 +264,11 @@ class Login {
...
@@ -255,7 +264,11 @@ class Login {
// this.events.removeAllListeners('loginSuccess')
// this.events.removeAllListeners('loginSuccess')
// this.events.removeAllListeners('toggleIndustry')
// this.events.removeAllListeners('toggleIndustry')
// window.share.event = this.events;
// window.share.event = this.events;
if
(
self
.
globalConfig
.
userInfo
&&
self
.
globalConfig
.
userInfo
.
site
&&
self
.
globalConfig
.
userInfo
.
site
.
length
>
0
)
{
if
(
self
.
globalConfig
.
userInfo
&&
self
.
globalConfig
.
userInfo
.
site
&&
self
.
globalConfig
.
userInfo
.
site
.
length
>
0
)
{
// eslint-disable-next-line no-undef,no-underscore-dangle
// eslint-disable-next-line no-undef,no-underscore-dangle
getWebSiteConfig
(
getWebSiteConfig
(
...
@@ -269,7 +282,6 @@ class Login {
...
@@ -269,7 +282,6 @@ class Login {
)
)
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
.
then
(
response
=>
{
.
then
(
response
=>
{
const
resultData
=
const
resultData
=
response
&&
response
.
code
===
SERVICE_INTERFACE_SUCCESS_CODE
response
&&
response
.
code
===
SERVICE_INTERFACE_SUCCESS_CODE
?
Array
.
isArray
(
response
.
data
)
?
Array
.
isArray
(
response
.
data
)
...
@@ -280,7 +292,9 @@ class Login {
...
@@ -280,7 +292,9 @@ class Login {
const
mainConf
=
resultData
.
shift
();
const
mainConf
=
resultData
.
shift
();
const
mainType
=
mainConf
.
productType
||
'civweb4'
;
const
mainType
=
mainConf
.
productType
||
'civweb4'
;
if
(
mainConf
.
homepage
)
if
(
mainConf
.
homepage
)
self
.
globalConfig
.
homepage
=
`
${
mainType
}
/
${
mainConf
.
homepage
}
`
;
self
.
globalConfig
.
homepage
=
`
${
mainType
}
/
${
mainConf
.
homepage
}
`
;
if
(
mainConf
.
bannerLogo
)
if
(
mainConf
.
bannerLogo
)
self
.
globalConfig
.
bannerLogo
=
mainConf
.
bannerLogo
;
self
.
globalConfig
.
bannerLogo
=
mainConf
.
bannerLogo
;
if
(
mainConf
.
logo
)
self
.
globalConfig
.
logo
=
mainConf
.
logo
;
if
(
mainConf
.
logo
)
self
.
globalConfig
.
logo
=
mainConf
.
logo
;
...
@@ -302,7 +316,6 @@ class Login {
...
@@ -302,7 +316,6 @@ class Login {
}
else
{
}
else
{
// loginSuccess
// loginSuccess
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
// console.log("===loginSuccess===")
// console.log("===loginSuccess===")
getIndustry
getIndustry
...
@@ -372,7 +385,7 @@ class Login {
...
@@ -372,7 +385,7 @@ class Login {
url
:
'product/webgisPanda/ToggleProject/ToggleProject'
,
url
:
'product/webgisPanda/ToggleProject/ToggleProject'
,
});
});
}
}
debugger
debugger
;
if
(
layer
.
areaName
)
{
if
(
layer
.
areaName
)
{
this
.
globalConfig
.
mapsettings
.
areasettings
.
areaName
=
layer
.
areaName
;
this
.
globalConfig
.
mapsettings
.
areasettings
.
areaName
=
layer
.
areaName
;
}
}
...
@@ -430,7 +443,6 @@ class Login {
...
@@ -430,7 +443,6 @@ class Login {
}
}
goLogin
()
{
goLogin
()
{
if
(
if
(
this
.
globalConfig
.
style
===
'ios'
&&
this
.
globalConfig
.
style
===
'ios'
&&
this
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
this
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
...
@@ -617,14 +629,14 @@ class Login {
...
@@ -617,14 +629,14 @@ class Login {
expiration
:
this
.
globalConfig
.
expiration
,
// token过期时间(单位:秒)
expiration
:
this
.
globalConfig
.
expiration
,
// token过期时间(单位:秒)
client
:
'referer'
,
client
:
'referer'
,
username
:
usr
,
username
:
usr
,
password
:
params
.
getParams
(
'generateType'
)
?
pwd
:
sha1
(
pwd
).
toUpperCase
(),
password
:
params
.
getParams
(
'generateType'
)
?
pwd
:
sha1
(
pwd
).
toUpperCase
(),
referer
:
this
.
globalConfig
.
client
,
referer
:
this
.
globalConfig
.
client
,
skipMenuTest
:
1
,
skipMenuTest
:
1
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
})
})
.
then
(
response
=>
{
.
then
(
response
=>
{
// self.globalConfig.layout = 'blank';
// self.globalConfig.layout = 'blank';
if
(
response
&&
response
.
token
)
{
if
(
response
&&
response
.
token
)
{
const
tk
=
response
.
token
;
const
tk
=
response
.
token
;
...
@@ -642,18 +654,14 @@ class Login {
...
@@ -642,18 +654,14 @@ class Login {
)
)
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
.
then
(
response
=>
{
.
then
(
response
=>
{
try
{
try
{
if
(
response
&&
!
response
.
errMsg
)
{
if
(
response
&&
!
response
.
errMsg
)
{
self
.
globalConfig
.
userInfo
=
Object
.
assign
(
self
.
globalConfig
.
userInfo
=
Object
.
assign
({},
response
);
{},
if
(
response
.
hasOwnProperty
(
'data'
))
{
response
,
);
if
(
response
.
hasOwnProperty
(
'data'
))
{
self
.
globalConfig
.
userInfo
=
{
self
.
globalConfig
.
userInfo
=
{
// ... self.globalConfig.userInfo,
// ... self.globalConfig.userInfo,
...
response
.
data
...
response
.
data
,
}
}
;
}
}
const
date
=
new
Date
();
const
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
24
*
60
*
60
*
1000
);
date
.
setTime
(
date
.
getTime
()
+
24
*
60
*
60
*
1000
);
...
@@ -666,7 +674,7 @@ class Login {
...
@@ -666,7 +674,7 @@ class Login {
Cookies
.
set
(
'token'
,
tk
,
{
Cookies
.
set
(
'token'
,
tk
,
{
expires
:
date
,
expires
:
date
,
path
:
'/'
,
path
:
'/'
,
})
})
;
// self.globalConfig.Industry = industry;
// self.globalConfig.Industry = industry;
self
.
isSignIn
=
true
;
self
.
isSignIn
=
true
;
...
...
src/utils/routes.js
View file @
4fc185fd
...
@@ -64,7 +64,7 @@ const generRotes = (widgets, parent, level = 0) => {
...
@@ -64,7 +64,7 @@ const generRotes = (widgets, parent, level = 0) => {
const
path
=
`/civweb/
${
guid
(
'web_console'
)}
`
;
const
path
=
`/civweb/
${
guid
(
'web_console'
)}
`
;
const
subKey
=
guid
(
'panda'
);
const
subKey
=
guid
(
'panda'
);
const
alias
=
DEFAULT_APPLICATION
;
const
alias
=
DEFAULT_APPLICATION
;
const
convertURL
=
transformURL
(
item
.
icon
.
replace
(
/
\s
*/g
,
''
))
;
const
convertURL
=
item
.
icon
?
transformURL
(
item
.
icon
.
replace
(
/
\s
*/g
,
''
)):
''
;
const
icon
=
(
item
&&
item
.
icon
&&
item
.
icon
!==
null
&&
const
icon
=
(
item
&&
item
.
icon
&&
item
.
icon
!==
null
&&
isAbsoluteURL
(
convertURL
)
?
convertURL
:
/
(\\
|
\/)
/
.
test
(
convertURL
)
?
isAbsoluteURL
(
convertURL
)
?
convertURL
:
/
(\\
|
\/)
/
.
test
(
convertURL
)
?
window
.
globalConfig
.
transformDevAssetsBaseURL
(
transformURL
(
item
.
icon
.
replace
(
/
\s
*/g
,
''
))):
item
.
icon
window
.
globalConfig
.
transformDevAssetsBaseURL
(
transformURL
(
item
.
icon
.
replace
(
/
\s
*/g
,
''
))):
item
.
icon
...
@@ -164,7 +164,7 @@ export const transformWidgets = (widgets) => {
...
@@ -164,7 +164,7 @@ export const transformWidgets = (widgets) => {
return
widgets
.
map
(
item
=>
{
return
widgets
.
map
(
item
=>
{
const
widgets
=
item
.
widgets
;
const
widgets
=
item
.
widgets
;
const
homepage
=
window
.
globalConfig
.
homepage
;
const
homepage
=
window
.
globalConfig
.
homepage
;
const
homePageConvertArray
=
homepage
.
split
(
"/"
)
;
const
homePageConvertArray
=
homepage
?
homepage
.
split
(
"/"
):
[]
;
const
findIndex
=
widgets
&&
widgets
.
findIndex
(
item
=>
item
.
label
===
'系统菜单组'
);
const
findIndex
=
widgets
&&
widgets
.
findIndex
(
item
=>
item
.
label
===
'系统菜单组'
);
if
(
findIndex
===
-
1
&&
homePageConvertArray
[
0
]
!==
'civweb4'
)
{
if
(
findIndex
===
-
1
&&
homePageConvertArray
[
0
]
!==
'civweb4'
)
{
const
index
=
widgets
.
findIndex
(
item
=>
item
.
label
===
'首页'
);
const
index
=
widgets
.
findIndex
(
item
=>
item
.
label
===
'首页'
);
...
...
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