This commit is contained in:
@fawn-nine
2024-10-14 17:06:09 +08:00
parent 827e5171e1
commit 42da449031
9 changed files with 1275 additions and 32 deletions

View File

@@ -68,22 +68,79 @@
</view>
</view>
</view>
<!-- 自考入口 -->
<view class="selfStudyBox" v-if="librayList[curIndex] && librayList[curIndex].completion">
<!-- 自考入口 没有加入班级的时候暴漏入口-->
<view class="selfStudyBox" v-if="librayList[curIndex] && !classInfo.id">
<view style="padding: 20rpx;">
<view class="">
<view class="" style="line-height: 40rpx; font-size: 28rpx;" v-if="selfStudyCertificate.length == 0">
<text>课程学习进度大于等于70%您可以参与本门课程的自考考试考试成绩大于60分即可获得本门课程的B级证书如您想获得本门课程的A级证书可参加小班教学</text>
</view>
<view :class="['testRecode',zhedieTestRecode?'zhedie':'']" v-if="selfStudyPaperList.length > 0 && !testingPaper.id">
<view class="item flex_box flex_between align-items_box" v-for="(item, index) in selfStudyPaperList" :key="index">
<text style="color: #999; font-size: 26rpx;">{{index + 1}}次自考成绩</text>
<text class="score PM_font">{{item.score}}</text>
<view class="seePaper" @click.stop="seePaper(item.id)">
<!-- <image
src="../../static/icon/testPaperIcon.png"
mode="widthFix"
></image> -->
查看试卷
</view>
</view>
<view class="opbutn" v-if="selfStudyPaperList.length >= 3" @click="zhedieTestRecode = !zhedieTestRecode">
{{zhedieTestRecode ? '收起' : '展开'}}
</view>
</view>
<view v-if="selfStudyCertificate.length > 0" style="font-size: 30rpx; text-align: center; margin: 20rpx 0;">
<text>恭喜您已通过自考考试获得本门课程的B级证书,如您想获得本门课程的A级证书可参加小班教学</text>
</view>
</view>
<view class=" " style="margin-top: 20rpx;">
<!-- <view class=""> -->
<template v-if="selfStudyCertificate.length <= 0">
<template v-if="!testingPaper.id">
<button @click="onPageJump('/pages/selfStudy/selfStudy',courseId)" style="padding: 0 20rpx"
type="primary" v-if="selfStudyPaperList.length == 0"
:disabled="librayList[curIndex].completion < 70 && canJoinTestTime">参加自考考试</button>
<button v-if="selfStudyPaperList.length % 2 != 0 && canJoinTestTime" @click="onPageJump('/pages/selfStudy/selfStudy',courseId)" style="padding: 0 20rpx"
type="primary"
:disabled="librayList[curIndex].completion < 70">再考一次</button>
<button v-if="!canJoinTestTime && showNextTestDate" @click="onPageJump('/pages/selfStudy/selfStudy',courseId)" style="padding: 0 20rpx"
type="primary"
:disabled="!canJoinTestTime">{{showNextTestDate.nextZKTime}} 后可参与自考</button>
</template>
<button v-else @click="onPageJump('/pages/miniClass/continueTest',testingPaper.id)" style="padding: 0 20rpx"
type="primary"
:disabled="librayList[curIndex].completion < 70">
继续自考考试
<template v-if="showCountDown" style="font-size: 26rpx;"> (剩余时间
<uni-countdown style="display: inline-block; " @timeup="timeup" :font-size="20" :show-day="false"
:hour="timeDif.hour" :minute="timeDif.minutes" :second="timeDif.second"
color="#fff" splitorColor="#fff" />)
</template>
</button>
</template>
<button style="padding: 0 20rpx" v-if="selfStudyCertificate.length > 0" type="primary" @click="onPageJump('/pages/certificate/certificate')">查看证书</button>
<!-- </view> -->
<!-- <view class="" v-if="!classInfo.id">
<button style="background-color: #00e1ec;" type="primary" size="mini">查看可加入的小班</button>
</view> -->
</view>
</view>
</view>
<!-- 小班入口 -->
<view class="classEntrance" v-if="linkClassList.length > 0">
<view class="classEntrance" >
<view class="flex_box" style="justify-content: space-between;">
<view class="flex_box classTitleBox">
<image src="../../static/icon/class.png" mode="" style="width: 64rpx; height: 64rpx;"></image>
<text class="mainTxt">
<text class="mainTxt" v-if="linkClassList.length > 0 ">
<span style="font-weight: bold; padding: 0 16rpx;"></span>
加入班级开始更加系统的学习</text>
加入班级开始更加系统的学习</text>
<text class="mainTxt" v-else>
<span style="font-weight: bold; padding: 0 16rpx;"></span>
暂无可加入的小班</text>
</view>
<view class="btntext">
<view class="btntext" v-if="linkClassList.length > 0 ">
<text @click="goClassLIst('/pages/miniClass/courseClassList', course.id,course.title)">前往查看 >></text>
</view>
</view>
@@ -418,7 +475,8 @@
} from "vuex";
export default {
data() {
return {
return {
zhedieTestRecode:false, // 是否折叠自考的记录
goodsList: [],
currentCateIndex: 0,
protocolShow: false,
@@ -526,7 +584,16 @@
isAndorid: true,
oprateOsName:'',
linkClassList:[], // 可加入关联班级数组
classInfo:[] // 所在班级信息
classInfo:[], // 所在班级信息
selfStudyCertificate:[], // 自考证书
classCertificate:[], // 小班学习证书
testingPaper:{}, // 当前课程正在考试信息
timeDif: {},
showCountDown: false,
showSecondTestBtn:false, // 先否显示二次考试按钮
selfStudyPaperList:[], ///自考考试记录
showNextTestDate:undefined,
canJoinTestTime:false, //时间上是否可以参加自考考试
};
},
//第一次加载
@@ -542,8 +609,6 @@
// await this.getData(e.id);
this.getSayList();
this.getOS()
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
@@ -567,6 +632,62 @@
plus.screen.lockOrientation("portrait-primary");
// #endif
this.getLinkClassList()
var newCertificate = await this.getCertificateInfo()
console.log('5555555证书资料', newCertificate);
this.selfStudyCertificate = []
this.classCertificate = []
if(newCertificate && newCertificate.length > 0){
newCertificate.forEach(item => {
if(item.classId!= '' && item.classId > 0){
this.classCertificate.push(item)
}else{
this.selfStudyCertificate.push(item)
}
})
}
var historyPaper = await this.getingPaper()
console.log('historyPaper正在考试的信息',historyPaper);
if(historyPaper && historyPaper.id && historyPaper.type == '2' && historyPaper.relationId == this.courseId){
this.testingPaper = historyPaper
var paperEndTime = historyPaper.planEndTime
var severNowTime = await this.getServerTime()
if (severNowTime > -1 && paperEndTime - severNowTime > 0) {
var secondTimeDif = paperEndTime - severNowTime
this.timeDif.hour = parseInt((secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
this.timeDif.minutes = parseInt((secondTimeDif % (1000 * 60 * 60)) / (1000 * 60));
this.timeDif.second = (secondTimeDif % (1000 * 60)) / 1000
this.showCountDown = true
console.log('时间符合吗?', this.showCountDown, secondTimeDif);
} else {
this.showCountDown = false
}
}
var selfStudyPaperList = await this.getSelfStudyPaperList()
this.selfStudyPaperList = selfStudyPaperList
console.log('selfStudyPaperList',selfStudyPaperList);
if(selfStudyPaperList && selfStudyPaperList.length > 0 && selfStudyPaperList.length < 2){
this.canJoinTestTime = true
}
if(selfStudyPaperList && selfStudyPaperList.length > 0){
selfStudyPaperList.forEach((item, index) => {
if(item.score < 60 && index < 2){
this.showSecondTestBtn = true
}else{
this.showSecondTestBtn = false
}
})
}
if(selfStudyPaperList.length >= 2 && this.selfStudyCertificate.length == 0){
this.showNextTestDate = await this.getNextTestDate()
console.log('下次考试时间',this.showNextTestDate);
var now = new Date()
if(this.showNextTestDate.nextLongTime < now){
this.canJoinTestTime = true
}else{
this.canJoinTestTime = false
}
}
},
onUnload() {
this.selectGoodsData = {};
@@ -599,6 +720,145 @@
},
//方法
methods: {
// 查询下次可以考试的时间
async getNextTestDate(){
var time = {
nextLongTime:0,
nextZKTime:''
}
await $http.request({
url: "common/classExam/getNextZKTime",
method: "POST",
data: {
"courseId": parseInt(this.courseId)
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async (res) => {
if(res.code != 0) {
uni.showToast({
title:res.errMsg,
icon:'none'
})
return
}
if (res.code == 0) {
console.log('res',res);
time.nextZKTime = res.nextZKTime
time.nextLongTime = res.nextLongTime
}
}).catch(e => {
uni.showToast({
title:e.errMsg,
icon:'none'
})
});
return time
},
seePaper(val) {
// console.log('点击了');
uni.navigateTo({
url: `/pages/miniClass/paperBack?id=${val}`,
});
},
async timeup() {
this.showCountDown = false
setTimeout(async ()=>{
var selfStudyPaperList = await this.getSelfStudyPaperList()
this.selfStudyPaperList = selfStudyPaperList
console.log('selfStudyPaperList',selfStudyPaperList);
if(selfStudyPaperList && selfStudyPaperList.length > 0){
selfStudyPaperList.forEach((item, index) => {
if(item.score < 60 && index < 2){
this.showSecondTestBtn = true
}else{
this.showSecondTestBtn = false
}
})
}
},3000)
},
// 获取自考试卷列表
async getSelfStudyPaperList(){
var list = undefined
await $http.request({
url: "common/classExam/getZKExamPaperList",
method: "POST",
data: {
"courseId": parseInt(this.courseId)
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async (res) => {
if(res.code != 0) {
uni.showToast({
title:res.errMsg,
icon:'none'
})
return
}
if (res.code == 0) {
console.log('res',res);
list = res.ZKExamUserList
}
}).catch(e => {
uni.showToast({
title:e.errMsg,
icon:'none'
})
});
return list
},
// 获取服务器时间
async getServerTime() {
var time = 0
await $http.request({
url: "common/classExam/getServerTime",
method: "POST",
data: {},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async (res) => {
if (res.code == 0) {
time = res.serverTime
} else {
time = -1
}
}).catch(e => {
time = -1
});
return time
},
// 获取进行中的考试
async getingPaper(){
var obj = undefined
await $http.request({
url: "common/classExam/examingPaper",
method: "POST",
data: {},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async (res) => {
console.log('考试中',res);
if (res.code == 0 && res.classExamUser != null) {
obj = {...res.classExamUser, planEndTime:res.planEndTime}
}else{
obj = undefined
}
}).catch(e => {
obj = undefined
});
return obj
},
// 获得课程关联的班级
getLinkClassList(){
this.$http
@@ -1449,7 +1709,6 @@
})
.then(async (res) => {
if (res.code == 0 && res.chapterList.length > 0) {
list = res.chapterList;
// console.log("方法里面得到的章节列表:", list);
} else {
@@ -1466,6 +1725,47 @@
url: `${url}?id=${id}`,
});
},
// 查询证书情况
async getCertificateInfo(){
var list = undefined
await $http.request({
url: "common/userCertificate/getUserCertificateList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"type":'', //证书类型A a证 B b证 ZK自考
"courseId": this.courseId //课程id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.code != 0) {
uni.showToast({
title: res.errMsg,
icon: 'none'
})
return
}
if (res.code == 0) {
res.certificateList.forEach(item => {
item.certificateUrl && item.certificateUrl != '' ? item.certificateUrlList = item.certificateUrl.split(',') : item.certificateUrlList = []
})
list = res.certificateList
}
console.log('证书接口请求结果', res);
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: e.errMsg,
icon: 'none'
})
});
return list
},
goClassLIst(url, id,title){
uni.navigateTo({
url: `${url}?courseId=${id}&courseTitle=${title}`,
@@ -1476,7 +1776,7 @@
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.selfStudyBox{position: relative;}
.selfStudyBox{position: relative; background-color:#fff0e7;}
.classEntrance{background-color: #d0ecc1; padding:20rpx;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
.flex_box{align-items: center;}
@@ -2612,4 +2912,21 @@
padding: 20rpx;
}
}
.testRecode{ position: relative; margin-top: 20rpx; background-color:rgba(255, 255, 255, .8); padding: 20rpx;
.item{margin-bottom: 20rpx; border-bottom:1px solid #e1e1e1 ; line-height: 60rpx;}
.item:last-child{border-bottom: none; margin-bottom: 0;}
.score{color:#35a6ff ; font-size: 34rpx;}
.opbutn{position:absolute; padding-bottom: 20rpx; width: 100%; text-align: center; font-size: 26rpx; color: #999; bottom: 0; left: 0; z-index: 1;}
}
.testRecode.zhedie{height: 240rpx; overflow: hidden;}
.seePaper { color: #35a6ff; font-size: 26rpx;
// width: 50rpx;
// height: 50rpx;
// image {
// width: 100%;
// height: 100%;
// }
}
</style>