瀏覽代碼

fix: 侧边栏拆分全部科目+科目管理,评价图片内联预览

sequoia00 1 月之前
父節點
當前提交
12eb1a26e4
共有 3 個文件被更改,包括 27 次插入 和 7 次删除
  1. 2 0
      nohup.out
  2. 12 6
      templates/base.html
  3. 13 1
      templates/evaluations.html

+ 2 - 0
nohup.out

@@ -120,3 +120,5 @@ INFO:     219.146.255.202:59783 - "GET /subjects HTTP/1.1" 200 OK
 INFO:     219.146.255.202:59786 - "GET /subjects HTTP/1.1" 200 OK
 INFO:     219.146.255.202:59783 - "GET / HTTP/1.1" 200 OK
 INFO:     219.146.255.202:59791 - "GET / HTTP/1.1" 200 OK
+INFO:     219.146.255.202:60132 - "GET /evaluations HTTP/1.1" 200 OK
+INFO:     219.146.255.202:60133 - "GET /evaluations HTTP/1.1" 200 OK

+ 12 - 6
templates/base.html

@@ -79,17 +79,17 @@
           <span class="sidebar-text text-sm font-medium">首页</span>
         </a>
 
-        <!-- 科目管理 + 子菜单 -->
+        <!-- 全部科目 -->
         <div class="mb-1">
-          <a href="javascript:void(0)" id="subjectToggleBtn" class="sidebar-link flex items-center gap-3 px-3 py-2.5 rounded-xl text-gray-500 hover:bg-gray-50 transition {% if '/subjects' in request.url.path or '/subject/' in request.url.path %}active{% endif %}">
-            <i class="fa-solid fa-folder w-5 text-center text-base flex-shrink-0"></i>
-            <span class="sidebar-text text-sm font-medium">科目管理</span>
+          <a href="javascript:void(0)" id="subjectToggleBtn" class="sidebar-link flex items-center gap-3 px-3 py-2.5 rounded-xl text-gray-500 hover:bg-gray-50 transition">
+            <i class="fa-solid fa-list-check w-5 text-center text-base flex-shrink-0"></i>
+            <span class="sidebar-text text-sm font-medium">全部科目</span>
             <i class="fa-solid fa-chevron-right text-[10px] text-gray-400 ml-auto subject-toggle" id="subjectToggleIcon"></i>
           </a>
           <div id="subjectSubmenu" class="sidebar-sub collapsed mt-1 ml-4 pl-3 border-l border-gray-100">
-            <div class="sidebar-section-label sidebar-text px-1">全部科目</div>
+            <div class="sidebar-section-label sidebar-text px-1">科目列表</div>
             {% for s in subjects %}
-            <a href="/subject/{{ s.id }}" class="subject-item {% if request.url.path == '/subject/' ~ s.id|string %}active{% endif %}" style="{% if '/subject/' ~ s.id|string ~ '?' in request.url.path %}margin-top:0{% endif %}">
+            <a href="/subject/{{ s.id }}" class="subject-item {% if request.url.path == '/subject/' ~ s.id|string %}active{% endif %}">
               <span class="w-2.5 h-2.5 rounded-full flex-shrink-0" style="background-color:{{ s.color }};"></span>
               <span class="sidebar-text truncate">{{ s.name }}</span>
               <span class="sidebar-text ml-auto text-[10px] text-gray-300">{{ s.error_images|length }}</span>
@@ -101,6 +101,12 @@
           </div>
         </div>
 
+        <!-- 科目管理 -->
+        <a href="/subjects" class="sidebar-link flex items-center gap-3 px-3 py-2.5 rounded-xl text-gray-500 hover:bg-gray-50 transition mb-1 {% if '/subjects' in request.url.path %}active{% endif %}">
+          <i class="fa-solid fa-folder w-5 text-center text-base flex-shrink-0"></i>
+          <span class="sidebar-text text-sm font-medium">科目管��</span>
+        </a>
+
         <!-- 时间线 -->
         <a href="/timeline" class="sidebar-link flex items-center gap-3 px-3 py-2.5 rounded-xl text-gray-500 hover:bg-gray-50 transition mb-1 {% if '/timeline' in request.url.path %}active{% endif %}">
           <i class="fa-solid fa-clock-rotate-left w-5 text-center text-base flex-shrink-0"></i>

+ 13 - 1
templates/evaluations.html

@@ -47,12 +47,24 @@
         <p class="text-sm text-gray-500 leading-relaxed mt-2">{{ ev.content }}</p>
         {% endif %}
         {% if ev.filename %}
-        <div class="mt-3 flex items-center gap-2">
+        {% set ext = ev.filename.split('.') | last | lower %}
+        {% if ext in ['jpg','jpeg','png','webp','gif','bmp'] %}
+        <div class="mt-3">
+          <div class="relative rounded-xl overflow-hidden bg-gray-100 cursor-pointer group max-w-xs" onclick="openLightbox('/static/uploads/{{ ev.filename }}','{{ ev.title }}',evalLb{{ ev.id }},0)">
+            <img src="/static/uploads/{{ ev.filename }}" class="w-full h-auto object-cover group-hover:scale-105 transition-transform duration-300" loading="lazy">
+            <div class="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition flex items-center justify-center">
+              <i class="fa-solid fa-magnifying-glass-plus text-white opacity-0 group-hover:opacity-100 text-xl transition"></i>
+            </div>
+          </div>
+        </div>
+        {% else %}
+        <div class="mt-3">
           <a href="/static/uploads/{{ ev.filename }}" target="_blank" class="inline-flex items-center gap-2 text-xs text-amber-600 hover:text-amber-700 bg-amber-50 px-3 py-1.5 rounded-lg transition">
             <i class="fa-solid fa-paperclip"></i>{{ ev.filename }}
           </a>
         </div>
         {% endif %}
+        {% endif %}
       </div>
       <div class="flex-shrink-0 flex items-center gap-3">
         <span class="text-xs text-gray-300 hidden sm:block">{{ ev.upload_time.strftime('%m-%d %H:%M') }}</span>