@lingshugroup/web-plus 2.6.2 → 2.6.3
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/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/captchaVerify/Index.vue/index2.js +135 -120
- 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/upload/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/upload/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js +222 -217
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/upload/Index.vue/index2.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";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-
|
|
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-2943f7be"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2943f7be"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Z=Object.defineProperty;var l=(b,N)=>Z(b,"name",{value:N,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),J=require("../../../../../dialog/index.cjs"),K=require("../types/index.cjs"),Q={key:0,class:"captcha-loading-mask","aria-live":"polite"},Y={key:0,class:"captcha-overlay"},ee={class:"captcha-overlay-icon"},te={class:"captcha-overlay-text"},ae={class:"captcha-prompt"},ne=["aria-valuenow","aria-disabled"],oe={key:0,class:"captcha-slider-hint"},le={class:"captcha-actions"},re=["disabled"],se={class:"captcha-serial-text"},ie=e.defineComponent({name:"LSCaptchaVerify"}),ce=e.defineComponent({...ie,name:"LSCaptchaVerify",inheritAttrs:!1,props:e.mergeModels(K.lsCaptchaVerifyProps,{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:e.mergeModels(["refresh","select"],["update:modelValue"]),setup(b,{emit:N}){const r=b,P=N,E=e.useModel(b,"modelValue"),c=60,_=.95,W=c*(1-_),S=e.ref(),d=e.ref(),B=e.ref(),s=e.ref(!1),i=e.ref(0),v=e.ref(0),k=e.ref(0),w=e.ref(0),u=e.ref([]),y=e.ref(!1);let n=null;const V=e.computed(()=>r.sceneSeed||Date.now()),C=[{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)"}],R=["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%"],$=e.computed(()=>V.value%C.length),L=e.computed(()=>Math.floor(V.value/7)%R.length),D=e.computed(()=>V.value%4*90),T=e.computed(()=>30+V.value%40),A=e.computed(()=>({background:C[$.value].bg})),x=e.computed(()=>Math.max(.15,Math.min(.85,r.targetPercent))),p=e.computed(()=>v.value?Math.min(1,Math.max(0,i.value/v.value)):0),X=e.computed(()=>({left:`${x.value*100}%`,top:`${T.value}%`,width:`${c}px`,height:`${c}px`,borderRadius:R[L.value],transform:`translate(-50%, -50%) rotate(${D.value}deg)`})),F=e.computed(()=>({left:`${p.value*100}%`,top:`${T.value}%`,width:`${c}px`,height:`${c}px`,borderRadius:R[L.value],background:C[$.value].piece,transform:`translate(-50%, -50%) rotate(${D.value}deg)`})),q=e.computed(()=>({transform:`translateX(${i.value}px)`})),H=e.computed(()=>({width:`${i.value+40}px`}));function m(){var a;const t=d.value;t&&(v.value=Math.max(0,t.clientWidth-40),k.value=((a=S.value)==null?void 0:a.clientWidth)||t.clientWidth)}l(m,"updateMaxDrag");function O(){var o;const t=k.value||((o=d.value)==null?void 0:o.clientWidth)||0;if(!t)return 0;const a=Math.abs(p.value-x.value)*t;return Math.max(0,(c-a)/c)}l(O,"getPositionOverlapRatio");function I(){window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M)}l(I,"detachWindowPointerListeners");function U(t){const a=B.value;if(a!=null&&a.hasPointerCapture(t.pointerId))try{a.releasePointerCapture(t.pointerId)}catch{}}l(U,"releaseThumbCapture");function f(){I(),s.value=!1,y.value=!1,i.value=0,w.value=0,u.value=[]}l(f,"resetDrag");function j(t){if(r.loading||r.status==="success"||t.button!==0)return;m(),s.value=!0,y.value=!1,i.value=0,w.value=performance.now(),u.value=[{x:0,t:0}],t.currentTarget.setPointerCapture(t.pointerId),window.addEventListener("pointermove",z),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M)}l(j,"onPointerDown");function z(t){if(!s.value||!d.value)return;const a=d.value.getBoundingClientRect(),o=t.clientX-a.left-20;i.value=Math.min(Math.max(0,o),v.value);const h=Math.round(performance.now()-w.value),g=u.value[u.value.length-1];(!g||h-g.t>=16)&&u.value.push({x:Number(p.value.toFixed(4)),t:h})}l(z,"onPointerMove");function M(t){var g;if(I(),U(t),!s.value)return;s.value=!1;const a=Math.abs(p.value-x.value)*(k.value||((g=d.value)==null?void 0:g.clientWidth)||0);if(O()<_||a>W){y.value=!0,setTimeout(f,300);return}i.value=x.value*v.value;const h=Math.max(1,Math.round(performance.now()-w.value));u.value.push({x:Number(p.value.toFixed(4)),t:h}),P("select",{dragPercent:Number(p.value.toFixed(4)),durationMs:h,trace:u.value.slice(-300)})}l(M,"onPointerEnd");function G(){f(),P("refresh")}return l(G,"onRefresh"),e.watch(()=>[r.status,r.loading],([t,a])=>{(t==="error"||t==="idle"&&!a)&&f()}),e.watch(()=>[r.serialNo,r.sceneSeed],()=>{E.value&&f()}),e.watch(E,t=>{t?e.nextTick(()=>{m();const a=d.value,o=S.value;(a||o)&&typeof ResizeObserver<"u"&&(n==null||n.disconnect(),n=new ResizeObserver(()=>m()),a&&n.observe(a),o&&n.observe(o))}):(n==null||n.disconnect(),n=null,f())}),e.onMounted(()=>{window.addEventListener("resize",m)}),e.onBeforeUnmount(()=>{n==null||n.disconnect(),n=null,window.removeEventListener("resize",m),f()}),(t,a)=>(e.openBlock(),e.createBlock(e.unref(J.default),e.mergeProps({modelValue:E.value,"onUpdate:modelValue":a[0]||(a[0]=o=>E.value=o),title:"安全验证",width:"420px","has-footer":!1,"destroy-on-close":""},t.$attrs),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["captcha-wrap",{"is-slider-dragging":e.unref(s)}])},[t.loading?(e.openBlock(),e.createElementBlock("div",Q,a[1]||(a[1]=[e.createElementVNode("span",{class:"captcha-loading-dot"},null,-1),e.createElementVNode("span",null,"验证中…",-1)]))):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"sceneRef",ref:S,class:e.normalizeClass(["captcha-scene",`is-${t.status}`]),style:e.normalizeStyle(e.unref(A))},[e.createElementVNode("div",{class:"captcha-hole",style:e.normalizeStyle(e.unref(X))},null,4),e.createElementVNode("div",{class:"captcha-piece",style:e.normalizeStyle(e.unref(F))},null,4),t.status!=="idle"?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("span",ee,e.toDisplayString(t.status==="success"?"✓":"✗"),1),e.createElementVNode("span",te,e.toDisplayString(t.status==="success"?"验证通过":t.status==="error"?"不通过":"验证失败,请重试"),1)])):e.createCommentVNode("",!0)],6),e.createElementVNode("div",ae,e.toDisplayString(r.prompt),1),e.createElementVNode("div",{ref_key:"sliderRef",ref:d,class:e.normalizeClass(["captcha-slider",{"is-dragging":e.unref(s),"is-fail":e.unref(y),"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(p)*100),"aria-disabled":t.loading||t.status==="success"},[e.createElementVNode("div",{class:"captcha-slider-fill",style:e.normalizeStyle(e.unref(H))},null,4),e.createElementVNode("div",{ref_key:"thumbRef",ref:B,class:"captcha-slider-thumb",style:e.normalizeStyle(e.unref(q)),onPointerdown:e.withModifiers(j,["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(s)&&t.status==="idle"&&e.unref(i)===0?(e.openBlock(),e.createElementBlock("span",oe," 向右拖动滑块完成拼图 ")):e.createCommentVNode("",!0)],10,ne),e.createElementVNode("div",le,[e.createElementVNode("button",{type:"button",class:"captcha-action-btn",disabled:t.loading,onClick:G},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,re),e.createElementVNode("span",se,e.toDisplayString(t.serialNo),1)])],2)]),_:1},16,["modelValue"]))}});exports.default=ce;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var i = (
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
import
|
|
5
|
-
import { lsCaptchaVerifyProps as
|
|
6
|
-
const
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var i = (y, V) => ie(y, "name", { value: V, configurable: !0 });
|
|
3
|
+
import { defineComponent as J, mergeModels as q, useModel as re, ref as r, computed as s, watch as I, nextTick as ce, onMounted as ue, onBeforeUnmount as de, createBlock as pe, openBlock as L, unref as l, mergeProps as ve, withCtx as fe, createElementVNode as a, normalizeClass as B, createElementBlock as W, createCommentVNode as A, normalizeStyle as M, toDisplayString as $, withModifiers as he, createTextVNode as ge } from "vue";
|
|
4
|
+
import me from "../../../../../dialog/index.js";
|
|
5
|
+
import { lsCaptchaVerifyProps as be } from "../types/index.js";
|
|
6
|
+
const we = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "captcha-loading-mask",
|
|
9
9
|
"aria-live": "polite"
|
|
10
|
-
},
|
|
10
|
+
}, xe = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "captcha-overlay"
|
|
13
|
-
},
|
|
13
|
+
}, Me = { class: "captcha-overlay-icon" }, ye = { class: "captcha-overlay-text" }, Ee = { class: "captcha-prompt" }, Re = ["aria-valuenow", "aria-disabled"], ke = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "captcha-slider-hint"
|
|
16
|
-
},
|
|
16
|
+
}, Ce = { class: "captcha-actions" }, Pe = ["disabled"], Se = { class: "captcha-serial-text" }, Le = J({
|
|
17
17
|
name: "LSCaptchaVerify"
|
|
18
|
-
}),
|
|
19
|
-
...
|
|
18
|
+
}), Te = /* @__PURE__ */ J({
|
|
19
|
+
...Le,
|
|
20
20
|
name: "LSCaptchaVerify",
|
|
21
21
|
inheritAttrs: !1,
|
|
22
|
-
props: /* @__PURE__ */
|
|
22
|
+
props: /* @__PURE__ */ q(be, {
|
|
23
23
|
modelValue: { type: Boolean, default: !1 },
|
|
24
24
|
modelModifiers: {}
|
|
25
25
|
}),
|
|
26
|
-
emits: /* @__PURE__ */
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
26
|
+
emits: /* @__PURE__ */ q(["refresh", "select"], ["update:modelValue"]),
|
|
27
|
+
setup(y, { emit: V }) {
|
|
28
|
+
const c = y, X = V, E = re(y, "modelValue"), p = 60, F = 0.95, K = p * (1 - F), _ = r(), v = r(), H = r(), u = r(!1), d = r(0), m = r(0), N = r(0), R = r(0), f = r([]), k = r(!1);
|
|
29
29
|
let n = null;
|
|
30
|
-
const
|
|
30
|
+
const C = s(() => c.sceneSeed || Date.now()), T = [
|
|
31
31
|
{ bg: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)", piece: "rgba(102,126,234,0.7)" },
|
|
32
32
|
{ bg: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)", piece: "rgba(245,87,108,0.7)" },
|
|
33
33
|
{ bg: "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)", piece: "rgba(79,172,254,0.7)" },
|
|
@@ -36,7 +36,7 @@ const he = {
|
|
|
36
36
|
{ bg: "linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%)", piece: "rgba(161,140,209,0.7)" },
|
|
37
37
|
{ bg: "linear-gradient(135deg, #fccb90 0%, #d57eeb 100%)", piece: "rgba(213,126,235,0.7)" },
|
|
38
38
|
{ bg: "linear-gradient(135deg, #96fbc4 0%, #f9f586 100%)", piece: "rgba(150,251,196,0.7)" }
|
|
39
|
-
],
|
|
39
|
+
], D = [
|
|
40
40
|
"6px",
|
|
41
41
|
"50%",
|
|
42
42
|
"12px 4px",
|
|
@@ -45,152 +45,167 @@ const he = {
|
|
|
45
45
|
"50% 4px 50% 4px",
|
|
46
46
|
"16px 4px 4px 16px",
|
|
47
47
|
"30% 70% 70% 30% / 30% 30% 70% 70%"
|
|
48
|
-
],
|
|
49
|
-
background:
|
|
50
|
-
})),
|
|
51
|
-
left: `${
|
|
52
|
-
top: `${
|
|
53
|
-
width: `${
|
|
54
|
-
height: `${
|
|
55
|
-
borderRadius:
|
|
56
|
-
transform: `translate(-50%, -50%) rotate(${
|
|
57
|
-
})),
|
|
58
|
-
left: `${
|
|
59
|
-
top: `${
|
|
60
|
-
width: `${
|
|
61
|
-
height: `${
|
|
62
|
-
borderRadius:
|
|
63
|
-
background:
|
|
64
|
-
transform: `translate(-50%, -50%) rotate(${
|
|
65
|
-
})),
|
|
66
|
-
transform: `translateX(${
|
|
67
|
-
})),
|
|
68
|
-
width: `${
|
|
48
|
+
], U = s(() => C.value % T.length), z = s(() => Math.floor(C.value / 7) % D.length), G = s(() => C.value % 4 * 90), O = s(() => 30 + C.value % 40), Q = s(() => ({
|
|
49
|
+
background: T[U.value].bg
|
|
50
|
+
})), P = s(() => Math.max(0.15, Math.min(0.85, c.targetPercent))), h = s(() => m.value ? Math.min(1, Math.max(0, d.value / m.value)) : 0), Y = s(() => ({
|
|
51
|
+
left: `${P.value * 100}%`,
|
|
52
|
+
top: `${O.value}%`,
|
|
53
|
+
width: `${p}px`,
|
|
54
|
+
height: `${p}px`,
|
|
55
|
+
borderRadius: D[z.value],
|
|
56
|
+
transform: `translate(-50%, -50%) rotate(${G.value}deg)`
|
|
57
|
+
})), ee = s(() => ({
|
|
58
|
+
left: `${h.value * 100}%`,
|
|
59
|
+
top: `${O.value}%`,
|
|
60
|
+
width: `${p}px`,
|
|
61
|
+
height: `${p}px`,
|
|
62
|
+
borderRadius: D[z.value],
|
|
63
|
+
background: T[U.value].piece,
|
|
64
|
+
transform: `translate(-50%, -50%) rotate(${G.value}deg)`
|
|
65
|
+
})), te = s(() => ({
|
|
66
|
+
transform: `translateX(${d.value}px)`
|
|
67
|
+
})), ae = s(() => ({
|
|
68
|
+
width: `${d.value + 40}px`
|
|
69
69
|
}));
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
e
|
|
70
|
+
function b() {
|
|
71
|
+
var t;
|
|
72
|
+
const e = v.value;
|
|
73
|
+
e && (m.value = Math.max(0, e.clientWidth - 40), N.value = ((t = _.value) == null ? void 0 : t.clientWidth) || e.clientWidth);
|
|
73
74
|
}
|
|
74
|
-
i(
|
|
75
|
-
function
|
|
76
|
-
|
|
75
|
+
i(b, "updateMaxDrag");
|
|
76
|
+
function ne() {
|
|
77
|
+
var o;
|
|
78
|
+
const e = N.value || ((o = v.value) == null ? void 0 : o.clientWidth) || 0;
|
|
79
|
+
if (!e)
|
|
80
|
+
return 0;
|
|
81
|
+
const t = Math.abs(h.value - P.value) * e;
|
|
82
|
+
return Math.max(0, (p - t) / p);
|
|
77
83
|
}
|
|
78
|
-
i(
|
|
79
|
-
function
|
|
80
|
-
|
|
84
|
+
i(ne, "getPositionOverlapRatio");
|
|
85
|
+
function Z() {
|
|
86
|
+
window.removeEventListener("pointermove", j), window.removeEventListener("pointerup", S), window.removeEventListener("pointercancel", S);
|
|
87
|
+
}
|
|
88
|
+
i(Z, "detachWindowPointerListeners");
|
|
89
|
+
function se(e) {
|
|
90
|
+
const t = H.value;
|
|
81
91
|
if (t != null && t.hasPointerCapture(e.pointerId))
|
|
82
92
|
try {
|
|
83
93
|
t.releasePointerCapture(e.pointerId);
|
|
84
94
|
} catch {
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
|
-
i(
|
|
88
|
-
function
|
|
89
|
-
|
|
97
|
+
i(se, "releaseThumbCapture");
|
|
98
|
+
function g() {
|
|
99
|
+
Z(), u.value = !1, k.value = !1, d.value = 0, R.value = 0, f.value = [];
|
|
90
100
|
}
|
|
91
|
-
i(
|
|
92
|
-
function
|
|
93
|
-
if (
|
|
101
|
+
i(g, "resetDrag");
|
|
102
|
+
function le(e) {
|
|
103
|
+
if (c.loading || c.status === "success" || e.button !== 0)
|
|
94
104
|
return;
|
|
95
|
-
|
|
105
|
+
b(), u.value = !0, k.value = !1, d.value = 0, R.value = performance.now(), f.value = [{ x: 0, t: 0 }], e.currentTarget.setPointerCapture(e.pointerId), window.addEventListener("pointermove", j), window.addEventListener("pointerup", S), window.addEventListener("pointercancel", S);
|
|
96
106
|
}
|
|
97
|
-
i(
|
|
98
|
-
function
|
|
99
|
-
if (!
|
|
107
|
+
i(le, "onPointerDown");
|
|
108
|
+
function j(e) {
|
|
109
|
+
if (!u.value || !v.value)
|
|
100
110
|
return;
|
|
101
|
-
const t =
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
(!
|
|
111
|
+
const t = v.value.getBoundingClientRect(), o = e.clientX - t.left - 20;
|
|
112
|
+
d.value = Math.min(Math.max(0, o), m.value);
|
|
113
|
+
const w = Math.round(performance.now() - R.value), x = f.value[f.value.length - 1];
|
|
114
|
+
(!x || w - x.t >= 16) && f.value.push({ x: Number(h.value.toFixed(4)), t: w });
|
|
105
115
|
}
|
|
106
|
-
i(
|
|
107
|
-
function
|
|
108
|
-
|
|
116
|
+
i(j, "onPointerMove");
|
|
117
|
+
function S(e) {
|
|
118
|
+
var x;
|
|
119
|
+
if (Z(), se(e), !u.value)
|
|
109
120
|
return;
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
u.value = !1;
|
|
122
|
+
const t = Math.abs(h.value - P.value) * (N.value || ((x = v.value) == null ? void 0 : x.clientWidth) || 0);
|
|
123
|
+
if (ne() < F || t > K) {
|
|
124
|
+
k.value = !0, setTimeout(g, 300);
|
|
112
125
|
return;
|
|
113
126
|
}
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
dragPercent: Number(
|
|
118
|
-
durationMs:
|
|
119
|
-
trace:
|
|
127
|
+
d.value = P.value * m.value;
|
|
128
|
+
const w = Math.max(1, Math.round(performance.now() - R.value));
|
|
129
|
+
f.value.push({ x: Number(h.value.toFixed(4)), t: w }), X("select", {
|
|
130
|
+
dragPercent: Number(h.value.toFixed(4)),
|
|
131
|
+
durationMs: w,
|
|
132
|
+
trace: f.value.slice(-300)
|
|
120
133
|
});
|
|
121
134
|
}
|
|
122
|
-
i(
|
|
123
|
-
function
|
|
124
|
-
|
|
135
|
+
i(S, "onPointerEnd");
|
|
136
|
+
function oe() {
|
|
137
|
+
g(), X("refresh");
|
|
125
138
|
}
|
|
126
|
-
return i(
|
|
127
|
-
(e === "error" || e === "idle" && !t) &&
|
|
128
|
-
}),
|
|
129
|
-
|
|
130
|
-
}),
|
|
131
|
-
e ?
|
|
132
|
-
|
|
133
|
-
const t =
|
|
134
|
-
t && typeof ResizeObserver < "u" && (n == null || n.disconnect(), n = new ResizeObserver(() =>
|
|
135
|
-
}) : (n == null || n.disconnect(), n = null,
|
|
136
|
-
}),
|
|
137
|
-
window.addEventListener("resize",
|
|
138
|
-
}),
|
|
139
|
-
n == null || n.disconnect(), n = null, window.removeEventListener("resize",
|
|
140
|
-
}), (e, t) => (
|
|
141
|
-
modelValue:
|
|
142
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
139
|
+
return i(oe, "onRefresh"), I(() => [c.status, c.loading], ([e, t]) => {
|
|
140
|
+
(e === "error" || e === "idle" && !t) && g();
|
|
141
|
+
}), I(() => [c.serialNo, c.sceneSeed], () => {
|
|
142
|
+
E.value && g();
|
|
143
|
+
}), I(E, (e) => {
|
|
144
|
+
e ? ce(() => {
|
|
145
|
+
b();
|
|
146
|
+
const t = v.value, o = _.value;
|
|
147
|
+
(t || o) && typeof ResizeObserver < "u" && (n == null || n.disconnect(), n = new ResizeObserver(() => b()), t && n.observe(t), o && n.observe(o));
|
|
148
|
+
}) : (n == null || n.disconnect(), n = null, g());
|
|
149
|
+
}), ue(() => {
|
|
150
|
+
window.addEventListener("resize", b);
|
|
151
|
+
}), de(() => {
|
|
152
|
+
n == null || n.disconnect(), n = null, window.removeEventListener("resize", b), g();
|
|
153
|
+
}), (e, t) => (L(), pe(l(me), ve({
|
|
154
|
+
modelValue: E.value,
|
|
155
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => E.value = o),
|
|
143
156
|
title: "安全验证",
|
|
144
157
|
width: "420px",
|
|
145
158
|
"has-footer": !1,
|
|
146
159
|
"destroy-on-close": ""
|
|
147
160
|
}, e.$attrs), {
|
|
148
|
-
default:
|
|
161
|
+
default: fe(() => [
|
|
149
162
|
a("div", {
|
|
150
|
-
class:
|
|
163
|
+
class: B(["captcha-wrap", { "is-slider-dragging": l(u) }])
|
|
151
164
|
}, [
|
|
152
|
-
e.loading ? (
|
|
165
|
+
e.loading ? (L(), W("div", we, t[1] || (t[1] = [
|
|
153
166
|
a("span", { class: "captcha-loading-dot" }, null, -1),
|
|
154
167
|
a("span", null, "验证中…", -1)
|
|
155
|
-
]))) :
|
|
168
|
+
]))) : A("", !0),
|
|
156
169
|
a("div", {
|
|
157
|
-
|
|
158
|
-
|
|
170
|
+
ref_key: "sceneRef",
|
|
171
|
+
ref: _,
|
|
172
|
+
class: B(["captcha-scene", `is-${e.status}`]),
|
|
173
|
+
style: M(l(Q))
|
|
159
174
|
}, [
|
|
160
175
|
a("div", {
|
|
161
176
|
class: "captcha-hole",
|
|
162
|
-
style:
|
|
177
|
+
style: M(l(Y))
|
|
163
178
|
}, null, 4),
|
|
164
179
|
a("div", {
|
|
165
180
|
class: "captcha-piece",
|
|
166
|
-
style:
|
|
181
|
+
style: M(l(ee))
|
|
167
182
|
}, null, 4),
|
|
168
|
-
e.status !== "idle" ? (
|
|
169
|
-
a("span",
|
|
170
|
-
a("span",
|
|
171
|
-
])) :
|
|
183
|
+
e.status !== "idle" ? (L(), W("div", xe, [
|
|
184
|
+
a("span", Me, $(e.status === "success" ? "✓" : "✗"), 1),
|
|
185
|
+
a("span", ye, $(e.status === "success" ? "验证通过" : e.status === "error" ? "不通过" : "验证失败,请重试"), 1)
|
|
186
|
+
])) : A("", !0)
|
|
172
187
|
], 6),
|
|
173
|
-
a("div",
|
|
188
|
+
a("div", Ee, $(c.prompt), 1),
|
|
174
189
|
a("div", {
|
|
175
190
|
ref_key: "sliderRef",
|
|
176
|
-
ref:
|
|
177
|
-
class:
|
|
191
|
+
ref: v,
|
|
192
|
+
class: B(["captcha-slider", { "is-dragging": l(u), "is-fail": l(k), "is-loading": e.loading, "is-success": e.status === "success", "is-error": e.status === "error" }]),
|
|
178
193
|
role: "slider",
|
|
179
194
|
"aria-valuemin": 0,
|
|
180
195
|
"aria-valuemax": 100,
|
|
181
|
-
"aria-valuenow": Math.round(
|
|
196
|
+
"aria-valuenow": Math.round(l(h) * 100),
|
|
182
197
|
"aria-disabled": e.loading || e.status === "success"
|
|
183
198
|
}, [
|
|
184
199
|
a("div", {
|
|
185
200
|
class: "captcha-slider-fill",
|
|
186
|
-
style:
|
|
201
|
+
style: M(l(ae))
|
|
187
202
|
}, null, 4),
|
|
188
203
|
a("div", {
|
|
189
204
|
ref_key: "thumbRef",
|
|
190
|
-
ref:
|
|
205
|
+
ref: H,
|
|
191
206
|
class: "captcha-slider-thumb",
|
|
192
|
-
style:
|
|
193
|
-
onPointerdown:
|
|
207
|
+
style: M(l(te)),
|
|
208
|
+
onPointerdown: he(le, ["prevent"])
|
|
194
209
|
}, t[2] || (t[2] = [
|
|
195
210
|
a("svg", {
|
|
196
211
|
viewBox: "0 0 24 24",
|
|
@@ -204,14 +219,14 @@ const he = {
|
|
|
204
219
|
a("path", { d: "M4 18l6-6-6-6" })
|
|
205
220
|
], -1)
|
|
206
221
|
]), 36),
|
|
207
|
-
!
|
|
208
|
-
], 10,
|
|
209
|
-
a("div",
|
|
222
|
+
!l(u) && e.status === "idle" && l(d) === 0 ? (L(), W("span", ke, " 向右拖动滑块完成拼图 ")) : A("", !0)
|
|
223
|
+
], 10, Re),
|
|
224
|
+
a("div", Ce, [
|
|
210
225
|
a("button", {
|
|
211
226
|
type: "button",
|
|
212
227
|
class: "captcha-action-btn",
|
|
213
228
|
disabled: e.loading,
|
|
214
|
-
onClick:
|
|
229
|
+
onClick: oe
|
|
215
230
|
}, t[3] || (t[3] = [
|
|
216
231
|
a("svg", {
|
|
217
232
|
viewBox: "0 0 24 24",
|
|
@@ -224,9 +239,9 @@ const he = {
|
|
|
224
239
|
a("path", { d: "M1 4v6h6" }),
|
|
225
240
|
a("path", { d: "M3.51 15a9 9 0 1 0 2.13-9.36L1 10" })
|
|
226
241
|
], -1),
|
|
227
|
-
|
|
228
|
-
]), 8,
|
|
229
|
-
a("span",
|
|
242
|
+
ge(" 换一张 ", -1)
|
|
243
|
+
]), 8, Pe),
|
|
244
|
+
a("span", Se, $(e.serialNo), 1)
|
|
230
245
|
])
|
|
231
246
|
], 2)
|
|
232
247
|
]),
|
|
@@ -235,5 +250,5 @@ const he = {
|
|
|
235
250
|
}
|
|
236
251
|
});
|
|
237
252
|
export {
|
|
238
|
-
|
|
253
|
+
Te as default
|
|
239
254
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +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-
|
|
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-0688f54c"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0688f54c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ne=Object.defineProperty;var i=($,q)=>Ne($,"name",{value:q,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Se=/* empty css */Ve=/* empty css */Le=/* empty css */Pe=/* empty css */L=;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),xe=/* empty css */$e=/* empty css */_=/* empty css */J=/* empty css */qe=/* empty css */P=;/* empty css */;/* empty css */;/* empty css */const Ue={class:"ls-drag"},Te={class:"drag-txt ls-color-brand6"},Ae={key:0,class:"btn-picture-card"},Me={key:0,class:"ls-tip"},Re=["src"],ze={class:"el-upload-list__item-actions"},De=["onClick"],Ie=["onClick"],He=["onClick"],Oe=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:P.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc","onHandleCropper"],setup($,{expose:q,emit:Q}){const o=$,b=Q,U=e.useSlots(),m=e.useAttrs(),ee=xe.useNamespace("upload").b(),c=e.ref(),s=e.ref(!1),v=e.reactive({isCover:!0,accept:"",disabled:!1}),r=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,sourcePreview:"",iconColor:$e.getVariable("colorText1")});e.watch(()=>m["file-list"],t=>{r.uploadFileList=t||[]},{immediate:!0,deep:!0});const B=e.computed(()=>{var t,n;return!!((t=o==null?void 0:o.item)!=null&&t.isToast||typeof((n=o==null?void 0:o.item)==null?void 0:n.isToast)>"u")}),p=e.computed(()=>{var n;const t=(n=o==null?void 0:o.item)==null?void 0:n.isCover;return typeof t>"u"?!0:t}),k=e.computed(()=>m.multiple),g=e.computed(()=>{const t=m["auto-upload"];return typeof t>"u"?!0:t}),te=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.emptyFileMsg)||""}),T=e.computed(()=>m["list-type"]),w=e.computed(()=>T.value===P.UPLOAD_TYPE_MAP.picCard),ne=e.computed(()=>!T.value||T.value==="text"),E=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFile)||[]}),oe=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFileMsg)||""}),N=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSize)||2}),le=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSizeMsg)||""}),A=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitUnit)||"MB"}),re=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitNumMsg)||""}),ie=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.limitAllFail}),O=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.profile)||!1}),S=e.computed(()=>m.drag),ue=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.hideCoverBtn)&&p.value&&r.uploadFileList.length>0}),h=e.computed(()=>m.disabled),M=e.computed(()=>{const t=w.value?"图片":"文件";let n=`选择${t}`;return s.value?n="正在上传...":p.value&&!k.value?g.value?r.initUploadStatus?n="点击上传":n="重新上传":r.initUploadStatus?n=`选择${t}`:n="重新上传":g.value&&(n="点击上传"),n}),ae=e.computed(()=>{let t="不限制上传格式,";return w.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${N.value}${A.value}`}),se=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.tipContent)||""}),R=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.httpRequestFunc}),ce=e.computed(()=>{var n;const t=Number(m.limit||0);return t?((n=o==null?void 0:o.item)==null?void 0:n.hideBtnReachLimit)&&r.uploadFileList.length>=t:!1});e.watch([p,R,()=>o.httpRequest],([t,n,l])=>{v.isCover=t,(n&&typeof n=="function"||l&&typeof l=="function")&&(v["http-request"]=he)},{immediate:!0,deep:!0}),e.watch(()=>E.value,t=>{t&&t.length>0&&de(t)},{immediate:!0,deep:!0});function de(t){v.accept="",t.forEach(n=>{const l=P.fileTypeMap[n]||"";l&&(v.accept&&(v.accept+=","),v.accept+=l)})}i(de,"updateFileAccept");function V(t){const{formRuleFunc:n,formValidateFunc:l}=e.toRefs(o==null?void 0:o.item);if(n.value&&typeof n.value=="function"&&l&&typeof l.value=="function"){const u=n.value(),{message:a}=u;u.message=t,l.value(),u.message=a}b("uploadErrorFunc",t)}i(V,"validateForm");async function fe(t,n){if(s.value=!1,o.onExceed)return o.onExceed(t,n);const l=Number(m.limit||0);let u=0;ie.value||(u=l-r.uploadFileList.length,u>0&&(Ce(t.slice(0,u)),g.value&&D()));const a=re.value||`当前限制选择 ${l} 个文件,本次选择了 ${t.length} 个文件,已成功上传 ${u} 个文件`;B.value?setTimeout(()=>{L.ElMessage.warning(a)},200):V(a)}i(fe,"onExceedAction");function me(t){if(o.beforeUpload){const l=o.beforeUpload(t);return l&&p.value&&!k.value&&x(),l}const n=z(t,!0);return n&&g.value&&p.value&&!k.value&&x(),n}i(me,"beforeUploadAction");function z(t,n){let l=!0;const{size:u,name:a}=t,C=E.value.length>0&&!j(a);let y=!1;switch(A.value){case"KB":y=u/1024>N.value;break;case"MB":y=u/1024/1024>N.value;break;default:y=u/1024/1024/1024>N.value;break}if(C){const d=oe.value||`上传文件 ${t.name} 只能是 ${E.value.filter(H=>H).join(",").toLocaleLowerCase()} 格式!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}if(y){const d=le.value||`上传文件 ${t.name} 大小不能超过 ${N.value}${A.value}!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}if(!C&&w.value&&!j(a,P.IMG_SUFFIX_LIST)){const d=`上传文件 ${t.name} 不是图片格式的文件!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}return l}i(z,"validateUploadFile");function j(t,n){let l=[];if(E.value.length>0?l=E.value:n&&(l=n),l.length<=0)return!0;for(let u=0;u<l.length;u++){const a=(l[u]||"").toLowerCase();if(t.toLowerCase().endsWith(a))return!0}return!1}i(j,"fileTypeMatch");function x(t,n){r.uploadFileList.splice(t||0,n||r.uploadFileList.length-1)}i(x,"updateCoverFileList");function pe(t,n){r.uploadFileList=n;const l=t.raw&&z(t.raw,!g.value);if(l&&p.value&&!k.value&&x(),o.onChange)return o.onChange(t,n);const{size:u=0}=t;if(u<=0){Z();const a=te.value||"禁止上传空文件,请检查后重新上传!";B.value?L.ElMessage.error(a):V(a);return}t.raw&&(!g.value&&!l?Z():(t.blob=URL.createObjectURL(t.raw)||"",b("onChangeFunc",t)))}i(pe,"onChangeAction");function Z(){let t=0;r.uploadFileList.length>1&&(t=r.uploadFileList.length-1),x(t,1),b("onChangeFunc",{})}i(Z,"setChangeRes");function ve(t,n,l){s.value=!1,r.initUploadStatus=!1;const{formRuleFunc:u,formValidateFunc:a}=e.toRefs(o==null?void 0:o.item);if(u.value&&typeof u.value=="function"&&a.value&&typeof a.value=="function"&&a.value(),o.onSuccess)return o.onSuccess(t,n,l)}i(ve,"onSuccessAction");function ge(t,n,l){if(s.value=!1,o.onError)return o.onError(t,n,l)}i(ge,"onErrorAction");function ke(t,n){if(s.value=!1,r.initUploadStatus=!n.length,r.uploadFileList=r.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),o.onRemove)return o.onRemove(t,n)}i(ke,"onRemoveAction");async function he(t){const{file:n}=t;if(!n)return;const{size:l}=n;if(l<=0||!z(n,!1))return;if(o.httpRequest)return o.httpRequest(t);const u=new FormData;if(u.append("file",n),typeof R.value=="function"){s.value=!0;let a={};try{a=await R.value(u)}catch(C){a=C}finally{s.value=!1,b("httpResponseFunc",a)}}}i(he,"httpRequestAction");function G(){let t=!1;for(let n=0;n<r.uploadFileList.length;n++)if(r.uploadFileList[n].status===P.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}i(G,"hasReadyFile");function D(){var t;(t=c==null?void 0:c.value)==null||t.submit()}i(D,"comfirmUpload");function Ce(t){(t||[]).forEach(n=>{var l;(l=c==null?void 0:c.value)==null||l.handleStart(n)})}i(Ce,"comHandleStart");function K(t){c==null||c.value.handleRemove(t)}i(K,"removeFile");function ye(){r.uploadFileList.forEach(t=>{var n;if(t)try{(n=c==null?void 0:c.value)==null||n.abort(t),K(t)}catch{}})}i(ye,"cancelUpload");function Fe(t,n,l){if(s.value=!0,o.onProgress)return o.onProgress(t,n,l)}i(Fe,"onProgressAction");function _e(t){if(o.onPreview)return o.onPreview(t);if(w.value){const{url:n}=t||{};n&&(r.sourcePreview=n,r.showPreview=!0)}}i(_e,"onPreviewAction");function be(){r.showPreview=!1,r.sourcePreview=""}i(be,"closePreview");const I=e.ref(!1),W=e.ref([]);function Be(t,n){var l;W.value=[((l=r.uploadFileList[n])==null?void 0:l.url)||(t==null?void 0:t.url)],I.value=!0}i(Be,"onHandlePreview");function we(t){K(t)}i(we,"onHandleRemove");function Ee(t,n){b("onHandleCropper",t,n)}return i(Ee,"onHandleCropper"),q({uploadRef:c}),(t,n)=>{const l=Ve.ElAvatar,u=e.resolveComponent("Crop"),a=Se.ElIcon,C=e.resolveComponent("ZoomIn"),y=e.resolveComponent("Delete"),d=Pe.ElUpload,H=Le.ElImageViewer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(ee),e.unref(S)?"ls-upload-drag":"",e.unref(O)?"ls-profile":"",e.unref(ue)?"hide-cover-btn":"",e.unref(ce)?"hide-btn":""])},[e.createVNode(d,e.mergeProps({ref_key:"uploadRef",ref:c},Object.assign(e.unref(v),t.$attrs),{"on-exceed":fe,"before-upload":me,"on-change":pe,"on-success":ve,"on-error":ge,"on-remove":ke,"on-progress":Fe,"on-preview":_e}),e.createSlots({trigger:e.withCtx(()=>[e.unref(O)?t.item.defProfile&&e.unref(r).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(U).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(_.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(h)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(J.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",Ue,[e.createElementVNode("div",Te,e.toDisplayString(e.unref(M)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[2]||(n[2]=e.createTextVNode(" / ",-1)),n[3]||(n[3]=e.createElementVNode("div",{class:"drag-txt ls-color-text2"}," 拖拽到此区域 ",-1))],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",Ae,[e.unref(s)?(e.openBlock(),e.createBlock(_.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(h)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(J.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(r).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref(M)),1)])):(e.openBlock(),e.createBlock(_.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(M)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(U).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(g)&&(e.unref(ne)||e.unref(S))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(S)?"drag-css":"nor-css",!e.unref(p)||e.unref(k)?"multi-css":""]])},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(p)||e.unref(k)?(e.openBlock(),e.createBlock(_.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(h),class:"ls-upload-btn-com ls-upload-btn-cancel",onClick:ye},{default:e.withCtx(()=>n[5]||(n[5]=[e.createTextVNode(" 取消上传 ",-1)])),_:1,__:[5]},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(_.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":G()}]),type:"primary",loading:e.unref(s),disabled:e.unref(h),onClick:D},{default:e.withCtx(()=>n[6]||(n[6]=[e.createTextVNode(" 开始上传 ",-1)])),_:1,__:[6]},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(_.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":G()}]),loading:e.unref(s),disabled:e.unref(h),onClick:D},{default:e.withCtx(()=>n[4]||(n[4]=[e.createTextVNode(" 开始上传 ",-1)])),_:1,__:[4]},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(U).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",Me,e.toDisplayString(e.unref(se)||e.unref(ae)),1))]),_:2},[t.customFile?{name:"file",fn:e.withCtx(({file:f,index:F})=>{var X;return[e.createElementVNode("img",{src:((X=e.unref(r).uploadFileList[F])==null?void 0:X.url)||f.url,class:"el-upload-list__item-thumbnail"},null,8,Re),e.createElementVNode("div",ze,[e.renderSlot(t.$slots,"default",{file:f,index:F},void 0,!0),t.hasCropper?(e.openBlock(),e.createElementBlock("span",{key:0,class:"el-upload-list__item-cropper",onClick:i(Y=>Ee(f,F),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(u)]),_:1})],8,De)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:"el-upload-list__item-preview",onClick:i(Y=>Be(f,F),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(C)]),_:1})],8,Ie),e.createElementVNode("span",{class:"el-upload-list__item-delete",onClick:i(Y=>we(f),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(y)]),_:1})],8,He)])]}),key:"0"}:{name:"file",fn:e.withCtx(({file:f,index:F})=>[e.renderSlot(t.$slots,"file",{file:f,index:F},void 0,!0)]),key:"1"}]),1040),e.createVNode(e.unref(qe.default),{modelValue:e.unref(r).showPreview,"onUpdate:modelValue":n[0]||(n[0]=f=>e.unref(r).showPreview=f),source:e.unref(r).sourcePreview,"on-close":be},null,8,["modelValue","source"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(I)?(e.openBlock(),e.createBlock(H,{key:0,"url-list":e.unref(W),onClose:n[1]||(n[1]=f=>I.value=!1)},null,8,["url-list"])):e.createCommentVNode("",!0)]))],2)}}});exports.default=Oe;
|
|
1
|
+
"use strict";var Se=Object.defineProperty;var i=($,q)=>Se($,"name",{value:q,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ve=/* empty css */Le=/* empty css */Pe=/* empty css */xe=/* empty css */L=;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),$e=/* empty css */qe=/* empty css */_=/* empty css */Q=/* empty css */Ue=/* empty css */P=;/* empty css */;/* empty css */;/* empty css */const Te={class:"ls-drag"},Ae={class:"drag-txt ls-color-brand6"},Me={key:0,class:"btn-picture-card"},Re={key:0,class:"ls-tip"},ze=["src"],De={class:"el-upload-list__item-actions"},Ie=["onClick"],He=["onClick"],Oe=["onClick"],je=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:P.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc","onHandleCropper"],setup($,{expose:q,emit:ee}){const o=$,b=ee,U=e.useSlots(),m=e.useAttrs(),te=$e.useNamespace("upload").b(),c=e.ref(),s=e.ref(!1),v=e.reactive({isCover:!0,accept:"",disabled:!1}),r=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,sourcePreview:"",iconColor:qe.getVariable("colorText1")});e.watch(()=>m["file-list"],t=>{r.uploadFileList=t||[]},{immediate:!0,deep:!0});const B=e.computed(()=>{var t,n;return!!((t=o==null?void 0:o.item)!=null&&t.isToast||typeof((n=o==null?void 0:o.item)==null?void 0:n.isToast)>"u")}),p=e.computed(()=>{var n;const t=(n=o==null?void 0:o.item)==null?void 0:n.isCover;return typeof t>"u"?!0:t}),k=e.computed(()=>m.multiple),g=e.computed(()=>{const t=m["auto-upload"];return typeof t>"u"?!0:t}),ne=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.emptyFileMsg)||""}),T=e.computed(()=>m["list-type"]),w=e.computed(()=>T.value===P.UPLOAD_TYPE_MAP.picCard),oe=e.computed(()=>!T.value||T.value==="text"),E=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFile)||[]}),le=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitFileMsg)||""}),N=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSize)||2}),re=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitSizeMsg)||""}),A=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitUnit)||"MB"}),ie=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.limitNumMsg)||""}),ue=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.limitAllFail}),O=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.profile)||!1}),S=e.computed(()=>m.drag),ae=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.hideCoverBtn)&&p.value&&r.uploadFileList.length>0}),h=e.computed(()=>m.disabled),M=e.computed(()=>{const t=w.value?"图片":"文件";let n=`选择${t}`;return s.value?n="正在上传...":p.value&&!k.value?g.value?r.initUploadStatus?n="点击上传":n="重新上传":r.initUploadStatus?n=`选择${t}`:n="重新上传":g.value&&(n="点击上传"),n}),se=e.computed(()=>{let t="不限制上传格式,";return w.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${N.value}${A.value}`}),ce=e.computed(()=>{var t;return((t=o==null?void 0:o.item)==null?void 0:t.tipContent)||""}),R=e.computed(()=>{var t;return(t=o==null?void 0:o.item)==null?void 0:t.httpRequestFunc}),de=e.computed(()=>{var n;const t=Number(m.limit||0);return t?((n=o==null?void 0:o.item)==null?void 0:n.hideBtnReachLimit)&&r.uploadFileList.length>=t:!1});e.watch([p,R,()=>o.httpRequest],([t,n,l])=>{v.isCover=t,(n&&typeof n=="function"||l&&typeof l=="function")&&(v["http-request"]=Ce)},{immediate:!0,deep:!0}),e.watch(()=>E.value,t=>{t&&t.length>0&&fe(t)},{immediate:!0,deep:!0});function fe(t){v.accept="",t.forEach(n=>{const l=P.fileTypeMap[n]||"";l&&(v.accept&&(v.accept+=","),v.accept+=l)})}i(fe,"updateFileAccept");function j(){const{formRuleFunc:t,formValidateFunc:n}=o.item||{};return{formRuleFunc:t,formValidateFunc:n}}i(j,"getFormValidateHandlers");function V(t){const{formRuleFunc:n,formValidateFunc:l}=j();if(typeof n=="function"&&typeof l=="function"){const u=n(),{message:a}=u;u.message=t,l(),u.message=a}b("uploadErrorFunc",t)}i(V,"validateForm");async function me(t,n){if(s.value=!1,o.onExceed)return o.onExceed(t,n);const l=Number(m.limit||0);let u=0;ue.value||(u=l-r.uploadFileList.length,u>0&&(ye(t.slice(0,u)),g.value&&D()));const a=ie.value||`当前限制选择 ${l} 个文件,本次选择了 ${t.length} 个文件,已成功上传 ${u} 个文件`;B.value?setTimeout(()=>{L.ElMessage.warning(a)},200):V(a)}i(me,"onExceedAction");function pe(t){if(o.beforeUpload){const l=o.beforeUpload(t);return l&&p.value&&!k.value&&x(),l}const n=z(t,!0);return n&&g.value&&p.value&&!k.value&&x(),n}i(pe,"beforeUploadAction");function z(t,n){let l=!0;const{size:u,name:a}=t,C=E.value.length>0&&!Z(a);let y=!1;switch(A.value){case"KB":y=u/1024>N.value;break;case"MB":y=u/1024/1024>N.value;break;default:y=u/1024/1024/1024>N.value;break}if(C){const d=le.value||`上传文件 ${t.name} 只能是 ${E.value.filter(H=>H).join(",").toLocaleLowerCase()} 格式!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}if(y){const d=re.value||`上传文件 ${t.name} 大小不能超过 ${N.value}${A.value}!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}if(!C&&w.value&&!Z(a,P.IMG_SUFFIX_LIST)){const d=`上传文件 ${t.name} 不是图片格式的文件!`;B.value&&n?setTimeout(()=>{L.ElMessage.error(d)},200):V(d),l=!1}return l}i(z,"validateUploadFile");function Z(t,n){let l=[];if(E.value.length>0?l=E.value:n&&(l=n),l.length<=0)return!0;for(let u=0;u<l.length;u++){const a=(l[u]||"").toLowerCase();if(t.toLowerCase().endsWith(a))return!0}return!1}i(Z,"fileTypeMatch");function x(t,n){r.uploadFileList.splice(t||0,n||r.uploadFileList.length-1)}i(x,"updateCoverFileList");function ve(t,n){r.uploadFileList=n;const l=t.raw&&z(t.raw,!g.value);if(l&&p.value&&!k.value&&x(),o.onChange)return o.onChange(t,n);const{size:u=0}=t;if(u<=0){G();const a=ne.value||"禁止上传空文件,请检查后重新上传!";B.value?L.ElMessage.error(a):V(a);return}t.raw&&(!g.value&&!l?G():(t.blob=URL.createObjectURL(t.raw)||"",b("onChangeFunc",t)))}i(ve,"onChangeAction");function G(){let t=0;r.uploadFileList.length>1&&(t=r.uploadFileList.length-1),x(t,1),b("onChangeFunc",{})}i(G,"setChangeRes");function ge(t,n,l){s.value=!1,r.initUploadStatus=!1;const{formRuleFunc:u,formValidateFunc:a}=j();if(typeof u=="function"&&typeof a=="function"&&a(),o.onSuccess)return o.onSuccess(t,n,l)}i(ge,"onSuccessAction");function ke(t,n,l){if(s.value=!1,o.onError)return o.onError(t,n,l)}i(ke,"onErrorAction");function he(t,n){if(s.value=!1,r.initUploadStatus=!n.length,r.uploadFileList=r.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),o.onRemove)return o.onRemove(t,n)}i(he,"onRemoveAction");async function Ce(t){const{file:n}=t;if(!n)return;const{size:l}=n;if(l<=0||!z(n,!1))return;if(o.httpRequest)return o.httpRequest(t);const u=new FormData;if(u.append("file",n),typeof R.value=="function"){s.value=!0;let a={};try{a=await R.value(u)}catch(C){a=C}finally{s.value=!1,b("httpResponseFunc",a)}}}i(Ce,"httpRequestAction");function K(){let t=!1;for(let n=0;n<r.uploadFileList.length;n++)if(r.uploadFileList[n].status===P.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}i(K,"hasReadyFile");function D(){var t;(t=c==null?void 0:c.value)==null||t.submit()}i(D,"comfirmUpload");function ye(t){(t||[]).forEach(n=>{var l;(l=c==null?void 0:c.value)==null||l.handleStart(n)})}i(ye,"comHandleStart");function W(t){c==null||c.value.handleRemove(t)}i(W,"removeFile");function Fe(){r.uploadFileList.forEach(t=>{var n;if(t)try{(n=c==null?void 0:c.value)==null||n.abort(t),W(t)}catch{}})}i(Fe,"cancelUpload");function _e(t,n,l){if(s.value=!0,o.onProgress)return o.onProgress(t,n,l)}i(_e,"onProgressAction");function be(t){if(o.onPreview)return o.onPreview(t);if(w.value){const{url:n}=t||{};n&&(r.sourcePreview=n,r.showPreview=!0)}}i(be,"onPreviewAction");function Be(){r.showPreview=!1,r.sourcePreview=""}i(Be,"closePreview");const I=e.ref(!1),X=e.ref([]);function we(t,n){var l;X.value=[((l=r.uploadFileList[n])==null?void 0:l.url)||(t==null?void 0:t.url)],I.value=!0}i(we,"onHandlePreview");function Ee(t){W(t)}i(Ee,"onHandleRemove");function Ne(t,n){b("onHandleCropper",t,n)}return i(Ne,"onHandleCropper"),q({uploadRef:c}),(t,n)=>{const l=Le.ElAvatar,u=e.resolveComponent("Crop"),a=Ve.ElIcon,C=e.resolveComponent("ZoomIn"),y=e.resolveComponent("Delete"),d=xe.ElUpload,H=Pe.ElImageViewer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(te),e.unref(S)?"ls-upload-drag":"",e.unref(O)?"ls-profile":"",e.unref(ae)?"hide-cover-btn":"",e.unref(de)?"hide-btn":""])},[e.createVNode(d,e.mergeProps({ref_key:"uploadRef",ref:c},Object.assign(e.unref(v),t.$attrs),{"on-exceed":me,"before-upload":pe,"on-change":ve,"on-success":ge,"on-error":ke,"on-remove":he,"on-progress":_e,"on-preview":be}),e.createSlots({trigger:e.withCtx(()=>[e.unref(O)?t.item.defProfile&&e.unref(r).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(U).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(_.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(h)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(Q.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",Te,[e.createElementVNode("div",Ae,e.toDisplayString(e.unref(M)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[2]||(n[2]=e.createTextVNode(" / ",-1)),n[3]||(n[3]=e.createElementVNode("div",{class:"drag-txt ls-color-text2"}," 拖拽到此区域 ",-1))],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",Me,[e.unref(s)?(e.openBlock(),e.createBlock(_.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(h)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(Q.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(r).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref(M)),1)])):(e.openBlock(),e.createBlock(_.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(M)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(U).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(g)&&(e.unref(oe)||e.unref(S))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(S)?"drag-css":"nor-css",!e.unref(p)||e.unref(k)?"multi-css":""]])},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(p)||e.unref(k)?(e.openBlock(),e.createBlock(_.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(h),class:"ls-upload-btn-com ls-upload-btn-cancel",onClick:Fe},{default:e.withCtx(()=>n[5]||(n[5]=[e.createTextVNode(" 取消上传 ",-1)])),_:1,__:[5]},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(_.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":K()}]),type:"primary",loading:e.unref(s),disabled:e.unref(h),onClick:D},{default:e.withCtx(()=>n[6]||(n[6]=[e.createTextVNode(" 开始上传 ",-1)])),_:1,__:[6]},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(_.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":K()}]),loading:e.unref(s),disabled:e.unref(h),onClick:D},{default:e.withCtx(()=>n[4]||(n[4]=[e.createTextVNode(" 开始上传 ",-1)])),_:1,__:[4]},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(U).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",Re,e.toDisplayString(e.unref(ce)||e.unref(se)),1))]),_:2},[t.customFile?{name:"file",fn:e.withCtx(({file:f,index:F})=>{var Y;return[e.createElementVNode("img",{src:((Y=e.unref(r).uploadFileList[F])==null?void 0:Y.url)||f.url,class:"el-upload-list__item-thumbnail"},null,8,ze),e.createElementVNode("div",De,[e.renderSlot(t.$slots,"default",{file:f,index:F},void 0,!0),t.hasCropper?(e.openBlock(),e.createElementBlock("span",{key:0,class:"el-upload-list__item-cropper",onClick:i(J=>Ne(f,F),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(u)]),_:1})],8,Ie)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:"el-upload-list__item-preview",onClick:i(J=>we(f,F),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(C)]),_:1})],8,He),e.createElementVNode("span",{class:"el-upload-list__item-delete",onClick:i(J=>Ee(f),"onClick")},[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(y)]),_:1})],8,Oe)])]}),key:"0"}:{name:"file",fn:e.withCtx(({file:f,index:F})=>[e.renderSlot(t.$slots,"file",{file:f,index:F},void 0,!0)]),key:"1"}]),1040),e.createVNode(e.unref(Ue.default),{modelValue:e.unref(r).showPreview,"onUpdate:modelValue":n[0]||(n[0]=f=>e.unref(r).showPreview=f),source:e.unref(r).sourcePreview,"on-close":Be},null,8,["modelValue","source"]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.unref(I)?(e.openBlock(),e.createBlock(H,{key:0,"url-list":e.unref(X),onClose:n[1]||(n[1]=f=>I.value=!1)},null,8,["url-list"])):e.createCommentVNode("",!0)]))],2)}}});exports.default=je;
|