mockExamInfo.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!-- 模拟考试详情 -->
  2. <template>
  3. <view class="mock-exam-info">
  4. <scroll-view scroll-y class="scroll-content">
  5. <view class="card">
  6. <view class="exam-name">{{ examData.examName }}</view>
  7. <view class="chip-row mb12">
  8. <text class="tag tag-blue text-xs">{{ examData.examTypeName }}</text>
  9. <text class="tag tag-orange text-xs">模拟卷</text>
  10. </view>
  11. <view class="info-grid mb14">
  12. <view class="info-item">
  13. <view class="text-xs text-gray mb4">题目总数</view>
  14. <view class="text-blue fw500">{{ examData.totalQuestionNum || 0 }} 题</view>
  15. </view>
  16. <view class="info-item">
  17. <view class="text-xs text-gray mb4">考试时长</view>
  18. <view class="fw500">{{ examData.answerDuration }} 分钟</view>
  19. </view>
  20. <view class="info-item">
  21. <view class="text-xs text-gray mb4">满分</view>
  22. <view class="fw500">{{ examData.totalScore }} 分</view>
  23. </view>
  24. <view class="info-item">
  25. <view class="text-xs text-gray mb4">及格分数</view>
  26. <view class="text-orange fw500">{{ examData.passScore }} 分</view>
  27. </view>
  28. </view>
  29. <view class="score-summary" v-for="(item,index) in examData.mockHistoryScores" :key="index">
  30. <view class="text-sm fw500 mb8">历次模拟成绩</view>
  31. <view class="row-between mb4">
  32. <text class="text-sm text-gray">第 {{ index+1 }} 次 {{ item.submitTime}}</text>
  33. <text class="text-sm fw500" :class="item.isPassed ? 'text-green' : 'text-red'">
  34. 最高 {{ item.score || 0 }} 分({{ item.isPassed ? '已通过' : '未通过' }})
  35. </text>
  36. </view>
  37. <view v-if="!item.isPassed" class="text-xs text-gray">
  38. 还需提高 {{ item.passScoreGap }} 分达到及格线
  39. </view>
  40. </view>
  41. <view class="notice">模拟考试需达到及格分数({{ examData.passScore }}分)方可参加正式在线考试。</view>
  42. </view>
  43. </scroll-view>
  44. <view class="bottom-bar" v-if="examData.needStudy||examData.examStudy||examData.mockExam">
  45. <view class="btn-primary" @click="startMockExam">
  46. {{examData.needStudy||examData.examStudy?'开始学习':(examData.mockExam?'开始模拟考试':'')}}
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. goToExamPage,
  54. } from '@/pages_safetyEducationExamination/utils/index.js'
  55. import {
  56. parseTime
  57. } from '@/component/public.js'
  58. export default {
  59. data() {
  60. return {
  61. examData: {}
  62. }
  63. },
  64. computed: {
  65. scoreGap() {
  66. return Math.max(0, (this.examData.passScore || 0) - (this.examData.maxScore || 0));
  67. }
  68. },
  69. onLoad(options) {
  70. if (options.examData) {
  71. try {
  72. this.examData = JSON.parse(decodeURIComponent(options.examData));
  73. this.formatExamData();
  74. } catch (e) {
  75. console.error('解析模拟考试数据失败', e);
  76. }
  77. }
  78. },
  79. methods: {
  80. formatExamData() {
  81. if (this.examData.startTime) {
  82. this.examData.startTime = parseTime(this.examData.startTime, '{y}-{m}-{d} {h}:{i}');
  83. }
  84. if (this.examData.endTime) {
  85. this.examData.endTime = parseTime(this.examData.endTime, '{y}-{m}-{d} {h}:{i}');
  86. }
  87. },
  88. startMockExam() {
  89. goToExamPage(this.examData);
  90. // uni.navigateTo({
  91. // url: `/pages_safetyEducationExamination/views/exam/mockExamPlay?examId=${this.examData.examId}&mockExamId=${this.examData.mockExamId || ''}&attemptId=${this.examData.attemptId || ''}`
  92. // });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="stylus" scoped>
  98. .mock-exam-info
  99. height 100%
  100. display flex
  101. flex-direction column
  102. background #f0f4fb
  103. .scroll-content
  104. flex 1
  105. overflow hidden
  106. padding-bottom 160rpx
  107. .card
  108. margin 24rpx
  109. padding 28rpx
  110. background #fff
  111. border 1rpx solid #dde3ed
  112. border-radius 20rpx
  113. .exam-name
  114. font-size 34rpx
  115. font-weight 700
  116. margin-bottom 16rpx
  117. .chip-row
  118. display flex
  119. gap 12rpx
  120. .tag
  121. padding 6rpx 16rpx
  122. border-radius 20rpx
  123. .tag-blue
  124. background #e6f4ff
  125. color #1677ff
  126. border 1rpx solid #91caff
  127. .tag-orange
  128. background #fff7e6
  129. color #d46b08
  130. border 1rpx solid #ffd591
  131. .info-grid
  132. display grid
  133. grid-template-columns 1fr 1fr
  134. gap 16rpx
  135. .info-item
  136. padding 20rpx
  137. border 1rpx solid #dde3ed
  138. border-radius 16rpx
  139. .score-summary
  140. padding 24rpx
  141. margin-bottom 28rpx
  142. background #f4f6fa
  143. border-radius 16rpx
  144. .notice
  145. padding 20rpx
  146. background #fff7e6
  147. border-radius 16rpx
  148. font-size 24rpx
  149. line-height 1.6
  150. color #d46b08
  151. .row-between
  152. display flex
  153. justify-content space-between
  154. align-items center
  155. .bottom-bar
  156. position fixed
  157. bottom 0
  158. left 0
  159. right 0
  160. padding 20rpx 24rpx
  161. padding-bottom calc(20rpx + env(safe-area-inset-bottom))
  162. background #fff
  163. border-top 1rpx solid #eee
  164. .btn-primary
  165. height 88rpx
  166. line-height 88rpx
  167. text-align center
  168. background #1857d4
  169. border-radius 16rpx
  170. color #fff
  171. font-size 32rpx
  172. font-weight 600
  173. .text-xs
  174. font-size 22rpx
  175. .text-sm
  176. font-size 24rpx
  177. .text-gray
  178. color #999
  179. .text-blue
  180. color #1857d4
  181. .text-orange
  182. color #d46b08
  183. .text-green
  184. color #52c41a
  185. .text-red
  186. color #ff4d4f
  187. .fw500
  188. font-weight 500
  189. .mb4
  190. margin-bottom 8rpx
  191. .mb8
  192. margin-bottom 16rpx
  193. .mb12
  194. margin-bottom 24rpx
  195. .mb14
  196. margin-bottom 28rpx
  197. </style>