timeline.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {% extends "base.html" %}
  2. {% block title %}时间线 - 满意错题本{% endblock %}
  3. {% block page_title %}时间线{% endblock %}
  4. {% block content %}
  5. <!-- Date nav -->
  6. <div class="bg-white rounded-2xl border border-gray-100 p-4 mb-6 flex items-center gap-3">
  7. {% if prev_date %}
  8. <a href="?date={{ prev_date }}" class="flex-shrink-0 w-9 h-9 rounded-xl bg-gray-50 hover:bg-gray-100 flex items-center justify-center text-gray-500 transition" title="前一天">
  9. <i class="fa-solid fa-chevron-left text-sm"></i>
  10. </a>
  11. {% else %}
  12. <span class="flex-shrink-0 w-9 h-9 rounded-xl bg-gray-50 flex items-center justify-center text-gray-200">
  13. <i class="fa-solid fa-chevron-left text-sm"></i>
  14. </span>
  15. {% endif %}
  16. <div class="flex items-center gap-2 overflow-x-auto flex-1 pb-1">
  17. {% for d in all_dates %}
  18. <a href="?date={{ d }}" class="date-chip flex-shrink-0 px-3 py-1.5 rounded-xl text-xs font-medium transition {% if d == current_date %}bg-primary text-white shadow-sm{% else %}bg-gray-50 text-gray-500 hover:bg-gray-100{% endif %}">
  19. {{ d }}
  20. </a>
  21. {% endfor %}
  22. </div>
  23. {% if next_date %}
  24. <a href="?date={{ next_date }}" class="flex-shrink-0 w-9 h-9 rounded-xl bg-gray-50 hover:bg-gray-100 flex items-center justify-center text-gray-500 transition" title="后一天">
  25. <i class="fa-solid fa-chevron-right text-sm"></i>
  26. </a>
  27. {% else %}
  28. <span class="flex-shrink-0 w-9 h-9 rounded-xl bg-gray-50 flex items-center justify-center text-gray-200">
  29. <i class="fa-solid fa-chevron-right text-sm"></i>
  30. </span>
  31. {% endif %}
  32. <input type="date" value="{{ current_date }}" onchange="location.href='/timeline?date='+this.value"
  33. class="border border-gray-200 rounded-xl px-3 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-primary/30 text-gray-500 flex-shrink-0">
  34. </div>
  35. {% if timeline_data %}
  36. <div class="space-y-5">
  37. {% for item in timeline_data %}
  38. <div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
  39. <div class="px-5 py-3.5 flex items-center gap-3 border-b border-gray-50">
  40. <span class="w-3 h-3 rounded-full flex-shrink-0" style="background-color:{{ item.subject.color }};box-shadow:0 0 0 3px {{ item.subject.color }}20"></span>
  41. <span class="font-bold text-gray-800 text-sm">{{ item.subject.name }}</span>
  42. <span class="text-xs text-gray-400 ml-auto">{{ item.images|length }} 张错题</span>
  43. <a href="/subject/{{ item.subject.id }}?date={{ current_date }}" class="text-xs text-primary hover:underline ml-2 flex items-center gap-1"><i class="fa-solid fa-arrow-right"></i>进入科目</a>
  44. </div>
  45. <div class="p-4 grid grid-cols-5 gap-3">
  46. {% for img in item.images %}
  47. <div class="group relative aspect-[3/4] rounded-xl overflow-hidden bg-gray-100 cursor-pointer" onclick="openLightbox('/static/uploads/{{ img.filename }}','{{ img.original_name }}',lb{{ item.subject.id }},{{ loop.index0 }})">
  48. <img src="/static/uploads/{{ img.filename }}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" loading="lazy">
  49. <div class="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition"></div>
  50. <div class="absolute bottom-1.5 left-1.5 right-1.5">
  51. <p class="text-[10px] text-white/80 truncate px-1 py-0.5 bg-black/30 rounded">{{ img.original_name }}</p>
  52. </div>
  53. </div>
  54. {% endfor %}
  55. </div>
  56. </div>
  57. {% endfor %}
  58. </div>
  59. {% else %}
  60. <div class="bg-white rounded-2xl border border-gray-100 p-16 text-center">
  61. <div class="text-6xl text-gray-200 mb-4"><i class="fa-regular fa-calendar-xmark"></i></div>
  62. <p class="text-gray-400 mb-2">该日期暂无错题记录</p>
  63. <p class="text-sm text-gray-300">请选择其他日期或前往科目页上传错题</p>
  64. </div>
  65. {% endif %}
  66. {% endblock %}
  67. {% block extra_js %}
  68. <script>
  69. {% for item in timeline_data %}
  70. const lb{{ item.subject.id }} = [
  71. {% for img in item.images %}" /static/uploads/{{ img.filename }}",{% endfor %}
  72. ];
  73. {% endfor %}
  74. </script>
  75. {% endblock %}