diff --git a/pages/user/set_info/set_info.vue b/pages/user/set_info/set_info.vue index 41b2b50..25ae231 100644 --- a/pages/user/set_info/set_info.vue +++ b/pages/user/set_info/set_info.vue @@ -138,7 +138,9 @@ }) } - const editNicknameDone = () => { + const editNicknameDone = () => { + if (!user_info.value.info.nickname) return uni.$lu.toast('请输入昵称'); + if (user_info.value.info.nickname.length < 2 || user_info.value.info.nickname.length > 20) return uni.$lu.toast('昵称长度应在2-20字符之间'); edit_nickname.value = false editUserNickname() } @@ -158,10 +160,11 @@ const setUserAccount = () => { if (!user_password.value) return uni.$lu.toast('请输入密码'); - if (user_password.value.length < 6 || user_password.value.length > 40) return uni.$lu.toast('密码长度应在6-20字符之间'); + if (user_password.value.length < 6 || user_password.value.length > 20) return uni.$lu.toast('密码长度应在6-20字符之间'); if (user_password.value !== check_password.value) return uni.$lu.toast('两次输入的密码不一致'); let data = {} if (user_info.value.account) { + if (!old_password.value) return uni.$lu.toast('请输入旧密码'); data.old_password = old_password.value data.password = user_password.value } else {