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
8a45c059
Commit
8a45c059
authored
May 09, 2023
by
张瑶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增图片演示功能
parent
ae43cab5
Pipeline
#72057
failed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
5 deletions
+115
-5
index.less
src/pages/system/previews/index.less
+37
-0
preview.js
src/pages/system/previews/preview.js
+68
-0
config.js
src/routes/config.js
+10
-5
No files found.
src/pages/system/previews/index.less
0 → 100644
View file @
8a45c059
.tab-preview {
width: 100%;
position: relative;
.oper-wrap {
top: 0;
right: 0;
width: 100px;
height: 100px;
position: absolute;
z-index: 2;
.oper-btn {
cursor: pointer;
color: #FFF;
position: absolute;
top: 10px;
right: -100%;
transition: right ease-in-out 0.8s;
}
&:hover {
.oper-btn {
right: 20px;
}
}
}
}
.tab-preview.normal-img {
overflow: hidden;
height: 100%;
}
.tab-preview.long-img {
overflow: auto;
}
src/pages/system/previews/preview.js
0 → 100644
View file @
8a45c059
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
{
notification
}
from
'antd'
;
import
Empty
from
'@wisdom-components/empty'
;
import
classnames
from
'classnames'
;
import
{
cloudService
}
from
'@/api'
;
import
useFullScreen
from
'../iframe/useFullScreen'
;
import
styles
from
'./index.less'
;
const
PrevieView
=
props
=>
{
const
params
=
Object
.
assign
({},
props
.
params
,
{
fullscreen
:
props
.
params
!==
undefined
&&
props
.
params
.
fullscreen
===
'true'
,
canScroll
:
props
.
params
!==
undefined
&&
props
.
params
.
longImg
===
'true'
,
});
const
{
imgName
,
accountName
,
fullscreen
,
canScroll
}
=
params
;
const
[
ref
,
isFullscreen
,
handleFullScreen
,
handleExitFullScreen
]
=
useFullScreen
(
fullscreen
);
const
[
imgUrl
,
setImgUrl
]
=
useState
(
''
);
const
getImgUrl
=
()
=>
{
cloudService
.
getAccountPageList
({
pageIndex
:
1
,
pageSize
:
5
,
sortFields
:
'录入时间'
,
direction
:
'desc'
,
info
:
imgName
,
accountName
,
})
.
then
(
res
=>
{
const
configData
=
JSON
.
parse
(
res
.
data
.
jsonData
||
'[]'
);
if
(
configData
.
length
>
0
&&
configData
[
0
][
'演示图片'
])
{
const
url
=
`
${
window
.
location
.
origin
}
/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=
${
configData
[
0
][
'演示图片'
]
}
&_site=
${
window
.
globalConfig
?.
userInfo
?.
site
}
`;
setImgUrl(url);
}
})
.catch(err => {
notification.error({ message: '提示', duration: 3, description: '获取图片信息错误' });
});
};
useEffect(() => {
getImgUrl();
}, [getImgUrl]);
return (
<div className={classnames(styles['tab-preview'], canScroll ? styles['long-img'] : styles['normal-img'])} 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>
{imgUrl ? (
<img src={imgUrl} display="block" position="relative" alt="演示图片" />
) : (
<Empty description="配置图片台账才能显示哦!" />
)}
</div>
);
};
export default PrevieView;
src/routes/config.js
View file @
8a45c059
import
React
from
'react'
;
import
{
UserLayout
}
from
'@wisdom-utils/components/lib/AppLayout'
;
import
LoadingComponent
from
'@wisdom-utils/components/lib/AppLayout/components/PageLoading'
;
import
{
dynamic
}
from
'@wisdom-utils/runtime'
;
...
...
@@ -12,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
PrevieView
from
'../pages/system/previews/preview'
;
export
const
dyRoutes
=
(
routes
,
layout
,
theme
)
=>
{
// eslint-disable-next-line no-shadow
...
...
@@ -31,9 +33,9 @@ export const dyRoutes = (routes, layout, theme) => {
component
:
Login
,
props
:
{
onEnter
(
props
)
{
console
.
log
(
"login props"
,
props
)
}
}
console
.
log
(
'login props'
,
props
);
}
,
}
,
},
{
name
:
'noscret'
,
...
...
@@ -93,10 +95,13 @@ export const dyRoutes = (routes, layout, theme) => {
render
:
({
routeConfig
})
=>
{
const
{
path
}
=
routeConfig
||
{};
if
(
/system
\/
iframe
\/
tabWidget/
.
test
(
path
))
{
return
<
TabIframe
{
...
routeConfig
}
/
>
}
return
<
TabIframe
{...
routeConfig
}
/>
;
}
if
(
/system
\/
previews
\/
preview/
.
test
(
path
))
{
return
<
PrevieView
{...
routeConfig
}
/>
;
}
},
},
],
},
...
...
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