mirror of
https://gitee.com/niucloud-team/niucloud.git
synced 2025-12-12 01:47:08 +00:00
26 lines
572 B
TypeScript
26 lines
572 B
TypeScript
import { getCaptcha } from '@/api/system'
|
|
import { ref } from 'vue'
|
|
|
|
interface formData {
|
|
captcha_code: string,
|
|
captcha_key: string
|
|
}
|
|
|
|
export function useCaptcha(formData: formData) {
|
|
const image = ref('')
|
|
|
|
const refresh = async ()=> {
|
|
try {
|
|
const res:AnyObject = await getCaptcha()
|
|
formData.captcha_key = res.data.captcha_key
|
|
formData.captcha_code = ''
|
|
image.value = res.data.img.replace(/\r\n/g, '')
|
|
} catch (e) {
|
|
}
|
|
}
|
|
|
|
return {
|
|
image,
|
|
refresh
|
|
}
|
|
} |