diff --git a/pages/start/login/login.vue b/pages/start/login/login.vue index c1ad80e..ab5e5d7 100644 --- a/pages/start/login/login.vue +++ b/pages/start/login/login.vue @@ -5,11 +5,17 @@ class="custom-navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }" > - + - 🎧 + + @@ -36,22 +42,36 @@ - + + + + + + + + + + + {{ selectedCountry.code }} - + + + + + + + + @@ -74,7 +114,7 @@ 通过 Apple 继续 @@ -83,7 +123,7 @@ 通过 Google 继续 @@ -104,10 +144,13 @@ import { ref } from "vue"; import countryList from "./list.js"; const email = ref(""); +const password = ref(""); const phone = ref(""); const agreed = ref(false); const switchType = ref("Email"); // 默认是邮箱注册 const { safeAreaInsets } = uni.getSystemInfoSync(); +const codeBtnText = ref("获取验证码"); +const isCodeBtnDisabled = ref(false); // 添加验证码按钮禁用状态 // 使用从list.js导入的完整国家列表数据 const countries = ref( @@ -194,15 +237,14 @@ function loginWithApple() { provider: "apple", success: function (info) { // 获取用户信息成功, info.authResult中保存登录认证数据 - console.log(info); + console.log(info); }, }); }, fail: function (err) { // 登录授权失败 // err.code错误码参考`授权失败错误码(code)说明` - console.log(err); - + console.log(err); }, }); } @@ -218,14 +260,14 @@ function loginWithGoogle() { provider: "google", success: function (info) { // 获取用户信息成功, info.authResult保存用户信息 - console.log(info); + console.log(info); }, }); }, fail: function (err) { // 登录授权失败 // err.code是错误码 - console.log(err); + console.log(err); }, }); } @@ -247,6 +289,29 @@ function onPhoneInput(e) { phone.value = value; } } + +function sendCode(){ + // 如果按钮已禁用,则不执行后续逻辑 + if (isCodeBtnDisabled.value) return; + + // 设置按钮为禁用状态 + isCodeBtnDisabled.value = true; + codeBtnText.value = "重新发送" + let time = 6 + const timer = setInterval(() => { + time-- + codeBtnText.value = "重新发送 " + time + "s" + if (time <= 0) { + clearInterval(timer) + codeBtnText.value = "重新发送" + // 倒计时结束后启用按钮 + isCodeBtnDisabled.value = false; + } + }, 1000) + + + return +}