review.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {% extends "base.html" %}
  2. {% block title %}复习汇总 - 满意错题本{% endblock %}
  3. {% block page_title %}复习汇总{% endblock %}
  4. {% block content %}
  5. <div class="flex items-center justify-between mb-6">
  6. <div class="flex items-center gap-4">
  7. <div class="w-10 h-10 rounded-xl bg-emerald-100 flex items-center justify-center text-emerald-600">
  8. <i class="fa-solid fa-graduation-cap text-lg"></i>
  9. </div>
  10. <div>
  11. <p class="text-sm font-semibold text-gray-700">期中/期末复习汇总</p>
  12. <p class="text-xs text-gray-400 mt-0.5">按日期排序所有错题,方便系统复习</p>
  13. </div>
  14. </div>
  15. <button onclick="window.print()" class="inline-flex items-center gap-2 bg-white border border-gray-200 text-gray-600 px-4 py-2 rounded-xl text-sm font-medium hover:bg-gray-50 transition">
  16. <i class="fa-solid fa-print"></i>打印
  17. </button>
  18. </div>
  19. {% if review_data %}
  20. <div class="space-y-8">
  21. {% for subject_id, data in review_data.items() %}
  22. {% set subject = data.subject %}
  23. <div>
  24. <!-- Subject header -->
  25. <div class="flex items-center gap-4 mb-4">
  26. <span class="w-4 h-4 rounded-full shadow-sm flex-shrink-0" style="background-color:{{ subject.color }};box-shadow:0 0 0 3px {{ subject.color }}20"></span>
  27. <h3 class="text-base font-bold text-gray-800">{{ subject.name }}</h3>
  28. <span class="text-xs text-gray-400 bg-gray-100 px-3 py-1 rounded-full">{{ data.images|length }} 张错题 · {{ data.dates|length }} 个日期</span>
  29. <a href="/subject/{{ subject_id }}" class="ml-auto text-xs text-primary hover:underline bg-indigo-50 px-3 py-1.5 rounded-lg flex items-center gap-1"><i class="fa-solid fa-pen"></i>管理</a>
  30. </div>
  31. <!-- Timeline of dates -->
  32. <div class="bg-white rounded-2xl border border-gray-100 overflow-hidden">
  33. {% for date_str in data.dates %}
  34. {% set day_images = [] %}
  35. {% for img in data.images if img.date == date_str %}{% set x = day_images.append(img) %}{% endfor %}
  36. <div class="{% if not loop.last %}border-b border-gray-50{% endif %}">
  37. <div class="px-5 py-2.5 bg-gray-50 flex items-center gap-3">
  38. <i class="fa-regular fa-calendar text-gray-400 text-sm"></i>
  39. <span class="text-sm font-semibold text-gray-600">{{ date_str }}</span>
  40. <span class="text-xs text-gray-400">{{ day_images|length }} 张</span>
  41. </div>
  42. <div class="p-4 grid grid-cols-5 gap-3">
  43. {% for img in day_images %}
  44. <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 }}',reviewLb{{ subject_id }}{{ loop.index0 }},{{ loop.index0 }})">
  45. <img src="/static/uploads/{{ img.filename }}" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" loading="lazy">
  46. <div class="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition"></div>
  47. <div class="absolute bottom-1.5 left-1.5 right-1.5">
  48. <p class="text-[10px] text-white/80 truncate px-1 py-0.5 bg-black/30 rounded">{{ img.original_name }}</p>
  49. </div>
  50. </div>
  51. {% endfor %}
  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-solid fa-book-open-reader"></i></div>
  62. <p class="text-gray-400 mb-2">暂无错题数据</p>
  63. <p class="text-sm text-gray-300 mb-6">上传错题后即可在此查看汇总</p>
  64. <a href="/subjects" class="inline-flex items-center gap-2 bg-primary text-white px-6 py-3 rounded-xl text-sm font-medium hover:bg-indigo-600 transition">
  65. <i class="fa-solid fa-plus"></i>先去添加错题
  66. </a>
  67. </div>
  68. {% endif %}
  69. {% endblock %}
  70. {% block extra_js %}
  71. <script>
  72. {% for subject_id, data in review_data.items() %}
  73. const reviewLb{{ subject_id }} = [
  74. {% for img in data.images %}" /static/uploads/{{ img.filename }}",{% endfor %}
  75. ];
  76. {% endfor %}
  77. </script>
  78. {% endblock %}