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
54f969e0
Commit
54f969e0
authored
Nov 06, 2024
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: 集成登录支持 站内跳转到指定功能
parent
a1fc4dec
Pipeline
#93673
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
7 deletions
+71
-7
index.js
src/components/IntegratedSwitch/index.js
+14
-6
index.js
src/pages/bootpage/template/integrationNew/index.js
+7
-1
utils.js
src/utils/utils.js
+50
-0
No files found.
src/components/IntegratedSwitch/index.js
View file @
54f969e0
...
...
@@ -15,6 +15,7 @@ import { defaultApp } from '@/micro';
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
LoadPage
from
'@/components/LoadPage'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
{
goToPath
}
from
'@/utils/utils'
;
import
styles
from
'./index.less'
;
const
IntegratedSwitch
=
props
=>
{
...
...
@@ -26,6 +27,7 @@ const IntegratedSwitch = props => {
const
[
dataList
,
setDataList
]
=
useState
([]);
const
[
client
,
setClient
]
=
useState
(
''
);
const
clientRef
=
useRef
(
props
.
global
.
client
);
const
clientInfo
=
useRef
({});
// 跳转子站信息
const
[
jumpLoading
,
setJumpLoading
]
=
useState
(
false
);
const
[
progressValue
,
setProgressValue
]
=
useState
(
0
);
...
...
@@ -139,7 +141,13 @@ const IntegratedSwitch = props => {
}
}
} else if (item.subType === '内链') {
const cli = item.appKey;
const cli = item.client;
if (item.client === props.global.client) {
if (item.url) {
goToPath(clientInfo.current?.url);
return;
}
}
const token = props.global?.token || Cookies.get('token');
getWebSiteConfig({
identity: token,
...
...
@@ -245,6 +253,9 @@ const IntegratedSwitch = props => {
<li
className={styles.switchPageLi}
onClick={() => {
const integrationClient = localStorage.getItem('integrationClient');
sessionStorage.setItem('client', integrationClient);
localStorage.removeItem('integrationClient');
history.push('/industry');
}}
>
...
...
@@ -254,9 +265,7 @@ const IntegratedSwitch = props => {
</Tooltip>
</div>
</li>
{dataList.map(item => {
if (item.subType === '内链' && item.appKey === props?.global?.client) return null;
return (
{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}>
...
...
@@ -267,8 +276,7 @@ const IntegratedSwitch = props => {
</Tooltip>
</div>
</li>
);
})}
))}
</ul>
</div>
) : null;
...
...
src/pages/bootpage/template/integrationNew/index.js
View file @
54f969e0
...
...
@@ -8,7 +8,7 @@ import { appService } from '@/api';
import
{
connect
}
from
'react-redux'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
axios
from
'axios'
;
import
{
getImageUrl
}
from
'@/utils/utils'
;
import
{
getImageUrl
,
goToPath
}
from
'@/utils/utils'
;
import
{
getUserInfo
,
getWebSiteConfig
}
from
'@/api/service/base'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
...
...
@@ -41,6 +41,7 @@ const IntegrationNew = props => {
const
timer3
=
useRef
(
null
);
const
timer4
=
useRef
(
null
);
const
clientRef
=
useRef
(
props
.
global
.
client
);
const
clientInfo
=
useRef
({});
// 跳转子站信息
const
progressRef2
=
useRef
(
0
);
const
loadingTime
=
integratedConfig
?.
loadingTime
||
5
;
const
[
loginAction
,
setAction
]
=
useState
(()
=>
new
LoginAction
(
props
));
...
...
@@ -192,6 +193,7 @@ const IntegrationNew = props => {
});
return
;
}
clientInfo
.
current
=
item
;
if
(
window
.
qiankunIsCache
)
{
store
.
set
(
'event:dropCache'
);
}
...
...
@@ -343,9 +345,13 @@ const IntegrationNew = props => {
setJumpLoading(false);
jumpProgressEnd();
window.jumpLoadingProgress = 0;
if (clientInfo.current?.url && clientInfo.current.subType === '内链') {
goToPath(clientInfo.current?.url);
} else {
props.history.push(`
/
?
client
=
$
{
clientRef
.
current
||
props
.
global
.
client
}
`);
props.updateCurrentIndex && props.updateCurrentIndex(0);
defaultApp();
}
};
const handleError = () => {
...
...
src/utils/utils.js
View file @
54f969e0
import
Cookies
from
'js-cookie'
;
import
pathRegexp
from
'path-to-regexp'
;
import
{
parse
}
from
'querystring'
;
import
{
cloneDeep
}
from
'lodash'
;
import
pkg
from
'../../package.json'
;
/* eslint no-useless-escape:0 import/prefer-default-export:0 */
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+
(?:
:
\d
+
)?
|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/
;
...
...
@@ -107,3 +109,51 @@ export const getImageUrl = path => {
return
`/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=
${
encodeURIComponent
(
path
)}
`
;
};
/**
* 跳转到指定页面
* @param {*} path 功能地址
*/
export
const
goToPath
=
(
path
,
data
,
widgetId
,
mode
)
=>
{
const
routes
=
window
.
globalConfig
?.
allWidgets
||
[];
let
info
=
null
;
const
target
=
path
.
substr
(
0
,
1
)
===
'/'
?
path
.
slice
(
1
)
:
path
;
function
urlSearch
(
arr
)
{
arr
.
forEach
(
a
=>
{
if
(
a
.
url
)
{
if
(
a
.
url
.
indexOf
(
target
)
>
-
1
&&
(
!
widgetId
||
a
.
url
.
indexOf
(
widgetId
)
>
-
1
))
{
// 跳转到指定板块功能
if
(
mode
)
{
if
(
a
.
widgetId
&&
a
.
widgetId
.
split
(
'_'
).
includes
(
mode
))
{
info
=
cloneDeep
(
a
);
}
}
else
{
info
=
cloneDeep
(
a
);
}
}
}
if
(
a
.
widgets
)
{
urlSearch
(
a
.
widgets
);
}
});
}
urlSearch
(
routes
);
if
(
!
info
)
return
info
;
info
.
url
=
info
.
url
.
substr
(
0
,
1
)
===
'/'
?
info
.
url
:
`/
${
info
.
url
}
`
;
let
url
=
`/civbase/
${
info
.
product
}${
info
.
url
}
`
;
const
arr
=
url
.
split
(
'|'
);
let
params
=
{};
url
=
arr
[
0
];
if
(
arr
[
1
])
{
url
+=
encodeURI
(
`|
${
arr
[
1
]}
`
);
const
arrObj
=
arr
[
1
].
split
(
'&'
);
arrObj
.
forEach
(
item
=>
{
const
temp
=
item
.
split
(
'='
);
params
[
temp
[
0
]]
=
temp
[
1
];
});
}
params
=
{
...
params
,
...
data
};
params
.
widget
=
widgetId
||
params
.
widget
;
console
.
log
(
params
,
url
);
window
.
history
.
pushState
(
params
,
''
,
url
);
};
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