You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.3 KiB

  1. <!-- src/components/WrongQuestion/WrongQuestionTable.vue -->
  2. <template>
  3. <!-- 表格容器用于展示错题统计数据 -->
  4. <div class="table-container">
  5. <!-- 数据表格 -->
  6. <table>
  7. <!-- 表头部分 -->
  8. <thead>
  9. <tr>
  10. <th>ID</th>
  11. <th>题干</th>
  12. <th>题目类型</th>
  13. <th>出错次数</th>
  14. <th>出错率</th>
  15. <th>推荐课程</th>
  16. <th>操作</th>
  17. </tr>
  18. </thead>
  19. <!-- 表格主体循环渲染每条错题数据 -->
  20. <tbody>
  21. <tr v-for="item in wrongQuestions" :key="item.id">
  22. <td>{{ item.id }}</td>
  23. <td>{{ item.questionText }}</td>
  24. <td>{{ item.type }}</td>
  25. <td>{{ item.errorCount }}</td>
  26. <td>{{ item.errorRate }}</td>
  27. <td>{{ item.recommendedCourse }}</td>
  28. <td>
  29. <!-- 查看出错用户按钮 -->
  30. <button class="btn-red small" @click="viewUser(item)">出错用户</button>
  31. <!-- 查看题目详情按钮 -->
  32. <button class="btn-red small" @click="viewQuestion(item)">查看题目</button>
  33. </td>
  34. </tr>
  35. </tbody>
  36. </table>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. // 组件名称:错题统计表格组件
  42. name: 'WrongQuestionTable',
  43. // 接收父组件传递的错题数据列表
  44. props: {
  45. wrongQuestions: {
  46. type: Array,
  47. default: () => []
  48. }
  49. },
  50. // 定义方法
  51. methods: {
  52. // 点击“出错用户”按钮时触发,用于查看该题目的错误用户信息
  53. viewUser(item) {
  54. console.log('查看出错用户:', item)
  55. },
  56. // 点击“查看题目”按钮时触发,用于跳转或显示题目详情
  57. viewQuestion(item) {
  58. console.log('查看题目:', item)
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped>
  64. /* 表格容器样式 */
  65. .table-container {
  66. width: 100%;
  67. border-collapse: collapse;
  68. margin-top: 10px;
  69. }
  70. /* 表格整体样式 */
  71. table {
  72. width: 100%;
  73. border-collapse: collapse;
  74. background-color: white;
  75. }
  76. /* 表头和表体单元格通用样式 */
  77. th,
  78. td {
  79. padding: 12px;
  80. text-align: left;
  81. border-bottom: 1px solid #ddd;
  82. }
  83. /* 表头样式 */
  84. th {
  85. background-color: #f2f2f2;
  86. font-weight: normal;
  87. color: #333;
  88. }
  89. /* 鼠标悬停行高亮效果 */
  90. tr:hover {
  91. background-color: #f9f9f9;
  92. }
  93. </style>