diff --git a/api/start/login.js b/api/start/login.js
index ee730e0..aecf0cf 100644
--- a/api/start/login.js
+++ b/api/start/login.js
@@ -15,13 +15,11 @@ import { http } from '../../utils/http'
*/
export const LoginApi = (data) => {
return http({
- // method: 'POST',
- // url: '/UserLogin/login',
- method: 'GET',
- url: '/loginSuccessByEmail',
- data: {
+ method: 'POST',
+ url: '/UserLogin/login',
+ data:
data
- },
+ ,
})
}
@@ -32,13 +30,11 @@ export const LoginApi = (data) => {
* @param {*} email
* @returns
*/
-export const SendEmailCodeApi = (data) => {
+export const SendEmailCodeApi = (data) => {
return http({
method: 'POST',
url: '/UserLogin/sendEmail',
- data:{
- data
- }
+ data: data
})
}
@@ -49,13 +45,11 @@ export const SendEmailCodeApi = (data) => {
* @param {*} email
* @returns
*/
-export const SendPhoneCodeApi = (data) => {
+export const SendPhoneCodeApi = (data) => {
return http({
method: 'POST',
url: '/UserLogin/sendPhone',
- data:{
- data
- }
+ data:data
})
}
@@ -65,13 +59,11 @@ export const SendPhoneCodeApi = (data) => {
* 注册
*/
-export const register = (data) => {
+export const registerApi = (data) => {
return http({
- method: 'GET',
- url: '/register',
- data: {
- data
- },
+ method: 'POST',
+ url: '/UserLogin/register',
+ data: data,
})
}
@@ -80,7 +72,7 @@ export const register = (data) => {
*
*/
-export const updatePassword = (data) => {
+export const updatePassword = (data) => {
return http({
method: 'GET',
url: '/updatePassword',
@@ -96,7 +88,7 @@ export const updatePassword = (data) => {
* 通过苹果登录
*/
-export const postLoginAppleSimpleAPI = (phoneNumber) => {
+export const postLoginAppleSimpleAPI = (phoneNumber) => {
return http({
method: 'POST',
url: '/login',
@@ -111,7 +103,7 @@ export const postLoginAppleSimpleAPI = (phoneNumber) => {
* 通过谷歌登录
*/
-export const postLoginGoogleSimpleAPI = (phoneNumber) => {
+export const postLoginGoogleSimpleAPI = (phoneNumber) => {
return http({
method: 'POST',
url: '/login/wxMin/simple',
diff --git a/components/footerBar.vue b/components/footerBar.vue
index 6454f19..80cc030 100644
--- a/components/footerBar.vue
+++ b/components/footerBar.vue
@@ -1,4 +1,45 @@
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/pages/start/Registration/Registration.vue b/pages/start/Registration/Registration.vue
index 9ef0ba7..ab17cbc 100644
--- a/pages/start/Registration/Registration.vue
+++ b/pages/start/Registration/Registration.vue
@@ -149,9 +149,10 @@
- 已有账号?
+ 已有账号?
登录
-
+
@@ -181,9 +182,14 @@
import { ref } from "vue";
// 导入完整的国家列表
import countryList from "../login/list";
-import footerBar from "../../../components/footerBar-cn.vue";
+import footerBar from "../../../components/footerBar";
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import { verificationPhone, verificationEmail } from "../login/verification";
+import {
+ registerApi,
+ SendEmailCodeApi,
+ SendPhoneCodeApi,
+} from "../../../api/start/login";
const type = ref("member");
const email = ref("");
@@ -247,39 +253,76 @@ function switchPhone() {
verifyCode.value = "";
}
-// function register() {
-// if (switchType.value === "Email") {
-// // 登录逻辑
-// if (!email.value) {
-// uni.showToast({
-// title: "请输入邮箱地址",
-// icon: "none",
-// });
-// return;
-// }
-
-// // 发送登录请求
-// console.log("登录:", email.value);
-// }
-
-// if (switchType.value === "Phone") {
-// // 登录逻辑
-// if (!phone.value) {
-// uni.showToast({
-// title: "请输入手机号码",
-// icon: "none",
-// });
-// return;
-// }
-
-// // 发送登录请求
-// console.log("登录:", phone.value);
-// }
-// }
-function register() {
+// 注册
+async function register() {
if (!basicVerification()) {
return;
}
+
+ const account = changeAccount();
+ const registerType = changeLoginType();
+
+ const res = await registerApi({
+ registerType: registerType,
+ account: account,
+ verifyCode: verifyCode.value,
+ agree: agreed.value,
+ });
+
+ const message = res.message;
+ if (res.code === 200) {
+ // 登录成功
+ uni.showToast({
+ title: "注册成功",
+ icon: "success",
+ });
+
+ const userStore = useUserStore();
+ userStore.setUserInfo(res.data);
+
+ console.log("userInfo为", userStore.userInfo);
+
+ // 跳转到首页
+ uni.redirectTo({
+ url: "/pages/home/home",
+ });
+ } else {
+ // 登录失败
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ }
+}
+
+// 请求账户
+function changeAccount() {
+ if (switchType.value === "User") {
+ account.value = deepChartID.value;
+ }
+
+ if (switchType.value === "Phone") {
+ account.value = `${country.value}${phone.value}`;
+ }
+ if (switchType.value === "Email") {
+ account.value = email.value;
+ }
+
+ return account.value;
+}
+
+// 改变请求时的type
+function changeLoginType() {
+ if (switchType.value === "User") {
+ return "DCCODE";
+ }
+
+ if (switchType.value === "Phone") {
+ return "PHONE";
+ }
+ if (switchType.value === "Email") {
+ return "EMAIL";
+ }
}
// 基础验证
@@ -367,8 +410,8 @@ function basicVerification() {
}
// 验证码验证
-function VerCodeVerfifcation() {
- if (switchType.value === "Phone") {
+function VerCodeVerfifcation() {
+ if (switchType.value === "Phone") {
if (!phone.value) {
uni.showToast({
title: "请输入手机号",
@@ -432,16 +475,47 @@ function onPhoneInput(e) {
}
}
-
-function sendCode() {
-
- if (!VerCodeVerfifcation()) {
- return ;
+async function sendCode() {
+ if (!VerCodeVerfifcation()) {
+ return;
}
// 如果按钮已禁用,则不执行后续逻辑
if (isCodeBtnDisabled.value) return;
+ console.log("发送验证码");
+ if (switchType.value === "Phone") {
+ // 发送验证码
+
+ const phoneAll = `${country.value}${phone.value}`;
+ const res = await SendPhoneCodeApi({
+ phone: phoneAll,
+ });
+ console.log("手机验证码:", res.message);
+
+ if (!res) {
+ uni.showToast({
+ title: "请求失败",
+ icon: "none",
+ });
+ }
+ }
+ if (switchType.value === "Email") {
+ // 发送验证码
+ const res = await SendEmailCodeApi({
+ email: email.value,
+ });
+ console.log("邮箱验证码:", res.message);
+
+ if (!res) {
+ uni.showToast({
+ title: "请求失败",
+ icon: "none",
+ });
+ }
+ }
+
+
// 设置按钮为禁用状态
isCodeBtnDisabled.value = true;
codeBtnText.value = "重新发送";
diff --git a/pages/start/index/index.vue b/pages/start/index/index.vue
index 663a7d8..30c8683 100644
--- a/pages/start/index/index.vue
+++ b/pages/start/index/index.vue
@@ -5,24 +5,25 @@
{{ title }}
-
+
diff --git a/pages/start/login/login.vue b/pages/start/login/login.vue
index 622fec5..2cefada 100644
--- a/pages/start/login/login.vue
+++ b/pages/start/login/login.vue
@@ -248,7 +248,7 @@
import { ref } from "vue";
// 导入完整的国家列表
import countryList from "./list.js";
-import footerBar from "../../../components/footerBar-cn";
+import footerBar from "../../../components/footerBar";
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";
@@ -340,9 +340,10 @@ async function Login() {
}
const account = changeAccount();
+ const loginType = changeLoginType();
const res = await LoginApi({
- loginType: switchType.value,
+ loginType: loginType,
account: account,
verifyCode: verifyCode.value,
password: password.value,
@@ -359,13 +360,13 @@ async function Login() {
});
const userStore = useUserStore();
- userStore.setUserInfo(res.data)
+ userStore.setUserInfo(res.data);
+
+ console.log("userInfo为", userStore.userInfo);
- console.log("userInfo为",userStore.userInfo);
-
// 跳转到首页
- uni.switchTab({
- url: "/pages/start/index/index",
+ uni.redirectTo({
+ url: "/pages/home/home",
});
} else {
// 登录失败
@@ -508,6 +509,7 @@ function VerCodeVerfifcation() {
return true;
}
+// 请求账户
function changeAccount() {
if (switchType.value === "User") {
account.value = deepChartID.value;
@@ -523,6 +525,20 @@ function changeAccount() {
return account.value;
}
+// 改变请求时的type
+function changeLoginType() {
+ if (switchType.value === "User") {
+ return "DCCODE";
+ }
+
+ if (switchType.value === "Phone") {
+ return "PHONE";
+ }
+ if (switchType.value === "Email") {
+ return "EMAIL";
+ }
+}
+
// 添加弹窗引用
const agreementPopup = ref(null);
@@ -622,10 +638,9 @@ async function sendCode() {
});
console.log("手机验证码:", res.message);
- const message = res.message;
- if (res.code === 200) {
+ if (!res) {
uni.showToast({
- title: message,
+ title: "请求失败",
icon: "none",
});
}
@@ -637,10 +652,9 @@ async function sendCode() {
});
console.log("邮箱验证码:", res.message);
- const message = res.message;
- if (res.code === 200) {
+ if (!res) {
uni.showToast({
- title: message,
+ title: "请求失败",
icon: "none",
});
}
diff --git a/pages/start/recoverPassword/recoverPassword.vue b/pages/start/recoverPassword/recoverPassword.vue
index 9455cfe..ada6c57 100644
--- a/pages/start/recoverPassword/recoverPassword.vue
+++ b/pages/start/recoverPassword/recoverPassword.vue
@@ -46,7 +46,7 @@
-
+
- 已有账号?登录
+ 已有账号?
+ 登录
+
+
@@ -231,9 +232,10 @@
import { ref } from "vue";
// 导入完整的国家列表
import countryList from "../login/list";
-import footerBar from "../../../components/footerBar-cn.vue";
+import footerBar from "../../../components/footerBar";
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import { verificationPhone, verificationEmail } from "../login/verification";
+import { SendEmailCodeApi, SendPhoneCodeApi } from "../../../api/start/login";
const type = ref("member");
const email = ref("");
@@ -332,7 +334,6 @@ function register() {
}
console.log("123");
-
const phoneAll = `${country.value}${phone.value}`;
console.log("完整手机号" + phoneAll);
@@ -399,6 +400,13 @@ function goToLogin() {
});
}
+function goToRegistration() {
+ // 跳转到登录页
+ uni.navigateTo({
+ url: "/pages/start/Registration/Registration",
+ });
+}
+
function onPhoneInput(e) {
// 确保只允许输入数字
const value = e.detail.value;
@@ -466,6 +474,34 @@ function sendCode() {
// 如果按钮已禁用,则不执行后续逻辑
if (isCodeBtnDisabled.value) return;
+ console.log("发送验证码");
+ // 发送验证码
+ if (switchType.value === "Email") {
+ const res = SendEmailCodeApi({
+ email: email.value,
+ });
+
+ if (!res) {
+ uni.showToast({
+ title: "发送失败",
+ icon: "none",
+ });
+ }
+ }
+ if (switchType.value === "Phone") {
+ const phoneAll = `${country.value}${phone.value}`;
+
+ const res = SendPhoneCodeApi({
+ phone: phoneAll,
+ });
+ if (!res) {
+ uni.showToast({
+ title: "发送失败",
+ icon: "none",
+ });
+ }
+ }
+
// 设置按钮为禁用状态
isCodeBtnDisabled.value = true;
codeBtnText.value = "重新发送";
diff --git a/pages/start/select/select.vue b/pages/start/select/select.vue
index ca555ea..7663375 100644
--- a/pages/start/select/select.vue
+++ b/pages/start/select/select.vue
@@ -18,29 +18,24 @@
-