diff --git a/src/pages/bind/Oauth/index.vue b/src/pages/bind/Oauth/index.vue index ca0be812..98867722 100644 --- a/src/pages/bind/Oauth/index.vue +++ b/src/pages/bind/Oauth/index.vue @@ -56,13 +56,13 @@ async function bindOauthClick() { diff --git a/src/pages/bind/ZF/index.vue b/src/pages/bind/ZF/index.vue index 44624289..496b625b 100644 --- a/src/pages/bind/ZF/index.vue +++ b/src/pages/bind/ZF/index.vue @@ -63,13 +63,13 @@ async function bindZFClick() { diff --git a/src/pages/setting/changePassword/index.scss b/src/pages/setting/changePassword/index.scss index ccf364f4..d03d9b3d 100644 --- a/src/pages/setting/changePassword/index.scss +++ b/src/pages/setting/changePassword/index.scss @@ -14,3 +14,8 @@ border-radius: 0.2rem; } } + +.red-text { + color: red; + font-size: 0.875rem; +} diff --git a/src/pages/setting/changePassword/index.vue b/src/pages/setting/changePassword/index.vue index a477c800..22bea700 100644 --- a/src/pages/setting/changePassword/index.vue +++ b/src/pages/setting/changePassword/index.vue @@ -6,22 +6,35 @@ 身份证号码 - + 学号 - + 新密码 - + 确认新密码 - + + + {{ warnText }} + @@ -60,22 +73,30 @@ const stuid = ref(""); const password = ref(""); const passwordAgain = ref(""); const isShowConfirm = ref(false); +const showWarning = ref(false); +const warnText = ref(""); -const changePasswordClick = () => { - isShowConfirm.value = false; - if (password.value !== passwordAgain.value) { - Taro.showToast({ - icon: "none", - title: "两次密码不一致!" - }); +const formCheck = () => { + if (password.value === "" || passwordAgain.value === "") return; + if (password.value.length < 6 || password.value.length > 20) { + warnText.value = "密码长度必须在6~20位之间"; + showWarning.value = true; return; - } else if (password.value.length < 6 || password.value.length > 20) { - Taro.showToast({ - icon: "none", - title: "密码长度必须在6~20位之间!" - }); + } + if (password.value !== passwordAgain.value) { + warnText.value = "两次密码输入不一致"; + showWarning.value = true; return; } + showWarning.value = false; +}; + +const handleConfirm = () => { + formCheck(); + isShowConfirm.value = true; +}; +const changePasswordClick = () => { + isShowConfirm.value = false; Taro.showLoading({ title: "正在修改中", mask: true @@ -90,26 +111,17 @@ const changePasswordClick = () => { const { run } = useRequest( UserService.changePassword, { loadingDelay: 600, + manual: true, onSuccess: (res) => { if (res.data.code === 1 && res.data.msg === "OK") { Taro.showToast({ icon: "success", title: "修改密码成功" }); - } else if (res.data.code === 200510) { - Taro.showToast({ - icon: "none", - title: "该学号或身份证不存在或者不匹配,请重新输入!" - }); - } else if (res.data.code === 200511) { - Taro.showToast({ - icon: "none", - title: "密码长度必须在6~20位之间!" - }); - } else if (res.data.code === 200513) { + } else { Taro.showToast({ icon: "none", - title: "学号格式不正确,请重新输入!" + title: res.data.msg }); } },