|
|
|
@ -191,7 +191,7 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 注册按钮 --> |
|
|
|
<button class="register-btn" @click="register">登录</button> |
|
|
|
<button class="register-btn" @click="Login">登录</button> |
|
|
|
|
|
|
|
<!-- 或者 --> |
|
|
|
<text class="or-text" @click="goToRegistration" |
|
|
|
@ -252,7 +252,13 @@ import footerBar from "../../../components/footerBar-cn"; |
|
|
|
import uniPopupDialogVue from "../../../uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"; |
|
|
|
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue"; |
|
|
|
import { verificationPhone, verificationEmail } from "../login/verification"; |
|
|
|
import { LoginApi, SendCodeApi } from "../../../api/start/login"; |
|
|
|
import { |
|
|
|
LoginApi, |
|
|
|
SendEmailCodeApi, |
|
|
|
SendPhoneCodeApi, |
|
|
|
} from "../../../api/start/login"; |
|
|
|
|
|
|
|
import { useUserStore } from "../../../stores/modules/userInfo"; |
|
|
|
|
|
|
|
const deepChartID = ref(""); |
|
|
|
const type = ref("member"); |
|
|
|
@ -328,7 +334,7 @@ function switchPhone() { |
|
|
|
} |
|
|
|
|
|
|
|
// 登录 |
|
|
|
async function register() { |
|
|
|
async function Login() { |
|
|
|
if (!basicVerification()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -351,6 +357,12 @@ async function register() { |
|
|
|
title: "登录成功", |
|
|
|
icon: "success", |
|
|
|
}); |
|
|
|
|
|
|
|
const userStore = useUserStore(); |
|
|
|
userStore.setUserInfo(res.data) |
|
|
|
|
|
|
|
console.log("userInfo为",userStore.userInfo); |
|
|
|
|
|
|
|
// 跳转到首页 |
|
|
|
uni.switchTab({ |
|
|
|
url: "/pages/start/index/index", |
|
|
|
@ -529,6 +541,7 @@ function handleCancel() { |
|
|
|
agreementPopup.value.close(); |
|
|
|
} |
|
|
|
|
|
|
|
// 苹果登录 |
|
|
|
function loginWithApple() { |
|
|
|
// Apple登录逻辑 |
|
|
|
console.log("通过Apple登录"); |
|
|
|
@ -551,6 +564,7 @@ function loginWithApple() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 谷歌登录 |
|
|
|
function loginWithGoogle() { |
|
|
|
// Google登录逻辑 |
|
|
|
console.log("通过Google登录"); |
|
|
|
@ -591,17 +605,37 @@ function onPhoneInput(e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 发送验证码 |
|
|
|
async function sendCode() { |
|
|
|
|
|
|
|
if (!VerCodeVerfifcation()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 如果按钮已禁用,则不执行后续逻辑 |
|
|
|
if (isCodeBtnDisabled.value) return; |
|
|
|
|
|
|
|
if (switchType.value === "Phone") { |
|
|
|
// 发送验证码 |
|
|
|
|
|
|
|
const phoneAll = `${country.value}${phone.value}`; |
|
|
|
const res = await SendPhoneCodeApi({ |
|
|
|
phone: phoneAll, |
|
|
|
}); |
|
|
|
console.log("手机验证码:", res.message); |
|
|
|
|
|
|
|
const message = res.message; |
|
|
|
if (res.code === 200) { |
|
|
|
uni.showToast({ |
|
|
|
title: message, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (switchType.value === "Email") { |
|
|
|
// 发送验证码 |
|
|
|
const res = await SendCodeApi({}); |
|
|
|
console.log("验证码:", res.message); |
|
|
|
const res = await SendEmailCodeApi({ |
|
|
|
email: email.value, |
|
|
|
}); |
|
|
|
console.log("邮箱验证码:", res.message); |
|
|
|
|
|
|
|
const message = res.message; |
|
|
|
if (res.code === 200) { |
|
|
|
@ -610,6 +644,7 @@ async function sendCode() { |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 设置按钮为禁用状态 |
|
|
|
isCodeBtnDisabled.value = true; |
|
|
|
|