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
15916b72
Commit
15916b72
authored
Nov 05, 2024
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 集成登录跳转前做菜单权限判断,获取子站优化
parent
d6a25018
Pipeline
#93634
waiting for manual action with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
191 additions
and
133 deletions
+191
-133
index.js
src/components/IntegratedSwitch/index.js
+91
-54
actions.js
src/containers/App/store/actions.js
+1
-0
BasicLayout.js
src/layouts/BasicLayout.js
+82
-76
index.js
src/pages/bootpage/template/integrationNew/index.js
+17
-3
No files found.
src/components/IntegratedSwitch/index.js
View file @
15916b72
...
@@ -14,6 +14,7 @@ import axios from 'axios';
...
@@ -14,6 +14,7 @@ import axios from 'axios';
import
{
defaultApp
}
from
'@/micro'
;
import
{
defaultApp
}
from
'@/micro'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
LoadPage
from
'@/components/LoadPage'
;
import
LoadPage
from
'@/components/LoadPage'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
const
IntegratedSwitch
=
props
=>
{
const
IntegratedSwitch
=
props
=>
{
...
@@ -74,29 +75,38 @@ const IntegratedSwitch = props => {
...
@@ -74,29 +75,38 @@ const IntegratedSwitch = props => {
useEffect
(()
=>
{
useEffect
(()
=>
{
// if (!window?.globalConfig?.userInfo?.OID || (!(window?.globalConfig?.isIntegration > 1) && window?.globalConfig?.Industry !== '集成登录')) return setDataList([]);
// if (!window?.globalConfig?.userInfo?.OID || (!(window?.globalConfig?.isIntegration > 1) && window?.globalConfig?.Industry !== '集成登录')) return setDataList([]);
if
(
!
window
?.
globalConfig
?.
userInfo
?.
OID
||
!
(
window
?.
globalConfig
?.
isIntegration
>=
1
))
return
setDataList
([]);
if
(
!
window
?.
globalConfig
?.
userInfo
?.
OID
||
!
(
window
?.
globalConfig
?.
isIntegration
>=
1
))
return
setDataList
([]);
appService
let
list
=
localStorage
.
getItem
(
'integrationData'
);
//
.
GetIntegrationConfig
({
list
=
list
?
JSON
.
parse
(
list
)
:
[];
type
:
'集成登录'
,
if
(
Array
.
isArray
(
list
)
&&
list
?.
length
)
{
userId
:
window
?.
globalConfig
?.
userInfo
?.
OID
??
null
,
setDataList
(
list
||
[]);
isEnable
:
true
,
}
else
{
client
:
appService
localStorage
.
getItem
(
'integrationClient'
)
||
sessionStorage
.
getItem
(
'client'
)
||
props
?.
global
?.
client
||
''
,
.
GetIntegrationConfig
({
})
type
:
'集成登录'
,
.
then
(
res
=>
{
userId
:
window
?.
globalConfig
?.
userInfo
?.
OID
??
null
,
setDataList
(
res
?.
data
||
[]);
isEnable
:
true
,
})
client
:
.
catch
(
err
=>
{
localStorage
.
getItem
(
'integrationClient'
)
||
setDataList
([]);
sessionStorage
.
getItem
(
'client'
)
||
});
props
?.
global
?.
client
||
''
,
})
.
then
(
res
=>
{
setDataList
(
res
?.
data
||
[]);
})
.
catch
(
err
=>
{
setDataList
([]);
});
}
},
[]);
},
[]);
// 子站跳转
// 子站跳转
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
const
handlePage
=
useCallback
((
item
,
loginAction
)
=>
{
const
handlePage
=
useCallback
((
item
,
loginAction
)
=>
{
setJumpLoading
(
true
);
jumpProgressStart
();
startTiming
(
5
);
if
(
item
.
subType
===
'外链'
)
{
if
(
item
.
subType
===
'外链'
)
{
setJumpLoading
(
true
);
jumpProgressStart
();
startTiming
(
5
);
// 营收
// 营收
if
(
item
.
paramValue
===
'ticket'
)
{
if
(
item
.
paramValue
===
'ticket'
)
{
// 获取临时token
// 获取临时token
...
@@ -129,35 +139,56 @@ const IntegratedSwitch = props => {
...
@@ -129,35 +139,56 @@ const IntegratedSwitch = props => {
}
}
}
}
} else if (item.subType === '内链') {
} else if (item.subType === '内链') {
if (window.qiankunIsCache) {
store.set('event:dropCache');
}
const cli = item.appKey;
const cli = item.appKey;
Cookies.set('client', cli, {
const token = props.global?.token || Cookies.get('token');
expires: 86400000 / (24 * 60 * 60 * 1000),
getWebSiteConfig({
path: '/'
,
identity: token
,
});
client: cli,
sessionStorage.setItem('client', cli);
}).then(res => {
const currentProduct = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
window
.
globalConfig
if (!res?.data?.[0]?.widgets?.length) {
?.
client
??
'city'
}
`;
message.error({
sessionStorage.removeItem(currentProduct);
duration: 3,
const currentProductNew = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
cli
||
'city'
}
`;
content: '您没有该板块权限,请联系管理员',
sessionStorage.setItem(currentProductNew, 0
);
}
);
setClient(cli);
return;
clientRef.current = cli;
}
const config = props.global;
setJumpLoading(true);
config.uiwidgets = [];
jumpProgressStart();
config.widgets = [];
startTiming(5);
config.allWidgets = [];
if (window.qiankunIsCache) {
window.qiankunStarted = false;
store.set('event:dropCache');
if (cli) {
}
config.client = cli;
}
Cookies.set('client', cli, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', cli);
const currentProduct = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
window
.
globalConfig
?.
client
??
'city'
}
`;
sessionStorage.removeItem(currentProduct);
const currentProductNew = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
cli
||
'city'
}
`;
sessionStorage.setItem(currentProductNew, 0);
// props.instance && props.instance.updateConfig(config);
setClient(cli);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type);
clientRef.current = cli;
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
window.qiankunStarted = false;
if (cli) {
config.client = cli;
}
// props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type);
});
} else {
} else {
setJumpLoading(true);
jumpProgressStart();
startTiming(5);
let { url } = item;
let { url } = item;
if (url?.indexOf('{userId}') >= 0) {
if (url?.indexOf('{userId}') >= 0) {
url = url.replace('{userId}', window.globalConfig?.userInfo?.OID);
url = url.replace('{userId}', window.globalConfig?.userInfo?.OID);
...
@@ -173,6 +204,9 @@ const IntegratedSwitch = props => {
...
@@ -173,6 +204,9 @@ const IntegratedSwitch = props => {
} else {
} else {
window.open(res.data?.data, '_blank');
window.open(res.data?.data, '_blank');
}
}
} else {
setJumpLoading(false);
jumpProgressEnd();
}
}
});
});
}
}
...
@@ -220,18 +254,21 @@ const IntegratedSwitch = props => {
...
@@ -220,18 +254,21 @@ const IntegratedSwitch = props => {
</Tooltip>
</Tooltip>
</div>
</div>
</li>
</li>
{dataList.map(item => (
{dataList.map(item => {
<li className={styles.switchPageLi} key={item.name} onClick={event => handlePage(item, loginAction)}>
if (item.subType === '内链' && item.appKey === props?.global?.client) return null;
<div className={styles.switchPageList}>
return (
<Tooltip placement="top" title={item.name}>
<li className={styles.switchPageLi} key={item.name} onClick={event => handlePage(item, loginAction)}>
<img
<div className={styles.switchPageList}>
src={`
$
{
window
.
location
.
origin
}
/${item.icon
?
item.icon : 'center/im
ages
/
科技风
/
二供
.
png
'}`}
<Tooltip placement="top" title={item.name}>
alt=""
<img
/>
src={`
$
{
window
.
location
.
origin
}
/${item.icon
?
item.icon : 'center/im
ages
/
科技风
/
二供
.
png
'}`}
</Tooltip>
alt=""
</div>
/>
</li>
</Tooltip>
))}
</div>
</li>
);
})}
</ul>
</ul>
</div>
</div>
) : null;
) : null;
...
...
src/containers/App/store/actions.js
View file @
15916b72
...
@@ -229,6 +229,7 @@ export function logout(data) {
...
@@ -229,6 +229,7 @@ export function logout(data) {
sessionStorage
.
setItem
(
'client'
,
integrationClient
);
sessionStorage
.
setItem
(
'client'
,
integrationClient
);
}
}
localStorage
.
removeItem
(
'integrationClient'
);
localStorage
.
removeItem
(
'integrationClient'
);
localStorage
.
removeItem
(
'integrationData'
);
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'password_token'
);
localStorage
.
removeItem
(
'password_token'
);
localStorage
.
removeItem
(
'password_pwdRegex'
);
localStorage
.
removeItem
(
'password_pwdRegex'
);
...
...
src/layouts/BasicLayout.js
View file @
15916b72
...
@@ -61,7 +61,7 @@ const arrowSvg = ({ fillColor = '#fff' }) => (
...
@@ -61,7 +61,7 @@ const arrowSvg = ({ fillColor = '#fff' }) => (
<
path
<
path
d
=
"M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z"
d
=
"M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z"
p
-
id
=
"8626"
p
-
id
=
"8626"
// fill={fillColor}
// fill={fillColor}
/>
/>
<
/svg
>
<
/svg
>
);
);
...
@@ -97,7 +97,9 @@ const OnlyFocusStations = props => {
...
@@ -97,7 +97,9 @@ const OnlyFocusStations = props => {
<
div
className
=
{
layoutStyles
.
focusStations
}
style
=
{{
border
:
'none'
}}
>
<
div
className
=
{
layoutStyles
.
focusStations
}
style
=
{{
border
:
'none'
}}
>
<
ul
>
<
ul
>
{
Array
.
isArray
(
data
)
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
,
props
.
data
))
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
,
props
.
data
),
)
:
null
}
:
null
}
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
...
@@ -180,7 +182,7 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
...
@@ -180,7 +182,7 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
stationName
,
setStationName
]
=
useState
(
''
);
const
[
stationName
,
setStationName
]
=
useState
(
''
);
useEffect
(()
=>
{
useEffect
(()
=>
{
window
.
share
.
event
.
on
(
'changeSiteVisible'
,
(
res
)
=>
{
window
.
share
.
event
.
on
(
'changeSiteVisible'
,
res
=>
{
setStationName
(
res
.
currentStationName
);
setStationName
(
res
.
currentStationName
);
setVisible
(
res
.
visible
);
setVisible
(
res
.
visible
);
});
});
...
@@ -292,11 +294,11 @@ const Layout = props => {
...
@@ -292,11 +294,11 @@ const Layout = props => {
// }, [location.pathname])
// }, [location.pathname])
useEffect
(()
=>
{
useEffect
(()
=>
{
// window.share.event.on('onTopMenuHeaderClick_', res => {
// window.share.event.on('onTopMenuHeaderClick_', res => {
// onTopMenuHeaderClick(res)
// onTopMenuHeaderClick(res)
// });
// });
window
.
onTopMenuHeaderClick_
=
onTopMenuHeaderClick
window
.
onTopMenuHeaderClick_
=
onTopMenuHeaderClick
;
event
.
on
(
'loading'
,
ret
=>
{
event
.
on
(
'loading'
,
ret
=>
{
setSubLoading
(
ret
);
setSubLoading
(
ret
);
...
@@ -327,19 +329,19 @@ const Layout = props => {
...
@@ -327,19 +329,19 @@ const Layout = props => {
?
`&generateType=
${
generateType
}
`
?
`&generateType=
${
generateType
}
`
:
''
;
:
''
;
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
if
(
integrationClient
)
client
=
integrationClient
if
(
integrationClient
)
client
=
integrationClient
;
if
(
!
isLogin
)
{
if
(
!
isLogin
)
{
history
.
push
(
`/user/login?client=
${
client
}${
generateType
}
`
,
{
reload
:
true
});
history
.
push
(
`/user/login?client=
${
client
}${
generateType
}
`
,
{
reload
:
true
});
clear
();
clear
();
props
.
logout
();
props
.
logout
();
}
}
if
(
props
.
global
.
security
===
"1"
)
{
if
(
props
.
global
.
security
===
'1'
)
{
store
.
off
(
'event:unauthorized'
);
store
.
off
(
'event:unauthorized'
);
}
else
{
}
else
{
store
.
on
(
'event:unauthorized'
,
()
=>
{
store
.
on
(
'event:unauthorized'
,
()
=>
{
store
.
off
(
'event:unauthorized'
);
store
.
off
(
'event:unauthorized'
);
const
key
=
`open
${
Date
.
now
()}
`
;
const
key
=
`open
${
Date
.
now
()}
`
;
if
(
notify
)
return
false
;
if
(
notify
)
return
false
;
notify
=
true
;
notify
=
true
;
notification
.
open
({
notification
.
open
({
description
:
'登录认证过期,即将跳转到登录页'
,
description
:
'登录认证过期,即将跳转到登录页'
,
...
@@ -354,8 +356,10 @@ const Layout = props => {
...
@@ -354,8 +356,10 @@ const Layout = props => {
notify
=
null
;
notify
=
null
;
clear
();
clear
();
props
.
logout
();
props
.
logout
();
})
});
}}
>
确认
}}
>
确认
<
/Button
>
<
/Button
>
),
),
key
,
key
,
...
@@ -388,26 +392,30 @@ const Layout = props => {
...
@@ -388,26 +392,30 @@ const Layout = props => {
const
GetIntegrationConfig
=
()
=>
{
const
GetIntegrationConfig
=
()
=>
{
if
(
first
)
{
if
(
first
)
{
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
let
list
=
localStorage
.
getItem
(
'integrationData'
);
//
appService
list
=
list
?
JSON
.
parse
(
list
)
:
[];
.
GetIntegrationConfig
({
if
(
Array
.
isArray
(
list
)
&&
list
?.
length
)
{
type
:
'集成登录'
,
setIntegrationData
(
list
);
userId
:
window
.
globalConfig
.
userInfo
?.
OID
??
null
,
}
else
{
isEnable
:
true
,
appService
client
:
integrationClient
||
props
.
global
.
client
// 只有指定client才能获取集成登录信息
.
GetIntegrationConfig
({
})
type
:
'集成登录'
,
.
then
(
res
=>
{
userId
:
window
.
globalConfig
.
userInfo
?.
OID
??
null
,
setFirst
(
false
);
isEnable
:
true
,
const
{
code
,
data
}
=
res
;
client
:
integrationClient
||
props
.
global
.
client
,
// 只有指定client才能获取集成登录信息
if
(
code
==
'0'
)
{
})
setIntegrationData
(
data
);
.
then
(
res
=>
{
}
else
{
setFirst
(
false
);
setIntegrationData
([]);
const
{
code
,
data
}
=
res
;
}
if
(
code
==
'0'
)
{
})
setIntegrationData
(
data
);
}
else
{
setIntegrationData
([]);
}
});
}
}
}
};
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
window
?.
globalConfig
?.
isIntegration
>=
1
)
{
if
(
window
?.
globalConfig
?.
isIntegration
>=
1
)
{
...
@@ -433,7 +441,7 @@ const Layout = props => {
...
@@ -433,7 +441,7 @@ const Layout = props => {
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
);
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
);
loginAction
.
events
.
removeListener
(
'toggleIndustry'
,
handleToggleIndustry
);
loginAction
.
events
.
removeListener
(
'toggleIndustry'
,
handleToggleIndustry
);
};
};
},
[
GetIntegrationConfig
,
loginAction
.
events
,
props
]);
},
[
loginAction
.
events
,
props
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
needMark
=
()
=>
const
needMark
=
()
=>
...
@@ -448,7 +456,7 @@ const Layout = props => {
...
@@ -448,7 +456,7 @@ const Layout = props => {
return
()
=>
{
return
()
=>
{
const
marks
=
document
.
querySelectorAll
(
'.pandawatermark_mask_div'
);
const
marks
=
document
.
querySelectorAll
(
'.pandawatermark_mask_div'
);
if
(
marks
&&
marks
.
length
)
{
if
(
marks
&&
marks
.
length
)
{
Array
.
prototype
.
forEach
.
call
(
marks
,
function
(
dom
,
index
)
{
Array
.
prototype
.
forEach
.
call
(
marks
,
function
(
dom
,
index
)
{
document
.
body
.
removeChild
(
dom
);
document
.
body
.
removeChild
(
dom
);
});
});
}
}
...
@@ -460,29 +468,31 @@ const Layout = props => {
...
@@ -460,29 +468,31 @@ const Layout = props => {
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
const
integrationClient
=
localStorage
.
getItem
(
'integrationClient'
);
// integrationClient存在,则返回集成登录站点
// integrationClient存在,则返回集成登录站点
if
(
window
.
globalConfig
.
isIntegration
>
1
||
integrationData
.
length
>
1
||
integrationClient
)
{
if
(
window
.
globalConfig
.
isIntegration
>
1
||
integrationData
.
length
>
1
||
integrationClient
)
{
if
(
integrationClient
)
{
if
(
integrationClient
)
{
Cookies
.
set
(
integrationClient
,
''
,
{
Cookies
.
set
(
integrationClient
,
''
,
{
path
:
'/'
,
path
:
'/'
,
});
});
window
.
globalConfig
.
client
=
integrationClient
;
window
.
globalConfig
.
client
=
integrationClient
;
props
.
updateConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
props
.
updateConfig
(
client
:
integrationClient
,
Object
.
assign
({},
window
.
globalConfig
,
{
client
:
integrationClient
,
}))
}),
);
sessionStorage
.
setItem
(
'client'
,
integrationClient
);
sessionStorage
.
setItem
(
'client'
,
integrationClient
);
localStorage
.
removeItem
(
'integrationClient'
);
localStorage
.
removeItem
(
'integrationClient'
);
// localStorage.removeItem('integrationData');
}
}
// window.qiankunIsCache = false;
// window.qiankunIsCache = false;
history
.
push
(
'/Industry'
);
history
.
push
(
'/Industry'
);
}
}
// 非云平台不做响应
// 非云平台不做响应
if
(
!
props
.
global
.
get
(
'userInfo.site'
))
{
if
(
!
props
.
global
.
get
(
'userInfo.site'
))
{
if
(
props
.
global
.
get
(
"isOpenTransitionPage"
))
{
if
(
props
.
global
.
get
(
'isOpenTransitionPage'
))
{
if
(
window
.
qiankunIsCache
)
{
if
(
window
.
qiankunIsCache
)
{
store
.
set
(
'event:refreshCurrentMenu'
,
{
store
.
set
(
'event:refreshCurrentMenu'
,
{
dropCache
:
true
,
dropCache
:
true
,
action
:
'closeAllTabs'
action
:
'closeAllTabs'
,
})
})
;
}
}
history
.
push
(
'/homePage'
);
history
.
push
(
'/homePage'
);
}
}
...
@@ -500,17 +510,17 @@ const Layout = props => {
...
@@ -500,17 +510,17 @@ const Layout = props => {
// setMenuLoading(false);
// setMenuLoading(false);
// }, [props.menu]);
// }, [props.menu]);
const
onTopMenuHeaderClick
=
(
index
=>
{
const
onTopMenuHeaderClick
=
index
=>
{
props
.
updateCurrentIndex
(
index
);
props
.
updateCurrentIndex
(
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
store
.
set
(
'updateMenuIndex'
,
index
);
store
.
set
(
'updateMenuIndex'
,
index
);
}
)
;
};
const
logo
=
const
logo
=
props
.
global
&&
_
.
isFunction
(
props
.
global
.
get
)
&&
props
.
global
.
get
(
'bannerLogo'
)
props
.
global
&&
_
.
isFunction
(
props
.
global
.
get
)
&&
props
.
global
.
get
(
'bannerLogo'
)
?
props
.
global
&&
?
props
.
global
&&
_
.
isFunction
(
props
.
global
.
transformDevAssetsBaseURL
)
&&
_
.
isFunction
(
props
.
global
.
transformDevAssetsBaseURL
)
&&
props
.
global
.
transformDevAssetsBaseURL
(
props
.
global
.
get
(
'bannerLogo'
))
props
.
global
.
transformDevAssetsBaseURL
(
props
.
global
.
get
(
'bannerLogo'
))
:
defaultSetting
.
logo
;
:
defaultSetting
.
logo
;
// 添加一个路由跳转事件
// 添加一个路由跳转事件
...
@@ -556,7 +566,7 @@ const Layout = props => {
...
@@ -556,7 +566,7 @@ const Layout = props => {
if
(
url
.
indexOf
(
'|'
)
>
-
1
)
{
if
(
url
.
indexOf
(
'|'
)
>
-
1
)
{
const
params
=
url
.
split
(
'|'
)[
1
];
const
params
=
url
.
split
(
'|'
)[
1
];
params
.
split
(
'&'
).
map
(
function
(
item
)
{
params
.
split
(
'&'
).
map
(
function
(
item
)
{
return
(
ret
[
item
.
split
(
'='
)[
0
]]
=
item
.
split
(
'='
)[
1
]);
return
(
ret
[
item
.
split
(
'='
)[
0
]]
=
item
.
split
(
'='
)[
1
]);
});
});
return
ret
;
return
ret
;
...
@@ -575,11 +585,11 @@ const Layout = props => {
...
@@ -575,11 +585,11 @@ const Layout = props => {
// 渲染集成站点切换弹框
// 渲染集成站点切换弹框
const
renderIntegration
=
(
inData
,
loginAction
,
props
)
=>
{
const
renderIntegration
=
(
inData
,
loginAction
,
props
)
=>
{
if
(
inData
.
length
<=
1
)
{
if
(
inData
.
length
<=
1
)
{
return
<><
/
>
return
<><
/>
;
}
}
const
choiceOne
=
inData
?.
find
(
function
(
a
)
{
const
choiceOne
=
inData
?.
find
(
function
(
a
)
{
return
a
.
url
?.
indexOf
(
window
?.
globalConfig
?.
client
)
>=
0
return
a
.
url
?.
indexOf
(
window
?.
globalConfig
?.
client
)
>=
0
;
})
})
;
// 切换集成站点
// 切换集成站点
const
checkIntegration
=
(
val
,
loginAction
,
props
)
=>
{
const
checkIntegration
=
(
val
,
loginAction
,
props
)
=>
{
...
@@ -590,7 +600,7 @@ const Layout = props => {
...
@@ -590,7 +600,7 @@ const Layout = props => {
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setVisible
(
false
);
setVisible
(
false
);
const
url
=
`
${
val
.
url
+
(
val
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
val
.
paramName
}
=
${
res
.
data
}
`
;
const
url
=
`
${
val
.
url
+
(
val
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
val
.
paramName
}
=
${
res
.
data
}
`
;
window
.
open
(
url
,
"_blank"
);
window
.
open
(
url
,
'_blank'
);
}
else
{
}
else
{
setVisible
(
false
);
setVisible
(
false
);
notification
.
error
({
notification
.
error
({
...
@@ -602,15 +612,17 @@ const Layout = props => {
...
@@ -602,15 +612,17 @@ const Layout = props => {
});
});
}
else
{
}
else
{
setVisible
(
false
);
setVisible
(
false
);
const
url
=
`
${
val
.
url
+
(
val
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
val
.
paramName
}
=
${
window
.
globalConfig
?.
token
}
`;
const
url
=
`
${
val
.
url
+
(
val
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
val
.
paramName
}
=
${
window.open(url, "_blank");
window
.
globalConfig
?.
token
}
`;
window.open(url, '_blank');
}
}
} else {
} else {
if (window.qiankunIsCache) {
if (window.qiankunIsCache) {
store.set('event:refreshCurrentMenu', {
store.set('event:refreshCurrentMenu', {
dropCache: true,
dropCache: true,
action: 'closeAllTabs'
action: 'closeAllTabs'
,
})
})
;
}
}
const cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
const cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
Cookies.set('client', cli, {
Cookies.set('client', cli, {
...
@@ -618,7 +630,8 @@ const Layout = props => {
...
@@ -618,7 +630,8 @@ const Layout = props => {
path: '/',
path: '/',
});
});
sessionStorage.setItem('client', cli);
sessionStorage.setItem('client', cli);
const currentProduct = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
window
.
globalConfig
?.
client
??
'city'
}
`;
const currentProduct = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
window
.
globalConfig
?.
client
??
'city'
}
`;
sessionStorage.removeItem(currentProduct);
sessionStorage.removeItem(currentProduct);
const currentProductNew = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
cli
||
'city'
}
`;
const currentProductNew = `
__global__recent_productIndex__micro_$
{
window
.
location
.
hostname
}
_$
{
cli
||
'city'
}
`;
sessionStorage.setItem(currentProductNew, 0);
sessionStorage.setItem(currentProductNew, 0);
...
@@ -637,7 +650,7 @@ const Layout = props => {
...
@@ -637,7 +650,7 @@ const Layout = props => {
// props.updateCurrentIndex(0);
// props.updateCurrentIndex(0);
// defaultApp();
// defaultApp();
}
}
}
}
;
return (
return (
<>
<>
...
@@ -647,14 +660,8 @@ const Layout = props => {
...
@@ -647,14 +660,8 @@ const Layout = props => {
visible={visible}
visible={visible}
content={
content={
<div className={layoutStyles.integrationList}>
<div className={layoutStyles.integrationList}>
{
{<Loading loading={integrationLoading} />}
<Loading loading={integrationLoading} />
{inData && inData.map(val => <p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>)}
}
{
inData && inData.map((val) => (
<p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
))
}
</div>
</div>
}
}
arrowPointAtCenter
arrowPointAtCenter
...
@@ -675,8 +682,8 @@ const Layout = props => {
...
@@ -675,8 +682,8 @@ const Layout = props => {
) : null}
) : null}
</Popover>
</Popover>
</>
</>
)
)
;
}
}
;
// 菜单比对方法
// 菜单比对方法
const querySkipUrl = (data, url) => {
const querySkipUrl = (data, url) => {
...
@@ -759,11 +766,9 @@ const Layout = props => {
...
@@ -759,11 +766,9 @@ const Layout = props => {
}}
}}
headerSiteRender={() =>
headerSiteRender={() =>
window?.globalConfig?.isIntegration >= 1
window?.globalConfig?.isIntegration >= 1
?
? // renderIntegration(integrationData, loginAction, props)
// renderIntegration(integrationData, loginAction, props)
null
null
:
: renderSite({
renderSite({
data: cityData,
data: cityData,
config: props.global,
config: props.global,
loading: siteLoading,
loading: siteLoading,
...
@@ -783,13 +788,14 @@ const Layout = props => {
...
@@ -783,13 +788,14 @@ const Layout = props => {
{dom}
{dom}
</a>
</a>
)}
)}
menuSuffixRender={() => (
menuSuffixRender={() =>
props.global?.variableTheme?.navTheme === 'chinaWater' ?
props.global?.variableTheme?.navTheme === 'chinaWater' ? (
(<img src={require('../assets/basic/chinaWater.png')} style={{width: '100%'}} alt="" />)
<img src={require('../assets/basic/chinaWater.png')} style={{ width: '100%' }} alt="" />
: <></>
) : (
)}
<></>
)
}
>
>
<div id="micro-container" className="subapp-container">
<div id="micro-container" className="subapp-container">
{props.children}
{props.children}
</div>
</div>
...
...
src/pages/bootpage/template/integrationNew/index.js
View file @
15916b72
...
@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
...
@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
axios
from
'axios'
;
import
axios
from
'axios'
;
import
{
getImageUrl
}
from
'@/utils/utils'
;
import
{
getImageUrl
}
from
'@/utils/utils'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
{
message
,
Button
}
from
'antd'
;
import
{
message
,
Button
}
from
'antd'
;
...
@@ -100,7 +101,7 @@ const IntegrationNew = props => {
...
@@ -100,7 +101,7 @@ const IntegrationNew = props => {
})
})
.
then
(
res1
=>
{
.
then
(
res1
=>
{
const
list
=
res1
.
data
||
[];
const
list
=
res1
.
data
||
[];
list
.
length
&&
localStorage
.
setItem
(
'integrationData'
,
JSON
.
stringify
(
list
));
setIntegrationData
(
list
);
setIntegrationData
(
list
);
});
});
};
};
...
@@ -175,11 +176,24 @@ const IntegrationNew = props => {
...
@@ -175,11 +176,24 @@ const IntegrationNew = props => {
}
}
};
};
const
toClient
=
(
item
,
loginA
)
=>
{
const
toClient
=
async
(
item
,
loginA
)
=>
{
const
token
=
props
.
global
?.
token
||
Cookies
.
get
(
'token'
);
const
cli
=
item
.
appKey
;
const
res
=
await
getWebSiteConfig
({
identity
:
token
,
client
:
cli
,
});
if
(
!
res
?.
data
?.[
0
]?.
widgets
?.
length
)
{
message
.
error
({
duration
:
3
,
content
:
'您没有该板块权限,请联系管理员'
,
});
return
;
}
if
(
window
.
qiankunIsCache
)
{
if
(
window
.
qiankunIsCache
)
{
store
.
set
(
'event:dropCache'
);
store
.
set
(
'event:dropCache'
);
}
}
const
cli
=
item
.
appKey
;
Cookies
.
set
(
'client'
,
cli
,
{
Cookies
.
set
(
'client'
,
cli
,
{
expires
:
86400000
/
(
24
*
60
*
60
*
1000
),
expires
:
86400000
/
(
24
*
60
*
60
*
1000
),
path
:
'/'
,
path
:
'/'
,
...
...
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