You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
663 B
29 lines
663 B
import { ref } from 'vue'
|
|
import { getCaptcha } from '@/app/api/system'
|
|
|
|
interface formData {
|
|
captcha_code: string,
|
|
captcha_key: string
|
|
}
|
|
|
|
export function useCaptcha(formData: formData) {
|
|
const image = ref('')
|
|
|
|
const refresh = async () => {
|
|
try {
|
|
await getCaptcha().then((res: any) => {
|
|
if (res.code == 1) {
|
|
formData.captcha_key = res.data.captcha_key
|
|
formData.captcha_code = ''
|
|
image.value = res.data.img.replace(/\r\n/g, '')
|
|
}
|
|
})
|
|
} catch (e) {
|
|
}
|
|
}
|
|
|
|
return {
|
|
image,
|
|
refresh
|
|
}
|
|
}
|
|
|