Browse Source

fix:修复密码超过4位的问题

master
guoapeng 4 months ago
parent
commit
b9848c975b
  1. 4
      src/pages/Index/components/Setting/EnterPinModal.vue
  2. 9
      src/pages/Index/components/Setting/UpdatePinModal.vue

4
src/pages/Index/components/Setting/EnterPinModal.vue

@ -8,7 +8,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="input-container"> <div class="input-container">
<input :type="isShowType?'text':'password'" v-model="pin" placeholder="输入密码" @focus="showKeyboard()" class="pin-input" />
<input :maxlength="4" :type="isShowType?'text':'password'" v-model="pin" placeholder="输入密码" @focus="showKeyboard()" class="pin-input" />
<el-icon class="pwd-view" @click="isShowType = !isShowType"><View /></el-icon> <el-icon class="pwd-view" @click="isShowType = !isShowType"><View /></el-icon>
</div> </div>
</div> </div>
@ -75,7 +75,7 @@ const handleKeyboardInput = (value: string) => {
// //
currentInputValue.value = value currentInputValue.value = value
// //
pin.value = value
pin.value = value.slice(0, 4)
} }
// //

9
src/pages/Index/components/Setting/UpdatePinModal.vue

@ -10,6 +10,7 @@
<div class="input-container"> <div class="input-container">
<div> <div>
<input <input
:maxlength="4"
:type="showoldpasswd ? 'text' : 'password'" :type="showoldpasswd ? 'text' : 'password'"
v-model="oldpasswd" v-model="oldpasswd"
placeholder="输入旧密码" placeholder="输入旧密码"
@ -23,6 +24,7 @@
<br /> <br />
<div> <div>
<input <input
:maxlength="4"
:type="showPassword ? 'text' : 'password'" :type="showPassword ? 'text' : 'password'"
v-model="password" v-model="password"
placeholder="输入新密码" placeholder="输入新密码"
@ -36,6 +38,7 @@
<br /> <br />
<div> <div>
<input <input
:maxlength="4"
:type="showConfirmPassword ? 'text' : 'password'" :type="showConfirmPassword ? 'text' : 'password'"
v-model="confirmPassword" v-model="confirmPassword"
placeholder="输入确认新密码" placeholder="输入确认新密码"
@ -171,11 +174,11 @@ const handleKeyboardInput = (value: string) => {
// //
if (currentInputField.value === 'oldpasswd') { if (currentInputField.value === 'oldpasswd') {
oldpasswd.value = value
oldpasswd.value = value.slice(0, 4)
} else if (currentInputField.value == 'password') { } else if (currentInputField.value == 'password') {
password.value = value
password.value = value.slice(0, 4)
} else if (currentInputField.value == 'confirmPassword') { } else if (currentInputField.value == 'confirmPassword') {
confirmPassword.value = value
confirmPassword.value = value.slice(0, 4)
} }
} }

Loading…
Cancel
Save