question-imported-difficulty-tune.blade.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <x-filament::page>
  2. <style>
  3. .qidt-shell {
  4. display: grid;
  5. grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
  6. gap: 1rem;
  7. align-items: start;
  8. }
  9. @media (max-width: 1024px) {
  10. .qidt-shell {
  11. grid-template-columns: 1fr;
  12. }
  13. }
  14. </style>
  15. <x-filament::section
  16. heading="说明"
  17. description="列表来自「待入库质检」页在本次登录会话中成功写入 questions 的题目 ID(快速/批量入库均会累积)。在此可逐题查看并修改难度系数 0.00~0.90(两位小数)。"
  18. :compact="true"
  19. >
  20. <div class="flex flex-wrap items-center gap-2">
  21. <x-filament::button
  22. color="gray"
  23. size="sm"
  24. wire:click="clearTuningList"
  25. wire:confirm="确定清空会话中的 ID 列表?(不会删除题库题目)"
  26. >
  27. 清空列表记录
  28. </x-filament::button>
  29. <a
  30. href="{{ \App\Filament\Pages\QuestionTemQualityReview::getUrl() }}"
  31. class="text-sm text-primary-600 underline"
  32. >
  33. 返回待入库质检
  34. </a>
  35. </div>
  36. <p class="mt-2 text-xs text-gray-500 dark:text-gray-400">
  37. 当前列表共 <strong>{{ count($this->tuningQuestionIds) }}</strong> 道题。
  38. </p>
  39. </x-filament::section>
  40. <div class="qidt-shell mt-4">
  41. <x-filament::section heading="题目列表" :compact="true">
  42. @if (count($this->tuningQuestionIds) === 0)
  43. <p class="text-sm text-gray-600 dark:text-gray-400">暂无记录,请先在待入库质检页执行入库。</p>
  44. @else
  45. <ul class="max-h-[min(70vh,40rem)] space-y-1 overflow-y-auto text-sm">
  46. @foreach ($this->tuningQuestionIds as $qid)
  47. @php
  48. $row = \App\Models\Question::query()->find($qid);
  49. $stemSnippet = $row ? \Illuminate\Support\Str::limit(strip_tags((string) $row->stem), 80) : '(无正文)';
  50. $diffLabel = $row ? number_format(max(0, min(0.9, (float) $row->difficulty)), 2, '.', '') : '—';
  51. @endphp
  52. <li
  53. wire:key="qidt-row-{{ $qid }}"
  54. class="flex items-start justify-between gap-2 rounded-lg border border-gray-100 p-2 dark:border-white/10 {{ (int) $this->selectedQuestionId === (int) $qid ? 'ring-2 ring-primary-500' : '' }}"
  55. >
  56. <button
  57. type="button"
  58. class="min-w-0 flex-1 text-left"
  59. wire:click="selectQuestion({{ (int) $qid }})"
  60. >
  61. <span class="font-mono text-xs text-primary-600">#{{ $qid }}</span>
  62. <span class="ml-2 text-xs text-gray-500">{{ $row?->kp_code }}</span>
  63. <span class="ml-2 text-xs text-gray-400">难度 {{ $diffLabel }}</span>
  64. <div class="mt-1 line-clamp-2 text-xs text-gray-700 dark:text-gray-300">
  65. {{ $stemSnippet }}
  66. </div>
  67. </button>
  68. <button
  69. type="button"
  70. class="shrink-0 text-xs text-danger-600 underline"
  71. wire:click="removeFromList({{ (int) $qid }})"
  72. >
  73. 移除
  74. </button>
  75. </li>
  76. @endforeach
  77. </ul>
  78. @endif
  79. </x-filament::section>
  80. <x-filament::section
  81. heading="调整难度"
  82. description="选中题目后修改 difficulty,点确定写回 questions 表"
  83. :compact="true"
  84. >
  85. @if (! $this->selectedQuestionId)
  86. <p class="text-xs text-gray-500">请从左侧选择一道题。</p>
  87. @else
  88. <p class="mb-2 text-xs text-gray-500">
  89. 当前 <span class="font-mono">question_id = {{ $this->selectedQuestionId }}</span>
  90. </p>
  91. <x-filament::input.wrapper>
  92. <x-filament::input
  93. type="number"
  94. min="0"
  95. max="0.9"
  96. step="0.01"
  97. wire:model.live.debounce.300ms="difficultyInput"
  98. />
  99. </x-filament::input.wrapper>
  100. <x-filament::button
  101. class="mt-3"
  102. color="primary"
  103. wire:click="saveDifficulty"
  104. wire:loading.attr="disabled"
  105. >
  106. 确定更新
  107. </x-filament::button>
  108. @endif
  109. </x-filament::section>
  110. </div>
  111. </x-filament::page>