Browse Source

完成忘记密码

lihuilin/feature-20251024095243-我的
wangyi 4 weeks ago
parent
commit
76299f4d8a
  1. 2
      api/start/login.js
  2. 7
      pages/deepMate/deepMate.vue
  3. 93
      pages/start/recoverPassword/recoverPassword.vue

2
api/start/login.js

@ -84,7 +84,7 @@ export const verifyCodeApi = (data) => {
/** /**
* 忘记密码输入新的验证吗
* 忘记密码输入新的密码
*/ */
export const forgetApi = (data) => { export const forgetApi = (data) => {

7
pages/deepMate/deepMate.vue

@ -297,6 +297,13 @@ import {
postHistory, postHistory,
postHistoryDetail, postHistoryDetail,
} from "../../api/deepMate/deepMate"; } from "../../api/deepMate/deepMate";
const renderer = new marked.Renderer();
renderer.heading = function(text, level) {
return `<p>${text}</p>`;
};
// marked // marked
marked.setOptions({ marked.setOptions({
renderer: new marked.Renderer(), renderer: new marked.Renderer(),

93
pages/start/recoverPassword/recoverPassword.vue

@ -209,9 +209,9 @@
</text> </text>
<!-- 或者 --> <!-- 或者 -->
<text class="or-text" @click="goToLogin">已有账号
<text class="link">登录
</text>
<text class="or-text" @click="goToLogin"
>已有账号
<text class="link">登录 </text>
</text> </text>
<!-- 同意弹窗 --> <!-- 同意弹窗 -->
@ -235,7 +235,12 @@ import countryList from "../login/list";
import footerBar from "../../../components/footerBar"; import footerBar from "../../../components/footerBar";
import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue"; import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import { verificationPhone, verificationEmail } from "../login/verification"; 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 type = ref("");
const email = ref(""); const email = ref("");
@ -254,6 +259,7 @@ const verifyCode = ref("");
const isRecovering = ref(false); const isRecovering = ref(false);
const newPasswordLookFirst = ref(false); const newPasswordLookFirst = ref(false);
const newPasswordLookSecond = ref(false); const newPasswordLookSecond = ref(false);
const account = ref("");
// 使list.js // 使list.js
const countries = ref( const countries = ref(
@ -301,7 +307,7 @@ function switchPhone() {
verifyCode.value = ""; verifyCode.value = "";
} }
function register() {
async function register() {
if (isRecovering.value) { if (isRecovering.value) {
if (!newPasswordFirst.value || !newPasswordSecond.value) { if (!newPasswordFirst.value || !newPasswordSecond.value) {
uni.showToast({ uni.showToast({
@ -319,6 +325,32 @@ function register() {
return; 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; return;
} }
@ -384,13 +416,54 @@ function register() {
console.log("登录:", email.value); 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; 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() { function goToLogin() {

Loading…
Cancel
Save