优化代码

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

@@ -51,7 +51,7 @@ const _sfc_main = {
});
}, 300);
} else {
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:142", res.msg);
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:144", res.msg);
}
});
},
@@ -84,21 +84,36 @@ const _sfc_main = {
method: "POST",
data: {
uuid: data.uuid,
userId: this.id
id: this.id
},
userInfo: true
}).then((res2) => {
if (res2.code === 200) {
components_request.request({
url: "user/confirm",
method: "POST",
data: {
uuid: data.uuid,
id: this.id
},
userInfo: true
}).then((res3) => {
if (res3.code === 200) {
common_vendor.index.showToast({
title: "登录成功",
icon: "success"
});
} else {
common_vendor.index.showToast({
title: res3,
icon: "none"
});
}
}).catch((err) => {
common_vendor.index.showToast({
title: "登录成功",
icon: "success"
});
} else {
common_vendor.index.showToast({
title: res2,
title: "登录失败",
icon: "none"
});
}
});
}).catch((err) => {
common_vendor.index.showToast({
title: "登录失败",
@@ -141,7 +156,7 @@ const _sfc_main = {
},
userInfo: true
}).then((ress) => {
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:243", "修改调用返回", ress);
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:262", "修改调用返回", ress);
if (ress.code === 200) {
common_vendor.index.showToast({
title: "修改成功",

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"]]);

View File

@@ -1 +1 @@
<view class="changeEmail data-v-87d0cc44"><view class="bg data-v-87d0cc44"><image class="bgImg data-v-87d0cc44" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png" mode="scaleToFill"/></view><view class="Return data-v-87d0cc44" bindtap="{{a}}"><image class="ReturnImg data-v-87d0cc44" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill"/></view><view class="title data-v-87d0cc44">邮箱</view><view class="contentbox data-v-87d0cc44"><view class="content data-v-87d0cc44"><input type="email" class="weui-input data-v-87d0cc44" placeholder="请输入邮箱号" value="{{b}}" bindinput="{{c}}"/><text wx:if="{{d}}" class="error data-v-87d0cc44">第一次填写邮箱时请确保填写正确的邮箱地址,填写错误请联系客服</text><text wx:if="{{e}}" class="error data-v-87d0cc44">请输入正确的邮箱地址</text><view wx:if="{{f}}" class="Verificationcodebox data-v-87d0cc44"><input type="text" class="weui-input data-v-87d0cc44" placeholder="验证码" value="{{g}}" bindinput="{{h}}"/><view class="Verificationcodebtn data-v-87d0cc44" bindtap="{{i}}">获取验证码</view></view><text wx:if="{{j}}" class="VerificationcodeSent data-v-87d0cc44">验证码已发送至{{k}}邮箱,请注意查收</text><view class="btn data-v-87d0cc44" bindtap="{{l}}">确认</view><text class="forget data-v-87d0cc44" bindtap="{{m}}">忘记邮箱?请联系客服</text></view></view></view>
<view class="changeEmail data-v-87d0cc44"><view class="bg data-v-87d0cc44"><image class="bgImg data-v-87d0cc44" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png" mode="scaleToFill"/></view><view class="Return data-v-87d0cc44" bindtap="{{a}}"><image class="ReturnImg data-v-87d0cc44" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill"/></view><view class="title data-v-87d0cc44">邮箱</view><view class="contentbox data-v-87d0cc44"><view class="content data-v-87d0cc44"><input type="email" class="weui-input data-v-87d0cc44" placeholder="请输入邮箱号" value="{{b}}" bindinput="{{c}}"/><text wx:if="{{d}}" class="error data-v-87d0cc44">第一次填写邮箱时请确保填写正确的邮箱地址,填写错误请联系客服</text><text wx:if="{{e}}" class="error data-v-87d0cc44">请输入正确的邮箱地址</text><view wx:if="{{f}}" class="Verificationcodebox data-v-87d0cc44"><input type="text" class="weui-input data-v-87d0cc44" placeholder="验证码" value="{{g}}" bindinput="{{h}}"/><view class="Verificationcodebtn data-v-87d0cc44" bindtap="{{j}}" style="{{k}}">{{i}}</view></view><text wx:if="{{l}}" class="VerificationcodeSent data-v-87d0cc44">验证码已发送至{{m}}邮箱,请注意查收</text><view class="btn data-v-87d0cc44" bindtap="{{n}}">确认</view><text class="forget data-v-87d0cc44" bindtap="{{o}}">忘记邮箱?请联系客服</text></view></view></view>

View File

@@ -73,7 +73,7 @@
text-align: center;
line-height: 80rpx;
}
.VerificationcodeSent.data-v-87d0cc44{
.VerificationcodeSent.data-v-87d0cc44 {
color: #00afb2;
font-size: 24rpx;
margin-top: 40rpx;
@@ -95,7 +95,7 @@
color: red;
font-size: 20rpx;
}
.forget.data-v-87d0cc44{
.forget.data-v-87d0cc44 {
font-size: 24rpx;
color: #00afb2;
margin-top: 50rpx;