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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
130 deletions
+138
-130
micro.js
src/micro.js
+8
-8
login.js
src/pages/user/login/login.js
+128
-120
routes.js
src/utils/routes.js
+2
-2
No files found.
src/micro.js
View file @
4fc185fd
...
@@ -37,7 +37,7 @@ const MICRO_STATUS = {
...
@@ -37,7 +37,7 @@ const MICRO_STATUS = {
};
};
export
const
initMicroApps
=
()
=>
{
export
const
initMicroApps
=
()
=>
{
/* eslint-disable */
/* eslint-disable */
const
config
=
window
.
globalConfig
||
{};
const
config
=
window
.
globalConfig
||
{};
//createStoreage.get('globalConfig');
//createStoreage.get('globalConfig');
...
@@ -190,12 +190,12 @@ export const initMicroApps = () => {
...
@@ -190,12 +190,12 @@ export const initMicroApps = () => {
addGlobalUncaughtErrorHandler
(
event
=>
{
addGlobalUncaughtErrorHandler
(
event
=>
{
console
.
log
(
event
);
console
.
log
(
event
);
});
});
};
};
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
;
...
@@ -211,14 +211,14 @@ export const defaultApp = () => {
...
@@ -211,14 +211,14 @@ 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 处理监听路由规则
*/
*/
// if(url === '/civbase/civweb4/') {
// if(url === '/civbase/civweb4/') {
// url = url.replace(/civweb4\//, 'civweb4');
// url = url.replace(/civweb4\//, 'civweb4');
// }
// }
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);
}
}
...
@@ -238,7 +238,7 @@ window.app = {
...
@@ -238,7 +238,7 @@ window.app = {
modules
:
{},
modules
:
{},
require
:
function
(
request
,
method
)
{
require
:
function
(
request
,
method
)
{
if
(
request
!==
'.'
&&
this
.
modules
[
request
])
{
if
(
request
!==
'.'
&&
this
.
modules
[
request
])
{
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
]();
}
}
...
@@ -277,7 +277,7 @@ window.app = {
...
@@ -277,7 +277,7 @@ window.app = {
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
(
'/'
);
...
@@ -293,7 +293,7 @@ window.app = {
...
@@ -293,7 +293,7 @@ window.app = {
dir
[
parts
[
parts
.
length
-
1
]]
=
context
.
bind
(
context
,
key
);
dir
[
parts
[
parts
.
length
-
1
]]
=
context
.
bind
(
context
,
key
);
}
}
if
(
index
&&
index
!==
null
)
{
if
(
index
&&
index
!==
null
)
{
this
.
modules
[
name
]
=
this
.
modules
[
name
][
index
];
this
.
modules
[
name
]
=
this
.
modules
[
name
][
index
];
}
}
},
},
...
...
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
&&
...
@@ -90,44 +93,42 @@ class Login {
...
@@ -90,44 +93,42 @@ class Login {
// eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
getUserInfo
({
getUserInfo
({
token
:
this
.
globalConfig
.
token
,
token
:
this
.
globalConfig
.
token
,
subOID
:
'subOID'
,
subOID
:
'subOID'
,
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
(
response
.
Groups
&&
response
.
Groups
&&
response
.
Groups
instanceof
Array
&&
response
.
Groups
instanceof
Array
&&
response
.
Groups
.
length
response
.
Groups
.
length
)
{
)
{
self
.
globalConfig
.
userInfo
.
Groups
=
response
.
Groups
;
self
.
globalConfig
.
userInfo
.
Groups
=
response
.
Groups
;
}
self
.
globalConfig
.
userInfo
=
Object
.
assign
(
{},
response
,
self
.
globalConfig
.
userInfo
,
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
getUserInfoAndConfig
();
}
else
{
self
.
logout
&&
self
.
logout
();
if
(
self
.
globalConfig
.
style
===
'ios'
&&
self
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
}
window
.
location
.
reload
();
}
}
});
self
.
globalConfig
.
userInfo
=
Object
.
assign
(
{},
response
,
self
.
globalConfig
.
userInfo
,
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
getUserInfoAndConfig
();
}
else
{
self
.
logout
&&
self
.
logout
();
if
(
self
.
globalConfig
.
style
===
'ios'
&&
self
.
globalConfig
.
loginTemplate
===
'IOSCloud.html'
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
`
;
return
false
;
}
window
.
location
.
reload
();
}
});
}
}
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
)
{
...
@@ -206,42 +206,51 @@ class Login {
...
@@ -206,42 +206,51 @@ 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
getWebSiteConfig
({
getWebSiteConfig
({
client
:
self
.
globalConfig
.
client
,
client
:
self
.
globalConfig
.
client
,
token
,
token
,
'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,21 +264,24 @@ class Login {
...
@@ -255,21 +264,24 @@ 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
(
{
{
client
:
self
.
globalConfig
.
client
,
client
:
self
.
globalConfig
.
client
,
token
,
token
,
ignoreSite
:
true
,
ignoreSite
:
true
,
'request.preventCache'
:
Date
.
now
(),
'request.preventCache'
:
Date
.
now
(),
},
},
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
)
)
// 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
;
...
@@ -301,7 +315,6 @@ class Login {
...
@@ -301,7 +315,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===")
...
@@ -335,19 +348,19 @@ class Login {
...
@@ -335,19 +348,19 @@ class Login {
let
widgetIndex
=
-
1
;
let
widgetIndex
=
-
1
;
this
.
globalConfig
.
uiwidgets
&&
this
.
globalConfig
.
uiwidgets
&&
this
.
globalConfig
.
uiwidgets
.
map
((
item
,
index
)
=>
{
this
.
globalConfig
.
uiwidgets
.
map
((
item
,
index
)
=>
{
// eslint-disable-next-line radix
if
(
parseInt
(
item
.
bottom
)
>
MAX_BOTTOM
)
{
// eslint-disable-next-line radix
// eslint-disable-next-line radix
MAX_BOTTOM
=
parseInt
(
item
.
bottom
);
if
(
parseInt
(
item
.
bottom
)
>
MAX_BOTTOM
)
{
}
// eslint-disable-next-line radix
if
(
!
isScale
&&
item
.
url
.
toLowerCase
().
indexOf
(
'widgets/zoom'
)
>
-
1
)
MAX_BOTTOM
=
parseInt
(
item
.
bottom
);
isScale
=
true
;
}
if
(
if
(
!
isScale
&&
item
.
url
.
toLowerCase
().
indexOf
(
'widgets/zoom'
)
>
-
1
)
widgetIndex
===
-
1
&&
isScale
=
true
;
item
.
url
.
indexOf
(
'ToggleProject/ToggleProject'
)
>
-
1
if
(
)
widgetIndex
===
-
1
&&
widgetIndex
=
index
;
item
.
url
.
indexOf
(
'ToggleProject/ToggleProject'
)
>
-
1
});
)
widgetIndex
=
index
;
});
const
{
layers
=
[]
}
=
this
.
globalConfig
.
mapsettings
||
{};
const
{
layers
=
[]
}
=
this
.
globalConfig
.
mapsettings
||
{};
if
(
layers
.
length
===
0
)
{
if
(
layers
.
length
===
0
)
{
...
@@ -372,24 +385,24 @@ class Login {
...
@@ -372,24 +385,24 @@ 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
;
}
}
if
(
layer
.
backgroundColor
)
{
if
(
layer
.
backgroundColor
)
{
this
.
globalConfig
.
mapsettings
.
areasettings
.
backgroundColor
=
this
.
globalConfig
.
mapsettings
.
areasettings
.
backgroundColor
=
layer
.
backgroundColor
;
layer
.
backgroundColor
;
}
}
if
(
layer
.
boundColor
)
{
if
(
layer
.
boundColor
)
{
this
.
globalConfig
.
mapsettings
.
areasettings
.
boundColor
=
layer
.
boundColor
;
this
.
globalConfig
.
mapsettings
.
areasettings
.
boundColor
=
layer
.
boundColor
;
}
}
if
(
layer
.
boundWidth
)
{
if
(
layer
.
boundWidth
)
{
this
.
globalConfig
.
mapsettings
.
areasettings
.
boundWidth
=
layer
.
boundWidth
;
this
.
globalConfig
.
mapsettings
.
areasettings
.
boundWidth
=
layer
.
boundWidth
;
}
}
// eslint-disable-next-line radix
// eslint-disable-next-line radix
if
(
Number
.
isInteger
(
parseInt
(
layer
.
backgroundOpacity
)))
{
if
(
Number
.
isInteger
(
parseInt
(
layer
.
backgroundOpacity
)))
{
this
.
globalConfig
.
mapsettings
.
areasettings
.
backgroundOpacity
=
this
.
globalConfig
.
mapsettings
.
areasettings
.
backgroundOpacity
=
...
@@ -400,7 +413,7 @@ class Login {
...
@@ -400,7 +413,7 @@ class Login {
if
(
layer
.
basemaps
&&
layer
.
basemaps
.
length
>
0
)
{
if
(
layer
.
basemaps
&&
layer
.
basemaps
.
length
>
0
)
{
this
.
globalConfig
.
mapsettings
.
basemaps
=
layer
.
basemaps
;
this
.
globalConfig
.
mapsettings
.
basemaps
=
layer
.
basemaps
;
}
}
// this.updateConfig && this.updateConfig(Object.assign({}, this.globalConfig, {
// this.updateConfig && this.updateConfig(Object.assign({}, this.globalConfig, {
// mapsettings: this.globalConfig.mapsettings
// mapsettings: this.globalConfig.mapsettings
// }));
// }));
...
@@ -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
;
...
@@ -632,28 +644,24 @@ class Login {
...
@@ -632,28 +644,24 @@ class Login {
// eslint-disable-next-line no-undef,no-debugger
// eslint-disable-next-line no-undef,no-debugger
getUserInfo
(
getUserInfo
(
{
{
token
:
tk
,
token
:
tk
,
subOID
:
'subOID'
,
subOID
:
'subOID'
,
site
:
this
.
getLocalSiteBytoken
(
tk
),
site
:
this
.
getLocalSiteBytoken
(
tk
),
ignoreSite
:
true
,
ignoreSite
:
true
,
},
},
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
)
)
// 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,8 +674,8 @@ class Login {
...
@@ -666,8 +674,8 @@ 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
;
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
self
.
updateConfig
&&
self
.
updateConfig
(
self
.
globalConfig
);
...
@@ -714,7 +722,7 @@ class Login {
...
@@ -714,7 +722,7 @@ class Login {
/* eslint-disable */
/* eslint-disable */
let
_industrySite
=
null
;
let
_industrySite
=
null
;
if
(
industry
)
{
if
(
industry
)
{
const
userInfo
=
const
userInfo
=
self
.
globalConfig
.
userInfo
&&
self
.
globalConfig
.
userInfo
&&
self
.
globalConfig
.
userInfo
.
Groups
&&
self
.
globalConfig
.
userInfo
.
Groups
&&
...
@@ -871,7 +879,7 @@ class Login {
...
@@ -871,7 +879,7 @@ class Login {
type
:
mode
,
type
:
mode
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
generateType
:
params
.
getParams
(
'generateType'
)
||
''
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
const
data
=
res
.
data
;
const
data
=
res
.
data
;
self
.
updateConfig
&&
self
.
updateConfig
(
Object
.
assign
({},
self
.
globalConfig
,
{
self
.
updateConfig
&&
self
.
updateConfig
(
Object
.
assign
({},
self
.
globalConfig
,
{
...
@@ -911,7 +919,7 @@ class Login {
...
@@ -911,7 +919,7 @@ class Login {
self
.
transformLoginHander
(
response
,
isRememberPWD
)
self
.
transformLoginHander
(
response
,
isRememberPWD
)
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
self
.
hasTry
=
true
;
self
.
hasTry
=
true
;
self
.
handleLoginError
();
self
.
handleLoginError
();
self
.
events
.
emit
(
'loginError'
,
error
.
message
);
self
.
events
.
emit
(
'loginError'
,
error
.
message
);
...
...
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