|
@@ -1,8 +1,11 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="d-flex flex-column">
|
|
|
|
|
|
|
+ <div class="d-flex flex-column container">
|
|
|
|
|
+ <div id="captchaBox" :class="show ? '' : 'hidden'" />
|
|
|
<vue-hcaptcha
|
|
<vue-hcaptcha
|
|
|
:sitekey="siteKey"
|
|
:sitekey="siteKey"
|
|
|
challenge-container="captchaBox"
|
|
challenge-container="captchaBox"
|
|
|
|
|
+ @opened="show = true"
|
|
|
|
|
+ @closed="show = false"
|
|
|
@verify="onVerify"
|
|
@verify="onVerify"
|
|
|
@expired="onExpire"
|
|
@expired="onExpire"
|
|
|
@challenge-expired="onChallengeExpire"
|
|
@challenge-expired="onChallengeExpire"
|
|
@@ -13,8 +16,6 @@
|
|
|
:rules="[validateCaptchaState]"
|
|
:rules="[validateCaptchaState]"
|
|
|
class="hidden-ctrl"
|
|
class="hidden-ctrl"
|
|
|
/>
|
|
/>
|
|
|
-
|
|
|
|
|
- <div id="captchaBox"></div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -25,6 +26,8 @@ import type { Ref } from 'vue'
|
|
|
const runtimeConfig = useRuntimeConfig()
|
|
const runtimeConfig = useRuntimeConfig()
|
|
|
const siteKey = runtimeConfig.public.hCaptchaSiteKey
|
|
const siteKey = runtimeConfig.public.hCaptchaSiteKey
|
|
|
|
|
|
|
|
|
|
+const show: Ref<boolean> = ref(false)
|
|
|
|
|
+
|
|
|
const verified: Ref<boolean> = ref(false)
|
|
const verified: Ref<boolean> = ref(false)
|
|
|
const expired: Ref<boolean> = ref(false)
|
|
const expired: Ref<boolean> = ref(false)
|
|
|
const token: Ref<string> = ref('')
|
|
const token: Ref<string> = ref('')
|
|
@@ -46,6 +49,8 @@ function onVerify(tokenStr: string, ekey: string) {
|
|
|
token.value = tokenStr
|
|
token.value = tokenStr
|
|
|
eKey.value = ekey
|
|
eKey.value = ekey
|
|
|
emit('update', true)
|
|
emit('update', true)
|
|
|
|
|
+
|
|
|
|
|
+ show.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function onExpire() {
|
|
function onExpire() {
|
|
@@ -81,4 +86,25 @@ function onError(err: string) {
|
|
|
display: none;
|
|
display: none;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.container {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#captchaBox {
|
|
|
|
|
+ z-index: 1000;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ bottom: 140px;
|
|
|
|
|
+ box-shadow: 2px 2px 1px grey;
|
|
|
|
|
+ border: solid 1px lightgray;
|
|
|
|
|
+ background: white;
|
|
|
|
|
+
|
|
|
|
|
+ @media (min-width: 600px) {
|
|
|
|
|
+ left: -100px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.hidden {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|