Files
certd/packages/ui/certd-client/src/views/framework/login/image-code.vue
ahe 81ac240ac8 perf: 新增找回密码功能 @nicheng-he
* feat 找回密码

* 1.发送邮件时修改模版
2.重置成功时清除登陆错误次数

* 增加自助找回密码控制

* 补充接口自助找回判断
2025-07-24 16:56:22 +08:00

42 lines
1.0 KiB
Vue

<template>
<div class="flex">
<a-input :value="value" placeholder="请输入图片验证码" autocomplete="off" @update:value="onChange">
<template #prefix>
<fs-icon icon="ion:image-outline"></fs-icon>
</template>
</a-input>
<div class="input-right pointer" title="点击刷新">
<img class="image-code" :src="imageCodeUrl" @click="resetImageCode" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, useAttrs, defineExpose } from "vue";
import { nanoid } from "nanoid";
const props = defineProps<{
randomStr?: string;
value?: string;
}>();
const emit = defineEmits(["update:value", "update:randomStr", "change"]);
function onChange(value: string) {
emit("update:value", value);
emit("change", value);
}
const imageCodeUrl = ref();
function resetImageCode() {
const randomStr = nanoid(10);
let url = "api/basic/code/captcha";
imageCodeUrl.value = url + "?randomStr=" + randomStr;
emit("update:randomStr", randomStr);
}
defineExpose({
resetImageCode,
})
resetImageCode();
</script>