math-render-test.blade.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <div class="space-y-6">
  2. <!-- 搜索框 -->
  3. <div class="bg-white p-4 rounded-lg border">
  4. <div class="flex items-center space-x-4">
  5. <input
  6. type="text"
  7. wire:model.live.debounce.300ms="search"
  8. placeholder="搜索题目..."
  9. class="flex-1 border rounded p-2"
  10. >
  11. <span class="text-sm text-gray-500">找到 {{ count($this->questions) }} 个结果</span>
  12. </div>
  13. </div>
  14. <!-- 题目列表 -->
  15. <div class="bg-white rounded-lg border overflow-hidden">
  16. <table class="min-w-full divide-y divide-gray-200">
  17. <thead class="bg-gray-50">
  18. <tr>
  19. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">题目编号</th>
  20. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">题目内容</th>
  21. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">难度</th>
  22. </tr>
  23. </thead>
  24. <tbody class="bg-white divide-y divide-gray-200">
  25. @forelse($this->questions as $question)
  26. <tr>
  27. <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
  28. {{ $question['code'] }}
  29. </td>
  30. <td class="px-6 py-4">
  31. <x-math-render :content="$question['content']" class="text-sm" />
  32. </td>
  33. <td class="px-6 py-4 whitespace-nowrap">
  34. @php
  35. $difficulty = $question['difficulty'];
  36. $label = match (true) {
  37. $difficulty <= 0.4 => '基础',
  38. $difficulty <= 0.7 => '中等',
  39. default => '拔高',
  40. };
  41. $color = match (true) {
  42. $difficulty <= 0.4 => 'green',
  43. $difficulty <= 0.7 => 'yellow',
  44. default => 'red',
  45. };
  46. @endphp
  47. <span class="px-2 py-1 text-xs font-semibold rounded-full bg-{{ $color }}-100 text-{{ $color }}-800">
  48. {{ $label }}
  49. </span>
  50. </td>
  51. </tr>
  52. @empty
  53. <tr>
  54. <td colspan="3" class="px-6 py-12 text-center text-gray-500">
  55. 暂无数据
  56. </td>
  57. </tr>
  58. @endforelse
  59. </tbody>
  60. </table>
  61. </div>
  62. <!-- 实时编辑演示 -->
  63. <div class="bg-white p-4 rounded-lg border">
  64. <h3 class="text-lg font-semibold mb-4">实时编辑演示</h3>
  65. <x-math-render
  66. content="初始内容:$f(x) = x^2$"
  67. class="mb-4 p-4 bg-gray-50 rounded"
  68. />
  69. <p class="text-sm text-gray-600">
  70. 题目内容会在组件更新后自动重新渲染数学公式。
  71. </p>
  72. </div>
  73. </div>