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
4c0bcfbc
Commit
4c0bcfbc
authored
Jun 14, 2024
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 集成登录增加切换菜单
parent
dad53c06
Pipeline
#89817
waiting for manual action with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
314 additions
and
1 deletion
+314
-1
集成登录.png
src/assets/bootPage/集成登录.png
+0
-0
index.js
src/components/IntegratedSwitch/index.js
+175
-0
index.less
src/components/IntegratedSwitch/index.less
+62
-0
BasicLayout.js
src/layouts/BasicLayout.js
+2
-0
index.js
src/pages/bootpage/template/integration/index.js
+2
-1
index.js
src/pages/thirdParty/index.js
+61
-0
index.less
src/pages/thirdParty/index.less
+7
-0
config.js
src/routes/config.js
+5
-0
No files found.
src/assets/bootPage/集成登录.png
0 → 100644
View file @
4c0bcfbc
This diff was suppressed by a .gitattributes entry.
src/components/IntegratedSwitch/index.js
0 → 100644
View file @
4c0bcfbc
/* eslint-disable prettier/prettier */
import
React
,
{
useEffect
,
useState
,
useCallback
,
useRef
}
from
'react'
;
import
classNames
from
'classnames'
;
import
{
connect
}
from
'react-redux'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
store
}
from
'@wisdom-utils/utils'
;
import
LoginAction
from
'@/pages/user/login/login'
;
import
Cookies
from
'js-cookie'
;
import
{
notification
,
Tooltip
}
from
'antd'
;
import
homeIcon
from
'@/assets/bootPage/集成登录.png'
;
import
{
appService
}
from
'@/api'
;
import
axios
from
'axios'
;
import
{
defaultApp
}
from
'@/micro'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
styles
from
'./index.less'
;
const
IntegratedSwitch
=
props
=>
{
const
history
=
useHistory
();
const
[
loginAction
,
setAction
]
=
useState
(()
=>
new
LoginAction
(
props
));
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
client
,
setClient
]
=
useState
(
''
);
useEffect
(()
=>
{
const
cli
=
''
;
sessionStorage
.
setItem
(
'client'
,
cli
);
if
(
!
window
?.
globalConfig
?.
userInfo
?.
OID
||
!
(
window
?.
globalConfig
?.
isIntegration
>=
1
))
return
setDataList
([]);
appService
.
GetIntegrationConfig
({
type
:
'集成登录'
,
userId
:
window
?.
globalConfig
?.
userInfo
?.
OID
??
null
,
isEnable
:
true
,
client
:
`
${
client
||
cli
||
props
.
global
.
client
}
`
,
})
.
then
(
res
=>
{
setDataList
(
res
?.
data
||
[]);
})
.
catch
(
err
=>
{
setDataList
([]);
});
},
[]);
// 子站跳转
// eslint-disable-next-line no-shadow
const
handlePage
=
useCallback
((
item
,
loginAction
)
=>
{
if
(
item
.
subType
===
'外链'
)
{
if
(
item
.
paramValue
===
'ticket'
)
{
// 获取临时token
appService
.
getTicketByToken
({
token
:
window
.
globalConfig
?.
token
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
const
url
=
`
${
item
.
url
+
(
item
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
item
.
paramName
}
=
${
res
.
data
}
`
;
window
.
open
(
url
,
'_blank'
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
});
}
else
{
const
url
=
`
${
item
.
url
+
(
item
.
url
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
item
.
paramName
}
=
${
window
.
globalConfig
?.
token
}
`;
window.open(url, '_blank');
}
} else if (item.subType === '内链') {
if (window.qiankunIsCache) {
store.set('event:dropCache');
}
const cli = item.url?.indexOf('client=') >= 0 ? item.url.split('client=')[1] : '';
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);
setClient(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 {
let { url } = item;
if (url?.indexOf('{userId}') >= 0) {
url = url.replace('{userId}', window.globalConfig?.userInfo?.OID);
}
axios({
url,
method: 'get',
dataType: 'json',
}).then(res => {
if (res?.data?.code === 0) {
history.push('/thirdParty', { linkUrl: res.data?.data });
}
});
}
});
useEffect(() => {
const cli = '';
sessionStorage.setItem('client', cli);
const handleToggleIndustry = event => {
history.push(`
/
?
client
=
$
{
client
||
cli
||
props
.
global
.
client
}
`);
props.updateCurrentIndex(0);
defaultApp();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => {
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
};
}, [loginAction.events, props]);
return (
dataList.length > 1 ? <div className={styles.switchPage}>
<ul className={classNames(styles.switchPageCase, styles.switchPageSmall)}>
<li className={styles.switchPageLi} onClick={() => { history.push('/industry'); }}>
<div className={styles.switchPageList}>
<Tooltip placement="top" title="主页">
<img
src={homeIcon}
alt=""
/>
</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>
))}
</ul>
</div > : null
);
};
const mapStateToProps = state => ({
global: state.getIn(['
global
', '
globalConfig
']),
instance: state.getIn(['
global
', '
instance
']),
client: state.getIn(['
global
', '
client
']),
});
const mapDispatchToProps = dispatch => ({
updateConfig(config) {
dispatch(actionCreators.getConfig(config));
},
createContext(data) {
dispatch(actionCreators.createContext(data));
},
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(IntegratedSwitch);
src/components/IntegratedSwitch/index.less
0 → 100644
View file @
4c0bcfbc
.switchPage {
position: fixed;
bottom: 0;
left: 0;
z-index: 1200;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 0px;
.switchPageCase {
position: absolute;
bottom: 0;
padding: 0 10px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 14px;
overflow: hidden;
height: 8px;
width: 80px;
background: rgba(94, 121, 143, .65);
transition: height .5s ease;
margin: 0 0 6px 0;
&:hover {
height: 50px;
width: auto;
.switchPageLi {
display: flex;
}
}
}
.switchPageLi {
padding: 10px;
display: none;
height: 100%;
overflow: hidden;
opacity: 0.8;
&:hover {
opacity: 1;
}
}
.switchPageList {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100%;
>img {
height: 100%;
cursor: pointer;
}
}
}
\ No newline at end of file
src/layouts/BasicLayout.js
View file @
4c0bcfbc
...
...
@@ -30,6 +30,7 @@ import { Storeage as Store } from '@wisdom-utils/utils/lib/helpers';
import
{
defaultApp
}
from
'@/micro'
;
import
{
appService
}
from
'@/api'
;
import
LoginAction
from
'@/pages/user/login/login'
;
import
IntegratedSwitch
from
'@/components/IntegratedSwitch'
;
import
Loading
from
'../components/Loading'
;
import
{
waterMark
}
from
'../utils/mark'
;
import
layoutStyles
from
'./BasicLayout.less'
;
...
...
@@ -797,6 +798,7 @@ const Layout = props => {
<div id="micro-container" className="subapp-container">
{props.children}
</div>
<IntegratedSwitch />
<SoundAi />
{subLoading && <Loading loading={subLoading} />}
{initWebContent && <Loading loading={initWebContent} />}
...
...
src/pages/bootpage/template/integration/index.js
View file @
4c0bcfbc
...
...
@@ -107,7 +107,8 @@ const Integration = props => {
dataType: 'json',
}).then(res => {
if (res?.data?.code === 0) {
window.location.href = res.data?.data;
// window.location.href = res.data?.data;
props.history.push('/thirdParty', { linkUrl: res.data?.data });
}
});
}
...
...
src/pages/thirdParty/index.js
0 → 100644
View file @
4c0bcfbc
/* eslint-disable prettier/prettier */
import
React
,
{
useEffect
}
from
'react'
;
import
Iframe
from
'react-iframe'
;
import
{
connect
}
from
'react-redux'
;
import
Cookies
from
'js-cookie'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
_
from
'lodash'
;
import
{
useHistory
,
useAliveController
}
from
'@wisdom-utils/runtime'
;
import
IntegratedSwitch
from
'@/components/IntegratedSwitch'
;
import
styles
from
'./index.less'
;
const
ThirdParty
=
props
=>
{
const
state
=
props
.
location
.
state
||
{};
const
{
clear
}
=
useAliveController
();
if
(
!
state
.
linkUrl
)
{
return
props
.
history
.
push
(
`/industry`
);
};
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect
(()
=>
{
const
tk
=
Cookies
.
get
(
'token'
)
||
props
.
global
.
token
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
void
0
;
let
client
=
props
?.
global
?.
client
||
sessionStorage
.
getItem
(
'client'
)
||
null
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
// eslint-disable-next-line no-prototype-builtins
const
generateType
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'get'
)
?
props
.
global
.
get
(
'generateType'
)
:
null
;
if
(
!
isLogin
)
{
props
.
history
.
push
(
`/user/login?client=
${
client
}${
generateType
||
''
}
`
,
{
reload
:
true
});
clear
();
props
.
logout
();
}
},
[
props
]);
return
(
<
div
className
=
{
styles
.
outerChainPage
}
>
<
Iframe
url
=
{
`
${
state
.
linkUrl
}
`
}
width
=
"100%"
height
=
"100%"
id
=
"myId"
frameBorder
=
"0"
className
=
"myClassname"
display
=
"initial"
position
=
"relative"
/>
<
IntegratedSwitch
/>
<
/div
>
);
};
const
mapStateToProps
=
state
=>
({
global
:
state
.
getIn
([
'global'
,
'globalConfig'
]),
});
const
mapDispatchToProps
=
dispatch
=>
({
logout
()
{
dispatch
(
actionCreators
.
logout
());
},
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
ThirdParty
);
src/pages/thirdParty/index.less
0 → 100644
View file @
4c0bcfbc
.outerChainPage {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
\ No newline at end of file
src/routes/config.js
View file @
4c0bcfbc
...
...
@@ -17,6 +17,7 @@ import TabIframe from '../pages/system/iframe/TabWidget';
import
JumpThirdLink
from
'../pages/system/iframe/JumpThirdLink'
;
import
IntegratedLogin
from
'../pages/system/iframe/IntegratedLogin'
;
import
IntegratedLoginPage
from
'../pages/integratedLogin'
;
// 集成登录管理
import
ThirdParty
from
'../pages/thirdParty'
;
// 集成登录自定义跳转
import
PrevieView
from
'../pages/system/previews/preview'
;
export
const
dyRoutes
=
(
routes
,
layout
,
theme
)
=>
{
...
...
@@ -56,6 +57,10 @@ export const dyRoutes = (routes, layout, theme) => {
path
:
'/industry'
,
component
:
BootPage
,
},
{
path
:
'/thirdParty'
,
component
:
ThirdParty
,
},
{
path
:
'/cloud/analysis/using'
,
component
:
UsingAnalysis
,
...
...
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