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
77b109b9
Commit
77b109b9
authored
1 year ago
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '集成登录嵌入web5'
parent
d1717ac2
Pipeline
#77711
passed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
6 deletions
+163
-6
base.js
src/api/service/base.js
+12
-0
IntegratedLogin.js
src/pages/system/iframe/IntegratedLogin.js
+140
-0
index.less
src/pages/system/iframe/index.less
+7
-6
config.js
src/routes/config.js
+4
-0
No files found.
src/api/service/base.js
View file @
77b109b9
...
...
@@ -39,6 +39,8 @@ export const API = {
GET_JIANGXI_MANAGE
:
'/PandaWorkFlow/WorkFlow/JiangXiManage/Login'
,
// 江西登录接口
GET_YANSHI_AUTHORITY
:
'/PandaCore/GCK/Demonstrate/GetYanshiAuthority'
,
// 获取当前用户开始演示模式的所有菜单ID
IS_OPEN_YANSHI
:
'/PandaCore/GCK/Demonstrate/IsOpenYanshi'
,
// 获取是否开启演示模式服务
GET_WEB_CONFIG
:
'/PandaOMS/OMS/GetIntegratedLoginbyName'
,
GET_WEB_TICKET
:
'/PandaOMS/OMS/GetTicketByToken'
,
};
const
services
=
{
...
...
@@ -201,6 +203,16 @@ const services = {
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
getIntegratedLoginbyName
:
{
url
:
API
.
GET_WEB_CONFIG
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
getTicketByToken
:
{
url
:
API
.
GET_WEB_TICKET
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
};
export
const
searchAutoCity
=
keywords
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/pages/system/iframe/IntegratedLogin.js
0 → 100644
View file @
77b109b9
/* eslint-disable no-lonely-if */
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
;
import
Iframe
from
'react-iframe'
;
import
{
appService
}
from
'@/api'
;
import
Empty
from
'@wisdom-components/empty'
;
import
axios
from
'axios'
;
import
{
Spin
,
notification
}
from
'antd'
;
import
styles
from
'./index.less'
;
const
IntegratedLogin
=
props
=>
{
const
{
sysName
}
=
props
.
params
;
const
[
linkUrl
,
setLinkUrl
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
getTicket
=
()
=>
{
appService
.
getTicketByToken
({
token
:
window
.
globalConfig
.
token
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
return
res
.
data
;
}
});
};
// 外网通不通判断
const
ping
=
()
=>
{
fetch
(
'https://www.google.com'
)
.
then
(
response
=>
{
if
(
response
.
ok
)
{
return
true
;
}
return
false
;
})
.
catch
(
error
=>
false
);
};
const
getUrlParam
=
url
=>
{
let
arrObj
=
url
.
split
(
'?'
);
const
params
=
Object
.
create
(
null
);
if
(
arrObj
.
length
>
1
)
{
arrObj
=
arrObj
[
1
].
split
(
'&'
);
arrObj
.
forEach
(
item
=>
{
item
=
item
.
split
(
'='
);
params
[
item
[
0
]]
=
item
[
1
];
});
}
return
params
;
};
const
getSiteConfig
=
()
=>
{
let
ticket
=
''
;
setLoading
(
true
);
appService
.
getIntegratedLoginbyName
({
sysName
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
AccountParam
[
0
].
value
===
1
)
{
ticket
=
getTicket
();
}
const
parma
=
res
.
data
.
AccountParam
[
0
].
value
===
1
?
ticket
:
window
.
globalConfig
.
token
;
if
(
res
.
data
.
siteType
===
1
)
{
// 集成SaaS平台
const
userId
=
window
.
globalConfig
.
userInfo
.
OID
;
axios
({
method
:
'get'
,
url
:
`
${
window
.
location
.
origin
}${
res
.
data
.
serviceUrl
}
?userId=
${
userId
}
`
,
}).
then
(
resData
=>
{
const
url
=
resData
.
data
.
data
;
if
(
res
.
data
.
target
===
1
)
{
window
.
open
(
url
);
}
else
{
setLinkUrl
(
url
);
}
});
}
else
{
// 第三方接入
const
pingState
=
ping
;
let
url
=
''
;
// 外网通
if
(
pingState
)
{
if
(
res
.
data
.
InternetAddress
)
{
url
=
res
.
data
.
InternetAddress
;
}
else
{
url
=
res
.
data
.
IntranetAddress
;
}
}
else
{
if
(
res
.
data
.
IntranetAddress
)
{
url
=
res
.
data
.
IntranetAddress
;
}
else
{
this
.
$message
.
error
(
'请配置内网地址'
);
url
=
res
.
data
.
InternetAddress
;
return
;
}
}
if
(
url
)
{
const
params
=
getUrlParam
(
url
);
if
(
JSON
.
stringify
(
params
)
===
'{}'
)
{
url
=
`
${
url
}
?
${
res
.
data
.
AccountParam
[
0
].
key
}
=
${
parma
}
`
;
}
else
{
url
=
`
${
url
}
&
${
res
.
data
.
AccountParam
[
0
].
key
}
=
${
parma
}
`
;
}
}
if
(
res
.
data
.
target
===
1
)
{
window
.
open
(
url
);
}
else
{
setLinkUrl
(
url
);
}
}
setLoading
(
false
);
}
else
{
setLoading
(
false
);
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
message
,
});
}
});
};
useEffect
(()
=>
{
getSiteConfig
();
},
[
getSiteConfig
]);
return
(
<
div
className
=
{
styles
.
IntegratedLogin
}
>
{
linkUrl
!==
''
?
(
<
Iframe
url
=
{
linkUrl
}
width
=
"100%"
height
=
"100%"
display
=
"block"
position
=
"relative"
styles
=
{{
border
:
'none'
}}
/
>
)
:
(
<
Spin
Spin
=
{
loading
}
tip
=
"加载中..."
style
=
{{
width
:
'100%'
,
height
:
'100%'
,
marginTop
:
'300px'
}}
/
>
)}
<
/div
>
);
};
export
default
IntegratedLogin
;
This diff is collapsed.
Click to expand it.
src/pages/system/iframe/index.less
View file @
77b109b9
...
...
@@ -8,7 +8,6 @@
border: none;
}
.oper-wrap {
top: 0;
right: 0;
...
...
@@ -19,13 +18,13 @@
.oper-btn {
cursor: pointer;
color: #
FFF
;
color: #
fff
;
position: absolute;
top: 10px;
right: 15px;
transition: right ease-in-out 0.8s;
}
.btn-fullscreen_exit {
display: block;
width: 1.2rem;
...
...
@@ -40,5 +39,8 @@
}
}
}
}
\ No newline at end of file
}
.IntegratedLogin {
width: 100%;
height: 100%;
}
This diff is collapsed.
Click to expand it.
src/routes/config.js
View file @
77b109b9
...
...
@@ -13,6 +13,7 @@ import Login from '../pages/user/login';
import
NoSecret
from
'../pages/user/login/noSecret'
;
import
Notifications
from
'../pages/system/notifications'
;
import
TabIframe
from
'../pages/system/iframe/TabWidget'
;
import
IntegratedLogin
from
'../pages/system/iframe/IntegratedLogin'
;
import
PrevieView
from
'../pages/system/previews/preview'
;
export
const
dyRoutes
=
(
routes
,
layout
,
theme
)
=>
{
...
...
@@ -100,6 +101,9 @@ export const dyRoutes = (routes, layout, theme) => {
if
(
/system
\/
previews
\/
preview/
.
test
(
path
))
{
return
<
PrevieView
{...
routeConfig
}
/>
;
}
if
(
/system
\/
iframe
\/
integratedLogin/
.
test
(
path
))
{
return
<
IntegratedLogin
{...
routeConfig
}
/>
;
}
},
},
],
...
...
This diff is collapsed.
Click to expand it.
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