首页登录 ‘大写锁定已打开’ 提示修改版
This commit is contained in:
parent
a8ecc8e143
commit
28f5bba467
|
@ -23,25 +23,27 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="password">
|
<el-tooltip v-model="visible" content="大写锁定已打开" placement="top-end" manual>
|
||||||
<span class="svg-container">
|
<el-form-item prop="password">
|
||||||
<svg-icon icon-class="password" />
|
<span class="svg-container">
|
||||||
</span>
|
<svg-icon icon-class="password" />
|
||||||
<el-input
|
</span>
|
||||||
:key="passwordType"
|
<el-input
|
||||||
ref="password"
|
:key="passwordType"
|
||||||
v-model="loginForm.password"
|
ref="password"
|
||||||
:type="passwordType"
|
v-model="loginForm.password"
|
||||||
:placeholder="$t('login.password')"
|
:type="passwordType"
|
||||||
name="password"
|
:placeholder="$t('login.password')"
|
||||||
auto-complete="on"
|
name="password"
|
||||||
@keyup.native="checkCapslock"
|
auto-complete="on"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.native="checkCapslock"
|
||||||
/>
|
@keyup.enter.native="handleLogin"
|
||||||
<span class="show-pwd" @click="showPwd">
|
/>
|
||||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
<span class="show-pwd" @click="showPwd">
|
||||||
</span>
|
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||||
</el-form-item>
|
</span>
|
||||||
|
</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') }}
|
||||||
|
@ -77,7 +79,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { validUsername } from '@/utils/validate'
|
import { validUsername } from '@/utils/validate'
|
||||||
import { debounce } from '@/utils'
|
|
||||||
import LangSelect from '@/components/LangSelect'
|
import LangSelect from '@/components/LangSelect'
|
||||||
import SocialSign from './socialSignin'
|
import SocialSign from './socialSignin'
|
||||||
|
|
||||||
|
@ -109,6 +110,7 @@ export default {
|
||||||
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
|
password: [{ required: true, trigger: 'blur', validator: validatePassword }]
|
||||||
},
|
},
|
||||||
passwordType: 'password',
|
passwordType: 'password',
|
||||||
|
visible: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
redirect: undefined
|
redirect: undefined
|
||||||
|
@ -136,23 +138,17 @@ export default {
|
||||||
// window.removeEventListener('storage', this.afterQRScan)
|
// window.removeEventListener('storage', this.afterQRScan)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
capslockNotify: debounce(function() {
|
|
||||||
this.$notify({
|
|
||||||
title: '提示',
|
|
||||||
message: '大写锁定已打开',
|
|
||||||
duration: 4500,
|
|
||||||
showClose: false,
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
}, 4500, true),
|
|
||||||
checkCapslock({ shiftKey, key } = {}) {
|
checkCapslock({ shiftKey, key } = {}) {
|
||||||
if (((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) && key.length === 1) {
|
if (((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) && key.length === 1) {
|
||||||
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
|
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
|
||||||
this.capslockNotify()
|
this.visible = true
|
||||||
} else {
|
} else {
|
||||||
this.$notify.closeAll()
|
this.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (key === 'CapsLock' && this.visible === true) {
|
||||||
|
this.visible = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showPwd() {
|
showPwd() {
|
||||||
if (this.passwordType === 'password') {
|
if (this.passwordType === 'password') {
|
||||||
|
|
Loading…
Reference in New Issue