ExamingEnd.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="container" id="exam-end" v-if="afterExamRemark !== null">
  3. <div class="instructions">
  4. <h1 class="">考试已结束</h1>
  5. <div><img class="user-avatar" :src="user.photoPath" alt="无底照" /></div>
  6. <div class="qm-big-text score-text" v-if="!examResult">
  7. 考试结果计算中...
  8. </div>
  9. <div
  10. class="qm-big-text score-text"
  11. v-if="!examResult && getResultTimes > 10"
  12. >
  13. 后台繁忙,请稍后在待考列表中查看客观题得分。
  14. </div>
  15. <div
  16. class="qm-big-text score-text"
  17. v-if="showObjectScore && !examResult.isWarn"
  18. >
  19. 客观题得分:
  20. <span style="color: red">{{ examResult.objectiveScore }}</span>
  21. </div>
  22. <div
  23. class="qm-big-text score-text"
  24. v-if="
  25. exam &&
  26. exam.examType !== 'ONLINE' &&
  27. showObjectScore &&
  28. !examResult.isWarn
  29. "
  30. >
  31. 客观题正确率:
  32. <span style="color: red">{{ examResult.objectiveAccuracy }}%</span>
  33. </div>
  34. <div class="qm-big-text score-text" v-if="examResult.isWarn">
  35. 客观题得分: 成绩待审核
  36. </div>
  37. <h1 v-if="examResult.isWarn" style="text-align: left;">违纪提示:</h1>
  38. <div
  39. v-if="examResult.isWarn"
  40. class=""
  41. style="text-align: left; padding-bottom: 20px"
  42. >
  43. <p v-html="cheatingRemark"></p>
  44. </div>
  45. <h1 style="text-align: left;">考后说明:</h1>
  46. <div style="text-align: left; padding-bottom: 20px">
  47. <p v-html="afterExamRemark"></p>
  48. </div>
  49. <router-link
  50. class="qm-primary-button"
  51. to="/online-exam"
  52. style="display: inline-block; width: 100%;"
  53. >
  54. 返回主页</router-link
  55. >
  56. </div>
  57. </div>
  58. <div v-else>正在等待数据返回...</div>
  59. </template>
  60. <script>
  61. import { mapState as globalMapState } from "vuex";
  62. import { createNamespacedHelpers } from "vuex";
  63. const { mapMutations } = createNamespacedHelpers("examingHomeModule");
  64. export default {
  65. name: "ExamingEnd",
  66. data() {
  67. return {
  68. exam: null,
  69. afterExamRemark: null,
  70. showObjectScore: null,
  71. cheatingRemark: null,
  72. examResult: null,
  73. getResultTimes: 0
  74. };
  75. },
  76. async mounted() {
  77. window._hmt.push(["_trackEvent", "考试结束页面", "进入页面"]);
  78. const examRecordDataId = this.$route.params.examRecordDataId;
  79. const examId = this.$route.params.examId;
  80. this.waitingNumber = 0;
  81. const f = async () => {
  82. if (this.$route.name !== "ExamingEnd") {
  83. // 非成绩页,不在查询成绩
  84. return;
  85. }
  86. try {
  87. this.getResultTimes = this.getResultTimes + 1;
  88. const examResult = (await this.$http.get(
  89. "/api/ecs_oe_student/examControl/getEndExamInfo?examRecordDataId=" +
  90. examRecordDataId
  91. )).data;
  92. if (examResult === undefined || examResult === null) {
  93. this.waitingNumber++;
  94. setTimeout(() => f(), 3000);
  95. return;
  96. }
  97. window._hmt.push([
  98. "_trackEvent",
  99. "考试结束页面",
  100. "等待分数",
  101. "等待次数=" + this.waitingNumber
  102. ]);
  103. this.examResult = examResult;
  104. } catch (error) {
  105. this.waitingNumber++;
  106. setTimeout(() => f(), 3000);
  107. }
  108. };
  109. await f();
  110. try {
  111. // if (!this.exam) {
  112. this.exam = (await this.$http.get(
  113. "/api/ecs_exam_work/exam/" + examId
  114. )).data;
  115. // }
  116. if (this.exam.examType === "PRACTICE") {
  117. this.$router.replace(
  118. `/online-practice/exam/${examId}/detail?examRecordDataId=${examRecordDataId}&disableGoBack=true`
  119. );
  120. return;
  121. }
  122. const afterExamRemark = await this.$http.get(
  123. "/api/ecs_exam_work/exam/examOrgProperty/" +
  124. examId +
  125. `/AFTER_EXAM_REMARK`
  126. );
  127. this.afterExamRemark = afterExamRemark.data || "";
  128. const showObjectScore = await this.$http.get(
  129. "/api/ecs_exam_work/exam/examOrgProperty/" +
  130. examId +
  131. `/IS_OBJ_SCORE_VIEW`
  132. );
  133. this.showObjectScore = showObjectScore.data || false;
  134. if (this.examResult.isWarn) {
  135. const cheatingRemark = await this.$http.get(
  136. "/api/ecs_exam_work/exam/examOrgProperty/" +
  137. examId +
  138. `/CHEATING_REMARK`
  139. );
  140. this.cheatingRemark = cheatingRemark.data || "";
  141. }
  142. } catch (error) {
  143. this.$Message.error({
  144. content: "获取考试设置错误,请在待考列表查看成绩!",
  145. duration: 15,
  146. closable: true
  147. });
  148. this.$router.push("/");
  149. }
  150. document.body.style = "";
  151. },
  152. beforeDestroy() {
  153. this.updateExamState({
  154. exam: null,
  155. paperStruct: null,
  156. examQuestionList: null,
  157. questionAudioFileUrl: []
  158. });
  159. },
  160. computed: {
  161. ...globalMapState(["user"])
  162. // ...mapState(["exam"])
  163. },
  164. methods: {
  165. ...mapMutations(["updateExamState"])
  166. }
  167. };
  168. </script>
  169. <style scoped>
  170. .container {
  171. margin: 0 auto;
  172. width: 80vw;
  173. overflow: auto;
  174. }
  175. .instructions {
  176. /* display: grid; */
  177. /* grid-template-rows: 40px 300px min(100px) 30px minmax(200px, auto) min(100px) min(
  178. 100px
  179. ) min(100px); */
  180. padding: 40px 20px;
  181. }
  182. .instructions > h1,
  183. .instructions > div {
  184. padding-bottom: 30px;
  185. }
  186. .user-avatar {
  187. display: inline-block;
  188. width: 140px;
  189. height: 140px;
  190. object-fit: contain;
  191. }
  192. .score-text {
  193. font-size: 40px;
  194. }
  195. /* .exam-detail {
  196. padding: 40px 20px;
  197. background-color: #f5f5f5;
  198. text-align: left;
  199. } */
  200. </style>
  201. <style>
  202. #exam-end img {
  203. max-width: 100%;
  204. height: auto !important;
  205. }
  206. </style>