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
0b61a3a6
Commit
0b61a3a6
authored
2 years ago
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: iframe嵌入功能支持全屏显示
parent
da1eaf6f
Pipeline
#64070
waiting for manual action with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
18 deletions
+91
-18
HocContainer.js
src/pages/system/iframe/HocContainer.js
+8
-13
TabWidget.js
src/pages/system/iframe/TabWidget.js
+21
-5
index.less
src/pages/system/iframe/index.less
+30
-0
useFullScreen.js
src/pages/system/iframe/useFullScreen.js
+32
-0
No files found.
src/pages/system/iframe/HocContainer.js
View file @
0b61a3a6
import
React
,
{
memo
}
from
"react"
;
import
SecurityLayout
from
"../../../layouts/SecurityLayout"
;
import
React
from
'react'
;
import
SecurityLayout
from
'../../../layouts/SecurityLayout'
;
const
HocContainer
=
Component
=>
{
return
(
props
)
=>
{
return
(
<
SecurityLayout
>
<
Component
{...
props
}
/
>
<
/SecurityLayout
>
)
}
}
const
HocContainer
=
Component
=>
props
=>
(
<
SecurityLayout
>
<
Component
{...
props
}
/
>
<
/SecurityLayout
>
);
export
default
HocContainer
;
\ No newline at end of file
export
default
HocContainer
;
This diff is collapsed.
Click to expand it.
src/pages/system/iframe/TabWidget.js
View file @
0b61a3a6
import
React
,
{
memo
}
from
'react'
;
import
React
,
{
memo
,
useEffect
,
useRef
}
from
'react'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
Iframe
from
'react-iframe'
;
import
Empty
from
'@wisdom-components/empty'
;
import
styles
from
'./index.less'
;
import
Hoc
from
'./HocContainer'
;
import
useFullScreen
from
'./useFullScreen'
;
const
TabWidget
=
({
params
})
=>
{
const
{
linkUrl
}
=
params
||
{};
const
TabWidget
=
props
=>
{
const
params
=
Object
.
assign
({},
props
.
params
,
{
fullscreen
:
!
(
props
.
params
!==
undefined
&&
props
.
params
.
fullscreen
===
'true'
),
});
const
{
linkUrl
,
fullscreen
}
=
params
;
const
[
ref
,
isFullscreen
,
handleFullScreen
,
handleExitFullScreen
]
=
useFullScreen
(
fullscreen
);
return
(
<
div
className
=
{
styles
[
'tab-iframe'
]}
>
<
div
className
=
{
styles
[
'tab-iframe'
]}
ref
=
{
ref
}
>
<
div
className
=
{
styles
[
'oper-wrap'
]}
>
<
div
className
=
{
styles
[
'oper-btn'
]}
>
{
isFullscreen
?
(
<
FullscreenExitOutlined
className
=
{
styles
[
'btn-fullscreen_exit'
]}
onClick
=
{
handleExitFullScreen
}
/
>
)
:
(
<
FullscreenOutlined
className
=
{
styles
[
'btn-fullscreen'
]}
onClick
=
{
handleFullScreen
}
/
>
)}
<
/div
>
<
/div
>
{
linkUrl
?
(
<
Iframe
url
=
{
linkUrl
}
...
...
@@ -19,7 +35,7 @@ const TabWidget = ({ params }) => {
styles
=
{{
border
:
'none'
}}
/
>
)
:
(
<
Empty
description
=
"配置url链接才能显示哦!"
/>
<
Empty
description
=
"配置url链接才能显示哦!"
/>
)}
<
/div
>
);
...
...
This diff is collapsed.
Click to expand it.
src/pages/system/iframe/index.less
View file @
0b61a3a6
...
...
@@ -3,4 +3,33 @@
height: 100%;
position: relative;
overflow: hidden;
iframe {
border: none;
}
.oper-wrap {
top: 0;
right: 0;
width: 100px;
height: 100px;
position: absolute;
.oper-btn {
cursor: pointer;
color: #FFF;
position: absolute;
top: 10px;
right: -100%;
transition: right ease-in-out 0.8s;
}
&:hover {
.oper-btn {
right: 20px;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/pages/system/iframe/useFullScreen.js
0 → 100644
View file @
0b61a3a6
import
{
useState
,
useEffect
,
useCallback
,
useRef
}
from
'react'
;
const
useFullScreen
=
needFullscreen
=>
{
const
[
isFullscreen
,
setIsFullscreen
]
=
useState
(
!!
document
.
fullscreenElement
);
const
ref
=
useRef
();
useEffect
(()
=>
{
const
handleToggleFullScreen
=
()
=>
{
setIsFullscreen
(
!!
document
.
fullscreenElement
);
};
document
.
addEventListener
(
'fullscreenchange'
,
handleToggleFullScreen
);
return
()
=>
{
document
.
removeEventListener
(
'fullscreenchange'
,
handleToggleFullScreen
);
};
},
[]);
const
handleFullScreen
=
useCallback
(()
=>
{
ref
.
current
?.
requestFullscreen
();
},
[]);
const
handleExitFullScreen
=
useCallback
(()
=>
{
document
.
exitFullscreen
();
},
[]);
useEffect
(()
=>
{
needFullscreen
&&
handleFullScreen
();
},
[
handleFullScreen
,
needFullscreen
]);
return
[
ref
,
isFullscreen
,
handleFullScreen
,
handleExitFullScreen
];
};
export
default
useFullScreen
;
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