优化代码

This commit is contained in:
pengxiaolong
2025-09-29 20:48:31 +08:00
parent 0a721e99f8
commit 0044f8f334
63 changed files with 667 additions and 137 deletions

View File

@@ -16,8 +16,14 @@ const _sfc_main = {
//邮箱错误
VerificationcodeSent: false,
//验证码是否已发送
turnsoutemail: ""
turnsoutemail: "",
//修改前的邮箱
countdown: 0,
//验证码倒计时
isCounting: false,
//是否正在倒计时
timer: null
//倒计时定时器
};
},
onLoad(options) {
@@ -25,6 +31,17 @@ const _sfc_main = {
this.id = options.id;
},
methods: {
// 倒计时
startCountdown() {
this.countdown = 60;
this.isCounting = true;
this.timer = setInterval(() => {
this.countdown--;
if (this.countdown <= 0) {
this.isCounting = false;
}
}, 1e3);
},
//提交验证
onSubmit() {
if (this.turnsoutemail == "") {
@@ -52,7 +69,7 @@ const _sfc_main = {
},
userInfo: true
}).then((ress) => {
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:98", "修改调用返回", ress);
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:120", "修改调用返回", ress);
if (ress.code === 200) {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
@@ -73,7 +90,7 @@ const _sfc_main = {
});
}
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:122", "修改调用失败", err);
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:144", "修改调用失败", err);
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "修改失败",
@@ -83,6 +100,9 @@ const _sfc_main = {
},
//发送验证码
sendVerificationCode() {
if (this.isCounting) {
return;
}
components_request.request({
url: "user/sendUpdateMailConfirmMail",
method: "POST",
@@ -92,6 +112,7 @@ const _sfc_main = {
userInfo: true
}).then((ress) => {
this.VerificationcodeSent = true;
this.startCountdown();
});
},
//第一次提交
@@ -114,7 +135,7 @@ const _sfc_main = {
},
userInfo: true
}).then((ress) => {
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:164", "修改调用返回", ress);
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:190", "修改调用返回", ress);
if (ress.code === 200) {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
@@ -142,7 +163,7 @@ const _sfc_main = {
});
}
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:195", "修改调用失败", err);
common_vendor.index.__f__("log", "at pages/Setting/settingmod/changeEmail.vue:221", "修改调用失败", err);
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "修改失败",
@@ -182,14 +203,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
}, $data.turnsoutemail != "" ? {
g: $data.Verificationcode,
h: common_vendor.o(($event) => $data.Verificationcode = $event.detail.value),
i: common_vendor.o((...args) => $options.sendVerificationCode && $options.sendVerificationCode(...args))
i: common_vendor.t($data.isCounting ? `${$data.countdown}秒后重发` : "获取验证码"),
j: common_vendor.o((...args) => $options.sendVerificationCode && $options.sendVerificationCode(...args)),
k: common_vendor.s($data.isCounting ? "background-image: linear-gradient(0deg, #cccccc, #dddddd); cursor: not-allowed;" : "")
} : {}, {
j: $data.VerificationcodeSent && $data.turnsoutemail != ""
l: $data.VerificationcodeSent && $data.turnsoutemail != ""
}, $data.VerificationcodeSent && $data.turnsoutemail != "" ? {
k: common_vendor.t($data.turnsoutemail)
m: common_vendor.t($data.turnsoutemail)
} : {}, {
l: common_vendor.o((...args) => $options.onSubmit && $options.onSubmit(...args)),
m: common_vendor.o((...args) => $options.onCustomerService && $options.onCustomerService(...args))
n: common_vendor.o((...args) => $options.onSubmit && $options.onSubmit(...args)),
o: common_vendor.o((...args) => $options.onCustomerService && $options.onCustomerService(...args))
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-87d0cc44"]]);