| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <!-- 考试详情 -->
- <template>
- <view class="exam-detail-page">
- <scroll-view scroll-y class="scroll-content">
- <view class="card">
- <view class="chip-row mb8">
- <text class="tag tag-orange text-xs">{{ examData.examTypeName }}</text>
- <text class="tag tag-orange text-xs">{{ examData.examStatus == 2?'进行中':(examData.examStatus==1?'未开始':'') }}</text>
- </view>
- <view class="exam-title">{{ examData.examName }}</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="text-333 fw500">{{ examData.answerDuration }} 分钟</view>
- </view>
- <view class="info-item">
- <view class="text-xs text-gray mb4">总分/及格</view>
- <view class="text-333 fw500">{{ examData.totalScore }} / {{ examData.passScore }} 分</view>
- </view>
- <view class="info-item">
- <view class="text-xs text-gray mb4">考试次数</view>
- <view class="text-333 fw500">{{ examData.attemptLimit === 0 ? '不限' : examData.attemptLimit+' 次' }}</view>
- </view>
- </view>
- <!-- 考前任务要求 -->
- <view class="exam-type-max-box" v-if="examData.needStudy||examData.examStudy||examData.mockExam">
- <view class="exam-title-p">考前任务状态</view>
- <view class="exam-type-box">
- <view class="exam-min-box" v-if="examData.needStudy">
- <view>学时要求</view>
- <view>{{ examData.completedStudyHours }}/{{ examData.studyHoursRequirement }}</view>
- </view>
- <view class="exam-min-box" v-if="examData.examStudy">
- <view>学习任务</view>
- <view>待完成</view>
- </view>
- <view class="exam-min-box" v-if="examData.mockExam">
- <view>模拟考试</view>
- <view>待完成</view>
- </view>
- </view>
- </view>
- <!-- 考试说明 -->
- <view v-if="examData.unavailableDesc" class="exam-desc-box" style="background-color:#f4f6fa;">
- <view class="exam-desc">{{ examData.unavailableDesc }}</view>
- </view>
- </view>
- </scroll-view>
- <!-- 底部按钮 -->
- <view class="bottom-bar">
- <view class="btn-primary" @click="startExam">
- {{examData.needStudy||examData.examStudy?'开始学习':(examData.mockExam?'开始模拟考试':'开始考试')}}
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- parseTime
- } from '@/component/public.js'
- export default {
- data() {
- return {
- examData: {},
- }
- },
- computed: {
- showConditions() {
- return this.examData.needStudy || this.examData.examStudy || this.examData.mockExam;
- }
- },
- onLoad(options) {
- // 接收从上个页面传递的考试数据
- if (options.examData) {
- try {
- this.examData = JSON.parse(decodeURIComponent(options.examData));
- this.formatExamData();
- } catch (e) {
- console.error('解析考试数据失败', e);
- }
- }
- },
- methods: {
- 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}');
- }
- },
- goToStudyHour() {
- // 跳转到学时任务页面
- if (this.examData.knowledgePointIds && this.examData.knowledgePointIds.length > 0) {
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/studyHourTask/index?knowledgePointId=${this.examData.knowledgePointIds.join(',')}`
- });
- } else {
- uni.navigateTo({
- url: '/pages_safetyEducationExamination/views/study/index'
- });
- }
- },
- goToCourse() {
- // 跳转到课程学习页面
- uni.showToast({
- title: '跳转到课程学习',
- icon: 'none'
- });
- },
- goToMockExam() {
- // 跳转到模拟考试页面
- uni.showToast({
- title: '跳转到模拟考试',
- icon: 'none'
- });
- },
- startExam() {
-
- },
- },
- }
- </script>
- <style lang="stylus" scoped>
- .exam-detail-page {
- height: 100%;
- display: flex;
- flex-direction: column;
- background-color: #f0f4fb;
- }
- .scroll-content {
- flex: 1;
- overflow: hidden;
- padding-bottom: 160rpx;
- }
- .card {
- background: #fff;
- border-radius: 20rpx;
- padding: 28rpx;
- margin: 24rpx 24rpx 0;
- border: 1px solid #dde3ed;
- }
- .chip-row {
- display: flex;
- gap: 12rpx;
- }
- .tag {
- display: inline-block;
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- font-size: 20rpx;
- }
- .tag-orange {
- background: #fff7e6;
- color: #d46b08;
- }
- .text-xs {
- font-size: 22rpx;
- }
- .mb8 {
- margin-bottom: 16rpx;
- }
- .mb4 {
- margin-bottom: 8rpx;
- }
- .mb12 {
- margin-bottom: 24rpx;
- }
- .mb14 {
- margin-bottom: 28rpx;
- }
- .exam-title {
- font-size: 34rpx;
- font-weight: 700;
- margin-bottom: 24rpx;
- }
- .info-grid {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 16rpx;
- }
- .info-item {
- border: 1px solid #dde3ed;
- border-radius: 16rpx;
- padding: 20rpx;
- }
- .text-gray {
- color: #999;
- }
- .text-333 {
- color: #333;
- }
-
- .text-blue {
- color: #1857d4;
- }
- .text-green {
- color: #52c41a;
- }
- .text-red {
- color: #ff4d4f;
- }
- .fw500 {
- font-weight: 500;
- }
- .time-row {
- font-size: 24rpx;
- }
- .card-title {
- font-size: 28rpx;
- font-weight: 600;
- }
- .condition-row {
- display: flex;
- align-items: center;
- padding: 16rpx 0;
- border-bottom: 1rpx solid #f0f0f0;
- &:last-child {
- border-bottom: none;
- }
- }
- .condition-icon {
- font-size: 32rpx;
- margin-right: 16rpx;
- }
- .condition-text {
- flex: 1;
- font-size: 26rpx;
- }
- .exam-desc-box{
- padding:28rpx;
- border-radius:10rpx;
- }
- .exam-desc {
- font-size: 26rpx;
- line-height: 1.8;
- color: #666;
- }
- .exam-type-max-box{
- margin-bottom:30rpx;
- .exam-title-p{
- font-size:24rpx;
- line-height:70rpx;
- }
- .exam-type-box{
- border:1px solid #dde3ed;
- border-radius:20rpx;
- .exam-min-box:nth-child(1){
- border-top:none;
- }
- .exam-min-box{
- display:flex;
- border-top:1px solid #dde3ed;
- padding:30rpx 28rpx;
- view{
- height:30rpx;
- line-height:30rpx;
- font-size:24rpx;
- }
- view:nth-child(1){
- flex:1;
- }
- view:nth-child(2){
- color:#e67e22;
- }
- }
- }
- }
- .bottom-bar {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background: #fff;
- padding: 20rpx 24rpx;
- border-top: 1rpx solid #eee;
- padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
- }
- .btn-primary {
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- background: #1857d4;
- color: #fff;
- border-radius: 16rpx;
- font-size: 32rpx;
- font-weight: 600;
- }
- </style>
|