Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
linweijiong
jinfa-platform
Commits
36c99658
Commit
36c99658
authored
Nov 05, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:新增图片预览组件,修复确认支付订单预览问题
parent
1a03d339
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
3 deletions
+59
-3
index.less
src/components/ImagePreview/index.less
+20
-0
index.tsx
src/components/ImagePreview/index.tsx
+33
-0
index.tsx
...ages/transaction/components/orderPayResultModal/index.tsx
+6
-3
No files found.
src/components/ImagePreview/index.less
0 → 100644
View file @
36c99658
.imgPreviewWrapper {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
background: #000;
}
.imgPreview {
max-width: 100%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
\ No newline at end of file
src/components/ImagePreview/index.tsx
0 → 100644
View file @
36c99658
import
React
,
{
useState
,
useEffect
}
from
'react'
import
styles
from
'./index.less'
export
interface
ImagePreviewProps
{
src
:
string
,
currentRef
?:
any
}
const
ImagePreview
:
React
.
FC
<
ImagePreviewProps
>
=
({
src
,
currentRef
})
=>
{
const
[
state
,
setState
]
=
useState
(
false
)
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
toggle
}
}
},
[])
const
toggle
=
()
=>
{
setState
(
!
state
)
}
return
state
&&
(
<
div
className=
{
styles
.
imgPreviewWrapper
}
onClick=
{
toggle
}
>
<
img
src=
{
src
}
className=
{
styles
.
imgPreview
}
/>
</
div
>
)
}
ImagePreview
.
defaultProps
=
{}
export
default
ImagePreview
\ No newline at end of file
src/pages/transaction/components/orderPayResultModal/index.tsx
View file @
36c99658
import
React
,
{
useState
,
useEffect
,
useContext
}
from
'react'
import
React
,
{
useState
,
useEffect
,
useContext
,
useRef
}
from
'react'
import
{
Modal
,
List
,
Avatar
,
Button
,
Space
}
from
'antd'
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
import
{
OrderDetailContext
}
from
'../../_public/order/context'
...
...
@@ -7,6 +7,7 @@ import { PublicApi } from '@/services/api'
import
{
history
,
Link
}
from
'umi'
import
OverflowText
from
'@/components/OverflowText'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
ImagePreview
from
'@/components/ImagePreview'
export
interface
OrderPayResultModalProps
{
type
:
'default'
|
'preview'
,
...
...
@@ -14,12 +15,13 @@ export interface OrderPayResultModalProps {
}
const
OrderPayResultModal
:
React
.
FC
<
OrderPayResultModalProps
>
=
({
type
,
currentRef
})
=>
{
const
imgRef
=
useRef
<
any
>
({})
const
{
data
}
=
useContext
(
OrderDetailContext
)
const
{
id
}
=
usePageStatus
()
const
[
visible
,
setVisible
]
=
useState
(
false
)
const
canCtlData
=
data
?.
paymentInformationResponses
.
find
(
v
=>
v
.
externalState
===
PayOutWorkState
.
READY_CONFIRM_RESULT
)
||
{}
const
{
run
,
loading
}
=
useHttpRequest
(
PublicApi
.
postOrderConfirmedPaymentResultsOrder
)
const
transData
=
canCtlData
.
payOrderUrls
?.
split
(
','
)
||
[]
const
transData
=
canCtlData
.
payOrderUrls
?
JSON
.
parse
(
canCtlData
.
payOrderUrls
)
:
[]
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
...
...
@@ -62,10 +64,11 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
itemLayout=
"horizontal"
dataSource=
{
transData
||
[]
}
renderItem=
{
(
item
:
string
)
=>
(
<
List
.
Item
style=
{
{
fontSize
:
12
}
}
extra=
{
<
a
href=
{
item
}
target=
'_blank'
>
预览
</
a
>
}
>
<
List
.
Item
style=
{
{
fontSize
:
12
}
}
extra=
{
<
Button
type=
'link'
onClick=
{
imgRef
.
current
.
toggle
}
>
预览
</
Button
>
}
>
<
OverflowText
style=
{
{
flex
:
'.9'
}
}
>
{
item
}
</
OverflowText
>
<
ImagePreview
src=
{
item
}
currentRef=
{
imgRef
}
/>
</
List
.
Item
>
)
}
/>
...
...
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