diff --git a/frontend/admin.html b/frontend/admin.html index 9b94aaa..8cf60d9 100644 --- a/frontend/admin.html +++ b/frontend/admin.html @@ -455,7 +455,7 @@ - + + - + diff --git a/frontend/js/app.js b/frontend/js/app.js index cad7a24..195fe8c 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -25,6 +25,13 @@ createApp({ this.sessionId = this.generateSessionId(); this.autoResizeTextarea(); this.loadModels(); + + // 键盘 Escape 关闭模态框 + document.addEventListener('keydown', this.handleKeydown); + }, + + beforeUnmount() { + document.removeEventListener('keydown', this.handleKeydown); }, methods: { checkAuth() { @@ -40,6 +47,13 @@ createApp({ } }, + handleKeydown(e) { + if (e.key === 'Escape') { + if (this.showImageModal) this.closeImageModal(); + else if (this.showContactModal) this.showContactModal = false; + } + }, + logout() { localStorage.removeItem('token'); window.location.href = '/static/login.html'; diff --git a/frontend/login.html b/frontend/login.html index 5b62370..14b9e6d 100644 --- a/frontend/login.html +++ b/frontend/login.html @@ -221,7 +221,7 @@ - + - + + + - + +