OnlineExamOverview.vue 4.7 KB

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