diff --git a/src/App.vue b/src/App.vue
index 72ed79d..e35e315 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -12,6 +12,7 @@
const router = useRouter()
const globalStore = useGlobalStore()
const loading = computed(() => globalStore.state.loading || globalStore.state.view_loading)
+ globalStore.setLoading(false)
window['onClickPrivacy'] = () => {
// window.event?.preventDefault()
console.log('onClickPrivacy')
@@ -28,7 +29,7 @@
#app {
font-size: 1.6rem;
}
- .el-message{
+ .el-message {
font-size: 1.6rem;
}
#loading {
diff --git a/src/views/login/login.vue b/src/views/login/login.vue
index dbffb06..d5779a0 100644
--- a/src/views/login/login.vue
+++ b/src/views/login/login.vue
@@ -48,7 +48,12 @@
-
+
@@ -84,11 +89,14 @@
router.back()
}
}
+ const visibleCodeRef = ref(null)
const onSubmit = () => {
formRef.value?.validate?.((valid) => {
if (valid) {
// console.log('submit!')
- isVisible.value = true
+ visibleCodeRef.value?.onSendCode().then(() => {
+ isVisible.value = true
+ })
} else {
console.warn('error submit!')
}
diff --git a/src/views/login/register.vue b/src/views/login/register.vue
index 3598ccc..aa60600 100644
--- a/src/views/login/register.vue
+++ b/src/views/login/register.vue
@@ -52,7 +52,12 @@
-
+
@@ -90,11 +95,14 @@
router.back()
}
}
+ const visibleCodeRef = ref(null)
const onSubmit = () => {
formRef.value?.validate?.((valid) => {
if (valid) {
// console.log('submit!')
- isVisible.value = true
+ visibleCodeRef.value?.onSendCode().then(() => {
+ isVisible.value = true
+ })
} else {
console.warn('error submit!')
}
diff --git a/src/views/login/visible-code.vue b/src/views/login/visible-code.vue
index 7d79a86..dea0bc9 100644
--- a/src/views/login/visible-code.vue
+++ b/src/views/login/visible-code.vue
@@ -45,16 +45,17 @@
clearTime()
})
onMounted(() => {
- onSendCode()
+ // onSendCode()
})
const onSendCode = async () => {
const email = props.email
if (!email) {
console.warn('请输入邮箱')
- return
+ return Promise.reject('请输入邮箱')
}
- setTime()
await SendVerificationCode({ email })
+ setTime()
+ return Promise.resolve()
}
const onResend = () => {
if (time.value > 0) return
@@ -64,6 +65,9 @@
if (code.value.length !== 6) return
emit('submit', code.value)
}
+ defineExpose({
+ onSendCode
+ })