231 lines
8.1 KiB
Vue
231 lines
8.1 KiB
Vue
<script>
|
|
import "~/assets/styles/GeetestField.DiieTibK.css";
|
|
import "~/assets/styles/CaptchaField.BSN3ZbsD.css";
|
|
import { toDisplayString } from "vue";
|
|
import { useId } from "vue";
|
|
import { mergeModels } from "vue";
|
|
import { useModel } from "vue";
|
|
import { createBlock } from "vue";
|
|
import { createElementBlock } from "vue";
|
|
import { Fragment } from "vue";
|
|
import { createElementVNode } from "vue";
|
|
import { createTextVNode } from "vue";
|
|
import { unref } from "vue";
|
|
import { defineComponent } from "vue";
|
|
import { createVNode } from "vue";
|
|
import { openBlock } from "vue";
|
|
import button from "primevue/button";
|
|
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
|
import GeetestField from "~/components/GeetestField.vue";
|
|
import inputtext from "primevue/inputtext";
|
|
var _ = {
|
|
class: `field`,
|
|
},
|
|
v = [`for`],
|
|
y = {
|
|
class: `row`,
|
|
},
|
|
b = [`disabled`],
|
|
x = [`src`],
|
|
S = {
|
|
key: 1,
|
|
class: `pi pi-spin pi-spinner`,
|
|
},
|
|
C = {
|
|
key: 2,
|
|
class: `retry`,
|
|
},
|
|
w = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `CaptchaField`,
|
|
props: mergeModels(
|
|
{
|
|
img: {},
|
|
loading: {
|
|
type: Boolean,
|
|
},
|
|
label: {},
|
|
provider: {},
|
|
captchaId: {},
|
|
disabled: {
|
|
type: Boolean,
|
|
},
|
|
},
|
|
{
|
|
modelValue: {
|
|
default: ``,
|
|
},
|
|
modelModifiers: {},
|
|
},
|
|
),
|
|
emits: mergeModels(
|
|
[`refresh`, `verified`, `invalid`],
|
|
[`update:modelValue`],
|
|
),
|
|
setup(n, { emit: u }) {
|
|
let m = u,
|
|
w = useModel(n, `modelValue`),
|
|
T = useId();
|
|
return (t, r) => {
|
|
let u = GeetestField,
|
|
E = button,
|
|
D = inputtext;
|
|
return (
|
|
openBlock(),
|
|
createElementBlock(`div`, _, [
|
|
n.provider === `geetest`
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 0,
|
|
},
|
|
[
|
|
!n.loading && n.captchaId
|
|
? (openBlock(),
|
|
createBlock(
|
|
u,
|
|
{
|
|
key: 0,
|
|
"captcha-id": n.captchaId,
|
|
disabled: n.disabled,
|
|
onVerified: (r[0] ||= (e) => m(`verified`, e)),
|
|
onInvalid: (r[1] ||= (e) => m(`invalid`)),
|
|
},
|
|
null,
|
|
8,
|
|
[`captcha-id`, `disabled`],
|
|
))
|
|
: (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 1,
|
|
},
|
|
[
|
|
(r[5] ||= createElementVNode(
|
|
`span`,
|
|
null,
|
|
`人机验证`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
E,
|
|
{
|
|
type: `button`,
|
|
severity: `secondary`,
|
|
outlined: ``,
|
|
label: n.loading
|
|
? `验证码加载中…`
|
|
: `重新加载验证码`,
|
|
disabled: n.loading || n.disabled,
|
|
onClick: (r[2] ||= (e) => m(`refresh`)),
|
|
fluid: ``,
|
|
},
|
|
null,
|
|
8,
|
|
[`label`, `disabled`],
|
|
),
|
|
],
|
|
64,
|
|
)),
|
|
],
|
|
64,
|
|
))
|
|
: (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 1,
|
|
},
|
|
[
|
|
createElementVNode(
|
|
`label`,
|
|
{
|
|
for: unref(T),
|
|
},
|
|
toDisplayString(n.label || `图形验证码`),
|
|
9,
|
|
v,
|
|
),
|
|
createElementVNode(`div`, y, [
|
|
createVNode(
|
|
D,
|
|
{
|
|
id: unref(T),
|
|
modelValue: w.value,
|
|
"onUpdate:modelValue": (r[3] ||= (e) =>
|
|
(w.value = e)),
|
|
placeholder: `请输入图中字符`,
|
|
disabled: n.disabled || n.loading,
|
|
autocomplete: `off`,
|
|
},
|
|
null,
|
|
8,
|
|
[`id`, `modelValue`, `disabled`],
|
|
),
|
|
createElementVNode(
|
|
`button`,
|
|
{
|
|
type: `button`,
|
|
class: `img`,
|
|
disabled: n.loading || n.disabled,
|
|
title: `点击刷新`,
|
|
"aria-label": `刷新图形验证码`,
|
|
onClick: (r[4] ||= (e) => m(`refresh`)),
|
|
},
|
|
[
|
|
n.img
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
`img`,
|
|
{
|
|
key: 0,
|
|
src: n.img,
|
|
alt: `图形验证码`,
|
|
},
|
|
null,
|
|
8,
|
|
x,
|
|
))
|
|
: n.loading
|
|
? (openBlock(), createElementBlock(`i`, S))
|
|
: (openBlock(),
|
|
createElementBlock(`span`, C, [
|
|
...(r[6] ||= [
|
|
createElementVNode(
|
|
`i`,
|
|
{
|
|
class: `pi pi-refresh`,
|
|
"aria-hidden": `true`,
|
|
},
|
|
null,
|
|
-1,
|
|
),
|
|
createTextVNode(` 点击加载`, -1),
|
|
]),
|
|
])),
|
|
],
|
|
8,
|
|
b,
|
|
),
|
|
]),
|
|
],
|
|
64,
|
|
)),
|
|
])
|
|
);
|
|
};
|
|
},
|
|
}),
|
|
[[`__scopeId`, `data-v-5ba6618f`]],
|
|
),
|
|
{
|
|
__name: `CaptchaField`,
|
|
},
|
|
);
|
|
export {};
|
|
export default w;
|
|
</script>
|