"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { data() { return { account: "", code: "", newPassword: "", showPassword: false, countdown: 0, timer: null }; }, computed: { canSubmit() { return this.account && this.code && this.newPassword; } }, methods: { async getVerificationCode() { if (!this.account) { common_vendor.index.showToast({ title: "请输入手机号或邮箱", icon: "none" }); return; } try { await this.$api.auth.getResetCode({ account: this.account }); common_vendor.index.showToast({ title: "验证码已发送", icon: "none" }); this.startCountdown(); } catch (error) { common_vendor.index.showToast({ title: error.message || "获取验证码失败", icon: "none" }); } }, startCountdown() { this.countdown = 60; this.timer = setInterval(() => { if (this.countdown <= 0) { clearInterval(this.timer); return; } this.countdown--; }, 1e3); }, async handleResetPassword() { try { await this.$api.auth.resetPassword({ account: this.account, code: this.code, newPassword: this.newPassword }); common_vendor.index.showToast({ title: "密码重置成功", icon: "success" }); this.goToLogin(); } catch (error) { common_vendor.index.showToast({ title: error.message || "重置密码失败", icon: "none" }); } }, goToLogin() { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }, beforeDestroy() { if (this.timer) { clearInterval(this.timer); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: $data.account, b: common_vendor.o(($event) => $data.account = $event.detail.value), c: $data.code, d: common_vendor.o(($event) => $data.code = $event.detail.value), e: common_vendor.t($data.countdown > 0 ? `${$data.countdown}s后重试` : "获取验证码"), f: $data.countdown > 0, g: common_vendor.o((...args) => $options.getVerificationCode && $options.getVerificationCode(...args)), h: $data.showPassword ? "text" : "password", i: $data.newPassword, j: common_vendor.o(($event) => $data.newPassword = $event.detail.value), k: common_vendor.t($data.showPassword ? "隐藏" : "显示"), l: common_vendor.o(($event) => $data.showPassword = !$data.showPassword), m: !$options.canSubmit, n: common_vendor.o((...args) => $options.handleResetPassword && $options.handleResetPassword(...args)), o: common_vendor.o((...args) => $options.goToLogin && $options.goToLogin(...args)) }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2ee2a2a5"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/forgot.js.map