Commit 535f1b63 authored by 郑磊's avatar 郑磊

更新语言判断

parent 43ced5dc
This source diff could not be displayed because it is too large. You can view the blob instead.
import { defineComponent as C, openBlock as l, createElementBlock as m, createElementVNode as c, normalizeStyle as S, pushScopeId as E, popScopeId as T, provide as et, inject as at, computed as $, normalizeClass as z, Fragment as V, toDisplayString as D, unref as y, renderSlot as st, createVNode as A, Transition as nt, withCtx as O, createBlock as x, normalizeProps as rt, mergeProps as ct, createCommentVNode as b, ref as f, onBeforeUnmount as N, toRef as ot, onMounted as it, withModifiers as P, resolveDynamicComponent as ut } from "vue";
const dt = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), lt = { class: "captcha--slider-bar" }, ht = { class: "captcha--slider-bar--bar" }, pt = /* @__PURE__ */ dt(() => /* @__PURE__ */ c("svg", {
import { defineComponent as C, openBlock as l, createElementBlock as f, createElementVNode as o, normalizeStyle as S, pushScopeId as E, popScopeId as T, provide as Q, inject as tt, computed as $, normalizeClass as R, Fragment as V, toDisplayString as D, unref as y, renderSlot as et, createVNode as A, Transition as at, withCtx as O, createBlock as x, normalizeProps as st, mergeProps as nt, createCommentVNode as b, ref as m, onBeforeUnmount as W, toRef as rt, onMounted as ot, withModifiers as P, resolveDynamicComponent as ct } from "vue";
const it = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), ut = { class: "captcha--slider-bar" }, dt = { class: "captcha--slider-bar--bar" }, lt = /* @__PURE__ */ it(() => /* @__PURE__ */ o("svg", {
class: "captcha--slider-bar--track-icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -8,13 +8,13 @@ const dt = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), lt = { class: "captch
width: "64",
height: "64"
}, [
/* @__PURE__ */ c("path", {
/* @__PURE__ */ o("path", {
d: "M576 192v256H0v128h576v256l448-320z",
"p-id": "4240"
})
], -1)), vt = [
pt
], gt = /* @__PURE__ */ C({
], -1)), ht = [
lt
], pt = /* @__PURE__ */ C({
__name: "SliderBar",
props: {
x: {
......@@ -23,19 +23,19 @@ const dt = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), lt = { class: "captch
}
},
setup(t) {
return (e, a) => (l(), m("div", lt, [
c("div", ht, [
c("div", {
return (e, a) => (l(), f("div", ut, [
o("div", dt, [
o("div", {
class: "captcha--slider-bar--active",
style: S({ width: `${t.x}px` })
}, null, 4)
]),
c("div", {
o("div", {
class: "captcha--slider-bar--track",
style: S({
transform: `translateX(${t.x}px)`
})
}, vt, 4)
}, ht, 4)
]));
}
}), _ = (t, e) => {
......@@ -43,45 +43,46 @@ const dt = (t) => (E("data-v-fcfe5ea2"), t = t(), T(), t), lt = { class: "captch
for (const [n, i] of e)
a[n] = i;
return a;
}, ft = /* @__PURE__ */ _(gt, [["__scopeId", "data-v-fcfe5ea2"]]), mt = {
}, vt = /* @__PURE__ */ _(pt, [["__scopeId", "data-v-fcfe5ea2"]]), gt = {
验证成功: "Success",
"验证失败,请再试一次": "Verification failed",
验证码已过期: "Expired",
拖动下方滑块完成拼图: "Drag the slider to complete the puzzle",
"网络异常,请点击重试": "Network error, click to retry"
}, yt = {
}, mt = {
验证成功: "验证成功",
"验证失败,请再试一次": "验证失败,请再试一次",
验证码已过期: "验证码已过期",
拖动下方滑块完成拼图: "拖动下方滑块完成拼图",
"网络异常,请点击重试": "网络异常,请点击重试"
}, wt = {
}, ft = {
验证成功: "驗證成功",
"验证失败,请再试一次": "驗證失敗,請再試一次",
验证码已过期: "驗證碼已過期",
拖动下方滑块完成拼图: "拖動下方滑塊完成拼圖",
"网络异常,请点击重试": "網路異常,請點擊重試"
}, Y = {
en: mt,
"zh-cn": yt,
"zh-tw": wt
}, U = Object.keys(Y), _t = "zh-cn";
function Z(t) {
}, U = {
en: gt,
"zh-cn": mt,
"zh-tw": ft
}, yt = Object.keys(U), wt = "zh-cn";
function _t(t) {
const e = t.split(/_|-/);
return e.length > 2 && e.splice(1, e.length - 2), e.map((a) => a.toLowerCase()).join("-");
}
function Ct(t) {
if (typeof t == "string" && (t = Z(t), U.includes(t)))
return t;
if (navigator && navigator.languages) {
for (let e of navigator.languages)
if (e = Z(e), U.includes(e))
return e;
let e = typeof t == "string" && t ? [t] : navigator && navigator.languages ? navigator.languages : [wt];
e = e.map((a) => _t(a));
for (let a of e) {
if (a === "en" || a.startsWith("en-"))
return "en";
if (yt.includes(a))
return a;
}
return _t;
return e.some((a) => a === "zh" || a.startsWith("zh-")) ? "zh-cn" : "en";
}
function xt(t) {
return Y[Ct(t)] ?? {};
return U[Ct(t)] ?? {};
}
function bt(t) {
const e = xt(t);
......@@ -108,14 +109,14 @@ function It(t) {
i !== null && (e[n] = i);
}), e;
}
function G(t) {
function Z(t) {
const {
url: e,
baseURL: a,
method: n,
params: i,
headers: s,
data: o,
data: c,
timeout: u,
withCredentials: d = !1
} = t, r = new XMLHttpRequest();
......@@ -130,12 +131,12 @@ function G(t) {
if (r.readyState === XMLHttpRequest.OPENED) {
if (typeof s == "object" && s && Object.entries(s).forEach(
([h, v]) => r.setRequestHeader(h, v)
), typeof o < "u" && o !== null) {
if (typeof o == "string") {
r.send(o);
), typeof c < "u" && c !== null) {
if (typeof c == "string") {
r.send(c);
return;
} else if (typeof o == "object") {
r.setRequestHeader("Content-Type", "application/json"), r.send(JSON.stringify(o));
} else if (typeof c == "object") {
r.setRequestHeader("Content-Type", "application/json"), r.send(JSON.stringify(c));
return;
}
}
......@@ -146,7 +147,7 @@ function G(t) {
}
async function Lt(t) {
for (; ; ) {
const e = await G({
const e = await Z({
method: "POST",
data: {},
...t
......@@ -159,7 +160,7 @@ async function kt(t) {
const { data: e, ...a } = t;
let n;
try {
n = (await G({
n = (await Z({
...a,
method: "POST",
data: e
......@@ -170,7 +171,7 @@ async function kt(t) {
if (n.code !== 0)
return n.code === 4e3 ? "验证码已过期" : "验证失败,请再试一次";
}
function R(t) {
function H(t) {
if (t.pageX !== null && t.pageX !== void 0)
return {
x: Math.round(t.pageX),
......@@ -185,14 +186,14 @@ function R(t) {
y: Math.round(e[0].clientY)
};
}
function W(t) {
function N(t) {
const { triggers: e = [], max: a, onDrag: n, onVerify: i } = t;
let s = null, o = [];
let s = null, c = [];
const u = (h) => {
s = {
...R(h),
...H(h),
startTime: Date.now()
}, o.push({
}, c.push({
x: 0,
y: 0,
type: "down",
......@@ -201,8 +202,8 @@ function W(t) {
}, d = (h) => {
if (!s)
return;
const v = R(h);
o.push({
const v = H(h);
c.push({
x: v.x - s.x,
y: v.y - s.y,
type: "move",
......@@ -212,11 +213,11 @@ function W(t) {
n(I);
}, r = (h) => {
if (s) {
if (p(), !o.some((v) => v.type === "move"))
o = [];
if (p(), !c.some((v) => v.type === "move"))
c = [];
else {
const v = R(h);
o.push({
const v = H(h);
c.push({
x: v.x - s.x,
y: v.y - s.y,
type: "up",
......@@ -224,7 +225,7 @@ function W(t) {
}), w(), i({
startSlidingTime: new Date(s.startTime).toISOString(),
endSlidingTime: (/* @__PURE__ */ new Date()).toISOString(),
trackList: o
trackList: c
});
}
s = null;
......@@ -249,13 +250,13 @@ function Mt(t) {
const { captcha: e, ratio: a, onVerify: n, ...i } = t, s = Math.round(
(e.backgroundImageWidth - e.templateImageWidth) * a
);
return W({
return N({
...i,
captcha: e,
max: s,
onVerify: (o) => {
onVerify: (c) => {
n({
...o,
...c,
bgImageWidth: Math.round(e.backgroundImageWidth * a),
bgImageHeight: Math.round(
e.backgroundImageHeight * a
......@@ -271,9 +272,9 @@ function Mt(t) {
});
}
function Et(t) {
const { captcha: e, ratio: a, onVerify: n, onDrag: i, max: s, ...o } = t;
return W({
...o,
const { captcha: e, ratio: a, onVerify: n, onDrag: i, max: s, ...c } = t;
return N({
...c,
captcha: e,
max: s,
onDrag: (u) => i(u, u / s * 360),
......@@ -294,20 +295,20 @@ function Et(t) {
}
});
}
function F(t, e) {
function Y(t, e) {
return Math.round(
(t.backgroundImageHeight - t.data.randomY) * e
);
}
function Tt(t) {
const { captcha: e, ratio: a, onVerify: n, max: i, ...s } = t;
return W({
return N({
...s,
captcha: e,
max: i,
onVerify: (o) => {
onVerify: (c) => {
n({
...o,
...c,
bgImageWidth: Math.round(e.backgroundImageWidth * a),
bgImageHeight: Math.round(
e.backgroundImageHeight * a
......@@ -315,20 +316,20 @@ function Tt(t) {
sliderImageWidth: Math.round(
e.backgroundImageWidth * a
),
sliderImageHeight: F(e, a)
sliderImageHeight: Y(e, a)
});
}
});
}
const J = Symbol();
const G = Symbol();
function $t(t) {
et(J, t);
Q(G, t);
}
function B(t) {
return t || (t = at(J, () => $(() => {
return t || (t = tt(G, () => $(() => {
}), !0)), $(() => bt(t.value));
}
const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K(() => /* @__PURE__ */ c("svg", {
const F = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ F(() => /* @__PURE__ */ o("svg", {
class: "captcha--status-tip--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -337,11 +338,11 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
width: "64",
height: "64"
}, [
/* @__PURE__ */ c("path", {
/* @__PURE__ */ o("path", {
d: "M896 512a384 384 0 1 0-768 0 384 384 0 0 0 768 0zM42.666667 512C42.666667 252.8 252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333S42.666667 771.2 42.666667 512z m652.501333-158.165333l60.330667 60.330666L469.333333 700.330667l-200.832-200.832 60.330667-60.330667L469.333333 579.669333l225.834667-225.834666z",
"p-id": "5408"
})
], -1)), Ot = /* @__PURE__ */ K(() => /* @__PURE__ */ c("svg", {
], -1)), Ot = /* @__PURE__ */ F(() => /* @__PURE__ */ o("svg", {
class: "captcha--status-tip--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -350,11 +351,11 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
width: "64",
height: "64"
}, [
/* @__PURE__ */ c("path", {
/* @__PURE__ */ o("path", {
d: "M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z",
"p-id": "6384"
})
], -1)), Ht = /* @__PURE__ */ C({
], -1)), zt = /* @__PURE__ */ C({
__name: "StatusTip",
props: {
status: {
......@@ -367,19 +368,19 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
setup(t) {
const e = B();
return (a, n) => (l(), m("div", {
class: z(`captcha--status-tip captcha--status-tip--${t.status ? "success" : "fail"}`)
return (a, n) => (l(), f("div", {
class: R(`captcha--status-tip captcha--status-tip--${t.status ? "success" : "fail"}`)
}, [
t.status ? (l(), m(V, { key: 0 }, [
t.status ? (l(), f(V, { key: 0 }, [
Dt,
c("div", null, D(y(e)("验证成功")), 1)
], 64)) : (l(), m(V, { key: 1 }, [
o("div", null, D(y(e)("验证成功")), 1)
], 64)) : (l(), f(V, { key: 1 }, [
Ot,
c("div", null, D(y(e)(t.message ?? "验证失败,请再试一次")), 1)
o("div", null, D(y(e)(t.message ?? "验证失败,请再试一次")), 1)
], 64))
], 2));
}
}), Rt = /* @__PURE__ */ _(Ht, [["__scopeId", "data-v-4b782e10"]]), zt = { class: "captcha--view" }, Vt = { class: "captcha--view--tip" }, Nt = { class: "captcha--view--content" }, Wt = /* @__PURE__ */ C({
}), Ht = /* @__PURE__ */ _(zt, [["__scopeId", "data-v-4b782e10"]]), Rt = { class: "captcha--view" }, Vt = { class: "captcha--view--tip" }, Wt = { class: "captcha--view--content" }, Nt = /* @__PURE__ */ C({
__name: "CaptchaViewContainer",
props: {
verifyStatus: {
......@@ -392,21 +393,21 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
setup(t) {
const e = B();
return (a, n) => (l(), m("div", zt, [
c("div", Vt, D(y(e)("拖动下方滑块完成拼图")), 1),
c("div", Nt, [
st(a.$slots, "default", {}, void 0, !0),
A(nt, { name: "captcha--status-tip" }, {
return (a, n) => (l(), f("div", Rt, [
o("div", Vt, D(y(e)("拖动下方滑块完成拼图")), 1),
o("div", Wt, [
et(a.$slots, "default", {}, void 0, !0),
A(at, { name: "captcha--status-tip" }, {
default: O(() => [
t.verifyStatus ? (l(), x(Rt, rt(ct({ key: 0 }, t.verifyStatus)), null, 16)) : b("", !0)
t.verifyStatus ? (l(), x(Ht, st(nt({ key: 0 }, t.verifyStatus)), null, 16)) : b("", !0)
]),
_: 1
})
]),
A(ft, { x: t.x }, null, 8, ["x"])
A(vt, { x: t.x }, null, 8, ["x"])
]));
}
}), j = /* @__PURE__ */ _(Wt, [["__scopeId", "data-v-ef209593"]]), Bt = ["src"], jt = /* @__PURE__ */ C({
}), j = /* @__PURE__ */ _(Nt, [["__scopeId", "data-v-ef209593"]]), Bt = ["src"], jt = /* @__PURE__ */ C({
__name: "ConcatCaptcha",
props: {
captcha: {
......@@ -419,14 +420,14 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = f(0), o = $(() => F(n.captcha, i)), u = Tt({
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = m(0), c = $(() => Y(n.captcha, i)), u = Tt({
captcha: n.captcha,
ratio: i,
max: 225,
onDrag: (d) => s.value = d,
onVerify: (d) => a("verify", d)
});
return N(() => u.destroy()), (d, r) => (l(), x(j, {
return W(() => u.destroy()), (d, r) => (l(), x(j, {
class: "captcha--view--concat",
verifyStatus: t.verifyStatus,
x: s.value,
......@@ -434,14 +435,14 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
onMousedown: y(u).onDragStart
}, {
default: O(() => [
c("img", {
o("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--concat--bg"
}, null, 8, Bt),
c("div", {
o("div", {
class: "captcha--view--concat--track",
style: S({
height: `${o.value}px`,
height: `${c.value}px`,
backgroundImage: `url('${t.captcha.backgroundImage}')`,
backgroundPositionX: `${s.value}px`
})
......@@ -463,16 +464,16 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = f(0), s = f(0), o = 280 / n.captcha.backgroundImageWidth, u = Et({
const a = e, n = t, i = m(0), s = m(0), c = 280 / n.captcha.backgroundImageWidth, u = Et({
captcha: n.captcha,
ratio: o,
ratio: c,
max: 225,
onDrag: (d, r) => {
i.value = d, s.value = r;
},
onVerify: (d) => a("verify", d)
});
return N(() => u.destroy()), (d, r) => (l(), x(j, {
return W(() => u.destroy()), (d, r) => (l(), x(j, {
class: "captcha--view--rotate",
verifyStatus: t.verifyStatus,
x: i.value,
......@@ -480,11 +481,11 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
onMousedown: y(u).onDragStart
}, {
default: O(() => [
c("img", {
o("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--rotate--bg"
}, null, 8, Xt),
c("img", {
o("img", {
src: t.captcha.templateImage,
class: "captcha--view--rotate--track",
style: S({ transform: `rotate(${s.value}deg)` })
......@@ -506,7 +507,7 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
emits: ["verify"],
setup(t, { emit: e }) {
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = f(0), o = Mt({
const a = e, n = t, i = 280 / n.captcha.backgroundImageWidth, s = m(0), c = Mt({
captcha: n.captcha,
ratio: i,
onDrag: (u) => {
......@@ -514,19 +515,19 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
},
onVerify: (u) => a("verify", u)
});
return N(() => o.destroy()), (u, d) => (l(), x(j, {
return W(() => c.destroy()), (u, d) => (l(), x(j, {
class: "captcha--view--slider",
verifyStatus: t.verifyStatus,
x: s.value,
onTouchstart: y(o).onDragStart,
onMousedown: y(o).onDragStart
onTouchstart: y(c).onDragStart,
onMousedown: y(c).onDragStart
}, {
default: O(() => [
c("img", {
o("img", {
src: t.captcha.backgroundImage,
class: "captcha--view--slider--bg"
}, null, 8, Zt),
c("img", {
o("img", {
src: t.captcha.templateImage,
class: "captcha--view--slider--track",
style: S({ transform: `translateX(${s.value}px)` })
......@@ -535,7 +536,7 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
_: 1
}, 8, ["verifyStatus", "x", "onTouchstart", "onMousedown"]));
}
}), Ft = /* @__PURE__ */ _(Gt, [["__scopeId", "data-v-8fb0f971"]]), Jt = (t) => (E("data-v-6ba70e16"), t = t(), T(), t), Kt = /* @__PURE__ */ Jt(() => /* @__PURE__ */ c("svg", {
}), Ft = /* @__PURE__ */ _(Gt, [["__scopeId", "data-v-8fb0f971"]]), Jt = (t) => (E("data-v-6ba70e16"), t = t(), T(), t), Kt = /* @__PURE__ */ Jt(() => /* @__PURE__ */ o("svg", {
class: "captcha--error--icon",
viewBox: "0 0 1024 1024",
version: "1.1",
......@@ -544,7 +545,7 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
width: "64",
height: "64"
}, [
/* @__PURE__ */ c("path", {
/* @__PURE__ */ o("path", {
d: "M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z",
"p-id": "6384"
})
......@@ -553,40 +554,40 @@ const K = (t) => (E("data-v-4b782e10"), t = t(), T(), t), Dt = /* @__PURE__ */ K
emits: ["click"],
setup(t, { emit: e }) {
const a = e, n = B();
return (i, s) => (l(), m("div", {
return (i, s) => (l(), f("div", {
className: "captcha--error",
onClick: s[0] || (s[0] = (o) => a("click", o))
onClick: s[0] || (s[0] = (c) => a("click", c))
}, [
Kt,
c("div", Qt, D(y(n)("网络异常,请点击重试")), 1)
o("div", Qt, D(y(n)("网络异常,请点击重试")), 1)
]));
}
}), ee = /* @__PURE__ */ _(te, [["__scopeId", "data-v-6ba70e16"]]), ae = {}, se = (t) => (E("data-v-edb749e2"), t = t(), T(), t), ne = { class: "captcha--loading" }, re = /* @__PURE__ */ se(() => /* @__PURE__ */ c("div", { class: "lds-ellipsis" }, [
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div"),
/* @__PURE__ */ c("div")
], -1)), ce = [
}), ee = /* @__PURE__ */ _(te, [["__scopeId", "data-v-6ba70e16"]]), ae = {}, se = (t) => (E("data-v-edb749e2"), t = t(), T(), t), ne = { class: "captcha--loading" }, re = /* @__PURE__ */ se(() => /* @__PURE__ */ o("div", { class: "lds-ellipsis" }, [
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div"),
/* @__PURE__ */ o("div")
], -1)), oe = [
re
];
function oe(t, e) {
return l(), m("div", ne, ce);
function ce(t, e) {
return l(), f("div", ne, oe);
}
const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2"]]), q = (t) => (E("data-v-0a2d342a"), t = t(), T(), t), ue = { class: "captcha--box" }, de = { className: "captcha--bottom" }, le = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
const ie = /* @__PURE__ */ _(ae, [["render", ce], ["__scopeId", "data-v-edb749e2"]]), q = (t) => (E("data-v-0a2d342a"), t = t(), T(), t), ue = { class: "captcha--box" }, de = { className: "captcha--bottom" }, le = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
d: "M715.7 794.7c-1.9-4.7-7.4-6.5-11.8-4-54.3 31.1-115.8 50.3-177.2 50.3-192.2 0-345.2-148.3-345.2-335.7 0-37.7 5.5-72.6 18.3-107.1l65.2 17.5c6.3 1.7 11.9-4.1 10-10.5l-55.5-183.1c-1.8-5.9-9.1-7.9-13.5-3.6l-139.4 131c-4.8 4.5-2.8 12.3 3.5 14.1l58.2 15.6c-15.7 42.6-25.4 86.5-25.4 135 0 226.6 187.9 409.8 419.5 409.8 76.7 0 149.6-18.6 215.5-55.9 3.6-2.1 5.2-6.5 3.6-10.4l-25.8-63zM308.2 229.2c1.9 4.7 7.4 6.5 11.8 4 54.3-31.2 115.8-50.3 177.2-50.3 192.2 0 345.2 148.3 345.2 335.7 0 37.7-5.5 72.6-18.3 107.1l-65.2-17.5c-6.3-1.7-11.9 4.1-10 10.5l55.5 183.1c1.8 5.9 9.1 7.9 13.5 3.6l139.5-130.8c4.8-4.5 2.8-12.3-3.5-14.1l-58.2-15.6c15.7-42.6 25.4-86.5 25.4-135 0-226.6-187.9-409.8-419.5-409.8-76.7 0-149.6 18.6-215.5 55.9-3.6 2.1-5.2 6.5-3.6 10.4l25.7 62.8z",
"p-id": "4400"
}, null, -1)), he = [
le
], pe = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
], pe = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
d: "M509.866667 32C245.333333 32 32 247.466667 32 512s213.333333 480 477.866667 480S987.733333 776.533333 987.733333 512 774.4 32 509.866667 32z m0 896C281.6 928 96 742.4 96 512S281.6 96 509.866667 96 923.733333 281.6 923.733333 512s-185.6 416-413.866666 416z",
"p-id": "5378"
}, null, -1)), ve = /* @__PURE__ */ q(() => /* @__PURE__ */ c("path", {
}, null, -1)), ve = /* @__PURE__ */ q(() => /* @__PURE__ */ o("path", {
d: "M693.333333 330.666667c-12.8-12.8-32-12.8-44.8 0L512 467.2l-136.533333-136.533333c-12.8-12.8-32-12.8-44.8 0-12.8 12.8-12.8 32 0 44.8l136.533333 136.533333-136.533333 136.533333c-12.8 12.8-12.8 32 0 44.8 6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334l136.533333-136.533333 136.533334 136.533333c6.4 6.4 14.933333 8.533333 23.466666 8.533334s17.066667-2.133333 23.466667-8.533334c12.8-12.8 12.8-32 0-44.8L556.8 512l136.533333-136.533333c12.8-12.8 12.8-32 0-44.8z",
"p-id": "5379"
}, null, -1)), ge = [
pe,
ve
], fe = /* @__PURE__ */ C({
], me = /* @__PURE__ */ C({
__name: "Captcha",
props: {
requestCaptchaDataUrl: {
......@@ -622,11 +623,11 @@ const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2
CONCAT: qt,
SLIDER: Ft,
ROTATE: Ut
}, i = a, s = t, o = $(
}, i = a, s = t, c = $(
() => typeof s.radius == "number" && !isNaN(s.radius) && s.radius >= 0 ? { borderRadius: `${s.radius}px` } : {}
), u = ot(s, "locale");
), u = rt(s, "locale");
$t(u);
const d = f(!1), r = f(!1), w = f(!1), p = f(), h = f(!1), v = f(), I = f(0), Q = () => {
const d = m(!1), r = m(!1), w = m(!1), p = m(), h = m(!1), v = m(), I = m(0), J = () => {
d.value = !0;
const L = ++I.value;
return new Promise((g, k) => {
......@@ -643,15 +644,15 @@ const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2
});
}, X = async () => {
try {
p.value = await Q();
p.value = await J();
} catch {
h.value = !0;
}
}, H = async () => {
}, z = async () => {
r.value || w.value || (h.value = !1, r.value = !0, await X(), r.value = !1);
};
it(H);
const tt = async (L) => {
ot(z);
const K = async (L) => {
if (!p.value)
return;
const g = p.value;
......@@ -677,35 +678,35 @@ const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2
return e({
containerRef: v,
refresh: () => {
H();
z();
}
}), (L, g) => (l(), m("div", {
}), (L, g) => (l(), f("div", {
ref_key: "containerRef",
ref: v,
class: z(["captcha--container", {
class: R(["captcha--container", {
"captcha--container--radius": t.radius,
"captcha--container--shadow": t.shadow
}]),
style: S(o.value),
style: S(c.value),
onTouchmove: g[1] || (g[1] = P(() => {
}, ["prevent"])),
onMousemove: g[2] || (g[2] = P(() => {
}, ["prevent"]))
}, [
c("div", ue, [
p.value ? (l(), x(ut(n[p.value.captcha.type]), {
o("div", ue, [
p.value ? (l(), x(ct(n[p.value.captcha.type]), {
key: p.value.key,
captcha: p.value.captcha,
verifyStatus: p.value.verifyStatus,
onVerify: tt
onVerify: K
}, null, 40, ["captcha", "verifyStatus"])) : b("", !0),
p.value ? (l(), m(V, { key: 1 }, [], 64)) : b("", !0),
p.value ? (l(), f(V, { key: 1 }, [], 64)) : b("", !0),
d.value ? (l(), x(ie, { key: 2 })) : b("", !0),
h.value ? (l(), x(ee, { key: 3 })) : b("", !0)
]),
c("div", de, [
(l(), m("svg", {
class: z(["captcha--svg-icon captcha--btn-refresh", {
o("div", de, [
(l(), f("svg", {
class: R(["captcha--svg-icon captcha--btn-refresh", {
"captcha--btn-refresh--active": r.value
}]),
viewBox: "0 0 1024 1024",
......@@ -714,9 +715,9 @@ const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2
"p-id": "4399",
width: "64",
height: "64",
onClick: H
onClick: z
}, he, 2)),
t.showClose ? (l(), m("svg", {
t.showClose ? (l(), f("svg", {
key: 0,
class: "captcha--svg-icon captcha--btn-close",
viewBox: "0 0 1024 1024",
......@@ -732,7 +733,7 @@ const ie = /* @__PURE__ */ _(ae, [["render", oe], ["__scopeId", "data-v-edb749e2
])
], 38));
}
}), ye = /* @__PURE__ */ _(fe, [["__scopeId", "data-v-0a2d342a"]]);
}), ye = /* @__PURE__ */ _(me, [["__scopeId", "data-v-0a2d342a"]]);
export {
ye as Captcha
};
{
"name": "fj-captcha-vue",
"version": "1.0.2",
"version": "1.0.3",
"type": "module",
"main": "./esm/index.js",
"typings": "./esm/index.d.ts",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment