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
ec3c175c
Commit
ec3c175c
authored
Jun 20, 2024
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 演示过渡页添加 隐藏 返回按钮事件
parent
642ef97c
Pipeline
#90009
waiting for manual action with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
34 deletions
+43
-34
index.js
...ootpage/template/demonstration/components/Iframe/index.js
+0
-10
index.js
src/pages/bootpage/template/demonstration/index.js
+43
-24
No files found.
src/pages/bootpage/template/demonstration/components/Iframe/index.js
View file @
ec3c175c
...
...
@@ -13,18 +13,8 @@ import { decode, encode } from 'js-base64';
import
styles
from
'./index.less'
;
const
IframeContainer
=
props
=>
{
const
{
linkUrl
,
onMessageBack
,
loading
}
=
props
;
const
[
showBackBtn
,
setShowBackBtn
]
=
useState
(
true
);
// 是否显示iframe 返回按钮,三维平台用
const
onMessage
=
e
=>
{
console
.
log
(
'onMessageBack ~ data:'
,
e
?.
data
);
if
(
e
?.
data
.
type
===
'showBack'
)
{
!
showBackBtn
&&
setShowBackBtn
(
true
);
return
;
}
if
(
e
?.
data
.
type
===
'hideBack'
)
{
showBackBtn
&&
setShowBackBtn
(
false
);
return
;
}
onMessageBack
&&
onMessageBack
(
e
?.
data
);
};
const
onError
=
e
=>
{
...
...
src/pages/bootpage/template/demonstration/index.js
View file @
ec3c175c
...
...
@@ -59,6 +59,7 @@ const Demonstration = props => {
const
[
newProductData
,
setNewProductData
]
=
useState
([]);
const
[
productConfig
,
setProductConfig
]
=
useState
({});
// 项目案例是否可免密跳转
const
[
showBackBtn
,
setShowBackBtn
]
=
useState
(
true
);
// 是否显示iframe 返回按钮,三维平台用
const
[
ref
,
isFullscreen
,
handleFullScreen
,
handleExitFullScreen
]
=
useFullScreen
(
false
);
// 退出
const
exit
=
()
=>
{
...
...
@@ -133,19 +134,35 @@ const Demonstration = props => {
};
const
onMessageBack
=
data
=>
{
if
(
!
data
?.
type
)
return
;
if
(
data
?.
type
===
'runAfterFirstMounted'
||
data
?.
type
===
'loginSuccess'
)
{
jumpProgressEnd
();
setTimeout
(()
=>
{
setJumpLoading
(
false
);
},
100
);
}
else
if
(
data
?.
type
===
'loginError'
)
{
message
.
warning
(
'登录失败,请联系管理人员'
);
handError
();
}
else
if
(
data
?.
type
===
'无法连接'
)
{
message
.
warning
(
'该站点无法连接,请联系管理人员'
);
setTimeout
(()
=>
{
console
.
log
(
'onMessageBack ~ data:'
,
data
);
switch
(
data
?.
type
)
{
// 页面加载完成
// 登录成功
case
'runAfterFirstMounted'
:
case
'loginSuccess'
:
jumpProgressEnd
();
setTimeout
(()
=>
{
setJumpLoading
(
false
);
},
100
);
break
;
case
'loginError'
:
message
.
warning
(
'登录失败,请联系管理人员'
);
handError
();
},
100
);
break
;
case
'无法连接'
:
message
.
warning
(
'该站点无法连接,请联系管理人员'
);
setTimeout
(()
=>
{
handError
();
},
100
);
break
;
case
'showBack'
:
!
showBackBtn
&&
setShowBackBtn
(
true
);
break
;
case
'hideBack'
:
showBackBtn
&&
setShowBackBtn
(
false
);
break
;
default
:
break
;
}
};
...
...
@@ -391,18 +408,6 @@ const Demonstration = props => {
if
(
!
linkUrl
)
return
null
;
return
(
<>
<
div
className
=
{
classNames
(
styles
.
iframeExit
,
'animate__animated'
,
'animate__fadeIn'
)}
onClick
=
{()
=>
setLinkUrl
(
''
)}
>
<
div
className
=
{
styles
.
iframeBackLeft
}
>
<
img
src
=
{
arrowLeftImg
}
alt
=
"返回"
/>
<
/div
>
<
div
className
=
{
styles
.
iframeExitIcon
}
>
<
img
src
=
{
backImg
}
alt
=
"返回"
/>
返回
<
/div
>
<
/div
>
<
div
className
=
{
classNames
(
!
jumpLoading
?
styles
.
scaleInCenter
:
styles
.
hide
,
'animate__animated'
)}
>
<
Iframe
linkUrl
=
{
linkUrl
}
onMessageBack
=
{
onMessageBack
}
/
>
<
/div
>
...
...
@@ -566,6 +571,20 @@ const Demonstration = props => {
<
/
>
)
:
null
}
<
/div
>
{
linkUrl
&&
showBackBtn
?
(
<
div
className
=
{
classNames
(
styles
.
iframeExit
,
'animate__animated'
,
'animate__fadeIn'
)}
onClick
=
{()
=>
setLinkUrl
(
''
)}
>
<
div
className
=
{
styles
.
iframeBackLeft
}
>
<
img
src
=
{
arrowLeftImg
}
alt
=
"返回"
/>
<
/div
>
<
div
className
=
{
styles
.
iframeExitIcon
}
>
<
img
src
=
{
backImg
}
alt
=
"返回"
/>
返回
<
/div
>
<
/div
>
)
:
null
}
{
iframeItem
}
<
/div
>
);
...
...
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