ExamingEnd.vue 6.4 KB

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