Skip to content

Commit 147e35a

Browse files
committed
UI: 调整二次验证的样式实现和移动实现
1 parent fe411a9 commit 147e35a

File tree

3 files changed

+109
-104
lines changed

3 files changed

+109
-104
lines changed

src/components/Captcha/index.css

Lines changed: 0 additions & 99 deletions
This file was deleted.

src/components/Captcha/index.less

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
@captcha-img-url: '/captcha-tianai.png';
2+
3+
.slider {
4+
background-color: #fff;
5+
width: 278px;
6+
height: 285px;
7+
z-index: 999;
8+
box-sizing: border-box;
9+
padding: 9px;
10+
border-radius: 6px;
11+
box-shadow: 0 0 11px 0 #999;
12+
user-select: none;
13+
14+
.content {
15+
width: 100%;
16+
height: 159px;
17+
position: relative;
18+
}
19+
20+
.bg-img-div {
21+
width: 100%;
22+
height: 100%;
23+
position: absolute;
24+
transform: translate3d(0, 0, 0);
25+
}
26+
27+
.slider-img-div {
28+
height: 100%;
29+
position: absolute;
30+
transform: translate3d(0, 0, 0);
31+
}
32+
33+
.bg-img-div img {
34+
width: 100%;
35+
}
36+
37+
.slider-img-div img {
38+
height: 100%;
39+
}
40+
41+
.refresh-btn,
42+
.close-btn,
43+
.slider-move-track,
44+
.slider-move-btn {
45+
background: url(@captcha-img-url) no-repeat;
46+
}
47+
48+
.refresh-btn,
49+
.close-btn {
50+
display: inline-block;
51+
}
52+
53+
.slider-move {
54+
height: 60px;
55+
width: 100%;
56+
margin: 11px 0;
57+
position: relative;
58+
59+
.slider-move-track {
60+
line-height: 38px;
61+
font-size: 14px;
62+
text-align: center;
63+
white-space: nowrap;
64+
color: #88949d;
65+
-moz-user-select: none;
66+
-webkit-user-select: none;
67+
user-select: none;
68+
}
69+
70+
.slider-move-btn {
71+
transform: translate3d(0, 0, 0);
72+
background-position: -5px 11.79625%;
73+
position: absolute;
74+
top: -12px;
75+
left: 0;
76+
width: 66px;
77+
height: 66px;
78+
}
79+
}
80+
81+
.slider-move-btn:hover,
82+
.close-btn:hover,
83+
.refresh-btn:hover {
84+
cursor: pointer;
85+
}
86+
87+
.bottom {
88+
height: 19px;
89+
width: 100%;
90+
91+
.close-btn {
92+
width: 20px;
93+
height: 20px;
94+
background-position: 0 44.86874%;
95+
margin-right: 5px;
96+
}
97+
98+
.refresh-btn {
99+
width: 20px;
100+
height: 20px;
101+
background-position: 0 81.38425%;
102+
}
103+
}
104+
}

src/components/Captcha/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { captchaGet, captchaValid } from '@/services/captcha';
33
import I18n from '@/utils/I18nUtils';
44
import type { CSSProperties, RefObject } from 'react';
55
import React, { Component } from 'react';
6-
import './index.css';
6+
import './index.less';
77

88
export * from './typings';
99

@@ -43,10 +43,10 @@ const defaultState = {
4343
trackArr: [],
4444
moveBtnStyles: {
4545
backgroundPosition: '-5px 11.79625%',
46-
transform: 'translate(0px, 0px)',
46+
transform: 'translate3d(0px, 0px, 0)',
4747
},
4848
imgDivStyles: {
49-
transform: 'translate(0px, 0px)',
49+
transform: 'translate3d(0px, 0px, 0)',
5050
},
5151
raw: {},
5252
};
@@ -186,8 +186,8 @@ export default class extends AbstractVerify<State> {
186186
moveX,
187187
trackArr,
188188
movePercent: moveX / (bgImgRef.current?.width || 1),
189-
moveBtnStyles: { ...moveBtnStyles, transform: `translate(${moveX}px, 0px)` },
190-
imgDivStyles: { transform: `translate(${moveX}px, 0px)` },
189+
moveBtnStyles: { ...moveBtnStyles, transform: `translate3d(${moveX}px, 0px, 0)` },
190+
imgDivStyles: { transform: `translate3d(${moveX}px, 0px, 0)` },
191191
});
192192
}
193193

0 commit comments

Comments
 (0)