This commit is contained in:
xiaojunnuo
2025-09-27 01:19:32 +08:00
parent dcc396afb7
commit a7ab26d08d
7 changed files with 142 additions and 68 deletions
@@ -12,6 +12,14 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
type: {
type: String,
default: "image",
},
addonId: {
type: Number,
default: 0,
},
});
const captchaRef = ref(null);
const settingStore = useSettingStore();
@@ -23,7 +31,7 @@ const captchaAddonId = computed(() => {
return settingStore.sysPublic.captchaAddonId ?? 0;
});
const captchaComponent = computed(() => {
let type: any = "image";
let type: any = props.type ?? "image";
if (settingStore.sysPublic.captchaAddonId && settingStore.sysPublic.captchaType) {
type = settingStore.sysPublic.captchaType;
}
@@ -14,7 +14,6 @@ async function loadCaptchaScript() {
await loadScript("https://static.geetest.com/v4/gt4.js");
loaded.value = true;
}
loadCaptchaScript();
defineOptions({
name: "GeetestCaptcha",
@@ -25,15 +24,10 @@ const props = defineProps<{
captchaGet: () => Promise<any>;
}>();
const captchaRef = ref(null);
// const addonApi = createAddonApi();
const settingStore = useSettingStore();
const captchaInstanceRef: Ref = ref({});
async function init() {
// if (!initGeetest4) {
// await import("https://static.geetest.com/v4/gt4.js");
// }
await loadCaptchaScript();
const { captchaId } = await props.captchaGet();
// @ts-ignore
initGeetest4(