This commit is contained in:
@fawn-nine
2024-09-06 17:08:49 +08:00
parent 409e808a3c
commit ac4f5dcd66
5 changed files with 1263 additions and 135 deletions

View File

@@ -2,6 +2,7 @@
<view>
<public-module></public-module>
<z-nav-bar title="班级详情"></z-nav-bar>
<text class="small_btn retake border_radius_10" @click="goTest()">再考一次</text>
<view class="mainContent" v-if="thisClass.id">
<view :class="['classStatus',
thisClass.state == '0' ? 'daikai' :'',
@@ -49,35 +50,42 @@
<view class="optionsBox" v-if="thisClass.state == '3'">
<view class=" ">
<view class="">
<!-- -->
<view class="gotoExams" @click="goTest" v-if="paperList.length <= 0">
<text>去考试{{showCountDown}}</text>
<text>去考试</text>
</view>
<view class="" v-if="paperList.length > 0 && showCountDown">
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
:hour="timeDif.hour"
:minute="timeDif.minutes"
:second="timeDif.second"
color="#ffaa7f" />
<view class="" v-else-if="paperList.length > 0 && showCountDown">
<view class="flex_box flex_between align-items_box">
<view class="">
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
:hour="timeDif.hour" :minute="timeDif.minutes" :second="timeDif.second"
color="#ffaa7f" />
</view>
<view class="">
<text class="small_btn retake border_radius_10"
@click="continueTest(examId)">继续考试</text>
</view>
</view>
</view>
<view class="flex_box flex_center align-items_box userScore" v-else
style="color: #666; justify-content: space-around !important">
<view class="flex_box align-items_box">
<text><text class="PM_font mainTxt" style="font-size: 60rpx; ">{{paperSore}}</text>
</text>
<uni-icons type="eye" size="20" color="#999" @click="showPaperList = true"></uni-icons>
<uni-icons type="eye" size="20" color="#999"
@click="showPaperList = true"></uni-icons>
</view>
<view class="" v-if="paperList.length == 1">
<text class="small_btn retake border_radius_10" @click="goTest">再考一次</text>
<text class="small_btn retake border_radius_10" @click="goTest()">再考一次</text>
</view>
</view>
</view>
</view>
<view class="chengji" v-show="thisClass.state == '2'">
<!-- v-show="thisClass.state == '2'" -->
<view class="chengji" >
<view>恭喜您获得<text class="greenScore">A证</text> <text
class="small_btn border_radius_10 zhengshu">查看证书</text></view>
<view style="margin-top: 20rpx; text-align: center;">很遗憾您的成绩未达标</view>
@@ -223,10 +231,11 @@
<!-- {{getTijiaoTitleList}} -->
<!-- 班内提交 -->
<view class="" v-if="tabId == '3' && thisClass.state != '0'">
<view class="flex_box tijiaoTitle">
<text :class="tijiaoTitleId == item.id ? 'active' :''" @click="titleClick(item,index)"
v-for="(item, index) in tijiaoTitleList" :key="index">{{item.name}}</text>
</view>
</view>
<!-- 班内任务 --><!-- 医案 --> <!-- 心得 -->
<view class="">
<view class="" v-if="tijiaoTitleId == 2 && thisClass.state == '1' && roleCode.includes('0')">
@@ -379,32 +388,32 @@
<h3 style="margin-bottom: 20rpx; text-align: center;">
试卷列表
</h3>
<view class="scoreBox flex_box flex_between border_radius_10 " >
<template v-if="classModel.isExam == 1">
<template v-if="paperList.length == 0">
<view class="">
<view class="scoreBox flex_box flex_between border_radius_10 ">
<template v-if="classModel.isExam == 1">
<template v-if="paperList.length == 0">
<view class="">
未参加考试
<view class="">
未参加考试
</view>
</view>
</view>
</template>
<template v-else >
<view class="" v-for="(item1, index1) in paperList">
<view class="ciyao">
{{index1 == 0 ? '一' : '二'}}次考试成绩
</view>
<view class="flex_box flex_center" @click.stop="goToPaper(item1.id)">
<text class="score">{{item1.score}} </text>
<view class="seePaper">
<image src="../../static/icon/testPaperIcon.png" mode="widthFix" ></image>
</template>
<template v-else>
<view class="" v-for="(item1, index1) in paperList">
<view class="ciyao">
{{index1 == 0 ? '一' : '二'}}次考试成绩
</view>
<view class="flex_box flex_center" @click.stop="goToPaper(item1.id)">
<text class="score">{{item1.score}} </text>
<view class="seePaper">
<image src="../../static/icon/testPaperIcon.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
</view>
</template>
</template>
</template>
<!-- && thisClass.state == '2' -->
<!-- <view v-if="classModel.isExam == 1" :class="['PM_font','zhengshu',thisStudent.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
<!-- && thisClass.state == '2' -->
<!-- <view v-if="classModel.isExam == 1" :class="['PM_font','zhengshu',thisStudent.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
></view> -->
</view>
</view>
@@ -450,8 +459,8 @@
active: false
},
],
timeDif:{},
showCountDown:false,
timeDif: {},
showCountDown: false,
thisClass: {},
students: [],
@@ -564,7 +573,9 @@ showCountDown:false,
paperList: [],
paperSore: 0, // 最终的笔试成绩
showTestTips: false,
showPaperList:false,
showPaperList: false,
examId: undefined,
ingPaper: undefined, // 正在进行中的试卷信息
}
},
onLoad(e) {
@@ -598,32 +609,53 @@ showCountDown:false,
this.getList()
uni.stopPullDownRefresh()
},
async onShow() {
var ss = await this.getClassInfo()
this.getScore()
console.log('this.thisClass.state', this.thisClass.state);
console.log('this.$store.state.paperEndTime',this.$store.state);
if(this.$store.state.paperEndTime && this.$store.state.paperEndTime.time - Date.now() > 0){
var secondTimeDif = this.$store.state.paperEndTime.time - Date.now()
this.timeDif.hour = (secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
this.timeDif.minutes = (secondTimeDif % (1000 * 60 * 60)) / (1000 * 60);
this.timeDif.second = (secondTimeDif % (1000 * 60)) / 1000
this.showCountDown = true
console.log('时间符合吗?',this.showCountDown, secondTimeDif);
}
if (this.thisClass.state == '3') {
async onShow() {
console.log('this.curTagIndex', this.curTagIndex);
var ss = await this.getClassInfo()
this.curTagIndex = 0
this.getScore()
if (this.thisClass.state == '3' || this.thisClass.state == '2') {
var ll = await this.getPaperList()
console.log('this.paperList.length',this.paperList.length);
if (!this.showAlert && this.paperList.length <= 0 ) {
console.log('this.paperList.length', this.paperList.length);
if (!this.showAlert && this.paperList.length <= 0) {
uni.showModal({
title: '提示',
content: '您好当前教学进度已进入考试周请尽快完成最终的笔试考试如在结班endTime之前未完成考试则卷面成绩记为0分',
content: '您好,当前教学进度已进入考试周,请尽快完成最终的笔试考试,如在结班之前未完成考试,则卷面成绩记为0分',
confirmText: '好的',
showCancel: false
})
this.showAlert = true
}
}
if (this.thisClass.state == '3' && this.paperList.length > 0) {
// var paperData={}
var paperEndTime = 0
var severNowTime = -1
// paperData = await this.getlocaltestInfo('paperEndTime')
var historyPaper = await this.getingPaper()
this.ingPaper = historyPaper
console.log('对比',historyPaper.classId , this.classId);
if(historyPaper && historyPaper.classId == this.classId){
paperEndTime = this.hourUp(historyPaper.startTime,1) // 结束的时间戳
this.examId = historyPaper.id
}else{
this.examId = undefined
paperEndTime = 0
}
severNowTime = await this.getServerTime()
// console.log('//////////////', paperEndTime, severNowTime);
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
}
}
}
},
computed: {
...mapState(["userInfo"]),
@@ -657,7 +689,7 @@ showCountDown:false,
}
return list
},
// 获得提交项目的tab
getTijiaoTitleList() {
var _list = []
@@ -695,18 +727,40 @@ showCountDown:false,
}
},
methods: {
goToPaper(id){
// 获取服务器时间
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
},
goToPaper(id) {
uni.navigateTo({
url: `/pages/miniClass/paperBack?id=${id}`
})
},
timeup(){
timeup() {
this.showCountDown = false
},
// 获取试卷列表
async getPaperList() {
console.log('--------------',parseInt(this.classId),this.userInfo.id);
console.log('--------------', parseInt(this.classId), this.userInfo.id);
await $http.request({
url: "common/classExam/getExamPaperList",
method: "POST",
@@ -756,44 +810,54 @@ showCountDown:false,
},
// 查询考试成绩
getPaperScore() {
console.log('获取卷面成绩');
// $http.request({
// url: "common/class/getUserRole",
// method: "POST",
// data: {
// "classId": this.classId
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// })
// .then((res) => {
// uni.hideLoading()
// console.log('res获取身份信息',res);
// this.roleCode = res.result
// }).catch(e => {
// uni.hideLoading()
// this.roleCode = []
// uni.showToast({
// title: '获取身份信息失败',
// icon: 'error'
// })
// });
console.log('获取卷面成绩');
},
// 考试周和结班状态下,学员的信息
async getStudentScoreList() {
var list = undefined
await this.$http
.post('book/user/info/' + this.userInfo.id)
await $http.request({
url: "common/class/userScoreList",
method: "POST",
data: {
"classId": this.classId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
console.log('班状态下,学员的信息',res);
// this.userMsg = res.user
list = studentList
// if(res.code == 0){
// list = res.result
// }else{
// uni.showToast({
// title: res.errMsg,
// icon: 'none',
// duration: 3000
// })
// }
}).catch(e => {
list = []
uni.showToast({
title: res.errMsg,
icon: 'none',
duration: 3000
})
});
return list
},
goTest() {
if(this.ingPaper){
uni.showModal({
title:'提示',
content:'您有一项正在进行中的考试,请完成后再开启本班级的考试',
showCancel:false,
confirmText:'好的'
})
return
}
uni.navigateTo({
url: `/pages/miniClass/test?classId=${this.thisClass.id}`
})
@@ -843,7 +907,7 @@ showCountDown:false,
.then((res) => {
if (res.code == 0) {
this.performanceScore = res.result
console.log('this.performanceScore-------', this.performanceScore);
console.log('this.平时成绩e-------', this.performanceScore);
} else {
uni.showToast({
title: '平时成绩获取失败',
@@ -863,6 +927,12 @@ showCountDown:false,
url: `/pages/miniClass/addHomeWork?id=${item.id}&type=2`
})
},
// 继续考试
continueTest(id) {
uni.navigateTo({
url: `/pages/miniClass/continueTest?id=${id}`
})
},
radioChange1(e) {
this.myExperience = e.detail.value
console.log('点了', this.myExperience);
@@ -926,7 +996,27 @@ showCountDown:false,
}
})
},
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
}
}).catch(e => {
});
return obj
},
// 获取本地试卷信息
getList() {
console.log('进入函数了吗');
this.status = 1;
@@ -1032,12 +1122,24 @@ showCountDown:false,
tabClick(e) {
console.log('e', e);
this.tabId = e.id
this.curTagIndex = e.index
if (e.id == 3) {
console.log('心得');
this.getList()
}
},
hourUp(start,e) {
// 比现在多几个小时
// var end = Date.now()
var startTimeDate = new Date(start)
var startTime = startTimeDate.getTime();
var step = 1000 * 60 * 60 * e // 时间间隔
var interval = startTime + step; //开始 + 时长 = 结束的毫秒数
// var a = new Date(interval)
console.log('aaaaaaaaaa结束时间的毫秒数时间戳',interval);
return interval
},
formatRichText(html) {
if (html == '') {
return
@@ -1270,11 +1372,12 @@ showCountDown:false,
this.refresh = false
if (res.code == 0) {
res = classData // 测试数据
this.isHave = res.result.isJoin
this.thisClass = res.result.class
this.isHave = res.result.isJoin
this.thisClass = res.result.class
if (this.thisClass.state == '0') {
this.tabId = '0'
} else {
this.tijiaoTitleId = '0'
this.tabId = '3'
}
this.admins.list = res.result.admins
@@ -1448,7 +1551,10 @@ showCountDown:false,
}
.testBox {
.mainTxt{color: #55aa00 !important;}
.mainTxt {
color: #55aa00 !important;
}
.scoreTitle {
.titles {
background-color: #55aa00;
@@ -1519,8 +1625,8 @@ showCountDown:false,
.scoreNumber {
font-size: 60rpx;
}
.upopBox {
.upopBox {
padding: 40rpx;
max-height: 80vh;
overflow-y: scroll;
@@ -1531,17 +1637,37 @@ showCountDown:false,
border-bottom: 1px solid #eee;
}
}
.scoreBox{
.scoreBox {
align-items: center;
border: none !important;
border: none !important;
margin-top: 20rpx;
text-align: center; background-color: #fff; padding: 10rpx 20rpx;
.ciyao{color: #999; margin-bottom: 20rpx;}
.score{color: #258feb; font-weight: bold; font-size: 36rpx;}
.seePaper{width: 50rpx; height: 50rpx;
image{width: 100%; height: 100%;}
}
text-align: center;
background-color: #fff;
padding: 10rpx 20rpx;
.ciyao {
color: #999;
margin-bottom: 20rpx;
}
.score {
color: #258feb;
font-weight: bold;
font-size: 36rpx;
}
.seePaper {
width: 50rpx;
height: 50rpx;
image {
width: 100%;
height: 100%;
}
}
}
.chengji {
padding-top: 20rpx;
margin-top: 20rpx;
@@ -1734,6 +1860,7 @@ showCountDown:false,
.gotoExams {
margin: 60rpx 0;
text {
display: block;
text-align: center;