Skip to content

Commit

Permalink
Merge pull request #148 from xixiIBN5100/master
Browse files Browse the repository at this point in the history
fix(input): fix password input content can be seen
  • Loading branch information
xixiIBN5100 authored Nov 3, 2024
2 parents 089500f + fb1ccba commit 6e45308
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/pages/bind/Oauth/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ async function bindOauthClick() {
<input
v-if="!user.isBindOauth"
v-model="oauthpass"
password
type="password"
placeholder="请输入密码"
>
<input
v-else
v-model="oauthpass"
password
type="password"
placeholder="*******"
>
</view>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/bind/ZF/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ async function bindZFClick() {
<input
v-if="!user.isBindZF"
v-model="zfpass"
password
type="password"
placeholder="请输入密码"
>
<input
v-else
v-model="zfpass"
password
type="password"
placeholder="*******"
>
</view>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/setting/changePassword/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
border-radius: 0.2rem;
}
}

.red-text {
color: red;
font-size: 0.875rem;
}
70 changes: 41 additions & 29 deletions src/pages/setting/changePassword/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,35 @@
<card title="修改密码" class="input-card">
<text>身份证号码</text>
<view>
<input v-model="iid" password placeholder="请输入您的身份证号码">
<input v-model="iid" placeholder="请输入您的身份证号码">
</view>
<text>学号</text>
<view>
<input v-model="stuid" password placeholder="请输入您的学号">
<input v-model="stuid" placeholder="请输入您的学号">
</view>
<text>新密码</text>
<view>
<input v-model="password" password placeholder="请输入您的新密码">
<input
v-model="password"
type="password"
placeholder="请输入您的新密码"
@blur="formCheck"
>
</view>
<text>确认新密码</text>
<view>
<input v-model="passwordAgain" password placeholder="请重复输入您的新密码">
<input
v-model="passwordAgain"
type="password"
placeholder="请重复输入您的新密码"
@blur="formCheck"
>
</view>
<text v-if="showWarning" class="red-text">
{{ warnText }}
</text>
<template #footer>
<w-button block @tap="isShowConfirm = true">
<w-button block @tap="handleConfirm">
确认修改
</w-button>
</template>
Expand Down Expand Up @@ -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
Expand All @@ -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
});
}
},
Expand Down

0 comments on commit 6e45308

Please sign in to comment.