yuang-framework-ui-pc 1.1.29 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/icons/SliderArrowSlide.js +1 -1
- package/es/icons/SliderArrowStatic.js +1 -1
- package/es/style/default.scss +77 -0
- package/es/style/index.scss +1 -0
- package/es/yu-slider-captcha-dialog/SliderCaptcha.js +60 -151
- package/es/yu-slider-captcha-dialog/index.js +5 -5
- package/es/yu-slider-captcha-dialog/style/index.scss +38 -35
- package/lib/icons/SliderArrowSlide.cjs +1 -1
- package/lib/icons/SliderArrowStatic.cjs +1 -1
- package/lib/style/default.scss +77 -0
- package/lib/style/index.scss +1 -0
- package/lib/yu-slider-captcha-dialog/SliderCaptcha.cjs +59 -150
- package/lib/yu-slider-captcha-dialog/index.cjs +5 -5
- package/lib/yu-slider-captcha-dialog/style/index.scss +38 -35
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
/* 滑块验证码弹出框 */
|
|
3
|
+
.yu-slider-captcha-dialog {
|
|
4
|
+
.yu-slider-captcha-dialog-modal {
|
|
3
5
|
position: fixed;
|
|
4
6
|
left: 0;
|
|
5
7
|
top: 0;
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
z-index: 1000;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
.slider-captcha-dialog-wrapper {
|
|
16
|
+
.yu-slider-captcha-dialog-wrapper {
|
|
15
17
|
position: fixed;
|
|
16
18
|
top: 0;
|
|
17
19
|
right: 0;
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
|
|
23
25
|
z-index: 1001;
|
|
24
26
|
|
|
25
|
-
.slider-captcha-dialog {
|
|
27
|
+
.yu-slider-captcha-dialog {
|
|
26
28
|
// 在移动端禁止上下滑动,添加position: fixed;
|
|
27
29
|
position: fixed;
|
|
28
30
|
background: #fff;
|
|
@@ -43,15 +45,15 @@
|
|
|
43
45
|
|
|
44
46
|
border-radius: 4px;
|
|
45
47
|
|
|
46
|
-
.slider-captcha {
|
|
48
|
+
.yu-slider-captcha {
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
.slide-up {
|
|
51
|
-
animation: slide-up-animation 0.5s ease;
|
|
52
|
+
.yu-slider-captcha-slide-up {
|
|
53
|
+
animation: yu-slider-captcha-slide-up-animation 0.5s ease;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
@keyframes slide-up-animation {
|
|
56
|
+
@keyframes yu-slider-captcha-slide-up-animation {
|
|
55
57
|
0% {
|
|
56
58
|
transform: translate(-50%, 100%);
|
|
57
59
|
}
|
|
@@ -65,18 +67,19 @@
|
|
|
65
67
|
|
|
66
68
|
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
/* 滑块验证码弹容器 */
|
|
71
|
+
.yu-slider-captcha-container {
|
|
72
|
+
.yu-slider-captcha {
|
|
70
73
|
position: relative;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
.slider-captcha-title {
|
|
76
|
+
.yu-slider-captcha-title {
|
|
74
77
|
position: relative;
|
|
75
78
|
height: 30px;
|
|
76
79
|
font-size: 16px;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
.slider-captcha-refresh-icon {
|
|
82
|
+
.yu-slider-captcha-refresh-icon {
|
|
80
83
|
position: absolute;
|
|
81
84
|
right: 30px;
|
|
82
85
|
top: 0;
|
|
@@ -89,11 +92,11 @@
|
|
|
89
92
|
opacity: 0.7;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
.slider-captcha-refresh-icon:hover {
|
|
95
|
+
.yu-slider-captcha-refresh-icon:hover {
|
|
93
96
|
opacity: 1;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
.slider-captcha-close-icon {
|
|
99
|
+
.yu-slider-captcha-close-icon {
|
|
97
100
|
position: absolute;
|
|
98
101
|
right: 0;
|
|
99
102
|
top: 0;
|
|
@@ -106,20 +109,20 @@
|
|
|
106
109
|
opacity: 0.7;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
.slider-captcha-close-icon:hover {
|
|
112
|
+
.yu-slider-captcha-close-icon:hover {
|
|
110
113
|
opacity: 1;
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
/*图片加载样式*/
|
|
115
|
-
.img-loading {
|
|
118
|
+
.yu-slider-captcha-img-loading {
|
|
116
119
|
position: absolute;
|
|
117
120
|
top: 0;
|
|
118
121
|
right: 0;
|
|
119
122
|
left: 0;
|
|
120
123
|
bottom: 0;
|
|
121
124
|
z-index: 999;
|
|
122
|
-
animation: loading 1.5s infinite;
|
|
125
|
+
animation: yu-slider-captcha-loading 1.5s infinite;
|
|
123
126
|
background-image: url(../images/loading.svg);
|
|
124
127
|
background-repeat: no-repeat;
|
|
125
128
|
background-position: center center;
|
|
@@ -128,7 +131,7 @@
|
|
|
128
131
|
//border-radius: 5px;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
@keyframes loading {
|
|
134
|
+
@keyframes yu-slider-captcha-loading {
|
|
132
135
|
0% {
|
|
133
136
|
opacity: 0.7;
|
|
134
137
|
}
|
|
@@ -165,12 +168,12 @@
|
|
|
165
168
|
//}
|
|
166
169
|
|
|
167
170
|
/*验证图片*/
|
|
168
|
-
.
|
|
171
|
+
.yu-slider-captcha-canvas {
|
|
169
172
|
//border-radius: 5px;
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
/*阻塞块*/
|
|
173
|
-
.
|
|
176
|
+
.yu-slider-captcha-block {
|
|
174
177
|
position: absolute;
|
|
175
178
|
left: 0;
|
|
176
179
|
top: 0;
|
|
@@ -179,12 +182,12 @@
|
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
/*校验失败时的阻塞块样式*/
|
|
182
|
-
.
|
|
185
|
+
.yu-slider-captcha-block.is-verify-fail {
|
|
183
186
|
transition: left 0.5s linear;
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
/*滑动条*/
|
|
187
|
-
.slider {
|
|
190
|
+
.yu-slider-captcha-slider {
|
|
188
191
|
position: relative;
|
|
189
192
|
text-align: center;
|
|
190
193
|
width: 100%;
|
|
@@ -201,7 +204,7 @@
|
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
/*滑动盒子*/
|
|
204
|
-
.slider-box {
|
|
207
|
+
.yu-slider-captcha-slider-box {
|
|
205
208
|
position: absolute;
|
|
206
209
|
left: 0;
|
|
207
210
|
top: 0;
|
|
@@ -214,7 +217,7 @@
|
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
/*滑动按钮*/
|
|
217
|
-
.slider-button {
|
|
220
|
+
.yu-slider-captcha-slider-button {
|
|
218
221
|
background-color: rgb(255, 255, 255);
|
|
219
222
|
color: white;
|
|
220
223
|
text-align: center;
|
|
@@ -235,17 +238,17 @@
|
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
/*鼠标悬浮时的按钮样式*/
|
|
238
|
-
.slider-button:hover {
|
|
241
|
+
.yu-slider-captcha-slider-button:hover {
|
|
239
242
|
//background: #1991FA
|
|
240
243
|
cursor: pointer;
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
/*鼠标悬浮时的按钮图标样式*/
|
|
244
|
-
.slider-button:hover .slider-button-icon {
|
|
247
|
+
.yu-slider-captcha-slider-button:hover .yu-slider-captcha-slider-button-icon {
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
/*滑动按钮图标*/
|
|
248
|
-
.slider-button-icon {
|
|
251
|
+
.yu-slider-captcha-slider-button-icon {
|
|
249
252
|
width: 32px;
|
|
250
253
|
height: 32px;
|
|
251
254
|
font-size: 24px;
|
|
@@ -254,42 +257,42 @@
|
|
|
254
257
|
}
|
|
255
258
|
|
|
256
259
|
/*校验时的按钮样式*/
|
|
257
|
-
.verify-active .slider-button {
|
|
260
|
+
.is-verify-active .slider-button {
|
|
258
261
|
//height: 38px;
|
|
259
262
|
//top: -1px;
|
|
260
263
|
//border: 1px solid #1991FA;
|
|
261
264
|
}
|
|
262
265
|
|
|
263
266
|
/*校验时的滑动箱样式*/
|
|
264
|
-
.verify-active .slider-box {
|
|
267
|
+
.is-verify-active .yu-slider-captcha-slider-box {
|
|
265
268
|
height: 40px;
|
|
266
269
|
border-width: 1px;
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
/*校验成功时的滑动箱样式*/
|
|
270
|
-
.verify-success .slider-box {
|
|
273
|
+
.is-verify-success .yu-slider-captcha-slider-box {
|
|
271
274
|
height: 40px;
|
|
272
275
|
}
|
|
273
276
|
|
|
274
277
|
/*校验成功时的按钮样式*/
|
|
275
|
-
.verify-success .slider-button {
|
|
278
|
+
.is-verify-success .slider-button {
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
/*校验成功时的按钮图标样式*/
|
|
279
|
-
.verify-success .slider-button-icon {
|
|
282
|
+
.is-verify-success .yu-slider-captcha-slider-button-icon {
|
|
280
283
|
background-position: 0 0 !important;
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
/*校验失败时的滑动箱样式*/
|
|
284
|
-
.verify-fail .slider-box {
|
|
287
|
+
.is-verify-fail .yu-slider-captcha-slider-box {
|
|
285
288
|
transition: width 0.5s linear;
|
|
286
289
|
}
|
|
287
290
|
|
|
288
291
|
/*校验失败时的按钮样式*/
|
|
289
|
-
.verify-fail .slider-button {
|
|
292
|
+
.is-verify-fail .slider-button {
|
|
290
293
|
transition: left 0.5s linear;
|
|
291
294
|
}
|
|
292
295
|
|
|
293
296
|
/*校验失败时的按钮图标样式*/
|
|
294
|
-
.verify-fail .slider-button-icon {
|
|
297
|
+
.is-verify-fail .yu-slider-captcha-slider-button-icon {
|
|
295
298
|
}
|
|
@@ -22,7 +22,7 @@ const _hoisted_1 = {
|
|
|
22
22
|
};
|
|
23
23
|
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
24
24
|
d: "M793.751 733.16l0-181.775-145.42 0 0-96.948L787.69199999 454.437l0-187.833L1024 502.911zM230.248 733.16l0-181.775L375.669 551.385l0-96.948-139.36099999 0 0-187.833L0 502.911zM575.621 757.396L442.32 757.396l0-490.793L575.621 266.603z",
|
|
25
|
-
fill: "
|
|
25
|
+
fill: "currentColor",
|
|
26
26
|
"p-id": "2866"
|
|
27
27
|
}, null, -1);
|
|
28
28
|
const _hoisted_3 = [
|
|
@@ -22,7 +22,7 @@ const _hoisted_1 = {
|
|
|
22
22
|
};
|
|
23
23
|
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
24
24
|
d: "M883.2 723.2a44.8 44.8 0 0 1 0 89.6H140.8a44.8 44.8 0 0 1 0-89.6h742.4z m0-256a44.8 44.8 0 0 1 0 89.6H140.8a44.8 44.8 0 0 1 0-89.6h742.4z m0-256a44.8 44.8 0 0 1 0 89.6H140.8a44.8 44.8 0 0 1 0-89.6h742.4z",
|
|
25
|
-
fill: "
|
|
25
|
+
fill: "currentColor",
|
|
26
26
|
"p-id": "3008"
|
|
27
27
|
}, null, -1);
|
|
28
28
|
const _hoisted_3 = [
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
|
|
2
|
+
.yu-hidden {
|
|
3
|
+
display: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.yu-block {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.yu-text-center {
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.yu-text-left {
|
|
15
|
+
text-align: left;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.yu-text-right {
|
|
19
|
+
text-align: right;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.yu-color-red {
|
|
23
|
+
color: #ff4d4f;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.yu-color-yellow {
|
|
27
|
+
color: #FAAD14;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.yu-color-green {
|
|
31
|
+
color: #33CC99;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
.yu-color-primary {
|
|
36
|
+
color: #409EFF;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.yu-color-info {
|
|
40
|
+
color: #1989fa;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.yu-color-default {
|
|
44
|
+
color: #fff;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.yu-color-danger {
|
|
48
|
+
color: #ee0a24;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.yu-color-warning {
|
|
52
|
+
color: #ff976a;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
.yu-bgc-red {
|
|
57
|
+
background-color: #ff4d4f;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.yu-bgc-yellow {
|
|
61
|
+
background-color: #FAAD14;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.yu-bgc-green {
|
|
65
|
+
background-color: #33CC99;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
.yu-overfow-hidden {
|
|
70
|
+
display: block !important;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.yu-link {
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
package/lib/style/index.scss
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
3
|
const httpConfig = require("yuang-framework-ui-common/lib/config/httpConfig");
|
|
4
|
-
const urlUtils = require("yuang-framework-ui-common/lib/utils/urlUtils");
|
|
5
4
|
const iconsVue = require("@element-plus/icons-vue");
|
|
6
5
|
const icons = require("../icons");
|
|
7
|
-
const _hoisted_1 = { class: "slider-captcha-container" };
|
|
8
|
-
const _hoisted_2 = { class: "slider-captcha-title" };
|
|
6
|
+
const _hoisted_1 = { class: "yu-slider-captcha-container" };
|
|
7
|
+
const _hoisted_2 = { class: "yu-slider-captcha-title" };
|
|
9
8
|
const _hoisted_3 = ["width", "height"];
|
|
10
|
-
const _hoisted_4 =
|
|
11
|
-
const _hoisted_5 = ["width", "height"];
|
|
12
|
-
const _hoisted_6 = { class: "slider-hint" };
|
|
9
|
+
const _hoisted_4 = { class: "slider-hint" };
|
|
13
10
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
14
11
|
...{ name: "SliderCaptcha" },
|
|
15
12
|
__name: "SliderCaptcha",
|
|
@@ -28,16 +25,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
28
25
|
const emit = __emit;
|
|
29
26
|
const canvas = vue.ref(null);
|
|
30
27
|
const block = vue.ref(null);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const blockY = vue.ref(void 0);
|
|
40
|
-
const image = vue.ref(void 0);
|
|
28
|
+
const isVerifyActive = vue.ref(false);
|
|
29
|
+
const isVerifySuccess = vue.ref(false);
|
|
30
|
+
const isVerifyFail = vue.ref(false);
|
|
31
|
+
vue.ref(null);
|
|
32
|
+
vue.ref(null);
|
|
33
|
+
vue.ref(props.blockLength * 2);
|
|
34
|
+
vue.ref(void 0);
|
|
35
|
+
vue.ref(void 0);
|
|
41
36
|
const originX = vue.ref(void 0);
|
|
42
37
|
const originY = vue.ref(void 0);
|
|
43
38
|
const dragDistanceList = vue.ref([]);
|
|
@@ -57,13 +52,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
57
52
|
bindEvents();
|
|
58
53
|
};
|
|
59
54
|
const initDom = () => {
|
|
60
|
-
|
|
61
|
-
canvasCtx.value = canvas.value.getContext("2d");
|
|
62
|
-
blockCtx.value = block.value.getContext("2d");
|
|
63
|
-
initImage();
|
|
64
|
-
} else {
|
|
65
|
-
getCaptcha();
|
|
66
|
-
}
|
|
55
|
+
getCaptcha();
|
|
67
56
|
};
|
|
68
57
|
const getCaptcha = () => {
|
|
69
58
|
httpConfig.http.get("/sso-api/standard/framework-captcha/getSliderCaptcha", { params: {} }).then((res) => {
|
|
@@ -76,63 +65,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
76
65
|
}, 200);
|
|
77
66
|
});
|
|
78
67
|
};
|
|
79
|
-
const initImage = () => {
|
|
80
|
-
const imageObject = createImage(() => {
|
|
81
|
-
drawBlock();
|
|
82
|
-
let { canvasWidth, canvasHeight, blockX: blockX2, blockY: blockY2, blockRadius, blockWidth: blockWidth2 } = this;
|
|
83
|
-
canvasCtx.value.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
84
|
-
blockCtx.value.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
85
|
-
let yAxle = blockY2 - blockRadius * 2;
|
|
86
|
-
let ImageData = blockCtx.value.getImageData(blockX2, yAxle, blockWidth2, blockWidth2);
|
|
87
|
-
block.value.width = blockWidth2;
|
|
88
|
-
blockCtx.value.putImageData(ImageData, 0, yAxle);
|
|
89
|
-
isLoading.value = false;
|
|
90
|
-
key.value = "loyer";
|
|
91
|
-
});
|
|
92
|
-
image.value = imageObject;
|
|
93
|
-
};
|
|
94
|
-
const createImage = (onload) => {
|
|
95
|
-
const image2 = document.createElement("img");
|
|
96
|
-
image2.crossOrigin = "Anonymous";
|
|
97
|
-
image2.onload = onload;
|
|
98
|
-
image2.onerror = () => {
|
|
99
|
-
image2.src = `${urlUtils.getBaseUrl()}/img/slider-captcha/pic-0.jpeg`;
|
|
100
|
-
};
|
|
101
|
-
image2.src = getImageSrc();
|
|
102
|
-
return image2;
|
|
103
|
-
};
|
|
104
|
-
const getImageSrc = () => {
|
|
105
|
-
const len = props.imageList.length;
|
|
106
|
-
return len > 0 ? props.imageList[getNonceByRange(0, len)] : `https://loyer.wang/view/ftp/wallpaper/${getNonceByRange(1, 1e3)}.jpg`;
|
|
107
|
-
};
|
|
108
|
-
const getNonceByRange = (start, end) => {
|
|
109
|
-
return Math.round(Math.random() * (end - start) + start);
|
|
110
|
-
};
|
|
111
|
-
const drawBlock = () => {
|
|
112
|
-
blockX.value = getNonceByRange(blockWidth.value + 10, props.canvasWidth - (blockWidth.value + 10));
|
|
113
|
-
blockY.value = getNonceByRange(10 + props.blockRadius * 2, props.canvasHeight - (blockWidth.value + 10));
|
|
114
|
-
draw(canvasCtx.value, "fill");
|
|
115
|
-
draw(blockCtx.value, "clip");
|
|
116
|
-
};
|
|
117
|
-
const draw = (ctx, operation) => {
|
|
118
|
-
const PI = Math.PI;
|
|
119
|
-
let { blockX: x, blockY: y, blockLength: l, blockRadius: r } = this;
|
|
120
|
-
ctx.beginPath();
|
|
121
|
-
ctx.moveTo(x, y);
|
|
122
|
-
ctx.arc(x + l / 2, y - r + 2, r, 0.72 * PI, 2.26 * PI);
|
|
123
|
-
ctx.lineTo(x + l, y);
|
|
124
|
-
ctx.arc(x + l + r - 2, y + l / 2, r, 1.21 * PI, 2.78 * PI);
|
|
125
|
-
ctx.lineTo(x + l, y + l);
|
|
126
|
-
ctx.lineTo(x, y + l);
|
|
127
|
-
ctx.arc(x + r - 2, y + l / 2, r + 0.4, 2.76 * PI, 1.24 * PI, true);
|
|
128
|
-
ctx.lineTo(x, y);
|
|
129
|
-
ctx.lineWidth = 2;
|
|
130
|
-
ctx.fillStyle = "rgba(255, 255, 255, 0.9)";
|
|
131
|
-
ctx.strokeStyle = "rgba(255, 255, 255, 0.9)";
|
|
132
|
-
ctx.stroke();
|
|
133
|
-
ctx[operation]();
|
|
134
|
-
ctx.globalCompositeOperation = "destination-over";
|
|
135
|
-
};
|
|
136
68
|
const bindEvents = () => {
|
|
137
69
|
var _a, _b, _c;
|
|
138
70
|
(_a = document.getElementById("slider-button")) == null ? void 0 : _a.addEventListener("mousedown", (event) => {
|
|
@@ -166,13 +98,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
166
98
|
}
|
|
167
99
|
};
|
|
168
100
|
const checkImgSrc = () => {
|
|
169
|
-
if (isFrontCheck.value) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
101
|
return !!canvas.value.src;
|
|
173
102
|
};
|
|
174
103
|
const startEvent = (clientX, clientY) => {
|
|
175
|
-
if (!checkImgSrc() || isLoading.value ||
|
|
104
|
+
if (!checkImgSrc() || isLoading.value || isVerifySuccess.value) {
|
|
176
105
|
return;
|
|
177
106
|
}
|
|
178
107
|
originX.value = clientX;
|
|
@@ -193,7 +122,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
193
122
|
sliderButtonLeft.value = moveX > props.canvasWidth - 56 ? props.canvasWidth - 56 : moveX;
|
|
194
123
|
let blockLeft = (props.canvasWidth - 40 - 20) / (props.canvasWidth - 40) * moveX;
|
|
195
124
|
block.value.style.left = (blockLeft > props.canvasWidth - 56 - 18 - 7 ? props.canvasWidth - 56 - 18 - 7 : blockLeft) + "px";
|
|
196
|
-
|
|
125
|
+
isVerifyActive.value = true;
|
|
197
126
|
sliderBoxWidth.value = moveX + 28;
|
|
198
127
|
dragDistanceList.value.push(moveY);
|
|
199
128
|
};
|
|
@@ -206,7 +135,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
206
135
|
return false;
|
|
207
136
|
}
|
|
208
137
|
isLoading.value = true;
|
|
209
|
-
|
|
138
|
+
isVerifyActive.value = false;
|
|
210
139
|
timestamp.value = +/* @__PURE__ */ new Date() - timestamp.value;
|
|
211
140
|
const moveLength = parseInt(block.value.style.left);
|
|
212
141
|
if (timestamp.value > 1e4) {
|
|
@@ -215,22 +144,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
215
144
|
if (!turingTest()) {
|
|
216
145
|
verifyFailEvent();
|
|
217
146
|
} else {
|
|
218
|
-
if (isFrontCheck.value) {
|
|
219
|
-
const accuracyValue = props.accuracy <= 1 ? 1 : props.accuracy > 10 ? 10 : props.accuracy;
|
|
220
|
-
const spliced = Math.abs(moveLength - blockX.value) <= accuracyValue;
|
|
221
|
-
if (!spliced) {
|
|
222
|
-
verifyFailEvent();
|
|
223
|
-
} else {
|
|
224
|
-
emit("success", { key: key.value, value: moveLength });
|
|
225
|
-
}
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
147
|
let params = {
|
|
229
148
|
key: key.value,
|
|
230
149
|
captcha: moveLength
|
|
231
150
|
};
|
|
232
151
|
httpConfig.http.get("/sso-api/standard/framework-captcha/validateSliderCaptcha", { params }).then((res) => {
|
|
233
|
-
|
|
152
|
+
verifySuccessEvent();
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
emit("success", { key: key.value, value: moveLength });
|
|
155
|
+
}, 500);
|
|
234
156
|
}).catch(() => {
|
|
235
157
|
verifyFailEvent();
|
|
236
158
|
});
|
|
@@ -245,31 +167,35 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
245
167
|
const stdDev = Math.sqrt(deviations.map(calcSquare).reduce(calcSum) / arr.length);
|
|
246
168
|
return average !== stdDev;
|
|
247
169
|
};
|
|
170
|
+
const verifySuccessEvent = () => {
|
|
171
|
+
isLoading.value = false;
|
|
172
|
+
isVerifySuccess.value = true;
|
|
173
|
+
const elapsedTime = (timestamp.value / 1e3).toFixed(1);
|
|
174
|
+
if (elapsedTime < 1) {
|
|
175
|
+
successHint.value = `仅仅${elapsedTime}S,你的速度快如闪电`;
|
|
176
|
+
} else if (elapsedTime < 2) {
|
|
177
|
+
successHint.value = `只用了${elapsedTime}S,这速度简直完美`;
|
|
178
|
+
} else {
|
|
179
|
+
successHint.value = `耗时${elapsedTime}S,争取下次再快一点`;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
248
182
|
const verifyFailEvent = () => {
|
|
249
|
-
|
|
183
|
+
isVerifyFail.value = true;
|
|
250
184
|
emit("fail", {});
|
|
251
185
|
refresh();
|
|
252
186
|
};
|
|
253
187
|
const refresh = () => {
|
|
254
188
|
setTimeout(() => {
|
|
255
|
-
|
|
189
|
+
isVerifyFail.value = false;
|
|
256
190
|
}, 300);
|
|
257
191
|
isLoading.value = true;
|
|
258
|
-
|
|
259
|
-
|
|
192
|
+
isVerifyActive.value = false;
|
|
193
|
+
isVerifySuccess.value = false;
|
|
260
194
|
block.value.style.left = 0;
|
|
261
195
|
sliderBoxWidth.value = 0;
|
|
262
196
|
sliderButtonLeft.value = 0;
|
|
263
197
|
vue.nextTick(() => {
|
|
264
|
-
|
|
265
|
-
let { canvasWidth, canvasHeight } = this;
|
|
266
|
-
canvasCtx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
267
|
-
blockCtx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
268
|
-
block.value.width = canvasWidth;
|
|
269
|
-
image.value.src = getImageSrc();
|
|
270
|
-
} else {
|
|
271
|
-
getCaptcha();
|
|
272
|
-
}
|
|
198
|
+
getCaptcha();
|
|
273
199
|
});
|
|
274
200
|
};
|
|
275
201
|
const close = () => {
|
|
@@ -287,83 +213,66 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
287
213
|
vue.createTextVNode(" 完成拼图验证 "),
|
|
288
214
|
vue.createElementVNode("div", {
|
|
289
215
|
onClick: refresh,
|
|
290
|
-
class: "slider-captcha-refresh-icon"
|
|
216
|
+
class: "yu-slider-captcha-refresh-icon"
|
|
291
217
|
}, [
|
|
292
218
|
vue.createVNode(vue.unref(iconsVue.RefreshRight))
|
|
293
219
|
]),
|
|
294
220
|
vue.createElementVNode("div", {
|
|
295
221
|
onClick: close,
|
|
296
|
-
class: "slider-captcha-close-icon"
|
|
222
|
+
class: "yu-slider-captcha-close-icon"
|
|
297
223
|
}, [
|
|
298
224
|
vue.createVNode(vue.unref(iconsVue.CircleClose))
|
|
299
225
|
])
|
|
300
226
|
]),
|
|
301
227
|
vue.createElementVNode("div", {
|
|
302
|
-
class: "slider-captcha",
|
|
228
|
+
class: "yu-slider-captcha",
|
|
303
229
|
style: vue.normalizeStyle({ width: _ctx.canvasWidth + "px" }),
|
|
304
230
|
onselectstart: "return false;"
|
|
305
231
|
}, [
|
|
306
232
|
isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
307
233
|
key: 0,
|
|
308
|
-
class: vue.normalizeClass({ "img-loading": isLoading.value }),
|
|
234
|
+
class: vue.normalizeClass({ "yu-slider-captcha-img-loading": isLoading.value }),
|
|
309
235
|
style: vue.normalizeStyle({ height: _ctx.canvasHeight + "px" })
|
|
310
236
|
}, null, 6)) : vue.createCommentVNode("", true),
|
|
311
|
-
|
|
237
|
+
isVerifySuccess.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
312
238
|
key: 1,
|
|
313
239
|
class: "success-hint",
|
|
314
240
|
style: vue.normalizeStyle({ height: _ctx.canvasHeight + "px" })
|
|
315
241
|
}, vue.toDisplayString(successHint.value), 5)) : vue.createCommentVNode("", true),
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
width: _ctx.canvasWidth,
|
|
329
|
-
height: _ctx.canvasHeight
|
|
330
|
-
}, null, 8, _hoisted_4)
|
|
331
|
-
], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
|
|
332
|
-
vue.createElementVNode("img", {
|
|
333
|
-
ref_key: "canvas",
|
|
334
|
-
ref: canvas,
|
|
335
|
-
class: "slide-canvas",
|
|
336
|
-
width: _ctx.canvasWidth,
|
|
337
|
-
height: _ctx.canvasHeight
|
|
338
|
-
}, null, 8, _hoisted_5),
|
|
339
|
-
vue.createElementVNode("img", {
|
|
340
|
-
ref_key: "block",
|
|
341
|
-
ref: block,
|
|
342
|
-
class: vue.normalizeClass(["slide-block", { "verify-fail": verifyFail.value }])
|
|
343
|
-
}, null, 2)
|
|
344
|
-
], 64)),
|
|
242
|
+
vue.createElementVNode("img", {
|
|
243
|
+
ref_key: "canvas",
|
|
244
|
+
ref: canvas,
|
|
245
|
+
class: "yu-slider-captcha-canvas",
|
|
246
|
+
width: _ctx.canvasWidth,
|
|
247
|
+
height: _ctx.canvasHeight
|
|
248
|
+
}, null, 8, _hoisted_3),
|
|
249
|
+
vue.createElementVNode("img", {
|
|
250
|
+
ref_key: "block",
|
|
251
|
+
ref: block,
|
|
252
|
+
class: vue.normalizeClass(["yu-slider-captcha-block", { "is-verify-fail": isVerifyFail.value }])
|
|
253
|
+
}, null, 2),
|
|
345
254
|
vue.createElementVNode("div", {
|
|
346
|
-
class: vue.normalizeClass(["slider", { "verify-active":
|
|
255
|
+
class: vue.normalizeClass(["yu-slider-captcha-slider", { "is-verify-active": isVerifyActive.value, "is-verify-success": isVerifySuccess.value, "is-verify-fail": isVerifyFail.value }])
|
|
347
256
|
}, [
|
|
348
257
|
vue.createElementVNode("div", {
|
|
349
|
-
class: "slider-box
|
|
258
|
+
class: "yu-slider-captcha-slider-box",
|
|
350
259
|
style: vue.normalizeStyle({ width: sliderBoxWidth.value + "px" })
|
|
351
260
|
}, [
|
|
352
261
|
vue.createElementVNode("div", {
|
|
353
|
-
class: "slider-button",
|
|
262
|
+
class: "yu-slider-captcha-slider-button",
|
|
354
263
|
id: "slider-button",
|
|
355
264
|
style: vue.normalizeStyle({ left: sliderButtonLeft.value + "px" })
|
|
356
265
|
}, [
|
|
357
266
|
!isSliderSlide.value ? (vue.openBlock(), vue.createBlock(vue.unref(icons.SliderArrowStatic), {
|
|
358
267
|
key: 0,
|
|
359
|
-
class: "slider-button-icon yu-color-primary"
|
|
268
|
+
class: "yu-slider-captcha-slider-button-icon yu-color-primary"
|
|
360
269
|
})) : (vue.openBlock(), vue.createBlock(vue.unref(icons.SliderArrowSlide), {
|
|
361
270
|
key: 1,
|
|
362
|
-
class: "slider-button-icon yu-color-primary"
|
|
271
|
+
class: "yu-slider-captcha-slider-button-icon yu-color-primary"
|
|
363
272
|
}))
|
|
364
273
|
], 4)
|
|
365
274
|
], 4),
|
|
366
|
-
vue.createElementVNode("span",
|
|
275
|
+
vue.createElementVNode("span", _hoisted_4, vue.toDisplayString(_ctx.sliderHint), 1)
|
|
367
276
|
], 2)
|
|
368
277
|
], 4)
|
|
369
278
|
]);
|
|
@@ -3,12 +3,12 @@ const vue = require("vue");
|
|
|
3
3
|
const SliderCaptcha = require("./SliderCaptcha");
|
|
4
4
|
const _hoisted_1 = {
|
|
5
5
|
key: 0,
|
|
6
|
-
class: "slider-captcha-dialog
|
|
6
|
+
class: "yu-slider-captcha-dialog"
|
|
7
7
|
};
|
|
8
|
-
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "slider-captcha-dialog-modal" }, null, -1);
|
|
9
|
-
const _hoisted_3 = { class: "slider-captcha-dialog-wrapper" };
|
|
10
|
-
const _hoisted_4 = { class: "slider-captcha-dialog slide-up" };
|
|
11
|
-
const _hoisted_5 = { class: "slider-captcha" };
|
|
8
|
+
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "yu-slider-captcha-dialog-modal" }, null, -1);
|
|
9
|
+
const _hoisted_3 = { class: "yu-slider-captcha-dialog-wrapper" };
|
|
10
|
+
const _hoisted_4 = { class: "yu-slider-captcha-dialog yu-slider-captcha-slide-up" };
|
|
11
|
+
const _hoisted_5 = { class: "yu-slider-captcha" };
|
|
12
12
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
13
13
|
...{ name: "YuSliderCaptchaDialog" },
|
|
14
14
|
__name: "index",
|