OnlinePracticeList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="list">
  3. <table>
  4. <tbody class="list-row">
  5. <tr class="list-header qm-primary-strong-text">
  6. <td>课程</td>
  7. <td>考试开放时间</td>
  8. <td>练习次数</td>
  9. <td>最近正确率</td>
  10. <td>平均正确率</td>
  11. <td>最高正确率</td>
  12. <td style="max-width: 200px">操作</td>
  13. </tr>
  14. <tr v-for="course in courses" :key="course.courseId">
  15. <td>{{ course.courseName }}</td>
  16. <td>
  17. {{ course.startTime }} <br />
  18. ~ <br />
  19. {{ course.endTime }}
  20. </td>
  21. <td>{{ course.practiceCount }}</td>
  22. <td>{{ course.recentObjectiveAccuracy }}%</td>
  23. <td>{{ course.aveObjectiveAccuracy }}%</td>
  24. <td>{{ course.maxObjectiveAccuracy }}%</td>
  25. <td style="min-width: 180px">
  26. <div
  27. style="display: grid; grid-template-columns: repeat( auto-fit, minmax(100px, 1fr) );
  28. grid-gap: 10px"
  29. >
  30. <i-button
  31. class="qm-primary-button qm-primary-button-padding-fix"
  32. :disabled="!courseInBetween(course)"
  33. @click="enterPractice(course)"
  34. >
  35. 进入练习
  36. </i-button>
  37. <i-button
  38. class="qm-primary-button qm-primary-button-padding-fix"
  39. @click="enterPracticeList(course)"
  40. >
  41. 查看详情
  42. </i-button>
  43. </div>
  44. </td>
  45. </tr>
  46. </tbody>
  47. </table>
  48. </div>
  49. </template>
  50. <script>
  51. import { createNamespacedHelpers } from "vuex";
  52. import moment from "moment";
  53. import { mapState as globalMapState } from "vuex";
  54. const { mapMutations } = createNamespacedHelpers("examHomeModule");
  55. export default {
  56. name: "OnlinePracticeList",
  57. data() {
  58. return { now: new Date(), selectedCourse: null };
  59. },
  60. props: {
  61. examList: Array,
  62. courses: Array,
  63. },
  64. created() {
  65. this.getNow();
  66. this.intervalID = setInterval(() => this.getNow(), 1000);
  67. },
  68. beforeDestroy() {
  69. clearInterval(this.intervalID);
  70. },
  71. methods: {
  72. ...mapMutations(["toggleFaceCheckModal"]),
  73. getNow() {
  74. this.now = Date.now() + this.timeDifference;
  75. },
  76. courseInBetween(course) {
  77. return moment(this.now).isBetween(
  78. moment(course.startTime),
  79. moment(course.endTime)
  80. );
  81. },
  82. async enterPractice(course) {
  83. const alreadyInExam = await this.checkExamInProgress();
  84. if (alreadyInExam) {
  85. window._hmt.push(["_trackEvent", "在线练习页面", "断点续考", "进入"]);
  86. return;
  87. }
  88. window._hmt.push(["_trackEvent", "在线练习页面", "进入练习"]);
  89. this.$router.push(
  90. `/online-exam/exam/${course.examId}/overview?examStudentId=${
  91. course.examStudentId
  92. }`
  93. );
  94. },
  95. async enterPracticeList(course) {
  96. this.$router.push(
  97. `/online-practice/exam/${course.examId}/list?examStudentId=${
  98. course.examStudentId
  99. }&examName=${encodeURIComponent(
  100. course.examName
  101. )}&courseName=${encodeURIComponent(course.courseName)}`
  102. );
  103. },
  104. },
  105. computed: {
  106. ...globalMapState(["user", "timeDifference"]),
  107. },
  108. };
  109. </script>
  110. <style scoped>
  111. .list {
  112. border: 1px solid #eeeeee;
  113. border-radius: 6px;
  114. }
  115. .list table {
  116. width: 100%;
  117. border-collapse: collapse !important;
  118. border-spacing: 0;
  119. }
  120. .list td {
  121. border: 1px solid #eeeeee;
  122. border-radius: 6px;
  123. border-collapse: separate !important;
  124. padding: 10px;
  125. }
  126. </style>
  127. <style>
  128. .online-exam-list-override-poptip .ivu-poptip-rel {
  129. width: 100%;
  130. }
  131. </style>