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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
57 deletions
+109
-57
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
+0
-0
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';
import
{
defaultApp
}
from
'@/micro'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
LoadPage
from
'@/components/LoadPage'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
styles
from
'./index.less'
;
const
IntegratedSwitch
=
props
=>
{
...
...
@@ -74,29 +75,38 @@ const IntegratedSwitch = props => {
useEffect
(()
=>
{
// 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
([]);
appService
.
GetIntegrationConfig
({
type
:
'集成登录'
,
userId
:
window
?.
globalConfig
?.
userInfo
?.
OID
??
null
,
isEnable
:
true
,
client
:
localStorage
.
getItem
(
'integrationClient'
)
||
sessionStorage
.
getItem
(
'client'
)
||
props
?.
global
?.
client
||
''
,
})
.
then
(
res
=>
{
setDataList
(
res
?.
data
||
[]);
})
.
catch
(
err
=>
{
setDataList
([]);
});
let
list
=
localStorage
.
getItem
(
'integrationData'
);
//
list
=
list
?
JSON
.
parse
(
list
)
:
[];
if
(
Array
.
isArray
(
list
)
&&
list
?.
length
)
{
setDataList
(
list
||
[]);
}
else
{
appService
.
GetIntegrationConfig
({
type
:
'集成登录'
,
userId
:
window
?.
globalConfig
?.
userInfo
?.
OID
??
null
,
isEnable
:
true
,
client
:
localStorage
.
getItem
(
'integrationClient'
)
||
sessionStorage
.
getItem
(
'client'
)
||
props
?.
global
?.
client
||
''
,
})
.
then
(
res
=>
{
setDataList
(
res
?.
data
||
[]);
})
.
catch
(
err
=>
{
setDataList
([]);
});
}
},
[]);
// 子站跳转
// eslint-disable-next-line no-shadow
const
handlePage
=
useCallback
((
item
,
loginAction
)
=>
{
setJumpLoading
(
true
);
jumpProgressStart
();
startTiming
(
5
);
if
(
item
.
subType
===
'外链'
)
{
setJumpLoading
(
true
);
jumpProgressStart
();
startTiming
(
5
);
// 营收
if
(
item
.
paramValue
===
'ticket'
)
{
// 获取临时token
...
...
@@ -129,35 +139,56 @@ const IntegratedSwitch = props => {
}
}
} else if (item.subType === '内链') {
if (window.qiankunIsCache) {
store.set('event:dropCache');
}
const cli = item.appKey;
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
);
const token = props.global?.token || Cookies.get('token');
getWebSiteConfig({
identity: token
,
client: cli,
}).then(res => {
if (!res?.data?.[0]?.widgets?.length) {
message.error({
duration: 3,
content: '您没有该板块权限,请联系管理员',
}
);
setClient(cli);
clientRef.current = cli;
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
window.qiankunStarted = false;
if (cli) {
config.client = cli;
}
return;
}
setJumpLoading(true);
jumpProgressStart();
startTiming(5);
if (window.qiankunIsCache) {
store.set('event:dropCache');
}
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);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type);
setClient(cli);
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 {
setJumpLoading(true);
jumpProgressStart();
startTiming(5);
let { url } = item;
if (url?.indexOf('{userId}') >= 0) {
url = url.replace('{userId}', window.globalConfig?.userInfo?.OID);
...
...
@@ -173,6 +204,9 @@ const IntegratedSwitch = props => {
} else {
window.open(res.data?.data, '_blank');
}
} else {
setJumpLoading(false);
jumpProgressEnd();
}
});
}
...
...
@@ -220,18 +254,21 @@ const IntegratedSwitch = props => {
</Tooltip>
</div>
</li>
{dataList.map(item => (
<li className={styles.switchPageLi} key={item.name} onClick={event => handlePage(item, loginAction)}>
<div className={styles.switchPageList}>
<Tooltip placement="top" title={item.name}>
<img
src={`
$
{
window
.
location
.
origin
}
/${item.icon
?
item.icon : 'center/im
ages
/
科技风
/
二供
.
png
'}`}
alt=""
/>
</Tooltip>
</div>
</li>
))}
{dataList.map(item => {
if (item.subType === '内链' && item.appKey === props?.global?.client) return null;
return (
<li className={styles.switchPageLi} key={item.name} onClick={event => handlePage(item, loginAction)}>
<div className={styles.switchPageList}>
<Tooltip placement="top" title={item.name}>
<img
src={`
$
{
window
.
location
.
origin
}
/${item.icon
?
item.icon : 'center/im
ages
/
科技风
/
二供
.
png
'}`}
alt=""
/>
</Tooltip>
</div>
</li>
);
})}
</ul>
</div>
) : null;
...
...
src/containers/App/store/actions.js
View file @
15916b72
...
...
@@ -229,6 +229,7 @@ export function logout(data) {
sessionStorage
.
setItem
(
'client'
,
integrationClient
);
}
localStorage
.
removeItem
(
'integrationClient'
);
localStorage
.
removeItem
(
'integrationData'
);
localStorage
.
removeItem
(
'access_token'
);
localStorage
.
removeItem
(
'password_token'
);
localStorage
.
removeItem
(
'password_pwdRegex'
);
...
...
src/layouts/BasicLayout.js
View file @
15916b72
This diff is collapsed.
Click to expand it.
src/pages/bootpage/template/integrationNew/index.js
View file @
15916b72
...
...
@@ -9,6 +9,7 @@ import { connect } from 'react-redux';
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
axios
from
'axios'
;
import
{
getImageUrl
}
from
'@/utils/utils'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
{
message
,
Button
}
from
'antd'
;
...
...
@@ -100,7 +101,7 @@ const IntegrationNew = props => {
})
.
then
(
res1
=>
{
const
list
=
res1
.
data
||
[];
list
.
length
&&
localStorage
.
setItem
(
'integrationData'
,
JSON
.
stringify
(
list
));
setIntegrationData
(
list
);
});
};
...
...
@@ -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
)
{
store
.
set
(
'event:dropCache'
);
}
const
cli
=
item
.
appKey
;
Cookies
.
set
(
'client'
,
cli
,
{
expires
:
86400000
/
(
24
*
60
*
60
*
1000
),
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