From 48d2cb593d1dfb3d6b4395ec7fe0ffce355b702d Mon Sep 17 00:00:00 2001 From: superlishunqin <852326703@qq.com> Date: Sat, 17 May 2025 05:11:18 +0800 Subject: [PATCH] home_page_fix --- app/static/css/main.css | 190 +++++++++++++++++++++++++++++++++++++--- app/templates/base.html | 84 ++++++++++++------ 2 files changed, 236 insertions(+), 38 deletions(-) diff --git a/app/static/css/main.css b/app/static/css/main.css index fe94da4..b3ab03c 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -138,10 +138,18 @@ body { align-items: center; } +/* 通知图标样式 */ .notifications { position: relative; margin-right: 20px; +} + +.notification-icon { cursor: pointer; + color: #495057; + position: relative; + display: block; + padding: 5px; } .badge { @@ -159,11 +167,139 @@ body { justify-content: center; } +/* 通知下拉菜单 */ +.notification-dropdown { + position: absolute; + top: 100%; + right: -10px; + width: 320px; + background-color: white; + border-radius: 5px; + box-shadow: 0 3px 10px rgba(0,0,0,0.2); + display: none; + z-index: 1000; + max-height: 400px; + overflow-y: auto; + margin-top: 10px; +} + +.notification-dropdown.show { + display: block; +} + +.notification-dropdown::before { + content: ''; + position: absolute; + top: -8px; + right: 15px; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-bottom: 8px solid white; +} + +.notification-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 12px 15px; + border-bottom: 1px solid #eaeaea; +} + +.notification-header h6 { + margin: 0; + font-size: 0.9rem; + font-weight: 600; +} + +.mark-all-read { + font-size: 0.8rem; + color: #4a6cf7; + text-decoration: none; +} + +.mark-all-read:hover { + text-decoration: underline; +} + +.notification-items { + max-height: 300px; + overflow-y: auto; +} + +.notification-item { + display: block; + padding: 12px 15px; + border-bottom: 1px solid #f5f5f5; + color: #333; + text-decoration: none; + transition: background-color 0.2s; +} + +.notification-item:hover { + background-color: #f8f9fa; + text-decoration: none; +} + +.notification-item.unread { + background-color: #f0f7ff; +} + +.notification-title { + font-size: 0.9rem; + margin-bottom: 5px; + font-weight: 600; +} + +.notification-text { + font-size: 0.8rem; + color: #666; + margin-bottom: 5px; +} + +.notification-time { + font-size: 0.75rem; + color: #999; + display: block; +} + +.no-notifications { + padding: 25px; + text-align: center; + color: #999; +} + +.dropdown-divider { + height: 1px; + background-color: #eaeaea; + margin: 5px 0; +} + +.view-all { + display: block; + text-align: center; + padding: 10px; + color: #4a6cf7; + text-decoration: none; + font-weight: 500; + font-size: 0.9rem; +} + +.view-all:hover { + background-color: #f8f9fa; + text-decoration: none; +} + +/* 用户信息样式 */ .user-info { + position: relative; +} + +.user-info-toggle { display: flex; align-items: center; cursor: pointer; - position: relative; + text-decoration: none; + color: inherit; } .user-avatar { @@ -194,41 +330,63 @@ body { color: #6c757d; } -.dropdown-menu { +.user-dropdown { position: absolute; top: 100%; right: 0; background-color: white; - box-shadow: 0 3px 10px rgba(0,0,0,0.1); + box-shadow: 0 3px 10px rgba(0,0,0,0.2); border-radius: 5px; width: 200px; - padding: 10px 0; + padding: 5px 0; display: none; z-index: 1000; + margin-top: 10px; } -.user-info.active .dropdown-menu { +.user-dropdown.show { display: block; } -.dropdown-menu a { +.user-dropdown::before { + content: ''; + position: absolute; + top: -8px; + right: 15px; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-bottom: 8px solid white; +} + +.user-dropdown a { display: block; - padding: 8px 15px; + padding: 10px 15px; color: #333; text-decoration: none; - transition: background-color 0.3s; + transition: background-color 0.2s; } -.dropdown-menu a:hover { +.user-dropdown a:hover { background-color: #f8f9fa; } -.dropdown-menu a i { +.user-dropdown a i { width: 20px; margin-right: 10px; text-align: center; } +.login-link, .register-link { + color: #4a6cf7; + text-decoration: none; + margin-left: 10px; + font-weight: 500; +} + +.login-link:hover, .register-link:hover { + text-decoration: underline; +} + /* 内容区域 */ .content-wrapper { flex: 1; @@ -258,4 +416,16 @@ body { .user-details { display: none; } + + .search-container { + width: 200px; + } + + .notification-dropdown, + .user-dropdown { + position: fixed; + right: 10px; + width: calc(100% - 80px); + max-width: 320px; + } } diff --git a/app/templates/base.html b/app/templates/base.html index e826ffb..1ca92cd 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -108,8 +108,9 @@