This commit is contained in:
2025-04-19 15:28:32 +08:00
parent c80b173e28
commit 9731d104f6
17 changed files with 796 additions and 738 deletions

View File

@@ -1,10 +1,11 @@
<script setup>
import {ref, defineProps, defineModel} from 'vue';
import {Notification} from "@arco-design/web-vue";
import {defineModel, defineProps, ref} from 'vue';
import {Message, Notification} from "@arco-design/web-vue";
import Api from "../../api/index.js";
const verificationCode = defineModel('verificationCode', {type: String});
const {phone} = defineProps({
phone: {
const {mobile} = defineProps({
mobile: {
type: String,
default: null,
}
@@ -13,9 +14,11 @@ const {phone} = defineProps({
const time = ref(null);
let timer = null;
const verifyPhone = () => {
if (/^1[3-9]\d{9}$/.test(phone)) {
const verifyPhone = async () => {
if (/^1[3-9]\d{9}$/.test(mobile)) {
if (timer === null) {
const {msg, code} = await Api.admin.sendSms(mobile);
if (code === 1) Message.success(msg);
time.value = 10;
timer = setInterval(() => {
if (time.value <= 0) {
@@ -39,7 +42,7 @@ const verifyPhone = () => {
</script>
<template>
<a-input :model-value="verificationCode" placeholder="验证码">
<a-input v-model:model-value="verificationCode" placeholder="验证码">
<template #append>
<a-link @click="verifyPhone" :disabled="Boolean(time)" :hoverable="false">
{{ time ? `${time}s后重新获取` : '发送验证码' }}