| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <!-- 模拟考试详情 -->
- <template>
- <view class="mock-exam-info">
- <scroll-view scroll-y class="scroll-content">
- <view class="card">
- <view class="exam-name">{{ examData.examName }}</view>
- <view class="chip-row mb12">
- <text class="tag tag-blue text-xs">{{ examData.examTypeName }}</text>
- <text class="tag tag-orange text-xs">模拟卷</text>
- </view>
- <view class="info-grid mb14">
- <view class="info-item">
- <view class="text-xs text-gray mb4">题目总数</view>
- <view class="text-blue fw500">{{ examData.totalQuestionNum || 0 }} 题</view>
- </view>
- <view class="info-item">
- <view class="text-xs text-gray mb4">考试时长</view>
- <view class="fw500">{{ examData.answerDuration }} 分钟</view>
- </view>
- <view class="info-item">
- <view class="text-xs text-gray mb4">满分</view>
- <view class="fw500">{{ examData.totalScore }} 分</view>
- </view>
- <view class="info-item">
- <view class="text-xs text-gray mb4">及格分数</view>
- <view class="text-orange fw500">{{ examData.passScore }} 分</view>
- </view>
- </view>
- <view class="score-summary" v-for="(item,index) in examData.mockHistoryScores" :key="index">
- <view class="text-sm fw500 mb8">历次模拟成绩</view>
- <view class="row-between mb4">
- <text class="text-sm text-gray">第 {{ index+1 }} 次 {{ item.submitTime}}</text>
- <text class="text-sm fw500" :class="item.isPassed ? 'text-green' : 'text-red'">
- 最高 {{ item.score || 0 }} 分({{ item.isPassed ? '已通过' : '未通过' }})
- </text>
- </view>
- <view v-if="!item.isPassed" class="text-xs text-gray">
- 还需提高 {{ item.passScoreGap }} 分达到及格线
- </view>
- </view>
- <view class="notice">模拟考试需达到及格分数({{ examData.passScore }}分)方可参加正式在线考试。</view>
- </view>
- </scroll-view>
- <view class="bottom-bar" v-if="examData.needStudy||examData.examStudy||examData.mockExam">
- <view class="btn-primary" @click="startMockExam">
- {{examData.needStudy||examData.examStudy?'开始学习':(examData.mockExam?'开始模拟考试':'')}}
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- goToExamPage,
- } from '@/pages_safetyEducationExamination/utils/index.js'
- import {
- examUserExamStart,
- examUserExamMockDetail,
- } from '@/pages_safetyEducationExamination/api/index.js'
- import {
- parseTime
- } from '@/component/public.js'
- export default {
- data() {
- return {
- examData: {},
- newData: {}
- }
- },
- computed: {
- scoreGap() {
- return Math.max(0, (this.examData.passScore || 0) - (this.examData.maxScore || 0));
- }
- },
- onLoad(options) {
- if (options.examData) {
- try {
- this.newData = JSON.parse(decodeURIComponent(options.examData));
- } catch (e) {
- console.error('解析模拟考试数据失败', e);
- }
- }
- },
- onShow(){
- this.examUserExamMockDetail();
- },
- methods: {
- async examUserExamMockDetail() {
- try {
- const { data } = await examUserExamMockDetail({examId:this.newData.examId});
- if (data.code === 200 && data.data) {
- this.$set(this,'examData',data.data);
- this.formatExamData();
- }
- } catch (e) {
- console.error('获取考试详情失败', e);
- }
- },
- formatExamData() {
- if (this.examData.startTime) {
- this.examData.startTime = parseTime(this.examData.startTime, '{y}-{m}-{d} {h}:{i}');
- }
- if (this.examData.endTime) {
- this.examData.endTime = parseTime(this.examData.endTime, '{y}-{m}-{d} {h}:{i}');
- }
- },
- async startMockExam() {
- if (this.examData.needStudy || this.examData.examStudy) {
- goToExamPage(this.examData);
- return;
- }
- try {
- uni.showLoading({ title: '加载中...', mask: true });
- const { data } = await examUserExamStart({ examId: this.examData.examId, examScene: 2 });
- uni.hideLoading();
- if (data.code === 200 && data.data && data.data.attemptId) {
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/exam/mockExamPlay?examId=${this.examData.examId}&attemptId=${data.data.attemptId}`
- });
- } else {
- uni.showToast({ title: data.message || '获取模拟试卷失败', icon: 'none' });
- }
- } catch (e) {
- uni.hideLoading();
- uni.showToast({ title: '获取模拟试卷失败', icon: 'none' });
- }
- }
- }
- }
- </script>
- <style lang="stylus" scoped>
- .mock-exam-info
- height 100%
- display flex
- flex-direction column
- background #f0f4fb
- .scroll-content
- flex 1
- overflow hidden
- padding-bottom 220rpx
- .card
- margin 24rpx
- padding 28rpx
- background #fff
- border 1rpx solid #dde3ed
- border-radius 20rpx
- .exam-name
- font-size 34rpx
- font-weight 700
- margin-bottom 16rpx
- .chip-row
- display flex
- gap 12rpx
- .tag
- padding 6rpx 16rpx
- border-radius 20rpx
- .tag-blue
- background #e6f4ff
- color #1677ff
- border 1rpx solid #91caff
- .tag-orange
- background #fff7e6
- color #d46b08
- border 1rpx solid #ffd591
- .info-grid
- display grid
- grid-template-columns 1fr 1fr
- gap 16rpx
- .info-item
- padding 20rpx
- border 1rpx solid #dde3ed
- border-radius 16rpx
- .score-summary
- padding 24rpx
- margin-bottom 28rpx
- background #f4f6fa
- border-radius 16rpx
- .notice
- padding 20rpx
- background #fff7e6
- border-radius 16rpx
- font-size 24rpx
- line-height 1.6
- color #d46b08
- .row-between
- display flex
- justify-content space-between
- align-items center
- .bottom-bar
- position fixed
- bottom 0
- left 0
- right 0
- padding 20rpx 24rpx
- padding-bottom calc(20rpx + env(safe-area-inset-bottom))
- background #fff
- border-top 1rpx solid #eee
- .btn-primary
- height 88rpx
- line-height 88rpx
- text-align center
- background #1857d4
- border-radius 16rpx
- color #fff
- font-size 32rpx
- font-weight 600
- .text-xs
- font-size 22rpx
- .text-sm
- font-size 24rpx
- .text-gray
- color #999
- .text-blue
- color #1857d4
- .text-orange
- color #d46b08
- .text-green
- color #52c41a
- .text-red
- color #ff4d4f
- .fw500
- font-weight 500
- .mb4
- margin-bottom 8rpx
- .mb8
- margin-bottom 16rpx
- .mb12
- margin-bottom 24rpx
- .mb14
- margin-bottom 28rpx
- </style>
|