OnlineExamOverview.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="container" id="exam-overview" v-if="startInfo && paperStruct">
  3. <div class="instructions">
  4. <h1 class="">考试说明</h1>
  5. <div style="text-align: left; padding-bottom: 20px">
  6. <p v-html="beforeExamRemark"></p>
  7. <!-- <p>{{"测试".repeat(500)}}</p> -->
  8. </div>
  9. <i-button
  10. class="qm-primary-button"
  11. :disabled="isForceRead"
  12. @click="goToPaper"
  13. style="display: inline-block; width: 100%;"
  14. >
  15. {{ isForceRead ? "强制阅读" : "开始答题" }} (倒计时:{{
  16. remainTimeFormatted
  17. }})
  18. </i-button>
  19. </div>
  20. <div class="exam-detail">
  21. <h3 class="">科目:{{ startInfo.courseName }}</h3>
  22. <br />
  23. <h4 class="">试卷概览(总分:{{ paperTotalScore }})</h4>
  24. <br />
  25. <ul class="list-group">
  26. <li
  27. class="list-group-item"
  28. v-for="(questionsGroup, index) in paperStruct.defaultPaper
  29. .questionGroupList"
  30. :key="questionsGroup.gruopName"
  31. >
  32. {{ index + 1 }}、{{ questionsGroup.groupName }}
  33. <small class="pull-right">
  34. (共{{ questionsGroup.questionWrapperList.length }}题,共{{
  35. questionsGroup.groupScore
  36. }}分)
  37. </small>
  38. </li>
  39. </ul>
  40. <div>
  41. <img style="width:100%; padding-top: 40px;" src="./good-wish.png" />
  42. </div>
  43. </div>
  44. </div>
  45. <div v-else>正在等待数据返回...</div>
  46. </template>
  47. <script>
  48. import moment from "moment";
  49. const TOTAL_READ_TIME = 120;
  50. const FORCE_READ_TIME = process.env.NODE_ENV === "production" ? 10 : 1;
  51. export default {
  52. name: "OnlineExamOverview",
  53. data() {
  54. return {
  55. beforeExamRemark: null,
  56. startInfo: null,
  57. paperStruct: null,
  58. remainTime: TOTAL_READ_TIME,
  59. isForceRead: true,
  60. };
  61. },
  62. async mounted() {
  63. window._hmt.push(["_trackEvent", "在线考试概览页面", "进入页面"]);
  64. this.intervalId = setInterval(() => {
  65. this.remainTime -= 1;
  66. this.isForceRead = TOTAL_READ_TIME - this.remainTime < FORCE_READ_TIME;
  67. if (this.remainTime === 0) {
  68. this.goToPaper();
  69. }
  70. }, 1000);
  71. try {
  72. const exam = await this.$http.get(
  73. "/api/ecs_exam_work/exam/examOrgPropertyFromCache4StudentSession/" +
  74. this.$route.params.examId +
  75. `/BEFORE_EXAM_REMARK`
  76. );
  77. this.beforeExamRemark = exam.data.BEFORE_EXAM_REMARK || "";
  78. const res = await this.$http.get(
  79. "/api/ecs_oe_student/examControl/startExam?examStudentId=" +
  80. this.$route.query.examStudentId
  81. );
  82. this.startInfo = res.data;
  83. this.examRecordDataId = res.data.examRecordDataId;
  84. const paperStruct = await this.$http.get(
  85. "/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=" +
  86. this.examRecordDataId
  87. );
  88. this.paperStruct = paperStruct.data;
  89. this.paperTotalScore =
  90. this.paperStruct.defaultPaper.questionGroupList
  91. .map(q => q.groupScore)
  92. .reduce((p, c) => p + c * 1000, 0) / 1000;
  93. } catch (e) {
  94. window._hmt.push([
  95. "_trackEvent",
  96. "在线考试概览页面",
  97. "获取考试概览信息异常",
  98. ]);
  99. this.$router.back();
  100. return;
  101. }
  102. document.body.style = "";
  103. },
  104. beforeDestroy() {
  105. clearInterval(this.intervalId);
  106. },
  107. computed: {
  108. remainTimeFormatted: function() {
  109. return moment.utc(this.remainTime * 1000).format("HH:mm:ss");
  110. },
  111. },
  112. methods: {
  113. goToPaper: function() {
  114. this.$router.replace(
  115. `/online-exam/exam/${this.$route.params.examId}/examRecordData/${this.examRecordDataId}/order/1` +
  116. (this.startInfo.faceVerifyMinute
  117. ? `?faceVerifyMinute=${this.startInfo.faceVerifyMinute}`
  118. : "")
  119. );
  120. },
  121. },
  122. };
  123. </script>
  124. <style scoped>
  125. .container {
  126. display: grid;
  127. grid-template-columns: 1fr 300px;
  128. width: 100vw;
  129. height: 100vh;
  130. overflow: auto;
  131. }
  132. .instructions {
  133. display: grid;
  134. grid-template-rows: 40px minmax(200px, auto) 1fr;
  135. padding: 40px 20px;
  136. }
  137. .exam-detail {
  138. padding: 40px 20px;
  139. background-color: #f5f5f5;
  140. text-align: left;
  141. }
  142. .list-group {
  143. list-style: none;
  144. }
  145. .list-group li {
  146. border-bottom: 1px solid #eeeeee;
  147. padding-top: 10px;
  148. }
  149. .pull-right {
  150. text-align: right;
  151. float: right;
  152. }
  153. </style>
  154. <style>
  155. #exam-overview img {
  156. max-width: 100%;
  157. height: auto !important;
  158. }
  159. </style>