From fe1a7f5e5e96f961c06caf8bcd8e513447468f6b Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 15 May 2026 10:47:10 +0800
Subject: [PATCH] feat:个人资料、修改密码提交优化
---
src/subPackages/userDetail/password/index.vue | 29 ++++++++++++++++++++++++-----
src/subPackages/userDetail/infos/index.vue | 28 +++++++++++++++++++++++++---
2 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/src/subPackages/userDetail/infos/index.vue b/src/subPackages/userDetail/infos/index.vue
index 2bec63c..c1a6734 100644
--- a/src/subPackages/userDetail/infos/index.vue
+++ b/src/subPackages/userDetail/infos/index.vue
@@ -29,7 +29,17 @@
</view>
<view class="btngroup">
<u-button color="#AEAEAE" class="custom-style" shape="circle" @click="reset">重置</u-button>
- <u-button color="#1D6FE9" class="custom-style" shape="circle" @click="submit">提交</u-button>
+ <u-button
+ :color="submitLoading ? '#AEAEAE' : '#1D6FE9'"
+ class="custom-style"
+ shape="circle"
+ text="提交"
+ :loading="submitLoading"
+ loading-text="提交中"
+ loading-mode="circle"
+ :loading-size="13"
+ @click="submit"
+ />
</view>
</view>
</template>
@@ -50,6 +60,7 @@
email: '',
deptName: '',
});
+const submitLoading = ref(false);
// 校验手机号
const validatePhone = () => {
@@ -199,16 +210,23 @@
// #endif
}
const submit = () => {
+ if (submitLoading.value) return
if (!validatePhone() || !validateEmail()) return
+ submitLoading.value = true
userInfo.value.name = userInfo.value.realName;
updateInfo(userInfo.value).then(res => {
if (res.data.code === 200) {
uni.showToast({
title: '修改信息成功',
icon: 'none',
- duration: 2000
+ duration: 1500
});
- getUserInfoData()
+ setTimeout(() => {
+ uni.switchTab({
+ url: '/pages/user/index'
+ });
+ }, 1500);
+ return
} else {
uni.showToast({
@@ -218,6 +236,10 @@
});
getUserInfoData()
}
+ submitLoading.value = false
+ }).catch(() => {
+ getUserInfoData()
+ submitLoading.value = false
});
};
onShow(async () => {
diff --git a/src/subPackages/userDetail/password/index.vue b/src/subPackages/userDetail/password/index.vue
index dd51f58..9de5039 100644
--- a/src/subPackages/userDetail/password/index.vue
+++ b/src/subPackages/userDetail/password/index.vue
@@ -21,7 +21,17 @@
</view>
<view class="btngroup">
<u-button color="#AEAEAE" class="custom-style" shape="circle" @click="reset">重置</u-button>
- <u-button color="#1D6FE9" class="custom-style" shape="circle" @click="submit">提交</u-button>
+ <u-button
+ :color="submitLoading ? '#AEAEAE' : '#1D6FE9'"
+ class="custom-style"
+ shape="circle"
+ text="提交"
+ :loading="submitLoading"
+ loading-text="提交中"
+ loading-mode="circle"
+ :loading-size="13"
+ @click="submit"
+ />
</view>
</view>
</template>
@@ -46,6 +56,7 @@
newPassword: '',
newPassword1: '',
});
+ const submitLoading = ref(false);
// 校验密码不能包含中文
const validatePasswordNoChinese = (password) => {
const chineseRegex = /[\u4e00-\u9fa5]/;
@@ -84,6 +95,7 @@
clearForm();
};
const submit = () => {
+ if (submitLoading.value) return;
// 原始密码校验
if (!passwordForm.value.oldPassword) {
@@ -119,6 +131,7 @@
// 复杂度校验
if (!validatePasswordStrength(passwordForm.value.newPassword)) return;
+ submitLoading.value = true;
updatePassword(md5(passwordForm.value.oldPassword),
md5(passwordForm.value.newPassword),
md5(passwordForm.value.newPassword1)).then(res => {
@@ -126,14 +139,17 @@
uni.showToast({
title: '修改信息成功',
icon: 'none',
- duration: 2000
+ duration: 1500
});
clearForm();
userStore.setUserInfo(null)
uni.removeStorageSync('rememberedUser');
- uni.reLaunch({
- url: '/pages/login/index'
- })
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/pages/login/index'
+ })
+ }, 1500);
+ return
} else {
uni.showToast({
@@ -142,7 +158,10 @@
duration: 2000
});
}
+ submitLoading.value = false;
+ }).catch(() => {
+ submitLoading.value = false;
});
};
--
Gitblit v1.9.3