GSExamProj/pages/exam/exam.vue

167 lines
4.2 KiB
Vue
Raw Normal View History

2024-04-18 11:01:57 +08:00
<template>
<view>
<view class="nav-bar"></view>
<view class="content">
<h3 class="upper-tit">关于送变电问题考试</h3>
<view class="need-know">
<view style="position: relative;">
<image style="position: absolute; width: 100%; height: 100%;" src="/static/totalBgd.png" mode=""></image>
<h3>100</h3>
</view>
<view style="position: relative;">
<image style="position: absolute; width: 100%; height: 100%;" src="/static/passedBgd.png" mode=""></image>
<h3>90</h3>
</view>
<view style="position: relative;">
<image style="position: absolute; width: 100%; height: 100%;" src="/static/timeBgd.png" mode=""></image>
<h3>60分钟</h3>
</view>
</view>
<h5>
<span style="color: #838383;">备注</span>简答题和案例题等用纸质答题
</h5>
<h5>
<span style="color: #838383;">扣分规则</span>多选题漏选选错不得分请谨慎作答
</h5>
<h5 style="line-height: 28px;"><span style="color: red;">注意事项</span>不要在考试期间对试卷进行拍照录屏等禁止通过微信QQ等聊天软件进行交流禁止通过浏览器搜索考试答案</h5>
<h5 style="color: red; font-weight: bold;">考试总分根据发布人员选择具体总分和考试时长以发布考试人员为准</h5>
<button class="enter-exam" @click="enterExam">进入考试</button>
</view>
</view>
</template>
<script>
import { publicPath } from '../../public.js'
export default {
data() {
return {
idCard: ''
}
},
methods: {
enterExam () {
// 获取有没有考试题
uni.request({
url: publicPath + '/backstage/app/waitExamPage',
method: 'POST',
header: {
'content-type':'application/x-www-form-urlencoded; charset=UTF-8'
},
data: {
loginName: this.idCard
},
success: (res) => {
console.log(res);
let list = res.data[0]
switch (list.diff) {
case '0':
uni.navigateTo({
url: `/pages/examPage/examPage?examId=${list.examId}&examPerfession=${list.examPerfession}`
})
break;
case '1':
let limitHr = new Date().getHours()
console.log(limitHr)
if (limitHr > 8 && limitHr < 20) {
uni.navigateTo({
url: `/pages/examPage/examPage?examId=${list.examId}&examPerfession=${list.examPerfession}`
})
} else {
uni.showToast({
icon: 'none',
title: '考试时间已过,请下次准时参加!',
duration: 3000
})
}
break;
case '4':
uni.showToast({
icon: 'none',
title: '该考生还没有报名!',
duration: 3000
})
break;
case '5':
uni.showToast({
icon: 'none',
title: '请联系管理员发布试题!',
duration: 3000
})
break;
default:
uni.showToast({
icon: 'none',
title: '试题异常,请联系管理员!',
duration: 3000
})
break;
}
}
})
}
},
onShow() {
this.idCard = uni.getStorageSync('idCard')
console.log(this.idCard);
}
}
</script>
<style lang="scss" scoped>
.nav-bar{
width: 100%;
height: var(--status-bar-height);
padding-top: var(--status-bar-height);
}
.content{
width: 100vw;
height: 90vh;
box-sizing: border-box;
padding: 30rpx;
.upper-tit{
margin-bottom: 15rpx;
}
h5{
margin: 30rpx auto;
font-size: 16px;
font-weight: normal;
line-height: 24px;
}
.need-know{
width: 100%;
height: 15vh;
display: flex;
justify-content: space-around;
margin: 50rpx auto;
view{
width: 30%;
height: 100%;
border-radius: 15rpx;
background-color: #F7F8FA;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
/* h4{
font-weight: normal;
color: #959698;
font-size: 12px;
} */
h3{
position: absolute;
margin: 40% auto;
}
}
}
.enter-exam{
width: 95%;
margin: 0 auto;
position: fixed;
left: 2.5%;
bottom: 20rpx;
background-color: #027BD5;
color: #fff;
}
}
</style>