recommendation-list.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <div>
  2. <div class="space-y-6">
  3. @if($loading)
  4. <div class="flex items-center justify-center py-12">
  5. <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"></div>
  6. <span class="ml-3 text-gray-600">正在加载推荐题目...</span>
  7. </div>
  8. @else
  9. <!-- 页面头部 -->
  10. <div class="bg-gradient-to-r from-indigo-500 to-purple-600 text-white rounded-lg p-6">
  11. <div class="flex items-center justify-between">
  12. <div>
  13. <h1 class="text-2xl font-bold mb-2">{{ $this->getTitle() }}</h1>
  14. @if(!empty($knowledgePoint))
  15. <p class="text-indigo-100">
  16. 基于知识点 <span class="font-semibold">{{ $knowledgePoint['cn_name'] }}</span>
  17. 为你智能推荐练习题目
  18. </p>
  19. @endif
  20. </div>
  21. <div class="text-right">
  22. <p class="text-sm text-indigo-100">推荐题目总数</p>
  23. <p class="text-3xl font-bold">{{ count($recommendedQuestions) }}</p>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- 筛选工具栏 -->
  28. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
  29. <div class="flex flex-wrap items-center justify-between gap-4">
  30. <div class="flex items-center space-x-4">
  31. <div>
  32. <label class="text-sm font-medium text-gray-700">难度筛选</label>
  33. <select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
  34. <option value="all">全部难度</option>
  35. <option value="easy">简单</option>
  36. <option value="medium">中等</option>
  37. <option value="hard">困难</option>
  38. </select>
  39. </div>
  40. <div>
  41. <label class="text-sm font-medium text-gray-700">题目类型</label>
  42. <select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
  43. <option value="all">全部类型</option>
  44. <option value="基础题">基础题</option>
  45. <option value="变式题">变式题</option>
  46. <option value="综合题">综合题</option>
  47. <option value="提高题">提高题</option>
  48. </select>
  49. </div>
  50. </div>
  51. <div class="flex items-center space-x-2">
  52. <button class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition-colors">
  53. <svg class="w-5 h-5 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  54. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
  55. </svg>
  56. 刷新推荐
  57. </button>
  58. <button class="px-4 py-2 border border-gray-300 text-gray-700 rounded-md hover:bg-gray-50 transition-colors">
  59. <svg class="w-5 h-5 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  60. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"></path>
  61. </svg>
  62. 筛选
  63. </button>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 题目列表 -->
  68. @if(!empty($recommendedQuestions))
  69. <div class="space-y-4">
  70. @foreach($recommendedQuestions as $index => $question)
  71. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6 hover:shadow-md transition-shadow duration-200">
  72. <div class="flex items-start justify-between mb-4">
  73. <div class="flex-1">
  74. <div class="flex items-center space-x-3 mb-2">
  75. <span class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 font-semibold text-sm">
  76. {{ $index + 1 }}
  77. </span>
  78. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-{{ $this->getDifficultyColor($question['difficulty'] ?? 'medium') }}-100 text-{{ $this->getDifficultyColor($question['difficulty'] ?? 'medium') }}-800">
  79. {{ $this->getDifficultyLabel($question['difficulty'] ?? 'medium') }}
  80. </span>
  81. <span class="px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded">
  82. {{ $question['question_type'] ?? '练习题' }}
  83. </span>
  84. <span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded">
  85. {{ $question['score'] ?? 5 }}分
  86. </span>
  87. </div>
  88. <h3 class="text-lg font-semibold text-gray-900 mb-2">
  89. {{ $question['stem'] ?? $question['content'] ?? '题目内容' }}
  90. </h3>
  91. @if(isset($question['content']) && $question['content'] !== $question['stem'])
  92. <p class="text-gray-600 text-sm">{{ $question['content'] }}</p>
  93. @endif
  94. </div>
  95. </div>
  96. <div class="flex items-center justify-between pt-4 border-t border-gray-200">
  97. <div class="flex items-center space-x-4 text-sm text-gray-500">
  98. <span>
  99. <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  100. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
  101. </svg>
  102. {{ $knowledgePoint['cn_name'] ?? $kpCode }}
  103. </span>
  104. <span>
  105. <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  106. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  107. </svg>
  108. 预计时间: {{ $question['difficulty'] === 'easy' ? '3' : ($question['difficulty'] === 'hard' ? '8' : '5') }}分钟
  109. </span>
  110. </div>
  111. <div class="flex items-center space-x-2">
  112. <button class="px-4 py-2 text-gray-600 hover:text-gray-800 transition-colors">
  113. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  114. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
  115. </svg>
  116. </button>
  117. <button class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition-colors inline-flex items-center">
  118. 开始练习
  119. <svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  120. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
  121. </svg>
  122. </button>
  123. </div>
  124. </div>
  125. </div>
  126. @endforeach
  127. </div>
  128. <!-- 分页 -->
  129. <div class="flex items-center justify-between">
  130. <p class="text-sm text-gray-700">
  131. 显示 <span class="font-medium">1</span> 到 <span class="font-medium">{{ min(10, count($recommendedQuestions)) }}</span> 共
  132. <span class="font-medium">{{ count($recommendedQuestions) }}</span> 道题目
  133. </p>
  134. <div class="flex items-center space-x-2">
  135. <button class="px-3 py-1 border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50" disabled>
  136. 上一页
  137. </button>
  138. <button class="px-3 py-1 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">
  139. 1
  140. </button>
  141. <button class="px-3 py-1 border border-gray-300 rounded-md hover:bg-gray-50">
  142. 2
  143. </button>
  144. <button class="px-3 py-1 border border-gray-300 rounded-md hover:bg-gray-50">
  145. 下一页
  146. </button>
  147. </div>
  148. </div>
  149. @else
  150. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-12 text-center">
  151. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  152. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M12 21a9 9 0 110-18 9 9 0 010 18z"></path>
  153. </svg>
  154. <h3 class="mt-2 text-sm font-medium text-gray-900">暂无推荐题目</h3>
  155. <p class="mt-1 text-sm text-gray-500">系统正在为你生成推荐题目,请稍后再试</p>
  156. </div>
  157. @endif
  158. @endif
  159. </div>
  160. </div>