feat: 重置密码
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { showToast } from 'vant'
|
||||
|
||||
const emit = defineEmits(['nextStep'])
|
||||
|
||||
@@ -16,7 +17,19 @@ const formData = ref({
|
||||
email: ''
|
||||
})
|
||||
|
||||
const validateEmail = () => {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
return emailRegex.test(formData.value.email)
|
||||
}
|
||||
|
||||
const handleNext = () => {
|
||||
if (!validateEmail()) {
|
||||
showToast({
|
||||
message: 'please input valid email',
|
||||
position:'top'
|
||||
})
|
||||
return
|
||||
}
|
||||
emit('nextStep', { email: formData.value.email })
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
import { showToast } from 'vant'
|
||||
const emit = defineEmits(['sucess'])
|
||||
const showPwd = ref(false)
|
||||
|
||||
@@ -24,8 +24,16 @@ const formData = ref({
|
||||
password: ''
|
||||
})
|
||||
|
||||
const validatePassword = () => {
|
||||
return formData.value.password.length >= 6
|
||||
}
|
||||
|
||||
const handleNext = () => {
|
||||
emit('sucess')
|
||||
if (!validatePassword()) {
|
||||
showToast('the password must be at least 6 characters long')
|
||||
return
|
||||
}
|
||||
emit('sucess', { password: formData.value.password })
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -63,7 +63,7 @@ const cIndex = computed(() => {
|
||||
i = (i + ctSize.value) % ctSize.value
|
||||
return i
|
||||
})
|
||||
const lastCode = computed(() => getCtData.value[ctSize.value - 1])
|
||||
// const lastCode = computed(() => getCtData.value[ctSize.value - 1])
|
||||
|
||||
const countdown = ref(60)
|
||||
const handleCountdown = () => {
|
||||
@@ -96,18 +96,7 @@ const handleConfirmCaptcha = () => {
|
||||
showToast('please enter the correct verification code.')
|
||||
return
|
||||
}
|
||||
// 验证验证码
|
||||
new Promise((resolve, reject) => {
|
||||
console.log('pwd', password)
|
||||
resolve(true)
|
||||
})
|
||||
.then(() => {
|
||||
// showToast('verification code is correct.')
|
||||
emit('nextStep', 'password')
|
||||
})
|
||||
.catch(() => {
|
||||
showToast('verification code is incorrect.')
|
||||
})
|
||||
emit('nextStep', { code: password })
|
||||
}
|
||||
|
||||
// Methods
|
||||
|
||||
Reference in New Issue
Block a user