@lingshugroup/web-plus 2.5.2 → 2.6.1
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/lib/captchaVerify/index.cjs +1 -0
- package/lib/captchaVerify/index.js +12 -0
- package/lib/index/index.cjs +1 -1
- package/lib/index/index.js +54 -52
- package/lib/index/index.js.br +0 -0
- package/lib/index/index.js.gz +0 -0
- package/lib/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.cjs +1 -1
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js +94 -126
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js.br +0 -0
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js.gz +0 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index.cjs +1 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index.js +7 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.cjs +1 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.js +241 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/captchaVerify/types/index.cjs +1 -0
- package/lib/packages/ls-components/components/captchaVerify/types/index.js +37 -0
- package/lib/packages/ls-components/components/index/index.cjs +1 -1
- package/lib/packages/ls-components/components/index/index.js +43 -41
- package/lib/packages/ls-components/components/index/index.js.br +0 -0
- package/lib/packages/ls-components/components/index/index.js.gz +0 -0
- package/package.json +1 -1
package/lib/index.css.br
CHANGED
|
Binary file
|
package/lib/index.css.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var x=Object.defineProperty;var n=(c,v)=>x(c,"name",{value:v,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("../useDelayLoader/index.cjs"),t=require("vue");function E(c,v,M){const{currentPageProp:N=1,pageSizeProp:R=10,isDelayLoader:b=!1,delayLoaderTime:q=300,isFullDose:P=!1,autoFetch:F=!0,hasPanigation:D=!0,dealParams:S,dealData:l,callbackAfter:h}=M||{},y=t.ref(!0),d=t.ref(!1),o=t.ref(N),s=t.ref(R),i=t.ref([]),T=t.ref([]),g=t.ref(0),w=n(e=>{if(D){if(P){let a=e||[],u=a.length;if(l&&typeof l=="function"){const{data:r,total:f=0}=l(e);a=r||[],u=Number(f||0)}T.value=a,g.value=u,m()}else if(l&&typeof l=="function"){const{data:a,total:u=0}=l(e);i.value=a||[],g.value=Number(u||0)}else{const{records:a=[],total:u}=e||{};i.value=a||[],g.value=Number(u)}h&&h(e,{tableData:i,total:g})}else{if(l&&typeof l=="function"){const{data:a}=l(e);i.value=a||[]}else i.value=e;h&&h(e,{})}},"disposeResponseData"),z=n(()=>new Promise((e,a)=>{if(!c){a(new Error("requestFn is required"));return}const u=(typeof v=="function"?v():v)||{};let r={};D?r={currentPage:o.value,pageSize:s.value,...u}:r={...u},S&&(r=S(r)),c(r).then(f=>{b||w(f),e(f)}).catch(f=>{a(f)}).finally(()=>{d.value=!1,setTimeout(()=>{y.value=!1},400)})}),"requestData"),L=A.default(q||300,e=>{w(e)});function m(){i.value=T.value.slice((o.value-1)*s.value,o.value*s.value)}n(m,"sliceTableData");const p=n((e=!0,a=!1)=>{if(c&&!(e&&d.value)){if(e&&(d.value=!0),a&&(y.value=!0),b){L.loadData(z);return}z().finally(()=>{d.value=!1})}},"loadData"),k=n((e,a=!0)=>{o.value=e,a&&(P?m():p())},"handleCurrentPageChange"),C=n(e=>{s.value=e,o.value=1,P?m():p()},"handleSizeChange");t.watch(o,e=>{k(e)}),t.watch(s,e=>{C(e)});const _=n(()=>{o.value=1,t.nextTick(()=>{p()})},"handleReset");return t.onMounted(()=>{F&&(y.value=!0,p())}),{isFirst:y,loading:b?L.loading:d,pageSize:s,currentPage:o,tableData:i,total:g,handleCurrentPageChange:k,handleSizeChange:C,handleReset:_,loadData:p}}n(E,"useTableListHook");exports.default=E;
|
|
@@ -1,146 +1,114 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import
|
|
4
|
-
import { ref as
|
|
5
|
-
function
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var o = (c, v) => M(c, "name", { value: v, configurable: !0 });
|
|
3
|
+
import q from "../useDelayLoader/index.js";
|
|
4
|
+
import { ref as s, watch as N, onMounted as B, nextTick as G } from "vue";
|
|
5
|
+
function O(c, v, R) {
|
|
6
6
|
const {
|
|
7
|
-
currentPageProp:
|
|
8
|
-
pageSizeProp:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
hasPagination: z = !0,
|
|
7
|
+
currentPageProp: x = 1,
|
|
8
|
+
pageSizeProp: F = 10,
|
|
9
|
+
isDelayLoader: y = !1,
|
|
10
|
+
delayLoaderTime: A = 300,
|
|
11
|
+
isFullDose: b = !1,
|
|
12
|
+
autoFetch: E = !0,
|
|
13
|
+
hasPanigation: D = !0,
|
|
15
14
|
dealParams: T,
|
|
16
|
-
dealData:
|
|
17
|
-
callbackAfter:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const P = /* @__PURE__ */ t(() => {
|
|
22
|
-
n.value = (w.value || []).slice(
|
|
23
|
-
(u.value - 1) * i.value,
|
|
24
|
-
u.value * i.value
|
|
25
|
-
);
|
|
26
|
-
}, "sliceTableData"), R = /* @__PURE__ */ t((e) => {
|
|
27
|
-
if (z) {
|
|
28
|
-
if (S) {
|
|
15
|
+
dealData: t,
|
|
16
|
+
callbackAfter: m
|
|
17
|
+
} = R || {}, h = s(!0), d = s(!1), n = s(x), f = s(F), u = s([]), S = s([]), p = s(0), w = /* @__PURE__ */ o((e) => {
|
|
18
|
+
if (D) {
|
|
19
|
+
if (b) {
|
|
29
20
|
let a = e || [], l = a.length;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
a =
|
|
21
|
+
if (t && typeof t == "function") {
|
|
22
|
+
const { data: i, total: r = 0 } = t(e);
|
|
23
|
+
a = i || [], l = Number(r || 0);
|
|
33
24
|
}
|
|
34
|
-
|
|
35
|
-
} else if (
|
|
36
|
-
const a =
|
|
37
|
-
|
|
25
|
+
S.value = a, p.value = l, P();
|
|
26
|
+
} else if (t && typeof t == "function") {
|
|
27
|
+
const { data: a, total: l = 0 } = t(e);
|
|
28
|
+
u.value = a || [], p.value = Number(l || 0);
|
|
38
29
|
} else {
|
|
39
30
|
const { records: a = [], total: l } = e || {};
|
|
40
|
-
|
|
31
|
+
u.value = a || [], p.value = Number(l);
|
|
41
32
|
}
|
|
42
|
-
|
|
33
|
+
m && m(e, { tableData: u, total: p });
|
|
43
34
|
} else {
|
|
44
|
-
if (
|
|
45
|
-
const a =
|
|
46
|
-
|
|
35
|
+
if (t && typeof t == "function") {
|
|
36
|
+
const { data: a } = t(e);
|
|
37
|
+
u.value = a || [];
|
|
47
38
|
} else
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
u.value = e;
|
|
40
|
+
m && m(e, {});
|
|
50
41
|
}
|
|
51
|
-
}, "disposeResponseData"),
|
|
52
|
-
if (!
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const e = typeof g == "function" ? g() : g || {};
|
|
56
|
-
let a = {};
|
|
57
|
-
z ? a = {
|
|
58
|
-
currentPage: u.value,
|
|
59
|
-
pageSize: i.value,
|
|
60
|
-
...e,
|
|
61
|
-
...f.value
|
|
62
|
-
} : a = {
|
|
63
|
-
...e,
|
|
64
|
-
...f.value
|
|
65
|
-
}, T && (a = T(a));
|
|
66
|
-
try {
|
|
67
|
-
const l = await d(a);
|
|
68
|
-
return R(l), l;
|
|
69
|
-
} catch (l) {
|
|
70
|
-
throw v.value = (l == null ? void 0 : l.message) || "请求失败", l;
|
|
42
|
+
}, "disposeResponseData"), z = /* @__PURE__ */ o(() => new Promise((e, a) => {
|
|
43
|
+
if (!c) {
|
|
44
|
+
a(new Error("requestFn is required"));
|
|
45
|
+
return;
|
|
71
46
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
const l = (typeof v == "function" ? v() : v) || {};
|
|
48
|
+
let i = {};
|
|
49
|
+
D ? i = {
|
|
50
|
+
currentPage: n.value,
|
|
51
|
+
pageSize: f.value,
|
|
52
|
+
...l
|
|
53
|
+
} : i = {
|
|
54
|
+
...l
|
|
55
|
+
}, T && (i = T(i)), c(i).then((r) => {
|
|
56
|
+
y || w(r), e(r);
|
|
57
|
+
}).catch((r) => {
|
|
58
|
+
a(r);
|
|
59
|
+
}).finally(() => {
|
|
60
|
+
d.value = !1, setTimeout(() => {
|
|
61
|
+
h.value = !1;
|
|
62
|
+
}, 400);
|
|
63
|
+
});
|
|
64
|
+
}), "requestData"), L = q(A || 300, (e) => {
|
|
65
|
+
w(e);
|
|
66
|
+
});
|
|
67
|
+
function P() {
|
|
68
|
+
u.value = S.value.slice((n.value - 1) * f.value, n.value * f.value);
|
|
69
|
+
}
|
|
70
|
+
o(P, "sliceTableData");
|
|
71
|
+
const g = /* @__PURE__ */ o((e = !0, a = !1) => {
|
|
72
|
+
if (c && !(e && d.value)) {
|
|
73
|
+
if (e && (d.value = !0), a && (h.value = !0), y) {
|
|
74
|
+
L.loadData(z);
|
|
78
75
|
return;
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
p.value = !1, setTimeout(() => {
|
|
84
|
-
m.value = !1;
|
|
85
|
-
}, 400);
|
|
86
|
-
}
|
|
77
|
+
z().finally(() => {
|
|
78
|
+
d.value = !1;
|
|
79
|
+
});
|
|
87
80
|
}
|
|
88
|
-
}, "loadData"),
|
|
89
|
-
|
|
90
|
-
}, "
|
|
91
|
-
|
|
92
|
-
}, "
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
}, "loadData"), k = /* @__PURE__ */ o((e, a = !0) => {
|
|
82
|
+
n.value = e, a && (b ? P() : g());
|
|
83
|
+
}, "handleCurrentPageChange"), C = /* @__PURE__ */ o((e) => {
|
|
84
|
+
f.value = e, n.value = 1, b ? P() : g();
|
|
85
|
+
}, "handleSizeChange");
|
|
86
|
+
N(n, (e) => {
|
|
87
|
+
k(e);
|
|
88
|
+
}), N(f, (e) => {
|
|
89
|
+
C(e);
|
|
90
|
+
});
|
|
91
|
+
const H = /* @__PURE__ */ o(() => {
|
|
92
|
+
n.value = 1, G(() => {
|
|
93
|
+
g();
|
|
97
94
|
});
|
|
98
|
-
}, "handleReset")
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
C.value = [];
|
|
102
|
-
}, "clearSelectedRows"), Q = /* @__PURE__ */ t((e) => {
|
|
103
|
-
f.value = { ...b, ...e };
|
|
104
|
-
}, "setSearchParams"), V = /* @__PURE__ */ t((e, a = !0) => {
|
|
105
|
-
e && (f.value = { ...b, ...e }), a && (u.value = 1), r();
|
|
106
|
-
}, "search"), W = /* @__PURE__ */ t(() => {
|
|
107
|
-
f.value = { ...b }, u.value = 1, r();
|
|
108
|
-
}, "resetSearch"), q = /* @__PURE__ */ t(() => {
|
|
109
|
-
y && (y.abort(), y = null, p.value = !1, v.value = "请求已取消");
|
|
110
|
-
}, "abort");
|
|
111
|
-
return A(u, (e) => {
|
|
112
|
-
F(e);
|
|
113
|
-
}), A(i, (e) => {
|
|
114
|
-
N(e);
|
|
115
|
-
}), Z(() => {
|
|
116
|
-
B && (m.value = !0, r());
|
|
117
|
-
}), _(() => {
|
|
118
|
-
q();
|
|
95
|
+
}, "handleReset");
|
|
96
|
+
return B(() => {
|
|
97
|
+
E && (h.value = !0, g());
|
|
119
98
|
}), {
|
|
120
|
-
isFirst:
|
|
121
|
-
loading:
|
|
122
|
-
pageSize:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
handleCurrentPageChange: F,
|
|
131
|
-
handleSizeChange: N,
|
|
132
|
-
handleReset: J,
|
|
133
|
-
loadData: r,
|
|
134
|
-
refresh: I,
|
|
135
|
-
clearData: K,
|
|
136
|
-
clearSelectedRows: O,
|
|
137
|
-
search: V,
|
|
138
|
-
resetSearch: W,
|
|
139
|
-
setSearchParams: Q,
|
|
140
|
-
abort: q
|
|
99
|
+
isFirst: h,
|
|
100
|
+
loading: y ? L.loading : d,
|
|
101
|
+
pageSize: f,
|
|
102
|
+
currentPage: n,
|
|
103
|
+
tableData: u,
|
|
104
|
+
total: p,
|
|
105
|
+
handleCurrentPageChange: k,
|
|
106
|
+
handleSizeChange: C,
|
|
107
|
+
handleReset: H,
|
|
108
|
+
loadData: g
|
|
141
109
|
};
|
|
142
110
|
}
|
|
143
|
-
|
|
111
|
+
o(O, "useTableListHook");
|
|
144
112
|
export {
|
|
145
|
-
|
|
113
|
+
O as default
|
|
146
114
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=/* empty css */u=t.default(e.default,[["__scopeId","data-v-e4fa634d"]]);exports.default=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var W=Object.defineProperty;var l=(v,V)=>W(v,"name",{value:V,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),j=require("../types/index.cjs"),G={key:0,class:"captcha-loading-mask","aria-live":"polite"},Z={key:0,class:"captcha-overlay"},J={class:"captcha-overlay-icon"},K={class:"captcha-overlay-text"},O={class:"captcha-prompt"},Q=["aria-valuenow","aria-disabled"],Y={key:0,class:"captcha-slider-hint"},ee={class:"captcha-actions"},te=["disabled"],ae={class:"captcha-serial-text"},ne=e.defineComponent({name:"LSCaptchaVerify"}),oe=e.defineComponent({...ne,name:"LSCaptchaVerify",inheritAttrs:!1,props:e.mergeModels(j.lsCaptchaVerifyProps,{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:e.mergeModels(["refresh","select"],["update:modelValue"]),setup(v,{emit:V}){const o=v,C=V,h=e.useModel(v,"modelValue"),g=60,T=.06,p=e.ref(),k=e.ref(),r=e.ref(!1),s=e.ref(0),f=e.ref(0),b=e.ref(0),i=e.ref([]),w=e.ref(!1);let n=null;const E=e.computed(()=>o.sceneSeed||Date.now()),N=[{bg:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",piece:"rgba(102,126,234,0.7)"},{bg:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",piece:"rgba(245,87,108,0.7)"},{bg:"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",piece:"rgba(79,172,254,0.7)"},{bg:"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)",piece:"rgba(67,233,123,0.7)"},{bg:"linear-gradient(135deg, #fa709a 0%, #fee140 100%)",piece:"rgba(250,112,154,0.7)"},{bg:"linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%)",piece:"rgba(161,140,209,0.7)"},{bg:"linear-gradient(135deg, #fccb90 0%, #d57eeb 100%)",piece:"rgba(213,126,235,0.7)"},{bg:"linear-gradient(135deg, #96fbc4 0%, #f9f586 100%)",piece:"rgba(150,251,196,0.7)"}],M=["6px","50%","12px 4px","20px 6px 20px 6px","4px 16px","50% 4px 50% 4px","16px 4px 4px 16px","30% 70% 70% 30% / 30% 30% 70% 70%"],L=e.computed(()=>E.value%N.length),P=e.computed(()=>Math.floor(E.value/7)%M.length),B=e.computed(()=>E.value%4*90),_=e.computed(()=>30+E.value%40),z=e.computed(()=>({background:N[L.value].bg})),S=e.computed(()=>Math.max(.15,Math.min(.85,o.targetPercent))),d=e.computed(()=>f.value?Math.min(1,Math.max(0,s.value/f.value)):0),I=e.computed(()=>({left:`${S.value*100}%`,top:`${_.value}%`,width:`${g}px`,height:`${g}px`,borderRadius:M[P.value],transform:`translate(-50%, -50%) rotate(${B.value}deg)`})),F=e.computed(()=>({left:`${d.value*100}%`,top:`${_.value}%`,width:`${g}px`,height:`${g}px`,borderRadius:M[P.value],background:N[L.value].piece,transform:`translate(-50%, -50%) rotate(${B.value}deg)`})),X=e.computed(()=>({transform:`translateX(${s.value}px)`})),A=e.computed(()=>({width:`${s.value+40}px`}));function m(){const t=p.value;t&&(f.value=Math.max(0,t.clientWidth-40))}l(m,"updateMaxDrag");function $(){window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y)}l($,"detachWindowPointerListeners");function q(t){const a=k.value;if(a!=null&&a.hasPointerCapture(t.pointerId))try{a.releasePointerCapture(t.pointerId)}catch{}}l(q,"releaseThumbCapture");function c(){$(),r.value=!1,w.value=!1,s.value=0,b.value=0,i.value=[]}l(c,"resetDrag");function H(t){if(o.loading||o.status==="success"||t.button!==0)return;m(),r.value=!0,w.value=!1,s.value=0,b.value=performance.now(),i.value=[{x:0,t:0}],t.currentTarget.setPointerCapture(t.pointerId),window.addEventListener("pointermove",R),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y)}l(H,"onPointerDown");function R(t){if(!r.value||!p.value)return;const a=p.value.getBoundingClientRect(),u=t.clientX-a.left-20;s.value=Math.min(Math.max(0,u),f.value);const x=Math.round(performance.now()-b.value),D=i.value[i.value.length-1];(!D||x-D.t>=16)&&i.value.push({x:Number(d.value.toFixed(4)),t:x})}l(R,"onPointerMove");function y(t){if($(),q(t),!r.value)return;if(r.value=!1,Math.abs(d.value-S.value)>T){w.value=!0,setTimeout(c,300);return}s.value=S.value*f.value;const u=Math.max(1,Math.round(performance.now()-b.value));i.value.push({x:Number(d.value.toFixed(4)),t:u}),C("select",{dragPercent:Number(d.value.toFixed(4)),durationMs:u,trace:i.value.slice(-300)})}l(y,"onPointerEnd");function U(){c(),C("refresh")}return l(U,"onRefresh"),e.watch(()=>[o.status,o.loading],([t,a])=>{(t==="error"||t==="idle"&&!a)&&c()}),e.watch(()=>[o.serialNo,o.sceneSeed],()=>{h.value&&c()}),e.watch(h,t=>{t?e.nextTick(()=>{m();const a=p.value;a&&typeof ResizeObserver<"u"&&(n==null||n.disconnect(),n=new ResizeObserver(()=>m()),n.observe(a))}):(n==null||n.disconnect(),n=null,c())}),e.onMounted(()=>{window.addEventListener("resize",m)}),e.onBeforeUnmount(()=>{n==null||n.disconnect(),n=null,window.removeEventListener("resize",m),c()}),(t,a)=>{const u=e.resolveComponent("LSDialog");return e.openBlock(),e.createBlock(u,{modelValue:h.value,"onUpdate:modelValue":a[0]||(a[0]=x=>h.value=x),title:"安全验证",width:"420px","has-footer":!1,"destroy-on-close":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["captcha-wrap",{"is-slider-dragging":e.unref(r)}])},[t.loading?(e.openBlock(),e.createElementBlock("div",G,a[1]||(a[1]=[e.createElementVNode("span",{class:"captcha-loading-dot"},null,-1),e.createElementVNode("span",null,"验证中…",-1)]))):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["captcha-scene",`is-${t.status}`]),style:e.normalizeStyle(e.unref(z))},[e.createElementVNode("div",{class:"captcha-hole",style:e.normalizeStyle(e.unref(I))},null,4),e.createElementVNode("div",{class:"captcha-piece",style:e.normalizeStyle(e.unref(F))},null,4),t.status!=="idle"?(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("span",J,e.toDisplayString(t.status==="success"?"✓":"✗"),1),e.createElementVNode("span",K,e.toDisplayString(t.status==="success"?"验证通过":"验证失败,请重试"),1)])):e.createCommentVNode("",!0)],6),e.createElementVNode("div",O,e.toDisplayString(o.prompt),1),e.createElementVNode("div",{ref_key:"sliderRef",ref:p,class:e.normalizeClass(["captcha-slider",{"is-dragging":e.unref(r),"is-fail":e.unref(w),"is-loading":t.loading,"is-success":t.status==="success","is-error":t.status==="error"}]),role:"slider","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.unref(d)*100),"aria-disabled":t.loading||t.status==="success"},[e.createElementVNode("div",{class:"captcha-slider-fill",style:e.normalizeStyle(e.unref(A))},null,4),e.createElementVNode("div",{ref_key:"thumbRef",ref:k,class:"captcha-slider-thumb",style:e.normalizeStyle(e.unref(X)),onPointerdown:e.withModifiers(H,["prevent"])},a[2]||(a[2]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2.5"},[e.createElementVNode("path",{d:"M9 18l6-6-6-6"}),e.createElementVNode("path",{d:"M4 18l6-6-6-6"})],-1)]),36),!e.unref(r)&&t.status==="idle"&&e.unref(s)===0?(e.openBlock(),e.createElementBlock("span",Y," 向右拖动滑块完成拼图 ")):e.createCommentVNode("",!0)],10,Q),e.createElementVNode("div",ee,[e.createElementVNode("button",{type:"button",class:"captcha-action-btn",disabled:t.loading,onClick:U},a[3]||(a[3]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M1 4v6h6"}),e.createElementVNode("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})],-1),e.createTextVNode(" 换一张 ",-1)]),8,te),e.createElementVNode("span",ae,e.toDisplayString(t.serialNo),1)])],2)]),_:1},8,["modelValue"])}}});exports.default=oe;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var i = (w, $) => ne(w, "name", { value: $, configurable: !0 });
|
|
3
|
+
import { defineComponent as j, mergeModels as Z, useModel as se, ref as d, computed as s, watch as B, nextTick as oe, onMounted as le, onBeforeUnmount as ie, resolveComponent as re, createBlock as ce, openBlock as L, withCtx as de, createElementVNode as a, normalizeClass as N, unref as o, createElementBlock as T, createCommentVNode as D, normalizeStyle as b, toDisplayString as P, withModifiers as ue, createTextVNode as pe } from "vue";
|
|
4
|
+
import { lsCaptchaVerifyProps as ve } from "../types/index.js";
|
|
5
|
+
const fe = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "captcha-loading-mask",
|
|
8
|
+
"aria-live": "polite"
|
|
9
|
+
}, he = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "captcha-overlay"
|
|
12
|
+
}, ge = { class: "captcha-overlay-icon" }, me = { class: "captcha-overlay-text" }, be = { class: "captcha-prompt" }, we = ["aria-valuenow", "aria-disabled"], xe = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "captcha-slider-hint"
|
|
15
|
+
}, ye = { class: "captcha-actions" }, Me = ["disabled"], Ee = { class: "captcha-serial-text" }, Ce = j({
|
|
16
|
+
name: "LSCaptchaVerify"
|
|
17
|
+
}), Pe = /* @__PURE__ */ j({
|
|
18
|
+
...Ce,
|
|
19
|
+
name: "LSCaptchaVerify",
|
|
20
|
+
inheritAttrs: !1,
|
|
21
|
+
props: /* @__PURE__ */ Z(ve, {
|
|
22
|
+
modelValue: { type: Boolean, default: !1 },
|
|
23
|
+
modelModifiers: {}
|
|
24
|
+
}),
|
|
25
|
+
emits: /* @__PURE__ */ Z(["refresh", "select"], ["update:modelValue"]),
|
|
26
|
+
setup(w, { emit: $ }) {
|
|
27
|
+
const l = w, I = $, x = se(w, "modelValue"), y = 60, q = 0.06, h = d(), F = d(), r = d(!1), c = d(0), g = d(0), M = d(0), u = d([]), E = d(!1);
|
|
28
|
+
let n = null;
|
|
29
|
+
const C = s(() => l.sceneSeed || Date.now()), R = [
|
|
30
|
+
{ bg: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)", piece: "rgba(102,126,234,0.7)" },
|
|
31
|
+
{ bg: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)", piece: "rgba(245,87,108,0.7)" },
|
|
32
|
+
{ bg: "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)", piece: "rgba(79,172,254,0.7)" },
|
|
33
|
+
{ bg: "linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)", piece: "rgba(67,233,123,0.7)" },
|
|
34
|
+
{ bg: "linear-gradient(135deg, #fa709a 0%, #fee140 100%)", piece: "rgba(250,112,154,0.7)" },
|
|
35
|
+
{ bg: "linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%)", piece: "rgba(161,140,209,0.7)" },
|
|
36
|
+
{ bg: "linear-gradient(135deg, #fccb90 0%, #d57eeb 100%)", piece: "rgba(213,126,235,0.7)" },
|
|
37
|
+
{ bg: "linear-gradient(135deg, #96fbc4 0%, #f9f586 100%)", piece: "rgba(150,251,196,0.7)" }
|
|
38
|
+
], V = [
|
|
39
|
+
"6px",
|
|
40
|
+
"50%",
|
|
41
|
+
"12px 4px",
|
|
42
|
+
"20px 6px 20px 6px",
|
|
43
|
+
"4px 16px",
|
|
44
|
+
"50% 4px 50% 4px",
|
|
45
|
+
"16px 4px 4px 16px",
|
|
46
|
+
"30% 70% 70% 30% / 30% 30% 70% 70%"
|
|
47
|
+
], X = s(() => C.value % R.length), A = s(() => Math.floor(C.value / 7) % V.length), H = s(() => C.value % 4 * 90), U = s(() => 30 + C.value % 40), J = s(() => ({
|
|
48
|
+
background: R[X.value].bg
|
|
49
|
+
})), _ = s(() => Math.max(0.15, Math.min(0.85, l.targetPercent))), v = s(() => g.value ? Math.min(1, Math.max(0, c.value / g.value)) : 0), K = s(() => ({
|
|
50
|
+
left: `${_.value * 100}%`,
|
|
51
|
+
top: `${U.value}%`,
|
|
52
|
+
width: `${y}px`,
|
|
53
|
+
height: `${y}px`,
|
|
54
|
+
borderRadius: V[A.value],
|
|
55
|
+
transform: `translate(-50%, -50%) rotate(${H.value}deg)`
|
|
56
|
+
})), Q = s(() => ({
|
|
57
|
+
left: `${v.value * 100}%`,
|
|
58
|
+
top: `${U.value}%`,
|
|
59
|
+
width: `${y}px`,
|
|
60
|
+
height: `${y}px`,
|
|
61
|
+
borderRadius: V[A.value],
|
|
62
|
+
background: R[X.value].piece,
|
|
63
|
+
transform: `translate(-50%, -50%) rotate(${H.value}deg)`
|
|
64
|
+
})), Y = s(() => ({
|
|
65
|
+
transform: `translateX(${c.value}px)`
|
|
66
|
+
})), O = s(() => ({
|
|
67
|
+
width: `${c.value + 40}px`
|
|
68
|
+
}));
|
|
69
|
+
function m() {
|
|
70
|
+
const e = h.value;
|
|
71
|
+
e && (g.value = Math.max(0, e.clientWidth - 40));
|
|
72
|
+
}
|
|
73
|
+
i(m, "updateMaxDrag");
|
|
74
|
+
function W() {
|
|
75
|
+
window.removeEventListener("pointermove", z), window.removeEventListener("pointerup", k), window.removeEventListener("pointercancel", k);
|
|
76
|
+
}
|
|
77
|
+
i(W, "detachWindowPointerListeners");
|
|
78
|
+
function ee(e) {
|
|
79
|
+
const t = F.value;
|
|
80
|
+
if (t != null && t.hasPointerCapture(e.pointerId))
|
|
81
|
+
try {
|
|
82
|
+
t.releasePointerCapture(e.pointerId);
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
i(ee, "releaseThumbCapture");
|
|
87
|
+
function p() {
|
|
88
|
+
W(), r.value = !1, E.value = !1, c.value = 0, M.value = 0, u.value = [];
|
|
89
|
+
}
|
|
90
|
+
i(p, "resetDrag");
|
|
91
|
+
function te(e) {
|
|
92
|
+
if (l.loading || l.status === "success" || e.button !== 0)
|
|
93
|
+
return;
|
|
94
|
+
m(), r.value = !0, E.value = !1, c.value = 0, M.value = performance.now(), u.value = [{ x: 0, t: 0 }], e.currentTarget.setPointerCapture(e.pointerId), window.addEventListener("pointermove", z), window.addEventListener("pointerup", k), window.addEventListener("pointercancel", k);
|
|
95
|
+
}
|
|
96
|
+
i(te, "onPointerDown");
|
|
97
|
+
function z(e) {
|
|
98
|
+
if (!r.value || !h.value)
|
|
99
|
+
return;
|
|
100
|
+
const t = h.value.getBoundingClientRect(), f = e.clientX - t.left - 20;
|
|
101
|
+
c.value = Math.min(Math.max(0, f), g.value);
|
|
102
|
+
const S = Math.round(performance.now() - M.value), G = u.value[u.value.length - 1];
|
|
103
|
+
(!G || S - G.t >= 16) && u.value.push({ x: Number(v.value.toFixed(4)), t: S });
|
|
104
|
+
}
|
|
105
|
+
i(z, "onPointerMove");
|
|
106
|
+
function k(e) {
|
|
107
|
+
if (W(), ee(e), !r.value)
|
|
108
|
+
return;
|
|
109
|
+
if (r.value = !1, Math.abs(v.value - _.value) > q) {
|
|
110
|
+
E.value = !0, setTimeout(p, 300);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
c.value = _.value * g.value;
|
|
114
|
+
const f = Math.max(1, Math.round(performance.now() - M.value));
|
|
115
|
+
u.value.push({ x: Number(v.value.toFixed(4)), t: f }), I("select", {
|
|
116
|
+
dragPercent: Number(v.value.toFixed(4)),
|
|
117
|
+
durationMs: f,
|
|
118
|
+
trace: u.value.slice(-300)
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
i(k, "onPointerEnd");
|
|
122
|
+
function ae() {
|
|
123
|
+
p(), I("refresh");
|
|
124
|
+
}
|
|
125
|
+
return i(ae, "onRefresh"), B(() => [l.status, l.loading], ([e, t]) => {
|
|
126
|
+
(e === "error" || e === "idle" && !t) && p();
|
|
127
|
+
}), B(() => [l.serialNo, l.sceneSeed], () => {
|
|
128
|
+
x.value && p();
|
|
129
|
+
}), B(x, (e) => {
|
|
130
|
+
e ? oe(() => {
|
|
131
|
+
m();
|
|
132
|
+
const t = h.value;
|
|
133
|
+
t && typeof ResizeObserver < "u" && (n == null || n.disconnect(), n = new ResizeObserver(() => m()), n.observe(t));
|
|
134
|
+
}) : (n == null || n.disconnect(), n = null, p());
|
|
135
|
+
}), le(() => {
|
|
136
|
+
window.addEventListener("resize", m);
|
|
137
|
+
}), ie(() => {
|
|
138
|
+
n == null || n.disconnect(), n = null, window.removeEventListener("resize", m), p();
|
|
139
|
+
}), (e, t) => {
|
|
140
|
+
const f = re("LSDialog");
|
|
141
|
+
return L(), ce(f, {
|
|
142
|
+
modelValue: x.value,
|
|
143
|
+
"onUpdate:modelValue": t[0] || (t[0] = (S) => x.value = S),
|
|
144
|
+
title: "安全验证",
|
|
145
|
+
width: "420px",
|
|
146
|
+
"has-footer": !1,
|
|
147
|
+
"destroy-on-close": ""
|
|
148
|
+
}, {
|
|
149
|
+
default: de(() => [
|
|
150
|
+
a("div", {
|
|
151
|
+
class: N(["captcha-wrap", { "is-slider-dragging": o(r) }])
|
|
152
|
+
}, [
|
|
153
|
+
e.loading ? (L(), T("div", fe, t[1] || (t[1] = [
|
|
154
|
+
a("span", { class: "captcha-loading-dot" }, null, -1),
|
|
155
|
+
a("span", null, "验证中…", -1)
|
|
156
|
+
]))) : D("", !0),
|
|
157
|
+
a("div", {
|
|
158
|
+
class: N(["captcha-scene", `is-${e.status}`]),
|
|
159
|
+
style: b(o(J))
|
|
160
|
+
}, [
|
|
161
|
+
a("div", {
|
|
162
|
+
class: "captcha-hole",
|
|
163
|
+
style: b(o(K))
|
|
164
|
+
}, null, 4),
|
|
165
|
+
a("div", {
|
|
166
|
+
class: "captcha-piece",
|
|
167
|
+
style: b(o(Q))
|
|
168
|
+
}, null, 4),
|
|
169
|
+
e.status !== "idle" ? (L(), T("div", he, [
|
|
170
|
+
a("span", ge, P(e.status === "success" ? "✓" : "✗"), 1),
|
|
171
|
+
a("span", me, P(e.status === "success" ? "验证通过" : "验证失败,请重试"), 1)
|
|
172
|
+
])) : D("", !0)
|
|
173
|
+
], 6),
|
|
174
|
+
a("div", be, P(l.prompt), 1),
|
|
175
|
+
a("div", {
|
|
176
|
+
ref_key: "sliderRef",
|
|
177
|
+
ref: h,
|
|
178
|
+
class: N(["captcha-slider", { "is-dragging": o(r), "is-fail": o(E), "is-loading": e.loading, "is-success": e.status === "success", "is-error": e.status === "error" }]),
|
|
179
|
+
role: "slider",
|
|
180
|
+
"aria-valuemin": 0,
|
|
181
|
+
"aria-valuemax": 100,
|
|
182
|
+
"aria-valuenow": Math.round(o(v) * 100),
|
|
183
|
+
"aria-disabled": e.loading || e.status === "success"
|
|
184
|
+
}, [
|
|
185
|
+
a("div", {
|
|
186
|
+
class: "captcha-slider-fill",
|
|
187
|
+
style: b(o(O))
|
|
188
|
+
}, null, 4),
|
|
189
|
+
a("div", {
|
|
190
|
+
ref_key: "thumbRef",
|
|
191
|
+
ref: F,
|
|
192
|
+
class: "captcha-slider-thumb",
|
|
193
|
+
style: b(o(Y)),
|
|
194
|
+
onPointerdown: ue(te, ["prevent"])
|
|
195
|
+
}, t[2] || (t[2] = [
|
|
196
|
+
a("svg", {
|
|
197
|
+
viewBox: "0 0 24 24",
|
|
198
|
+
width: "20",
|
|
199
|
+
height: "20",
|
|
200
|
+
fill: "none",
|
|
201
|
+
stroke: "currentColor",
|
|
202
|
+
"stroke-width": "2.5"
|
|
203
|
+
}, [
|
|
204
|
+
a("path", { d: "M9 18l6-6-6-6" }),
|
|
205
|
+
a("path", { d: "M4 18l6-6-6-6" })
|
|
206
|
+
], -1)
|
|
207
|
+
]), 36),
|
|
208
|
+
!o(r) && e.status === "idle" && o(c) === 0 ? (L(), T("span", xe, " 向右拖动滑块完成拼图 ")) : D("", !0)
|
|
209
|
+
], 10, we),
|
|
210
|
+
a("div", ye, [
|
|
211
|
+
a("button", {
|
|
212
|
+
type: "button",
|
|
213
|
+
class: "captcha-action-btn",
|
|
214
|
+
disabled: e.loading,
|
|
215
|
+
onClick: ae
|
|
216
|
+
}, t[3] || (t[3] = [
|
|
217
|
+
a("svg", {
|
|
218
|
+
viewBox: "0 0 24 24",
|
|
219
|
+
width: "16",
|
|
220
|
+
height: "16",
|
|
221
|
+
fill: "none",
|
|
222
|
+
stroke: "currentColor",
|
|
223
|
+
"stroke-width": "2"
|
|
224
|
+
}, [
|
|
225
|
+
a("path", { d: "M1 4v6h6" }),
|
|
226
|
+
a("path", { d: "M3.51 15a9 9 0 1 0 2.13-9.36L1 10" })
|
|
227
|
+
], -1),
|
|
228
|
+
pe(" 换一张 ", -1)
|
|
229
|
+
]), 8, Me),
|
|
230
|
+
a("span", Ee, P(e.serialNo), 1)
|
|
231
|
+
])
|
|
232
|
+
], 2)
|
|
233
|
+
]),
|
|
234
|
+
_: 1
|
|
235
|
+
}, 8, ["modelValue"]);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
export {
|
|
240
|
+
Pe as default
|
|
241
|
+
};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_utils/runtime/index.cjs"),t=e.buildProps({loading:{type:Boolean,default:!1},prompt:{type:String,default:"按住滑块拖动拼图到缺口处"},targetPercent:{type:Number,default:.5},status:{type:String,values:["idle","error","success"],default:"idle"},sceneSeed:{type:Number,default:0},serialNo:{type:String,default:""}});exports.lsCaptchaVerifyProps=t;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { buildProps as e } from "../../_utils/runtime/index.js";
|
|
2
|
+
const r = e({
|
|
3
|
+
/** 验证中 loading 状态 */
|
|
4
|
+
loading: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: !1
|
|
7
|
+
},
|
|
8
|
+
/** 提示文案 */
|
|
9
|
+
prompt: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "按住滑块拖动拼图到缺口处"
|
|
12
|
+
},
|
|
13
|
+
/** 缺口目标位置百分比(0-1) */
|
|
14
|
+
targetPercent: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 0.5
|
|
17
|
+
},
|
|
18
|
+
/** 验证状态 */
|
|
19
|
+
status: {
|
|
20
|
+
type: String,
|
|
21
|
+
values: ["idle", "error", "success"],
|
|
22
|
+
default: "idle"
|
|
23
|
+
},
|
|
24
|
+
/** 场景种子,用于生成不同主题和形状 */
|
|
25
|
+
sceneSeed: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 0
|
|
28
|
+
},
|
|
29
|
+
/** 验证码序列号 */
|
|
30
|
+
serialNo: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ""
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
r as lsCaptchaVerifyProps
|
|
37
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var o=(t,r)=>a(t,"name",{value:r,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@element-plus/icons-vue"),s=require("../../../../backTop/index.cjs"),d=require("../../../../bellMessage/index.cjs"),f=require("../../../../breadcrumb/index.cjs"),i=require("../../../../button/index.cjs"),S=require("../../../../captchaVerify/index.cjs"),L=require("../../../../chart/index.cjs"),p=require("../../../../confirm/index.cjs"),q=require("../../../../containerBox/index.cjs"),m=require("../../../../cropper/index.cjs"),b=require("../../../../descriptions/index.cjs"),g=require("../../../../dialog/index.cjs"),v=require("../../../../downloadFile/index.cjs"),P=require("../../../../editor/index.cjs"),c=require("../../../../form/index.cjs"),w=require("../../../../icon/index.cjs"),y=require("../../../../layout/index.cjs"),B=require("../../../../list/index.cjs"),_=require("../../../../live/index.cjs"),O=require("../../../../map/index.cjs"),j=require("../../../../menu/index.cjs"),x=require("../../../../preview_docx/index.cjs"),M=require("../../../../preview_image/index.cjs"),T=require("../../../../preview_pdf/index.cjs"),k=require("../../../../preview_xlsx/index.cjs"),D=require("../../../../print/index.cjs"),F=require("../../../../table/index.cjs"),I=require("../../../../tooltip/index.cjs"),C=require("../../../../tree/index.cjs"),h=require("../../../../upload/index.cjs");function V(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:o(()=>t[e],"get")})}}return r.default=t,Object.freeze(r)}o(V,"_interopNamespaceDefault");const E=V(l),u={LSButtonGroup:i.LSButtonGroup,LSButton:i.LSButton,LSDescriptions:b.default,LSUpload:h.default,LSForm:c.LSForm,LSFormItem:c.LSFormItem,LSTable:F.default,LSMenu:j.default,LSIcon:w.default,LSConfirm:p.default,LSChart:L.default,LSBreadcrumb:f.default,LSBellMessage:d.default,LSLive:_.default,LSTree:C.default,LSPrint:D.default,LSContainerBox:q.default,LSBackTop:s.default,LSMap:O.default,LSEditor:P.default,LSDialog:g.default,LSLayout:y.default,LSList:B.default,LSPreviewImage:M.default,LSPreviewDocx:x.default,LSPreviewPdf:T.default,LSPreviewXlsx:k.default,LSDownloadFile:v.default,LSTooltip:I.default,LSCropper:m.default,LSCaptchaVerify:S.default};function G(t){for(const[r,e]of Object.entries(E))t.component(r,e);for(const r of Object.keys(u)){const e=u[r];t.component(e==null?void 0:e.name,e)}}o(G,"install");const z={...u,install:G};exports.default=z;
|