From b8525b923c41e2ee59d7233d2240d89fbf2d15ef Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期五, 09 五月 2025 11:50:39 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 laboratory/src/views/login/index.vue |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/laboratory/src/views/login/index.vue b/laboratory/src/views/login/index.vue
index ad5de49..8add674 100644
--- a/laboratory/src/views/login/index.vue
+++ b/laboratory/src/views/login/index.vue
@@ -68,11 +68,20 @@
     // 添加窗口大小变化监听器
     window.addEventListener('resize', this.handleResize)
   },
+  mounted() {
+    document.addEventListener("keydown", this.handleKeyDown);
+  },
   destroyed() {
     // 组件销毁时移除监听器
     window.removeEventListener('resize', this.handleResize)
+    document.removeEventListener("keydown", this.handleKeyDown);
   },
   methods: {
+    handleKeyDown(event) {
+      if (event.key === 'Enter') {
+        this.login()
+      }
+    },
     // 添加处理窗口大小变化的方法
     handleResize() {
       this.viewWidth = window.innerWidth
@@ -87,7 +96,7 @@
         return
       }
       loginReq(this.loginForm).then(res => {
-        console.log('111111',res)
+        console.log('111111', res)
         sessionStorage.setItem('token', res.token)
         sessionStorage.setItem('userInfo', JSON.stringify(res.userInfo.user))
         this.$router.push('/system')

--
Gitblit v1.7.1