OnlinePracticeList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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>{{ course.startTime }} <br> ~ <br> {{ course.endTime }}</td>
  17. <td>{{ course.practiceCount }}</td>
  18. <td>{{ course.recentObjectiveAccuracy }}%</td>
  19. <td>{{ course.aveObjectiveAccuracy }}%</td>
  20. <td>{{ course.maxObjectiveAccuracy }}%</td>
  21. <td style="min-width: 180px">
  22. <div style="display: grid; grid-template-columns: repeat( auto-fit, minmax(100px, 1fr) ); grid-gap: 10px">
  23. <i-button class="qm-primary-button" :disabled="!courseInBetween(course)" @click="enterPractice(course)">进入练习</i-button>
  24. <i-button class="qm-primary-button" @click="enterPracticeList(course)">查看详情</i-button>
  25. </div>
  26. </td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. </div>
  31. </template>
  32. <script>
  33. import { createNamespacedHelpers } from "vuex";
  34. import moment from "moment";
  35. import { mapState as globalMapState } from "vuex";
  36. const { mapMutations } = createNamespacedHelpers("examHomeModule");
  37. export default {
  38. name: "OnlinePracticeList",
  39. data() {
  40. return { now: new Date(), selectedCourse: null };
  41. },
  42. props: {
  43. examList: Array,
  44. courses: Array
  45. },
  46. created() {
  47. this.getNow();
  48. this.intervalID = setInterval(() => this.getNow(), 1000);
  49. },
  50. beforeDestroy() {
  51. clearInterval(this.intervalID);
  52. },
  53. methods: {
  54. ...mapMutations(["toggleFaceCheckModal"]),
  55. getNow() {
  56. this.now = new Date();
  57. },
  58. courseInBetween(course) {
  59. return moment(this.now).isBetween(
  60. moment(course.startTime),
  61. moment(course.endTime)
  62. );
  63. },
  64. async checkExamInProgress() {
  65. try {
  66. // 断点续考
  67. const examingRes = (await this.$http.get(
  68. "/api/ecs_oe_student/examControl/checkExamInProgress"
  69. )).data;
  70. if (examingRes) {
  71. this.$Spin.show({
  72. render: () => {
  73. return <div style="font-size: 24px">正在进入断点续考...</div>;
  74. }
  75. });
  76. this.$router.push(
  77. `/online-exam/exam/${examingRes.examId}/examRecordData/${
  78. examingRes.examRecordDataId
  79. }/order/1` +
  80. (examingRes.faceVerifyMinute
  81. ? `?faceVerifyMinute=${examingRes.faceVerifyMinute}`
  82. : "")
  83. );
  84. setTimeout(() => this.$Spin.hide(), 1000);
  85. return true;
  86. }
  87. } catch (error) {
  88. this.$Message.error("获取断点续考信息异常");
  89. return true;
  90. }
  91. },
  92. async enterPractice(course) {
  93. const alreadyInExam = await this.checkExamInProgress();
  94. if (alreadyInExam) return;
  95. this.$router.push(
  96. `/online-exam/exam/${course.examId}/overview?examStudentId=${
  97. course.examStudentId
  98. }`
  99. );
  100. },
  101. async enterPracticeList(course) {
  102. this.$router.push(
  103. `/online-practice/exam/${course.examId}/list?examStudentId=${
  104. course.examStudentId
  105. }&examName=${encodeURIComponent(
  106. course.examName
  107. )}&courseName=${encodeURIComponent(course.courseName)}`
  108. );
  109. }
  110. },
  111. computed: {
  112. ...globalMapState(["user"])
  113. }
  114. };
  115. </script>
  116. <style scoped>
  117. .list {
  118. border: 1px solid #eeeeee;
  119. border-radius: 6px;
  120. }
  121. .list table {
  122. width: 100%;
  123. border-collapse: collapse !important;
  124. border-spacing: 0;
  125. }
  126. .list td {
  127. border: 1px solid #eeeeee;
  128. border-radius: 6px;
  129. border-collapse: separate !important;
  130. padding: 10px;
  131. }
  132. </style>
  133. <style>
  134. .online-exam-list-override-poptip .ivu-poptip-rel {
  135. width: 100%;
  136. }
  137. </style>