onlineExamInfo.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <!-- 考试详情 -->
  2. <template>
  3. <view class="exam-detail-page">
  4. <scroll-view scroll-y class="scroll-content">
  5. <view class="card">
  6. <view class="chip-row mb8">
  7. <text class="tag tag-orange text-xs">{{ examData.examTypeName }}</text>
  8. <text class="tag tag-orange text-xs">{{ examData.examStatus == 2?'进行中':(examData.examStatus==1?'未开始':'') }}</text>
  9. </view>
  10. <view class="exam-title">{{ examData.examName }}</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="text-333 fw500">{{ examData.answerDuration }} 分钟</view>
  19. </view>
  20. <view class="info-item">
  21. <view class="text-xs text-gray mb4">总分/及格</view>
  22. <view class="text-333 fw500">{{ examData.totalScore }} / {{ examData.passScore }} 分</view>
  23. </view>
  24. <view class="info-item">
  25. <view class="text-xs text-gray mb4">考试次数</view>
  26. <view class="text-333 fw500">{{ examData.attemptLimit === 0 ? '不限' : examData.attemptLimit+' 次' }}</view>
  27. </view>
  28. </view>
  29. <!-- 考前任务要求 -->
  30. <view class="exam-type-max-box" v-if="examData.needStudy||examData.examStudy||examData.mockExam">
  31. <view class="exam-title-p">考前任务状态</view>
  32. <view class="exam-type-box">
  33. <view class="exam-min-box" v-if="examData.needStudy">
  34. <view>学时要求</view>
  35. <view>{{ examData.completedStudyHours }}/{{ examData.studyHoursRequirement }}</view>
  36. </view>
  37. <view class="exam-min-box" v-if="examData.examStudy">
  38. <view>学习任务</view>
  39. <view>待完成</view>
  40. </view>
  41. <view class="exam-min-box" v-if="examData.mockExam">
  42. <view>模拟考试</view>
  43. <view>待完成</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 考试说明 -->
  48. <view v-if="examData.unavailableDesc" class="exam-desc-box" style="background-color:#f4f6fa;">
  49. <view class="exam-desc">{{ examData.unavailableDesc }}</view>
  50. </view>
  51. </view>
  52. </scroll-view>
  53. <!-- 底部按钮 -->
  54. <view class="bottom-bar">
  55. <view class="btn-primary" @click="startExam">
  56. {{examData.needStudy||examData.examStudy?'开始学习':(examData.mockExam?'开始模拟考试':'开始考试')}}
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. parseTime
  64. } from '@/component/public.js'
  65. export default {
  66. data() {
  67. return {
  68. examData: {},
  69. }
  70. },
  71. computed: {
  72. showConditions() {
  73. return this.examData.needStudy || this.examData.examStudy || this.examData.mockExam;
  74. }
  75. },
  76. onLoad(options) {
  77. // 接收从上个页面传递的考试数据
  78. if (options.examData) {
  79. try {
  80. this.examData = JSON.parse(decodeURIComponent(options.examData));
  81. this.formatExamData();
  82. } catch (e) {
  83. console.error('解析考试数据失败', e);
  84. }
  85. }
  86. },
  87. methods: {
  88. formatExamData() {
  89. // 格式化时间
  90. if (this.examData.startTime) {
  91. this.examData.startTime = parseTime(this.examData.startTime, '{y}-{m}-{d} {h}:{i}');
  92. }
  93. if (this.examData.endTime) {
  94. this.examData.endTime = parseTime(this.examData.endTime, '{y}-{m}-{d} {h}:{i}');
  95. }
  96. },
  97. goToStudyHour() {
  98. // 跳转到学时任务页面
  99. if (this.examData.knowledgePointIds && this.examData.knowledgePointIds.length > 0) {
  100. uni.navigateTo({
  101. url: `/pages_safetyEducationExamination/views/studyHourTask/index?knowledgePointId=${this.examData.knowledgePointIds.join(',')}`
  102. });
  103. } else {
  104. uni.navigateTo({
  105. url: '/pages_safetyEducationExamination/views/study/index'
  106. });
  107. }
  108. },
  109. goToCourse() {
  110. // 跳转到课程学习页面
  111. uni.showToast({
  112. title: '跳转到课程学习',
  113. icon: 'none'
  114. });
  115. },
  116. goToMockExam() {
  117. // 跳转到模拟考试页面
  118. uni.showToast({
  119. title: '跳转到模拟考试',
  120. icon: 'none'
  121. });
  122. },
  123. startExam() {
  124. },
  125. },
  126. }
  127. </script>
  128. <style lang="stylus" scoped>
  129. .exam-detail-page {
  130. height: 100%;
  131. display: flex;
  132. flex-direction: column;
  133. background-color: #f0f4fb;
  134. }
  135. .scroll-content {
  136. flex: 1;
  137. overflow: hidden;
  138. padding-bottom: 160rpx;
  139. }
  140. .card {
  141. background: #fff;
  142. border-radius: 20rpx;
  143. padding: 28rpx;
  144. margin: 24rpx 24rpx 0;
  145. border: 1px solid #dde3ed;
  146. }
  147. .chip-row {
  148. display: flex;
  149. gap: 12rpx;
  150. }
  151. .tag {
  152. display: inline-block;
  153. padding: 6rpx 16rpx;
  154. border-radius: 20rpx;
  155. font-size: 20rpx;
  156. }
  157. .tag-orange {
  158. background: #fff7e6;
  159. color: #d46b08;
  160. }
  161. .text-xs {
  162. font-size: 22rpx;
  163. }
  164. .mb8 {
  165. margin-bottom: 16rpx;
  166. }
  167. .mb4 {
  168. margin-bottom: 8rpx;
  169. }
  170. .mb12 {
  171. margin-bottom: 24rpx;
  172. }
  173. .mb14 {
  174. margin-bottom: 28rpx;
  175. }
  176. .exam-title {
  177. font-size: 34rpx;
  178. font-weight: 700;
  179. margin-bottom: 24rpx;
  180. }
  181. .info-grid {
  182. display: grid;
  183. grid-template-columns: 1fr 1fr;
  184. gap: 16rpx;
  185. }
  186. .info-item {
  187. border: 1px solid #dde3ed;
  188. border-radius: 16rpx;
  189. padding: 20rpx;
  190. }
  191. .text-gray {
  192. color: #999;
  193. }
  194. .text-333 {
  195. color: #333;
  196. }
  197. .text-blue {
  198. color: #1857d4;
  199. }
  200. .text-green {
  201. color: #52c41a;
  202. }
  203. .text-red {
  204. color: #ff4d4f;
  205. }
  206. .fw500 {
  207. font-weight: 500;
  208. }
  209. .time-row {
  210. font-size: 24rpx;
  211. }
  212. .card-title {
  213. font-size: 28rpx;
  214. font-weight: 600;
  215. }
  216. .condition-row {
  217. display: flex;
  218. align-items: center;
  219. padding: 16rpx 0;
  220. border-bottom: 1rpx solid #f0f0f0;
  221. &:last-child {
  222. border-bottom: none;
  223. }
  224. }
  225. .condition-icon {
  226. font-size: 32rpx;
  227. margin-right: 16rpx;
  228. }
  229. .condition-text {
  230. flex: 1;
  231. font-size: 26rpx;
  232. }
  233. .exam-desc-box{
  234. padding:28rpx;
  235. border-radius:10rpx;
  236. }
  237. .exam-desc {
  238. font-size: 26rpx;
  239. line-height: 1.8;
  240. color: #666;
  241. }
  242. .exam-type-max-box{
  243. margin-bottom:30rpx;
  244. .exam-title-p{
  245. font-size:24rpx;
  246. line-height:70rpx;
  247. }
  248. .exam-type-box{
  249. border:1px solid #dde3ed;
  250. border-radius:20rpx;
  251. .exam-min-box:nth-child(1){
  252. border-top:none;
  253. }
  254. .exam-min-box{
  255. display:flex;
  256. border-top:1px solid #dde3ed;
  257. padding:30rpx 28rpx;
  258. view{
  259. height:30rpx;
  260. line-height:30rpx;
  261. font-size:24rpx;
  262. }
  263. view:nth-child(1){
  264. flex:1;
  265. }
  266. view:nth-child(2){
  267. color:#e67e22;
  268. }
  269. }
  270. }
  271. }
  272. .bottom-bar {
  273. position: fixed;
  274. bottom: 0;
  275. left: 0;
  276. right: 0;
  277. background: #fff;
  278. padding: 20rpx 24rpx;
  279. border-top: 1rpx solid #eee;
  280. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  281. }
  282. .btn-primary {
  283. height: 88rpx;
  284. line-height: 88rpx;
  285. text-align: center;
  286. background: #1857d4;
  287. color: #fff;
  288. border-radius: 16rpx;
  289. font-size: 32rpx;
  290. font-weight: 600;
  291. }
  292. </style>