|
@@ -94,6 +94,16 @@ export default {
|
|
|
this.password=this.$cookie.get('userPwd');
|
|
|
this.msgs=this.$cookie.get('checked');
|
|
|
},
|
|
|
+ keyd(e){
|
|
|
+ let that = this
|
|
|
+ e = window.event || e
|
|
|
+ //保证是在登录页面发出的enter事件
|
|
|
+ if (e.code === 'Enter' || e.code === 'enter' || e.code === 'NumpadEnter') {
|
|
|
+ //调用登录函数
|
|
|
+ that.Login();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
//登录
|
|
|
Login() {
|
|
|
var homepage = "";
|
|
@@ -117,6 +127,7 @@ export default {
|
|
|
}).then(function (res) {
|
|
|
console.log(res);
|
|
|
if (res.data.code == 200) {
|
|
|
+ window.removeEventListener('keydown',that.keyd,false);
|
|
|
localStorage.setItem('userinif', JSON.stringify(res.data.data));
|
|
|
localStorage.setItem('unReadCount', JSON.stringify(res.data.data.unReadCount));
|
|
|
that.fullscreenLoading = false;
|
|
@@ -129,7 +140,7 @@ export default {
|
|
|
}
|
|
|
that.$router.push({ path: "/home" + homepage });
|
|
|
that.setUserInfo();
|
|
|
- console.log("/home" + homepage)
|
|
|
+ console.log("/home" + homepage);
|
|
|
// that.$router.push('/home/index');
|
|
|
} else {
|
|
|
that.fullscreenLoading = false;
|
|
@@ -146,15 +157,7 @@ export default {
|
|
|
document.querySelector(".login-all").style.height = window.innerHeight + "px";
|
|
|
|
|
|
this.getUserInfo();
|
|
|
- let that = this
|
|
|
- document.onkeydown = function (e) {
|
|
|
- e = window.event || e
|
|
|
- //保证是在登录页面发出的enter事件
|
|
|
- if (e.code === 'Enter' || e.code === 'enter' || e.code === 'NumpadEnter') {
|
|
|
- //调用登录函数
|
|
|
- that.Login();
|
|
|
- }
|
|
|
- }
|
|
|
+ window.addEventListener('keydown',this.keyd);
|
|
|
}
|
|
|
}
|
|
|
</script>
|