AnswerReport.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <div class="answer-report">
  3. <div class="title">测试报告</div>
  4. <div class="answer-info">
  5. <div>
  6. <span>耗时</span>
  7. <span>{{ secondFormatConversion(answer_record.answer_duration, 'chinese') }}</span>
  8. </div>
  9. <div>
  10. <span>正确</span>
  11. <span>{{ answer_record.right_count }}</span>
  12. </div>
  13. <div>
  14. <span>错误</span>
  15. <span>{{ answer_record.error_count }}</span>
  16. </div>
  17. </div>
  18. <div
  19. v-if="
  20. answer_record.answer_mode === 1 || (answer_record.answer_mode === 2 && answer_record.is_remarked === 'true')
  21. "
  22. class="answer-list"
  23. >
  24. <span
  25. v-for="({ question_id, is_objective, answer_status }, i) in question_list"
  26. :key="question_id"
  27. :class="['answer-list-item', { subjectivity: is_objective === 'false', error: answer_status === 2 }]"
  28. @click="selectQuestion(i)"
  29. >
  30. {{ i + 1 }}
  31. </span>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import { GetAnswerRecordReport } from '@/api/exercise';
  37. import { secondFormatConversion } from '@/utils/transform';
  38. export default {
  39. name: 'AnswerReport',
  40. props: {
  41. answerRecordId: {
  42. type: String,
  43. required: true,
  44. },
  45. },
  46. data() {
  47. return {
  48. secondFormatConversion,
  49. answer_record: {
  50. answer_duration: 0,
  51. right_count: 0,
  52. error_count: 0,
  53. },
  54. question_list: [],
  55. };
  56. },
  57. created() {
  58. this.getAnswerRecordReport();
  59. },
  60. methods: {
  61. selectQuestion(i) {
  62. this.$emit('selectQuestion', i);
  63. },
  64. // 获取答题报告
  65. getAnswerRecordReport() {
  66. GetAnswerRecordReport({ answer_record_id: this.answerRecordId })
  67. .then(({ answer_record, question_list }) => {
  68. this.answer_record = answer_record;
  69. this.question_list = question_list;
  70. })
  71. .catch(() => {});
  72. },
  73. },
  74. };
  75. </script>
  76. <style lang="scss" scoped>
  77. .answer-report {
  78. display: flex;
  79. flex-direction: column;
  80. row-gap: 24px;
  81. align-items: center;
  82. height: 100%;
  83. padding: 24px 40px;
  84. .title {
  85. font-size: 32px;
  86. font-weight: bold;
  87. color: $light-main-color;
  88. }
  89. .answer-info {
  90. display: flex;
  91. column-gap: 120px;
  92. justify-content: center;
  93. width: 770px;
  94. padding: 24px 40px;
  95. background-color: #f7f7f7;
  96. border-radius: 8px;
  97. > div {
  98. display: flex;
  99. flex-direction: column;
  100. row-gap: 8px;
  101. :first-child {
  102. color: #949494;
  103. }
  104. :last-child {
  105. font-size: 24px;
  106. font-weight: bold;
  107. color: #000;
  108. }
  109. }
  110. }
  111. .answer-list {
  112. display: flex;
  113. gap: 24px;
  114. width: 770px;
  115. &-item {
  116. width: 56px;
  117. height: 40px;
  118. padding: 8px;
  119. text-align: center;
  120. cursor: pointer;
  121. background-color: #f0f0f0;
  122. border-radius: 20px;
  123. &.error {
  124. color: #fff;
  125. background-color: #f2555a;
  126. }
  127. &.subjectivity {
  128. background-color: #fef2a4;
  129. }
  130. }
  131. }
  132. }
  133. </style>