perf[Login]: password input add caps tooltip (#1845)
This commit is contained in:
parent
e3b6602bbf
commit
0358667a73
|
@ -23,6 +23,7 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<span class="svg-container">
|
<span class="svg-container">
|
||||||
<svg-icon icon-class="password" />
|
<svg-icon icon-class="password" />
|
||||||
|
@ -35,12 +36,15 @@
|
||||||
:placeholder="$t('login.password')"
|
:placeholder="$t('login.password')"
|
||||||
name="password"
|
name="password"
|
||||||
auto-complete="on"
|
auto-complete="on"
|
||||||
|
@keyup.native="checkCapslock"
|
||||||
|
@blur="capsTooltip = false"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
/>
|
/>
|
||||||
<span class="show-pwd" @click="showPwd">
|
<span class="show-pwd" @click="showPwd">
|
||||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-tooltip>
|
||||||
|
|
||||||
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">
|
||||||
{{ $t('login.logIn') }}
|
{{ $t('login.logIn') }}
|
||||||
|
@ -107,6 +111,7 @@ export default {
|
||||||
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
|
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
|
||||||
},
|
},
|
||||||
passwordType: 'password',
|
passwordType: 'password',
|
||||||
|
capsTooltip: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
redirect: undefined
|
redirect: undefined
|
||||||
|
@ -134,6 +139,18 @@ export default {
|
||||||
// window.removeEventListener('storage', this.afterQRScan)
|
// window.removeEventListener('storage', this.afterQRScan)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
checkCapslock({ shiftKey, key } = {}) {
|
||||||
|
if (key && key.length === 1) {
|
||||||
|
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
|
||||||
|
this.capsTooltip = true
|
||||||
|
} else {
|
||||||
|
this.capsTooltip = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (key === 'CapsLock' && this.capsTooltip === true) {
|
||||||
|
this.capsTooltip = false
|
||||||
|
}
|
||||||
|
},
|
||||||
showPwd() {
|
showPwd() {
|
||||||
if (this.passwordType === 'password') {
|
if (this.passwordType === 'password') {
|
||||||
this.passwordType = ''
|
this.passwordType = ''
|
||||||
|
|
Loading…
Reference in New Issue