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
陈智峰
jinfa-platform
Commits
7c5e34ce
Commit
7c5e34ce
authored
Oct 09, 2020
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改滑动验证码
parent
6f40bdc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
index.less
src/pages/accountSetting/components/SliderVerify/index.less
+15
-1
index.tsx
src/pages/accountSetting/components/SliderVerify/index.tsx
+15
-7
No files found.
src/pages/accountSetting/components/SliderVerify/index.less
View file @
7c5e34ce
...
@@ -43,6 +43,20 @@
...
@@ -43,6 +43,20 @@
left: 175px;
left: 175px;
top: 45px;
top: 45px;
}
}
.status {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
color: red;
}
}
}
...
@@ -95,7 +109,7 @@
...
@@ -95,7 +109,7 @@
bottom: 0;
bottom: 0;
border-top-left-radius: 45px;
border-top-left-radius: 45px;
border-bottom-left-radius: 45px ;
border-bottom-left-radius: 45px ;
background-color: #91d5ff;
//
background-color: #91d5ff;
}
}
}
}
...
...
src/pages/accountSetting/components/SliderVerify/index.tsx
View file @
7c5e34ce
...
@@ -96,8 +96,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
...
@@ -96,8 +96,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
const
onError
=
()
=>
{
const
onError
=
()
=>
{
console
.
log
(
"error"
)
console
.
log
(
"error"
)
setStatus
(
ERROR
);
setTimeout
(()
=>
{
reRender
()
},
500
)
// setOffset({x: 0, y: 0})
// setOffset({x: 0, y: 0})
reRender
()
}
}
const
onReset
=
()
=>
{
const
onReset
=
()
=>
{
...
@@ -106,12 +109,8 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
...
@@ -106,12 +109,8 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
const
reRender
=
()
=>
{
const
reRender
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
setStatus
(
READY
);
setOffset
({
x
:
0
,
y
:
0
})
const
objImage
=
new
Image
()
const
objImage
=
new
Image
()
console
.
log
(
imageUrl
)
objImage
.
addEventListener
(
"load"
,
()
=>
{
objImage
.
addEventListener
(
"load"
,
()
=>
{
console
.
log
(
objImage
.
width
);
// 先获取两个ctx
// 先获取两个ctx
const
ctxShadow
=
shadowCanvas
.
current
.
getContext
(
"2d"
)
const
ctxShadow
=
shadowCanvas
.
current
.
getContext
(
"2d"
)
const
ctxFragment
=
fragmentCanvas
.
current
.
getContext
(
"2d"
)
const
ctxFragment
=
fragmentCanvas
.
current
.
getContext
(
"2d"
)
...
@@ -147,6 +146,9 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
...
@@ -147,6 +146,9 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
// 修改状态
// 修改状态
setLoading
(
false
);
setLoading
(
false
);
setStatus
(
READY
);
setOffset
({
x
:
0
,
y
:
0
})
})
})
objImage
.
src
=
imageUrl
objImage
.
src
=
imageUrl
}
}
...
@@ -161,11 +163,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
...
@@ -161,11 +163,11 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
?
null
?
null
:
(
:
(
<
div
>
<
div
>
{
{
/* {
loading
loading
? <div className={styles.loading}><Spin /></div>
? <div className={styles.loading}><Spin /></div>
: null
: null
}
}
*/
}
<
div
className=
{
styles
.
sliderContainer
}
style=
{
{
visibility
:
!
loading
?
'visible'
:
'hidden'
}
}
>
<
div
className=
{
styles
.
sliderContainer
}
style=
{
{
visibility
:
!
loading
?
'visible'
:
'hidden'
}
}
>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
>
...
@@ -184,6 +186,12 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
...
@@ -184,6 +186,12 @@ const SliderVerify: React.FC<SliderVerifyProps> = (props) => {
ref=
{
fragmentCanvas
}
ref=
{
fragmentCanvas
}
style=
{
{
left
:
offset
.
x
+
"px"
,
top
:
clipImagePosition
.
y
+
"px"
}
}
style=
{
{
left
:
offset
.
x
+
"px"
,
top
:
clipImagePosition
.
y
+
"px"
}
}
></
canvas
>
></
canvas
>
{
status
===
ERROR
?
<
div
className=
{
styles
.
status
}
>
验证失败
</
div
>
:
null
}
</
div
>
</
div
>
<
div
className=
{
styles
.
slider
}
onMouseMove=
{
mouseMove
}
onMouseLeave=
{
mouseUp
}
>
<
div
className=
{
styles
.
slider
}
onMouseMove=
{
mouseMove
}
onMouseLeave=
{
mouseUp
}
>
<
div
className=
{
styles
.
sliderHandle
}
onMouseDown=
{
mouseDown
}
onMouseUp=
{
mouseUp
}
style=
{
sliderHandleStyle
}
><
DoubleRightOutlined
/></
div
>
<
div
className=
{
styles
.
sliderHandle
}
onMouseDown=
{
mouseDown
}
onMouseUp=
{
mouseUp
}
style=
{
sliderHandleStyle
}
><
DoubleRightOutlined
/></
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