OnlineExamOverview.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="container" v-if="beforeExamRemark && startInfo && paperStruct">
  3. <div class="instructions">
  4. <h1 class="">考试说明</h1>
  5. <div class="" style="text-align: left; padding-bottom: 20px">
  6. <p v-html="beforeExamRemark"></p>
  7. <!-- <p>{{"测试".repeat(500)}}</p> -->
  8. </div>
  9. <!-- data-ui-sref="exam.start({examRecordDataId: startInfo.id,examStudentId:stateParams.examStudentId,examMins:startInfo.paperMins,examId:examInfo.id,faceVerifyMinute:startInfo.faceVerifyMinute})" -->
  10. <Button class="qm-primary-button" :disabled="remainTime > 110" @click="goToPaper" style="display: inline-block; width: 100%;">
  11. {{ remainTime > 110 ? '强制阅读' : '开始答题'}}(倒计时:{{remainTimeFormatted}})</Button>
  12. </div>
  13. <div class="exam-detail">
  14. <h3 class="">科目:{{startInfo.courseName}}</h3>
  15. <br>
  16. <h4 class="">试卷概览(总分:{{paperTotalScore}})</h4>
  17. <br>
  18. <ul class="list-group">
  19. <li class="list-group-item" v-for="(questionsGroup, index) in paperStruct.defaultPaper.questionGroupList" :key="questionsGroup.gruopName">
  20. {{index+1}}、{{questionsGroup.groupName}}
  21. <small class="pull-right">
  22. (共{{questionsGroup.questionWrapperList.length}}题,</span>共{{questionsGroup.groupScore}}分)
  23. </small>
  24. </li>
  25. </ul>
  26. <div>
  27. <img style="width:100%; padding-top: 40px;" src="./good-wish.png" />
  28. </div>
  29. </div>
  30. </div>
  31. <div v-else>
  32. 正在等待数据返回...
  33. </div>
  34. </template>
  35. <script>
  36. import moment from "moment";
  37. export default {
  38. data() {
  39. return {
  40. beforeExamRemark: null,
  41. startInfo: null,
  42. paperStruct: null,
  43. remainTime: 120
  44. };
  45. },
  46. async mounted() {
  47. this.intervalId = setInterval(() => {
  48. this.remainTime = this.remainTime - 1; // 为了界面更新,不能写 this.remainTime--
  49. if (this.remainTime === 0) {
  50. this.goToPaper();
  51. }
  52. }, 1000);
  53. const exam = await this.$http.get(
  54. "/api/ecs_exam_work/exam/examOrgProperty/" +
  55. this.$route.params.examId +
  56. `/BEFORE_EXAM_REMARK`
  57. );
  58. this.beforeExamRemark = exam.data || "";
  59. try {
  60. // await this.$http.get("/api/ecs_oe_student/examControl/endExam");
  61. const res = await this.$http.get(
  62. "/api/ecs_oe_student/examControl/startExam?examStudentId=" +
  63. this.$route.query.examStudentId
  64. );
  65. // var res = {
  66. // data: {
  67. // examRecordDataId: 7,
  68. // courseCode: "W00001",
  69. // courseName: "英语",
  70. // studentCode: "20180613",
  71. // studentName: "王章军",
  72. // duration: 120,
  73. // faceLivenessMinute: null
  74. // }
  75. // };
  76. this.startInfo = res.data;
  77. this.examRecordDataId = res.data.examRecordDataId;
  78. // this.startInfo = {
  79. // id: 101436,
  80. // courseName: "计算机应用基础",
  81. // studentCode: "20180613",
  82. // studentName: "王章军",
  83. // specialtyLevel: "ALL",
  84. // paperMins: 60,
  85. // invigilatorOperation: 0,
  86. // retakeTypeId: null,
  87. // retakeDetail: null,
  88. // faceVerifyMinute: null
  89. // };
  90. // this.examRcordId = this.startInfo.id;
  91. } catch (error) {
  92. console.log(error);
  93. this.$Message.error(error.message);
  94. }
  95. const paperStruct = await this.$http.get(
  96. "/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=" +
  97. this.examRecordDataId
  98. );
  99. this.paperStruct = paperStruct.data;
  100. // this.paperStruct = [
  101. // {
  102. // index: 1,
  103. // questionType: null,
  104. // title: "选择题",
  105. // totalScore: 45,
  106. // count: 36,
  107. // questionCount: 36,
  108. // score: null,
  109. // succQuestionNum: 0,
  110. // failQuestionNum: 0,
  111. // notAnsweredCount: 0
  112. // },
  113. // {
  114. // index: 2,
  115. // questionType: null,
  116. // title: "判断题",
  117. // totalScore: 20,
  118. // count: 20,
  119. // questionCount: 20,
  120. // score: null,
  121. // succQuestionNum: 0,
  122. // failQuestionNum: 0,
  123. // notAnsweredCount: 0
  124. // },
  125. // {
  126. // index: 3,
  127. // questionType: null,
  128. // title: "多项选择题",
  129. // totalScore: 10,
  130. // count: 5,
  131. // questionCount: 5,
  132. // score: null,
  133. // succQuestionNum: 0,
  134. // failQuestionNum: 0,
  135. // notAnsweredCount: 0
  136. // },
  137. // {
  138. // index: 4,
  139. // questionType: null,
  140. // title: "简答题",
  141. // totalScore: 25,
  142. // count: 3,
  143. // questionCount: 3,
  144. // score: null,
  145. // succQuestionNum: 0,
  146. // failQuestionNum: 0,
  147. // notAnsweredCount: 0
  148. // }
  149. // ];
  150. this.paperTotalScore = this.paperStruct.defaultPaper.questionGroupList
  151. .map(q => q.groupScore)
  152. .reduce((p, c) => p + c);
  153. },
  154. beforeDestroy() {
  155. clearInterval(this.intervalId);
  156. },
  157. computed: {
  158. remainTimeFormatted: function() {
  159. return moment.utc(this.remainTime * 1000).format("HH:mm:ss");
  160. }
  161. },
  162. methods: {
  163. goToPaper: function() {
  164. this.$router.push(
  165. `/online-exam/exam/${this.$route.params.examId}/?examRecordDataId=${
  166. this.examRecordDataId
  167. }&examStudentId=${this.$route.query.examStudentId}`
  168. );
  169. window.clearInterval(this.intervalId);
  170. }
  171. }
  172. };
  173. </script>
  174. <style scoped>
  175. .container {
  176. display: grid;
  177. grid-template-columns: 1fr 300px;
  178. width: 100wh;
  179. height: 100vh;
  180. }
  181. .instructions {
  182. display: grid;
  183. grid-template-rows: 40px minmax(200px, auto) 1fr;
  184. padding: 40px 20px;
  185. }
  186. .exam-detail {
  187. padding: 40px 20px;
  188. background-color: #f5f5f5;
  189. text-align: left;
  190. }
  191. .list-group {
  192. list-style: none;
  193. }
  194. .list-group li {
  195. border-bottom: 1px solid #eeeeee;
  196. padding-top: 10px;
  197. }
  198. .pull-right {
  199. text-align: right;
  200. float: right;
  201. }
  202. </style>