登录注册更改

This commit is contained in:
2026-02-24 14:54:41 +08:00
parent 1a4db805ae
commit ce3abc48a4
4 changed files with 29 additions and 8 deletions

View File

@@ -12,6 +12,7 @@
const router = useRouter() const router = useRouter()
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
const loading = computed(() => globalStore.state.loading || globalStore.state.view_loading) const loading = computed(() => globalStore.state.loading || globalStore.state.view_loading)
globalStore.setLoading(false)
window['onClickPrivacy'] = () => { window['onClickPrivacy'] = () => {
// window.event?.preventDefault() // window.event?.preventDefault()
console.log('onClickPrivacy') console.log('onClickPrivacy')
@@ -28,7 +29,7 @@
#app { #app {
font-size: 1.6rem; font-size: 1.6rem;
} }
.el-message{ .el-message {
font-size: 1.6rem; font-size: 1.6rem;
} }
#loading { #loading {

View File

@@ -48,7 +48,12 @@
</el-form> </el-form>
<div class="tip-2" v-html="$t('Login.noAccountToSignUp')"></div> <div class="tip-2" v-html="$t('Login.noAccountToSignUp')"></div>
</template> </template>
<visible-code v-else :email="formData.email" @submit="onVerifyCode" /> <visible-code
v-show="isVisible"
ref="visibleCodeRef"
:email="formData.email"
@submit="onVerifyCode"
/>
<other-login /> <other-login />
</div> </div>
</div> </div>
@@ -84,11 +89,14 @@
router.back() router.back()
} }
} }
const visibleCodeRef = ref(null)
const onSubmit = () => { const onSubmit = () => {
formRef.value?.validate?.((valid) => { formRef.value?.validate?.((valid) => {
if (valid) { if (valid) {
// console.log('submit!') // console.log('submit!')
isVisible.value = true visibleCodeRef.value?.onSendCode().then(() => {
isVisible.value = true
})
} else { } else {
console.warn('error submit!') console.warn('error submit!')
} }

View File

@@ -52,7 +52,12 @@
</el-form> </el-form>
<div class="tip-2" v-html="$t('Login.havenAccountToLogin')"></div> <div class="tip-2" v-html="$t('Login.havenAccountToLogin')"></div>
</template> </template>
<visible-code v-else :email="formData.email" @submit="onVerifyCode" /> <visible-code
v-show="isVisible"
ref="visibleCodeRef"
:email="formData.email"
@submit="onVerifyCode"
/>
<other-login /> <other-login />
</div> </div>
</div> </div>
@@ -90,11 +95,14 @@
router.back() router.back()
} }
} }
const visibleCodeRef = ref(null)
const onSubmit = () => { const onSubmit = () => {
formRef.value?.validate?.((valid) => { formRef.value?.validate?.((valid) => {
if (valid) { if (valid) {
// console.log('submit!') // console.log('submit!')
isVisible.value = true visibleCodeRef.value?.onSendCode().then(() => {
isVisible.value = true
})
} else { } else {
console.warn('error submit!') console.warn('error submit!')
} }

View File

@@ -45,16 +45,17 @@
clearTime() clearTime()
}) })
onMounted(() => { onMounted(() => {
onSendCode() // onSendCode()
}) })
const onSendCode = async () => { const onSendCode = async () => {
const email = props.email const email = props.email
if (!email) { if (!email) {
console.warn('请输入邮箱') console.warn('请输入邮箱')
return return Promise.reject('请输入邮箱')
} }
setTime()
await SendVerificationCode({ email }) await SendVerificationCode({ email })
setTime()
return Promise.resolve()
} }
const onResend = () => { const onResend = () => {
if (time.value > 0) return if (time.value > 0) return
@@ -64,6 +65,9 @@
if (code.value.length !== 6) return if (code.value.length !== 6) return
emit('submit', code.value) emit('submit', code.value)
} }
defineExpose({
onSendCode
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>