problem_sheet.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!-- +---------------------------------------------------------------------- -->
  2. <!-- | CRMEB [ CRMEB赋能开发者,助力企业发展 ] -->
  3. <!-- +---------------------------------------------------------------------- -->
  4. <!-- | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. -->
  5. <!-- +---------------------------------------------------------------------- -->
  6. <!-- | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 -->
  7. <!-- +---------------------------------------------------------------------- -->
  8. <!-- | Author: CRMEB Team <admin@crmeb.com> -->
  9. <!-- +---------------------------------------------------------------------- -->
  10. {extend name="public/container"}
  11. {block name="title"}答题卡{/block}
  12. {block name="head"}
  13. <style>
  14. body {
  15. background-color: #f5f5f5;
  16. }
  17. .answer-sheet-page .main-hd li:nth-child(1)::before {
  18. border-color: #ebf9eb;
  19. background-color: #ebf9eb;
  20. }
  21. .answer-sheet-page .main-hd li:nth-child(2)::before {
  22. border-color: #fff0e5;
  23. background-color: #fff0e5;
  24. }
  25. </style>
  26. {/block}
  27. {block name="content"}
  28. <div v-cloak id="app">
  29. <div class="answer-sheet-page">
  30. <div class="header">
  31. <a :href="'{:url('topic/problem_detail')}?test_id=' + test_id + '&e_id=' + e_id + '&index=' + index">返回答题</a>
  32. </div>
  33. <div class="main">
  34. <div class="main-hd">
  35. <div>答题情况</div>
  36. <ul>
  37. <li>正确</li>
  38. <li>错误</li>
  39. <li>未答</li>
  40. </ul>
  41. </div>
  42. <div v-if="questions.length" class="main-bd">
  43. <a
  44. v-for="(item, index) in questions"
  45. :class="{
  46. green: item.is_correct === 2,
  47. red: item.is_correct === 1
  48. }"
  49. :href="'{:url('topic/problem_detail')}?test_id=' + test_id + '&e_id=' + e_id + '&index=' + index + '&is_analysis=' + 1"
  50. >{{ index + 1 }}</a>
  51. </div>
  52. </div>
  53. <div v-if="!isSubmits" class="footer">
  54. <a href="javascript:" @click="onAgain(1)">重新答题</a>
  55. <a href="javascript:" @click="onAgain(2)">提交练习</a>
  56. </div>
  57. </div>
  58. <quick-menu></quick-menu>
  59. </div>
  60. <script>
  61. require(['vue', 'helper', 'store', 'quick'], function (Vue, $h, $http) {
  62. var vm = new Vue({
  63. el: '#app',
  64. data: {
  65. test_id: 0,
  66. e_id: 0,
  67. index: 0,
  68. questions: [],
  69. from: '',
  70. isSubmits: 1
  71. },
  72. created: function () {
  73. this.test_id = $h.getParmas('test_id');
  74. this.e_id = $h.getParmas('record_id');
  75. if ($h.getParmas('index')) {
  76. this.index = $h.getParmas('index');
  77. }
  78. if ($h.getParmas('from')) {
  79. this.from = $h.getParmas('from');
  80. }
  81. this.getSheet();
  82. this.isSubmit();
  83. },
  84. methods: {
  85. getSheet: function () {
  86. $h.loadFFF();
  87. $http.baseGet($h.U({
  88. c: 'topic',
  89. a: 'answerSheet',
  90. q: {
  91. test_id: this.test_id,
  92. type: 1,
  93. record_id: this.e_id
  94. }
  95. }), function (res) {
  96. $h.loadClear();
  97. var questions = res.data.data;
  98. for (var i = questions.length; i--;) {
  99. if (!Array.isArray(questions[i].userAnswer)) {
  100. Object.assign(questions[i], questions[i].userAnswer);
  101. }
  102. }
  103. vm.questions = questions;
  104. }, function () {
  105. window.location.replace($h.U({
  106. c: 'topic',
  107. a: 'question_user'
  108. }));
  109. });
  110. },
  111. onAgain: function (n) {
  112. var that=this;
  113. $h.loadFFF();
  114. $http.basePost($h.U({
  115. c: 'topic',
  116. a: 'submitTestPaper'
  117. }), {
  118. examination_id: that.e_id
  119. }, function (res) {
  120. $h.loadClear();
  121. $h.delCookie('e_id');
  122. if(n==1){
  123. location.href = "{:url('topic/problem_index')}?id=" + that.test_id;
  124. }else{
  125. location.href = "{:url('topic/problem_result')}?test_id=" + that.test_id;
  126. }
  127. });
  128. },
  129. isSubmit: function (n) {
  130. var that=this;
  131. $h.loadFFF();
  132. $http.basePost($h.U({
  133. c: 'topic',
  134. a: 'is_submit'
  135. }), {
  136. examination_id: that.e_id
  137. }, function (res) {
  138. $h.loadClear();
  139. $h.delCookie('e_id');
  140. that.isSubmits = res.data.data;
  141. }, undefined, true);
  142. },
  143. }
  144. });
  145. });
  146. </script>
  147. {/block}