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
58da0b31
Commit
58da0b31
authored
Aug 18, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '优化配置'
parent
77b109b9
Pipeline
#77735
passed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
62 deletions
+79
-62
IntegratedLogin.js
src/pages/system/iframe/IntegratedLogin.js
+79
-62
No files found.
src/pages/system/iframe/IntegratedLogin.js
View file @
58da0b31
...
...
@@ -4,18 +4,25 @@ 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
{
Message
,
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
ticketData
=
useRef
();
const
getTicket
=
()
=>
{
appService
.
getTicketByToken
({
token
:
window
.
globalConfig
.
token
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
return
res
.
data
;
ticketData
.
current
=
res
.
data
;
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
});
};
...
...
@@ -29,12 +36,14 @@ const IntegratedLogin = props => {
}
return
false
;
})
.
catch
(
error
=>
false
);
.
catch
(
error
=>
{
return
false
;
});
};
const
getUrlParam
=
url
=>
{
let
arrObj
=
url
.
split
(
'?'
);
cons
t
params
=
Object
.
create
(
null
);
le
t
params
=
Object
.
create
(
null
);
if
(
arrObj
.
length
>
1
)
{
arrObj
=
arrObj
[
1
].
split
(
'&'
);
arrObj
.
forEach
(
item
=>
{
...
...
@@ -46,78 +55,86 @@ const IntegratedLogin = props => {
};
const
getSiteConfig
=
()
=>
{
if
(
linkUrl
)
{
return
;
}
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
;
}
appService
.
getIntegratedLoginbyName
({
sysName
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
AccountParam
[
0
].
value
===
1
)
{
ticket
=
ticketData
.
current
;
}
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
{
if
(
res
.
data
.
IntranetAddress
)
{
url
=
res
.
data
.
IntranetAddress
;
// 第三方接入
const
pingState
=
ping
;
let
url
=
''
;
// 外网通
if
(
pingState
)
{
if
(
res
.
data
.
InternetAddress
)
{
url
=
res
.
data
.
InternetAddress
;
}
else
{
url
=
res
.
data
.
IntranetAddress
;
}
}
else
{
this
.
$message
.
error
(
'请配置内网地址'
);
url
=
res
.
data
.
InternetAddress
;
return
;
if
(
res
.
data
.
IntranetAddress
)
{
url
=
res
.
data
.
IntranetAddress
;
}
else
{
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
(
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
);
if
(
res
.
data
.
target
===
1
)
{
window
.
open
(
url
);
}
else
{
setLinkUrl
(
url
);
}
}
setLoading
(
false
);
}
else
{
setLoading
(
false
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
setLoading
(
false
);
}
else
{
setLoading
(
false
);
notification
.
error
({
message
:
'提交失败'
,
description
:
res
.
message
,
});
}
});
})
.
catch
(
error
=>
{});
};
useEffect
(()
=>
{
getTicket
();
getSiteConfig
();
},
[
getSiteConfig
]);
},
[]);
return
(
<
div
className
=
{
styles
.
IntegratedLogin
}
>
...
...
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