206 lines
4.8 KiB
Vue
206 lines
4.8 KiB
Vue
<template>
|
||
<view class="view">
|
||
<div class="content">
|
||
<div class="title">{{ title }}</div>
|
||
<div class="subtitle">{{ subtitle }}</div>
|
||
<div class="info">
|
||
<div class="duration-wrapper">
|
||
<u-icon name="/static/images/time.png"></u-icon>
|
||
<div class="duration">{{ duration }}分钟</div>
|
||
<div class="explain">考试时长</div>
|
||
</div>
|
||
<div class="count-wrapper">
|
||
<u-icon name="/static/images/infinite.png" size="21"></u-icon>
|
||
<div class="count">{{ count }}</div>
|
||
<div class="explain">考试次数</div>
|
||
</div>
|
||
<div class="switch-count-wrapper">
|
||
<u-icon name="/static/images/qiehuan.png"></u-icon>
|
||
<div class="switch-count">{{ '不允许切屏' }}</div>
|
||
<div class="explain">切屏次数</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="explain">
|
||
*进入考试后,计时结束将自动交卷,退出后将会继续计时,考试期间请勿登录其他设备,否则成绩作废
|
||
</div>
|
||
|
||
<!-- 底部固定按钮 -->
|
||
<div class="bottom-btn">
|
||
<div class="btn">
|
||
<u-button type="primary" shape="circle" text="进入考试" @click="openModal" />
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 确认进入考试弹框 -->
|
||
<u-modal
|
||
:show="showModal"
|
||
title="提示"
|
||
:content="content"
|
||
showCancelButton
|
||
@cancel="showModal = false"
|
||
@confirm="handleEnterExam"
|
||
/>
|
||
</div>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
showModal: false,
|
||
// 标题
|
||
title: '',
|
||
// 副标题
|
||
subtitle: '',
|
||
// 考试时长
|
||
duration: '',
|
||
// 考试次数
|
||
count: '不限次',
|
||
// 切屏次数
|
||
switchCount: '',
|
||
studyId: '',
|
||
content: '是否确认进入考试?',
|
||
examId: '',
|
||
examNum: 0, // 考试次数
|
||
examCount: '', // 1: 不限次 2: 及格终止 3: 自定义
|
||
examCustom: 0, // 自定义次数
|
||
score: 0,
|
||
passScore: 0
|
||
}
|
||
},
|
||
onLoad(opt) {
|
||
opt = JSON.parse(opt.params)
|
||
console.log('🚀 ~ onLoad ~ opt:', opt)
|
||
this.examId = opt.id
|
||
this.title = opt.name
|
||
this.subtitle = opt.validityDate
|
||
this.duration = opt.responseTime
|
||
this.examNum = opt.examNum
|
||
this.count = opt.examCount === 1 ? '不限次' : opt.examCount === 2 ? '及格终止' : opt.examCustom
|
||
this.examCount = opt.examCount
|
||
this.examCustom = opt.examCustom
|
||
this.switchCount = opt.cutNum.includes('null') || opt.cutNum.includes('undefined') ? '不限次' : opt.cutNum
|
||
this.studyId = opt.studyId
|
||
this.score = opt.score
|
||
this.passScore = opt.passScore
|
||
},
|
||
methods: {
|
||
openModal() {
|
||
this.showModal = true
|
||
},
|
||
// 进入考试
|
||
handleEnterExam() {
|
||
const params = {
|
||
examId: this.examId, // 考试id
|
||
switchCount: this.switchCount, // 切屏次数
|
||
examNum: this.examNum,
|
||
examCount: this.examCount,
|
||
examCustom: this.examCustom,
|
||
studyId: this.studyId, // 学习id
|
||
score: this.score, // 总分
|
||
passScore: this.passScore // 及格分数
|
||
}
|
||
console.log('🚀 ~ handleEnterExam ~ params:', params)
|
||
uni.navigateTo({
|
||
url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.view {
|
||
padding: 10px;
|
||
}
|
||
.content {
|
||
padding: 10px;
|
||
border-radius: 5px;
|
||
background-color: #fff;
|
||
height: calc(100vh - 90px);
|
||
box-sizing: border-box;
|
||
|
||
.title {
|
||
font-size: 18px;
|
||
font-weight: bold;
|
||
color: #333;
|
||
padding-top: 20px;
|
||
}
|
||
|
||
.subtitle {
|
||
font-size: 14px;
|
||
color: #3185f0;
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.info {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin-top: 50px;
|
||
|
||
.duration-wrapper,
|
||
.count-wrapper,
|
||
.switch-count-wrapper {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
width: 100px;
|
||
height: 100px;
|
||
background: #f4f9fe;
|
||
border-radius: 4px;
|
||
margin-bottom: 20px;
|
||
|
||
.icon {
|
||
width: 20px;
|
||
height: 20px;
|
||
}
|
||
|
||
.duration,
|
||
.count,
|
||
.switch-count {
|
||
font-size: 16px;
|
||
color: #333;
|
||
margin-left: 5px;
|
||
}
|
||
|
||
.explain {
|
||
font-size: 12px;
|
||
color: #999;
|
||
margin-left: 5px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.explain {
|
||
font-size: 12px;
|
||
color: #999;
|
||
}
|
||
|
||
.bottom-btn {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 50px;
|
||
background-color: #fff;
|
||
padding: 10px 0;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
align-items: center;
|
||
|
||
.btn {
|
||
width: 33%;
|
||
margin-right: 10px;
|
||
}
|
||
}
|
||
}
|
||
|
||
::v-deep .u-modal__content {
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
</style>
|