mockExamInfo.vue 4.9 KB

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