From 76299f4d8a093502a3bf96d4e4c47d17ccf8e138 Mon Sep 17 00:00:00 2001 From: wangyi <3432649580@qq.com> Date: Wed, 29 Oct 2025 17:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=BF=98=E8=AE=B0=E5=AF=86?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/start/login.js | 2 +- pages/deepMate/deepMate.vue | 7 ++ pages/start/recoverPassword/recoverPassword.vue | 95 ++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/api/start/login.js b/api/start/login.js index 1329acd..699a30f 100644 --- a/api/start/login.js +++ b/api/start/login.js @@ -84,7 +84,7 @@ export const verifyCodeApi = (data) => { /** - * 忘记密码输入新的验证吗 + * 忘记密码输入新的密码 */ export const forgetApi = (data) => { diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue index 78c5456..c5e7665 100644 --- a/pages/deepMate/deepMate.vue +++ b/pages/deepMate/deepMate.vue @@ -297,6 +297,13 @@ import { postHistory, postHistoryDetail, } from "../../api/deepMate/deepMate"; + + + +const renderer = new marked.Renderer(); +renderer.heading = function(text, level) { + return `

${text}

`; +}; // 设置 marked 选项 marked.setOptions({ renderer: new marked.Renderer(), diff --git a/pages/start/recoverPassword/recoverPassword.vue b/pages/start/recoverPassword/recoverPassword.vue index b4628f0..97530c5 100644 --- a/pages/start/recoverPassword/recoverPassword.vue +++ b/pages/start/recoverPassword/recoverPassword.vue @@ -209,10 +209,10 @@ - 已有账号? - 登录 - - + 已有账号? + 登录 + @@ -235,7 +235,12 @@ import countryList from "../login/list"; 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,verifyCodeApi,forgetApi } from "../../../api/start/login"; +import { + SendEmailCodeApi, + SendPhoneCodeApi, + verifyCodeApi, + forgetApi, +} from "../../../api/start/login"; const type = ref(""); const email = ref(""); @@ -254,6 +259,7 @@ const verifyCode = ref(""); const isRecovering = ref(false); const newPasswordLookFirst = ref(false); const newPasswordLookSecond = ref(false); +const account = ref(""); // 使用从list.js导入的完整国家列表数据 const countries = ref( @@ -301,7 +307,7 @@ function switchPhone() { verifyCode.value = ""; } -function register() { +async function register() { if (isRecovering.value) { if (!newPasswordFirst.value || !newPasswordSecond.value) { uni.showToast({ @@ -319,6 +325,32 @@ function register() { return; } + const account = changeAccount(); + + const res = await forgetApi({ + account: account, + password: newPasswordSecond.value, + }); + + console.log("res", res); + + if (res.code !== 200) { + uni.showToast({ + title: res.message, + icon: "none", + }); + return; + } + + uni.showToast({ + title: res.message, + icon: "none", + }); + + uni.navigateTo({ + url: "/pages/start/login/login", + }); + // 密码逻辑 return; } @@ -384,13 +416,54 @@ function register() { console.log("登录:", email.value); } + const account = changeAccount(); + const loginType = changeLoginType(); + + const res = await verifyCodeApi({ + loginType: loginType, //登录方式EMAIL,PHONE + account: account, //登陆账号 手机号/邮箱 + verifyCode: verifyCode.value, + }); + + if (res.code !== 200) { + uni.showToast({ + title: res.message, + icon: "none", + }); + return; + } + isRecovering.value = !isRecovering.value; +} - // 如果已经同意,则继续登录流程 - // uni.showToast({ - // title: "登录成功", - // icon: "success", - // }); +// 请求账户 +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"; + } } function goToLogin() {