暂存
This commit is contained in:
@@ -719,6 +719,14 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/miniClass/continueTest",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "继续考试页面",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/miniClass/paperBack",
|
"path" : "pages/miniClass/paperBack",
|
||||||
"style" :
|
"style" :
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<public-module></public-module>
|
<public-module></public-module>
|
||||||
<z-nav-bar title="班级详情"></z-nav-bar>
|
<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="mainContent" v-if="thisClass.id">
|
||||||
<view :class="['classStatus',
|
<view :class="['classStatus',
|
||||||
thisClass.state == '0' ? 'daikai' :'',
|
thisClass.state == '0' ? 'daikai' :'',
|
||||||
@@ -49,35 +50,42 @@
|
|||||||
<view class="optionsBox" v-if="thisClass.state == '3'">
|
<view class="optionsBox" v-if="thisClass.state == '3'">
|
||||||
<view class=" ">
|
<view class=" ">
|
||||||
<view class="">
|
<view class="">
|
||||||
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="gotoExams" @click="goTest" v-if="paperList.length <= 0">
|
<view class="gotoExams" @click="goTest" v-if="paperList.length <= 0">
|
||||||
<text>去考试{{showCountDown}}</text>
|
<text>去考试</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="" v-if="paperList.length > 0 && showCountDown">
|
<view class="" v-else-if="paperList.length > 0 && showCountDown">
|
||||||
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
|
<view class="flex_box flex_between align-items_box">
|
||||||
:hour="timeDif.hour"
|
<view class="">
|
||||||
:minute="timeDif.minutes"
|
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
|
||||||
:second="timeDif.second"
|
:hour="timeDif.hour" :minute="timeDif.minutes" :second="timeDif.second"
|
||||||
color="#ffaa7f" />
|
color="#ffaa7f" />
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<text class="small_btn retake border_radius_10"
|
||||||
|
@click="continueTest(examId)">继续考试</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex_box flex_center align-items_box userScore" v-else
|
<view class="flex_box flex_center align-items_box userScore" v-else
|
||||||
style="color: #666; justify-content: space-around !important">
|
style="color: #666; justify-content: space-around !important">
|
||||||
<view class="flex_box align-items_box">
|
<view class="flex_box align-items_box">
|
||||||
<text><text class="PM_font mainTxt" style="font-size: 60rpx; ">{{paperSore}}</text>
|
<text><text class="PM_font mainTxt" style="font-size: 60rpx; ">{{paperSore}}</text>
|
||||||
分 </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>
|
||||||
<view class="" v-if="paperList.length == 1">
|
<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>
|
</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
|
<view>恭喜您获得<text class="greenScore">A证</text>, <text
|
||||||
class="small_btn border_radius_10 zhengshu">查看证书</text></view>
|
class="small_btn border_radius_10 zhengshu">查看证书</text></view>
|
||||||
<view style="margin-top: 20rpx; text-align: center;">很遗憾,您的成绩未达标</view>
|
<view style="margin-top: 20rpx; text-align: center;">很遗憾,您的成绩未达标</view>
|
||||||
@@ -223,10 +231,11 @@
|
|||||||
<!-- {{getTijiaoTitleList}} -->
|
<!-- {{getTijiaoTitleList}} -->
|
||||||
<!-- 班内提交 -->
|
<!-- 班内提交 -->
|
||||||
<view class="" v-if="tabId == '3' && thisClass.state != '0'">
|
<view class="" v-if="tabId == '3' && thisClass.state != '0'">
|
||||||
|
|
||||||
<view class="flex_box tijiaoTitle">
|
<view class="flex_box tijiaoTitle">
|
||||||
<text :class="tijiaoTitleId == item.id ? 'active' :''" @click="titleClick(item,index)"
|
<text :class="tijiaoTitleId == item.id ? 'active' :''" @click="titleClick(item,index)"
|
||||||
v-for="(item, index) in tijiaoTitleList" :key="index">{{item.name}}</text>
|
v-for="(item, index) in tijiaoTitleList" :key="index">{{item.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 班内任务 --><!-- 医案 --> <!-- 心得 -->
|
<!-- 班内任务 --><!-- 医案 --> <!-- 心得 -->
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="" v-if="tijiaoTitleId == 2 && thisClass.state == '1' && roleCode.includes('0')">
|
<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 style="margin-bottom: 20rpx; text-align: center;">
|
||||||
试卷列表
|
试卷列表
|
||||||
</h3>
|
</h3>
|
||||||
<view class="scoreBox flex_box flex_between border_radius_10 " >
|
<view class="scoreBox flex_box flex_between border_radius_10 ">
|
||||||
<template v-if="classModel.isExam == 1">
|
<template v-if="classModel.isExam == 1">
|
||||||
<template v-if="paperList.length == 0">
|
<template v-if="paperList.length == 0">
|
||||||
<view class="">
|
|
||||||
<view class="">
|
<view class="">
|
||||||
未参加考试
|
<view class="">
|
||||||
|
未参加考试
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</template>
|
||||||
</template>
|
<template v-else>
|
||||||
<template v-else >
|
<view class="" v-for="(item1, index1) in paperList">
|
||||||
<view class="" v-for="(item1, index1) in paperList">
|
<view class="ciyao">
|
||||||
<view class="ciyao">
|
{{index1 == 0 ? '一' : '二'}}次考试成绩
|
||||||
{{index1 == 0 ? '一' : '二'}}次考试成绩
|
</view>
|
||||||
</view>
|
<view class="flex_box flex_center" @click.stop="goToPaper(item1.id)">
|
||||||
<view class="flex_box flex_center" @click.stop="goToPaper(item1.id)">
|
<text class="score">{{item1.score}} 分</text>
|
||||||
<text class="score">{{item1.score}} 分</text>
|
<view class="seePaper">
|
||||||
<view class="seePaper">
|
<image src="../../static/icon/testPaperIcon.png" mode="widthFix"></image>
|
||||||
<image src="../../static/icon/testPaperIcon.png" mode="widthFix" ></image>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</template>
|
||||||
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
</template>
|
<!-- && thisClass.state == '2' -->
|
||||||
<!-- && thisClass.state == '2' -->
|
<!-- <view v-if="classModel.isExam == 1" :class="['PM_font','zhengshu',thisStudent.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
|
||||||
<!-- <view v-if="classModel.isExam == 1" :class="['PM_font','zhengshu',thisStudent.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
|
|
||||||
></view> -->
|
></view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -450,8 +459,8 @@
|
|||||||
active: false
|
active: false
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
timeDif:{},
|
timeDif: {},
|
||||||
showCountDown:false,
|
showCountDown: false,
|
||||||
|
|
||||||
thisClass: {},
|
thisClass: {},
|
||||||
students: [],
|
students: [],
|
||||||
@@ -564,7 +573,9 @@ showCountDown:false,
|
|||||||
paperList: [],
|
paperList: [],
|
||||||
paperSore: 0, // 最终的笔试成绩
|
paperSore: 0, // 最终的笔试成绩
|
||||||
showTestTips: false,
|
showTestTips: false,
|
||||||
showPaperList:false,
|
showPaperList: false,
|
||||||
|
examId: undefined,
|
||||||
|
ingPaper: undefined, // 正在进行中的试卷信息
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -598,32 +609,53 @@ showCountDown:false,
|
|||||||
this.getList()
|
this.getList()
|
||||||
uni.stopPullDownRefresh()
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
async onShow() {
|
async onShow() {
|
||||||
var ss = await this.getClassInfo()
|
console.log('this.curTagIndex', this.curTagIndex);
|
||||||
this.getScore()
|
var ss = await this.getClassInfo()
|
||||||
console.log('this.thisClass.state', this.thisClass.state);
|
this.curTagIndex = 0
|
||||||
console.log('this.$store.state.paperEndTime',this.$store.state);
|
this.getScore()
|
||||||
if(this.$store.state.paperEndTime && this.$store.state.paperEndTime.time - Date.now() > 0){
|
if (this.thisClass.state == '3' || this.thisClass.state == '2') {
|
||||||
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') {
|
|
||||||
var ll = await this.getPaperList()
|
var ll = await this.getPaperList()
|
||||||
console.log('this.paperList.length',this.paperList.length);
|
console.log('this.paperList.length', this.paperList.length);
|
||||||
if (!this.showAlert && this.paperList.length <= 0 ) {
|
if (!this.showAlert && this.paperList.length <= 0) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '您好,当前教学进度已进入考试周,请尽快完成最终的笔试考试,如在结班(endTime)之前未完成考试,则卷面成绩记为0分',
|
content: '您好,当前教学进度已进入考试周,请尽快完成最终的笔试考试,如在结班之前未完成考试,则卷面成绩记为0分',
|
||||||
confirmText: '好的',
|
confirmText: '好的',
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
this.showAlert = true
|
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: {
|
computed: {
|
||||||
...mapState(["userInfo"]),
|
...mapState(["userInfo"]),
|
||||||
@@ -657,7 +689,7 @@ showCountDown:false,
|
|||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获得提交项目的tab
|
// 获得提交项目的tab
|
||||||
getTijiaoTitleList() {
|
getTijiaoTitleList() {
|
||||||
var _list = []
|
var _list = []
|
||||||
@@ -695,18 +727,40 @@ showCountDown:false,
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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({
|
uni.navigateTo({
|
||||||
url: `/pages/miniClass/paperBack?id=${id}`
|
url: `/pages/miniClass/paperBack?id=${id}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
timeup(){
|
timeup() {
|
||||||
this.showCountDown = false
|
this.showCountDown = false
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取试卷列表
|
// 获取试卷列表
|
||||||
async getPaperList() {
|
async getPaperList() {
|
||||||
console.log('--------------',parseInt(this.classId),this.userInfo.id);
|
console.log('--------------', parseInt(this.classId), this.userInfo.id);
|
||||||
await $http.request({
|
await $http.request({
|
||||||
url: "common/classExam/getExamPaperList",
|
url: "common/classExam/getExamPaperList",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -756,44 +810,54 @@ showCountDown:false,
|
|||||||
},
|
},
|
||||||
// 查询考试成绩
|
// 查询考试成绩
|
||||||
getPaperScore() {
|
getPaperScore() {
|
||||||
console.log('获取卷面成绩');
|
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'
|
|
||||||
// })
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
// 考试周和结班状态下,学员的信息
|
// 考试周和结班状态下,学员的信息
|
||||||
async getStudentScoreList() {
|
async getStudentScoreList() {
|
||||||
var list = undefined
|
var list = undefined
|
||||||
await this.$http
|
await $http.request({
|
||||||
.post('book/user/info/' + this.userInfo.id)
|
url: "common/class/userScoreList",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
"classId": this.classId
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
console.log('班状态下,学员的信息',res);
|
||||||
// this.userMsg = res.user
|
// this.userMsg = res.user
|
||||||
list = studentList
|
list = studentList
|
||||||
|
// if(res.code == 0){
|
||||||
|
// list = res.result
|
||||||
|
// }else{
|
||||||
|
// uni.showToast({
|
||||||
|
// title: res.errMsg,
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 3000
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
list = []
|
list = []
|
||||||
|
uni.showToast({
|
||||||
|
title: res.errMsg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
});
|
});
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
goTest() {
|
goTest() {
|
||||||
|
if(this.ingPaper){
|
||||||
|
uni.showModal({
|
||||||
|
title:'提示',
|
||||||
|
content:'您有一项正在进行中的考试,请完成后再开启本班级的考试',
|
||||||
|
showCancel:false,
|
||||||
|
confirmText:'好的'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/miniClass/test?classId=${this.thisClass.id}`
|
url: `/pages/miniClass/test?classId=${this.thisClass.id}`
|
||||||
})
|
})
|
||||||
@@ -843,7 +907,7 @@ showCountDown:false,
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.performanceScore = res.result
|
this.performanceScore = res.result
|
||||||
console.log('this.performanceScore-------', this.performanceScore);
|
console.log('this.平时成绩e-------', this.performanceScore);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '平时成绩获取失败',
|
title: '平时成绩获取失败',
|
||||||
@@ -863,6 +927,12 @@ showCountDown:false,
|
|||||||
url: `/pages/miniClass/addHomeWork?id=${item.id}&type=2`
|
url: `/pages/miniClass/addHomeWork?id=${item.id}&type=2`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 继续考试
|
||||||
|
continueTest(id) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/continueTest?id=${id}`
|
||||||
|
})
|
||||||
|
},
|
||||||
radioChange1(e) {
|
radioChange1(e) {
|
||||||
this.myExperience = e.detail.value
|
this.myExperience = e.detail.value
|
||||||
console.log('点了', this.myExperience);
|
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() {
|
getList() {
|
||||||
console.log('进入函数了吗');
|
console.log('进入函数了吗');
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
@@ -1032,12 +1122,24 @@ showCountDown:false,
|
|||||||
tabClick(e) {
|
tabClick(e) {
|
||||||
console.log('e', e);
|
console.log('e', e);
|
||||||
this.tabId = e.id
|
this.tabId = e.id
|
||||||
|
this.curTagIndex = e.index
|
||||||
if (e.id == 3) {
|
if (e.id == 3) {
|
||||||
console.log('心得');
|
console.log('心得');
|
||||||
this.getList()
|
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) {
|
formatRichText(html) {
|
||||||
if (html == '') {
|
if (html == '') {
|
||||||
return
|
return
|
||||||
@@ -1270,11 +1372,12 @@ showCountDown:false,
|
|||||||
this.refresh = false
|
this.refresh = false
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
res = classData // 测试数据
|
res = classData // 测试数据
|
||||||
this.isHave = res.result.isJoin
|
this.isHave = res.result.isJoin
|
||||||
this.thisClass = res.result.class
|
this.thisClass = res.result.class
|
||||||
if (this.thisClass.state == '0') {
|
if (this.thisClass.state == '0') {
|
||||||
this.tabId = '0'
|
this.tabId = '0'
|
||||||
} else {
|
} else {
|
||||||
|
this.tijiaoTitleId = '0'
|
||||||
this.tabId = '3'
|
this.tabId = '3'
|
||||||
}
|
}
|
||||||
this.admins.list = res.result.admins
|
this.admins.list = res.result.admins
|
||||||
@@ -1448,7 +1551,10 @@ showCountDown:false,
|
|||||||
}
|
}
|
||||||
|
|
||||||
.testBox {
|
.testBox {
|
||||||
.mainTxt{color: #55aa00 !important;}
|
.mainTxt {
|
||||||
|
color: #55aa00 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.scoreTitle {
|
.scoreTitle {
|
||||||
.titles {
|
.titles {
|
||||||
background-color: #55aa00;
|
background-color: #55aa00;
|
||||||
@@ -1519,8 +1625,8 @@ showCountDown:false,
|
|||||||
.scoreNumber {
|
.scoreNumber {
|
||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upopBox {
|
.upopBox {
|
||||||
padding: 40rpx;
|
padding: 40rpx;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
@@ -1531,17 +1637,37 @@ showCountDown:false,
|
|||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.scoreBox{
|
|
||||||
|
.scoreBox {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
text-align: center; background-color: #fff; padding: 10rpx 20rpx;
|
text-align: center;
|
||||||
.ciyao{color: #999; margin-bottom: 20rpx;}
|
background-color: #fff;
|
||||||
.score{color: #258feb; font-weight: bold; font-size: 36rpx;}
|
padding: 10rpx 20rpx;
|
||||||
.seePaper{width: 50rpx; height: 50rpx;
|
|
||||||
image{width: 100%; height: 100%;}
|
.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 {
|
.chengji {
|
||||||
padding-top: 20rpx;
|
padding-top: 20rpx;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
@@ -1734,6 +1860,7 @@ showCountDown:false,
|
|||||||
|
|
||||||
.gotoExams {
|
.gotoExams {
|
||||||
margin: 60rpx 0;
|
margin: 60rpx 0;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
display: block;
|
display: block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
790
pages/miniClass/continueTest.vue
Normal file
790
pages/miniClass/continueTest.vue
Normal file
@@ -0,0 +1,790 @@
|
|||||||
|
<template style="">
|
||||||
|
<view class="" style="background-color: #d4eaf0; min-height: calc(100vh); padding: 20rpx;">
|
||||||
|
<public-module></public-module>
|
||||||
|
<z-nav-bar title="正在考试" backState="2000">
|
||||||
|
<text slot="right" style="padding-right: 20rpx; font-size: 26rpx; color: #666;"
|
||||||
|
@click="showPopup = true">考试说明</text>
|
||||||
|
</z-nav-bar>
|
||||||
|
<!-- 有考试结果时候 -->
|
||||||
|
<template v-if="exameResult.id">
|
||||||
|
<view class="border_radius_10 haveResult">
|
||||||
|
<view class="scoreBox">
|
||||||
|
本次考试卷面成绩为:<text class="score PM_font">{{exameResult.score}} 分</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex_box flex_between">
|
||||||
|
<button type="primary" size="mini" @click="goToClass">返回班级</button>
|
||||||
|
<button type="warn" size="mini" @click="goToPaper">查看试卷</button>
|
||||||
|
</view>
|
||||||
|
<view class="result_imgBox">
|
||||||
|
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<!-- 没有考试结果的时候 -->
|
||||||
|
<template v-if="!exameResult.id">
|
||||||
|
<view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box"
|
||||||
|
v-if="secondTimeDif > 0">
|
||||||
|
|
||||||
|
<view class="">
|
||||||
|
<text><i style="color: #00aaff; font-style: normal; margin-right: 10rpx;" class="">{{curIndex1+1}}
|
||||||
|
</i> / {{questionList.length}}</text>
|
||||||
|
<text class="checkQuestBtn small_btn border_radius_10" @click="showQuestIndex = true">全部题目</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex_box align-items_box" v-if="secondTimeDif > 0">
|
||||||
|
<view class="" style="font-size: 26rpx;">
|
||||||
|
剩余时间:
|
||||||
|
</view>
|
||||||
|
<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>
|
||||||
|
<!-- </view> -->
|
||||||
|
<!-- <pre>{{testPaper}}</pre> -->
|
||||||
|
</view>
|
||||||
|
<!-- <view class="">
|
||||||
|
<text class="small_btn border_radius_10" @click="showQuestIndex = true">全部题目</text>
|
||||||
|
</view> -->
|
||||||
|
<view class="question border_radius_10" v-if="curQuestion.id">
|
||||||
|
<view class="">
|
||||||
|
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text>
|
||||||
|
<!-- <text class="checkQuestBtn small_btn border_radius_10" @click="showQuestIndex = true">检查</text> -->
|
||||||
|
<view class="questionItem" v-if="curQuestion.id">
|
||||||
|
<view class="">
|
||||||
|
<text>{{curQuestion.content}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="optionsBox">
|
||||||
|
<view
|
||||||
|
:class="['item','border_radius_10', (curQuestion.answerIds.includes(item.id) || curQuestion.answerIds.includes(item.id+'')) ? 'choosed' : '']"
|
||||||
|
@click="clickOption(item, index)" v-for="(item, index) in curQuestion.options"
|
||||||
|
:key="index">
|
||||||
|
<text>{{item.content}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btnBox " style="overflow: hidden;">
|
||||||
|
<view class="flex_box flex_between">
|
||||||
|
<view class="item">
|
||||||
|
<button @click="showPrevQuestion" type="default" plain="true" :disabled="curIndex1 == 0"
|
||||||
|
size="mini">上一题</button>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-show="curIndex1 == questionList.length-1 && !isOvertime || wantSubmit">
|
||||||
|
<button @click="sumitAnswer" type="primary" size="mini">交 卷</button>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<button @click="showNextQuestion" type="primary"
|
||||||
|
:disabled="curIndex1 == questionList.length-1" size="mini">下一题</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<u-popup key="1" :show="showPopup" :round="10" @close="hidePopup">
|
||||||
|
<view class="guanli">
|
||||||
|
<h3>考试说明</h3>
|
||||||
|
<view class="tips border_radius_10">
|
||||||
|
<text>①、每位学员共有两次考试的机会,考试成绩以两次成绩的最高分作为最终的卷面成绩,请认真对待每次考试;<br />
|
||||||
|
②、请在倒计时结束前完成答题,倒计时结束后将自动交卷。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup key="2" :show="showQuestIndex" :round="10" @close="hidePopup">
|
||||||
|
<view class="guanli">
|
||||||
|
<h3>题目索引</h3>
|
||||||
|
<view class="" style="text-align: center; font-size: 28rpx; line-height: 50rpx; color: #666;">
|
||||||
|
<text>红框标识未作答,绿色框标识已选定答案,灰色框标识您未查看的题目</text>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class="questIndx questIndxPup flex_box">
|
||||||
|
<!-- <scroll-view class="scroll-view_H" scroll-x="true">
|
||||||
|
<view class="scroll-view-item_H" v-for="index of getallLIst" :key="index"> -->
|
||||||
|
<text v-for="index of getallLIst" @click="clickIndex(index)" :key="index"
|
||||||
|
:class="[ haveAnswerList.includes(index-1) ? 'green' : '', noAnswerList.includes(index-1) ? 'red' : '',(curIndex1+1) == index ? 'cur' :'']">{{index}}</text>
|
||||||
|
<!-- </view>
|
||||||
|
</scroll-view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import $http from '@/config/requestConfig.js';
|
||||||
|
import {
|
||||||
|
mapState,mapMutations
|
||||||
|
} from "vuex";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showPopup: false,
|
||||||
|
code: 0, // 英文code
|
||||||
|
classId: undefined,
|
||||||
|
testPaper: {},
|
||||||
|
curQuestion: {
|
||||||
|
answerIds: []
|
||||||
|
},
|
||||||
|
result: {}, // 考试结果
|
||||||
|
curIndex1: 0,
|
||||||
|
paperCreateTime: 0,
|
||||||
|
examId: undefined,
|
||||||
|
endTime: undefined, // 结束时间戳
|
||||||
|
timeDif:{}, // 时间差(结束 - 现在)
|
||||||
|
isOvertime: false, // 是否超时
|
||||||
|
step: 8, /// 步长
|
||||||
|
// questIndexList: [],
|
||||||
|
nowPart: 1,
|
||||||
|
|
||||||
|
maxNumber: 0,
|
||||||
|
minNumber: 0,
|
||||||
|
noAnswerList: [],
|
||||||
|
haveAnswerList:[],
|
||||||
|
exameResult:{},
|
||||||
|
showQuestIndex:false,
|
||||||
|
secondTimeDif:undefined,
|
||||||
|
questionList:[],
|
||||||
|
answerIdsList:[],
|
||||||
|
wantSubmit:false, // 想要提交
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async onLoad(e) {
|
||||||
|
console.log('收到得值',e);
|
||||||
|
this.classId = e.classId
|
||||||
|
this.examId = e.id
|
||||||
|
this.wantSubmit = false
|
||||||
|
this.getTestPage()
|
||||||
|
// this.questIndexList = await this.getNowList('add')
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
if (!this.isOvertime) {}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
// this.endTime = this.hourUp(1)
|
||||||
|
// console.log('this.endTime', this.endTime.getTime());
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["userInfo"]),
|
||||||
|
getallLIst() {
|
||||||
|
const numbers = Array.from(Array(100).keys(), n => n + 1);
|
||||||
|
console.log('numbers', numbers);
|
||||||
|
return numbers
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapMutations(['setPaperEndTime']),
|
||||||
|
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
|
||||||
|
},
|
||||||
|
// 单个题的提交
|
||||||
|
saveQuestAnswer(paperId,questIndex,ids){
|
||||||
|
console.log('收到的值',paperId,questIndex,ids);
|
||||||
|
$http.request({
|
||||||
|
url: "common/classExam/submitOption",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
"id": paperId, //试卷id
|
||||||
|
"no": questIndex, // 提索引 1....
|
||||||
|
"answer": ids // 答案id
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log('提交成功');
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e, '数据报错')
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkAnswer(id){
|
||||||
|
var _list = [...this.answerIdsList]
|
||||||
|
var _list1 = []
|
||||||
|
_list = _list.map( item => {
|
||||||
|
return item.split(',')
|
||||||
|
})
|
||||||
|
for (var i = 0; i < _list.length; i++) {
|
||||||
|
for (var j = 0; j < _list[i].length; j++) {
|
||||||
|
if(id == _list[i][j]){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
getNoAnswerList() {
|
||||||
|
var list = []
|
||||||
|
// if (this.curIndex1 > 0) {
|
||||||
|
for (var i = 0; i < this.questionList.length; i++) {
|
||||||
|
if (this.questionList[i].answerIds.length == 0 && this.questionList[i].hadOpend) {
|
||||||
|
|
||||||
|
list.push(i)
|
||||||
|
// console.log('fuhe?',list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
return list
|
||||||
|
},
|
||||||
|
gethaveAnswerList() {
|
||||||
|
var list = []
|
||||||
|
// if (this.curIndex1 > 0) {
|
||||||
|
for (var i = 0; i < this.questionList.length; i++) {
|
||||||
|
if (this.questionList[i].answerIds.length > 0 && this.questionList[i].hadOpend) {
|
||||||
|
// console.log('fuhe?');
|
||||||
|
list.push(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
return list
|
||||||
|
},
|
||||||
|
// 倒计时结束 (超时)
|
||||||
|
timeup() {
|
||||||
|
this.isOvertime = true
|
||||||
|
this.sumbitPaper()
|
||||||
|
let that = this
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: "考试结束,系统已为您自动交卷,点击按钮返回所在班级",
|
||||||
|
confirmText: '知道了',
|
||||||
|
showCancel: false,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/classInfo?id=${that.classId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goToPaper(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/paperBack?id=${this.examId}`
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
// 获取交卷数据
|
||||||
|
sumitAnswer() {
|
||||||
|
let that = this
|
||||||
|
that.wantSubmit = true
|
||||||
|
// this.noAnswerList = await this.getNoAnswerList()
|
||||||
|
if(that.noAnswerList.length > 0){
|
||||||
|
that.showQuestIndex = true
|
||||||
|
uni.showModal({
|
||||||
|
title:'提示',
|
||||||
|
content:'您有未作答的题目,是否继续交卷操作?',
|
||||||
|
cancelText:'点错了',
|
||||||
|
confirmText:'确定',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.sumbitPaper()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
that.sumbitPaper()
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
// q请求提交试卷
|
||||||
|
sumbitPaper(ids) {
|
||||||
|
let that = this
|
||||||
|
$http.request({
|
||||||
|
url: "common/classExam/submitExamPaper",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
id: that.examId
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
// uni.hideLoading()
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log('交卷结果',res);
|
||||||
|
uni.showToast({
|
||||||
|
title: '交卷成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
setTimeout( ()=>{
|
||||||
|
that.exameResult = res.examPaper
|
||||||
|
// this.timeup()
|
||||||
|
that.showQuestIndex = false
|
||||||
|
that.secondTimeDif = 0
|
||||||
|
that.isOvertime = true
|
||||||
|
uni.setStorage({
|
||||||
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: 0,
|
||||||
|
examId: undefined
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},300)
|
||||||
|
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.log(e, '数据报错')
|
||||||
|
// this.status = 3
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showPrevQuestion() {
|
||||||
|
// 上一题
|
||||||
|
this.curIndex1--
|
||||||
|
// this.curQuestion.answerIds = []
|
||||||
|
this.curQuestion = {
|
||||||
|
...this.questionList[this.curIndex1]
|
||||||
|
}
|
||||||
|
this.questionList[this.curIndex1].hadOpend = true
|
||||||
|
// console.log('----------------', this.questionList );
|
||||||
|
this.noAnswerList = this.getNoAnswerList()
|
||||||
|
console.log('上一题', this.noAnswerList);
|
||||||
|
this.haveAnswerList = this.gethaveAnswerList()
|
||||||
|
},
|
||||||
|
showNextQuestion() {
|
||||||
|
// 下一题
|
||||||
|
this.curIndex1++
|
||||||
|
// this.curQuestion.answerIds = []
|
||||||
|
this.curQuestion = {
|
||||||
|
...this.questionList[this.curIndex1]
|
||||||
|
}
|
||||||
|
this.questionList[this.curIndex1].hadOpend = true
|
||||||
|
// console.log('+++++++++++++++', this.testPaper, );
|
||||||
|
this.noAnswerList = this.getNoAnswerList()
|
||||||
|
this.haveAnswerList = this.gethaveAnswerList()
|
||||||
|
},
|
||||||
|
clickOption(item, index) {
|
||||||
|
console.log('item', item, index, this.curIndex1);
|
||||||
|
if (this.curQuestion.type == 0) {
|
||||||
|
this.questionList[this.curIndex1].answerIds = [item.id]
|
||||||
|
this.curQuestion.answerIds = [item.id]
|
||||||
|
console.log('666666666', this.questionList[this.curIndex1].answerIds, this.curQuestion.answerIds);
|
||||||
|
this.$forceUpdate()
|
||||||
|
} else if (this.curQuestion.type == 1) {
|
||||||
|
console.log('多选');
|
||||||
|
var isIN = this.curQuestion.answerIds.findIndex(itemss => {
|
||||||
|
return itemss == item.id
|
||||||
|
})
|
||||||
|
if (isIN >= 0) {
|
||||||
|
console.log('有重复的,删除对应的', isIN);
|
||||||
|
this.questionList[this.curIndex1].answerIds.splice(isIN, 1)
|
||||||
|
this.curQuestion.answerIds.splice(isIN, 1)
|
||||||
|
} else {
|
||||||
|
this.questionList[this.curIndex1].answerIds.push(item.id)
|
||||||
|
|
||||||
|
this.curQuestion.answerIds = [...this.questionList[this.curIndex1].answerIds]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.noAnswerList = this.getNoAnswerList()
|
||||||
|
this.haveAnswerList = this.gethaveAnswerList()
|
||||||
|
console.log('this.testPaper.',this.noAnswerList,this.haveAnswerList);
|
||||||
|
this.saveQuestAnswer(this.examId,this.curIndex1+1,this.curQuestion.answerIds.join(','))
|
||||||
|
console.log('noAnswerList', this.noAnswerList)
|
||||||
|
},
|
||||||
|
setDesc() {
|
||||||
|
const letterArr = []
|
||||||
|
// 字母A的code值是65
|
||||||
|
for (let i = 65; i < 91; i++) {
|
||||||
|
letterArr[i] = String.fromCharCode(i)
|
||||||
|
}
|
||||||
|
return letterArr
|
||||||
|
},
|
||||||
|
async getTestPage() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在获取试卷'
|
||||||
|
})
|
||||||
|
await $http.request({
|
||||||
|
url: "common/classExam/getExamPaperInfo",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
"id": this.examId
|
||||||
|
},
|
||||||
|
header: { //默认 无 说明:请求头
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(async res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code == 0) {
|
||||||
|
console.log('试卷信息',res.examPaper);
|
||||||
|
var subOptions = JSON.parse(res.examPaper.subject)
|
||||||
|
this.answerIdsList = JSON.parse(res.examPaper.answer)
|
||||||
|
var newAnswerIdsList = [...this.answerIdsList ]
|
||||||
|
subOptions.forEach((item, index) => {
|
||||||
|
item.hadOpend = false // 是否呗打开过
|
||||||
|
item.answerIds = []
|
||||||
|
var code = 0
|
||||||
|
item.options.forEach(item1 => {
|
||||||
|
const randomAbc = this.setDesc().splice(65)
|
||||||
|
item1.content = randomAbc[code] + '、' + item1.content
|
||||||
|
code++
|
||||||
|
})
|
||||||
|
var temList = newAnswerIdsList[index].split(',')
|
||||||
|
console.log('temList474',temList);
|
||||||
|
if(temList == ''){
|
||||||
|
temList = []
|
||||||
|
}else{
|
||||||
|
item.hadOpend = true
|
||||||
|
}
|
||||||
|
item.answerIds = temList
|
||||||
|
})
|
||||||
|
this.questionList = subOptions
|
||||||
|
this.noAnswerList = this.getNoAnswerList()
|
||||||
|
this.haveAnswerList = this.gethaveAnswerList()
|
||||||
|
// console.log('this.answerIdsList', this.answerIdsList);
|
||||||
|
this.testPaper = res.examPaper
|
||||||
|
// this.examId = res.id
|
||||||
|
// this.paperCreateTime = 1
|
||||||
|
this.endTime = this.hourUp(res.examPaper.startTime,1) // 结束的时间戳
|
||||||
|
console.log('this.endTime',this.endTime);
|
||||||
|
var severNowTime = await this.getServerTime()
|
||||||
|
this.secondTimeDif = this.endTime - severNowTime // 时间差 毫秒
|
||||||
|
if(this.secondTimeDif > 0){
|
||||||
|
// this.setPaperEndTime({time:this.endTime})
|
||||||
|
uni.setStorage({
|
||||||
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: this.endTime,
|
||||||
|
examId: this.examId,
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.timeDif.hour = parseInt((this.secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||||
|
this.timeDif.minutes = parseInt((this.secondTimeDif % (1000 * 60 * 60)) / (1000 * 60))
|
||||||
|
this.timeDif.second = (this.secondTimeDif % (1000 * 60)) / 1000
|
||||||
|
console.log('this.endTime',this.timeDif.hour, this.timeDif.minutes, this.timeDif.second);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
uni.setStorage({
|
||||||
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: 0,
|
||||||
|
examId: undefined,
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// console.log('本地存储的结束时间', this.$store.state.paperEndTime);
|
||||||
|
this.curQuestion = {
|
||||||
|
...this.questionList[this.curIndex1]
|
||||||
|
}
|
||||||
|
this.curIndex1 = this.questionList.findIndex(itemdd =>{
|
||||||
|
console.log('itemdd',itemdd.answerIds);
|
||||||
|
return itemdd.answerIds.length == 0
|
||||||
|
})
|
||||||
|
console.log('^^^^^^^',this.curIndex1);
|
||||||
|
this.curIndex1 == -1 ? this.curIndex1 = this.questionList.length - 1 : ''
|
||||||
|
console.log('^^^^^^^',this.curIndex1);
|
||||||
|
this.questionList[this.curIndex1].hadOpend = true
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
console.log(res, '试卷', this.curQuestion)
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.getClassInfo()
|
||||||
|
// }, 500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.errMsg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(e => {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.log(e, '数据报错')
|
||||||
|
// this.status = 3
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showElart() {
|
||||||
|
// uni.showModal({
|
||||||
|
// title:'提示',
|
||||||
|
// content:"您还没有完成考试,确定要离开吗?离开后成绩会记为0分,是否继续?"
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
goToClass() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/classInfo?id=${this.classId}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
hidePopup() {
|
||||||
|
this.showPopup = false
|
||||||
|
this.showQuestIndex = false
|
||||||
|
},
|
||||||
|
clickIndex(val) {
|
||||||
|
this.curIndex1 = val - 1
|
||||||
|
console.log('val', val, this.curIndex1,this.questionList[this.curIndex1]);
|
||||||
|
for (var i = 0; i < this.curIndex1; i++) {
|
||||||
|
this.questionList[i].hadOpend = true
|
||||||
|
}
|
||||||
|
this.curQuestion = this.questionList[this.curIndex1]
|
||||||
|
this.questionList[this.curIndex1].hadOpend = true
|
||||||
|
this.hidePopup()
|
||||||
|
this.noAnswerList = this.getNoAnswerList()
|
||||||
|
this.haveAnswerList = this.gethaveAnswerList()
|
||||||
|
},
|
||||||
|
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
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "@/style/mixin.scss";
|
||||||
|
|
||||||
|
.questIndx { overflow: hidden;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
span{padding: 20rpx 0; display: inline-block;}
|
||||||
|
.red{border-color: #f56c6c; color: #f56c6c;}
|
||||||
|
.green{
|
||||||
|
border-color: #67c23a; color: #67c23a;
|
||||||
|
}
|
||||||
|
text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
// padding: 6rpx 10rpx;
|
||||||
|
display: flex;
|
||||||
|
// justify-content: center;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
// align-items: center;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cur {
|
||||||
|
background-color: #409eff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.guanli {
|
||||||
|
padding: 40rpx;
|
||||||
|
max-height: 60vh;
|
||||||
|
overflow-y: scroll;
|
||||||
|
h3 {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
background: #fbe8e8;
|
||||||
|
color: #f56c6c;
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.questionType {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 20rpx;
|
||||||
|
background-color: $themeColor;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 0 50rpx 50rpx 0;
|
||||||
|
}
|
||||||
|
.checkQuestBtn {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
// position: absolute;
|
||||||
|
// right: 20rpx;
|
||||||
|
// top: 20rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
// border: 1px solid $themeColor;
|
||||||
|
background-color: #409eff;
|
||||||
|
color: #fff;
|
||||||
|
// padding: 10rpx 20rpx;
|
||||||
|
// border-radius: 0 50rpx 50rpx 0;
|
||||||
|
}
|
||||||
|
.scroll-Y {
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-view_H {
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-view-item {
|
||||||
|
// height: 300rpx;
|
||||||
|
line-height: 300rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-view-item_H {
|
||||||
|
display: inline-block;
|
||||||
|
width: 13%;
|
||||||
|
// height: 300rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
// line-height: 300rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.haveResult {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scoreBox {
|
||||||
|
margin-top: 100rpx;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score {
|
||||||
|
font-size: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question {
|
||||||
|
padding: 20rpx;
|
||||||
|
padding-top: 100rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.optionsBox {
|
||||||
|
margin: 30rpx 0;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
padding: 16rpx 12rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choosed {
|
||||||
|
border-color: #b3d8ff;
|
||||||
|
color: #409eff;
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
border-color: #c2e7b0;
|
||||||
|
color: #67c23a;
|
||||||
|
background-color: #f0f9eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrong {
|
||||||
|
border-color: #fbc4c4;
|
||||||
|
color: #f56c6c;
|
||||||
|
background-color: #fef0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.result_imgBox {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeBox {
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.questIndx {
|
||||||
|
|
||||||
|
.cur {
|
||||||
|
border-color:#409eff ;
|
||||||
|
background-color: #409eff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.questIndxPup{
|
||||||
|
justify-content: space-around;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
text{
|
||||||
|
display: inline-block; margin: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btnBox {
|
||||||
|
.item {
|
||||||
|
width: 40%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
<template v-if="exameResult.id">
|
<template v-if="exameResult.id">
|
||||||
<view class="border_radius_10 haveResult">
|
<view class="border_radius_10 haveResult">
|
||||||
<view class="scoreBox">
|
<view class="scoreBox">
|
||||||
本次考试卷面成绩为:<text class="score PM_font">90分</text>
|
本次考试卷面成绩为:<text class="score PM_font">{{exameResult.score}} 分</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="flex_box flex_between">
|
||||||
<button type="primary" @click="goToClass">返回班级</button>
|
<button type="primary" size="mini" @click="goToClass">返回班级</button>
|
||||||
<button type="primary" @click="goToPaper">查看试卷</button>
|
<button type="warn" size="mini" @click="goToPaper">查看试卷</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="result_imgBox">
|
<view class="result_imgBox">
|
||||||
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
|
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<!-- 没有考试结果的时候 -->
|
<!-- 没有考试结果的时候 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box"
|
<view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box"
|
||||||
v-if="paperCreateTime > 0">
|
v-if="secondTimeDif > 0">
|
||||||
<!-- <view class=""> -->
|
<!-- <view class=""> -->
|
||||||
<view class="">
|
<view class="">
|
||||||
<text><i style="color: #00aaff; font-style: normal; margin-right: 10rpx;" class="">{{curIndex1+1}}
|
<text><i style="color: #00aaff; font-style: normal; margin-right: 10rpx;" class="">{{curIndex1+1}}
|
||||||
@@ -91,11 +91,11 @@
|
|||||||
<u-popup key="2" :show="showQuestIndex" :round="10" @close="hidePopup">
|
<u-popup key="2" :show="showQuestIndex" :round="10" @close="hidePopup">
|
||||||
<view class="guanli">
|
<view class="guanli">
|
||||||
<h3>题目索引</h3>
|
<h3>题目索引</h3>
|
||||||
|
<view class="" style="text-align: center; font-size: 28rpx; line-height: 50rpx; color: #666;">
|
||||||
|
<text>红框标识未作答,绿色框标识已选定答案,灰色框标识您未查看的题目</text>
|
||||||
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="questIndx questIndxPup flex_box">
|
<view class="questIndx questIndxPup flex_box">
|
||||||
<!-- <view class="" style="text-align: center; font-size: 24rpx; color: #666;">
|
|
||||||
<span>题目索引(可左右滑动)</span>
|
|
||||||
</view> -->
|
|
||||||
<!-- <scroll-view class="scroll-view_H" scroll-x="true">
|
<!-- <scroll-view class="scroll-view_H" scroll-x="true">
|
||||||
<view class="scroll-view-item_H" v-for="index of getallLIst" :key="index"> -->
|
<view class="scroll-view-item_H" v-for="index of getallLIst" :key="index"> -->
|
||||||
<text v-for="index of getallLIst" @click="clickIndex(index)" :key="index"
|
<text v-for="index of getallLIst" @click="clickIndex(index)" :key="index"
|
||||||
@@ -141,15 +141,18 @@
|
|||||||
haveAnswerList:[],
|
haveAnswerList:[],
|
||||||
exameResult:{},
|
exameResult:{},
|
||||||
showQuestIndex:false,
|
showQuestIndex:false,
|
||||||
|
secondTimeDif:undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onLoad(e) {
|
async onLoad(e) {
|
||||||
console.log('收到得值');
|
console.log('收到得值');
|
||||||
this.classId = e.classId
|
this.classId = e.classId
|
||||||
|
// this.examId = e.id
|
||||||
if (this.testPaper.length == 0) {
|
if (this.testPaper.length <= 0) {
|
||||||
this.getTestPage()
|
this.getTestPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this.questIndexList = await this.getNowList('add')
|
// this.questIndexList = await this.getNowList('add')
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
@@ -176,6 +179,28 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['setPaperEndTime']),
|
...mapMutations(['setPaperEndTime']),
|
||||||
|
// 获取服务器时间
|
||||||
|
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
|
||||||
|
},
|
||||||
// 单个题的提交
|
// 单个题的提交
|
||||||
saveQuestAnswer(paperId,questIndex,ids){
|
saveQuestAnswer(paperId,questIndex,ids){
|
||||||
console.log('收到的值',paperId,questIndex,ids);
|
console.log('收到的值',paperId,questIndex,ids);
|
||||||
@@ -209,7 +234,7 @@
|
|||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getNoAnswerList() {
|
getNoAnswerList() {
|
||||||
var list = []
|
var list = []
|
||||||
// if (this.curIndex1 > 0) {
|
// if (this.curIndex1 > 0) {
|
||||||
@@ -238,15 +263,18 @@
|
|||||||
timeup() {
|
timeup() {
|
||||||
this.isOvertime = true
|
this.isOvertime = true
|
||||||
this.sumbitPaper()
|
this.sumbitPaper()
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: "考试结束,系统已为您自动交卷",
|
content: "考试结束,系统已为您自动交卷,点击按钮返回所在班级",
|
||||||
confirmText: '知道了',
|
confirmText: '知道了',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// that.goToClass()
|
// that.goToClass()
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/classInfo?id=${that.classId}`
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -274,16 +302,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
that.sumbitPaper()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
// q请求提交试卷
|
// q请求提交试卷
|
||||||
sumbitPaper(ids) {
|
sumbitPaper(ids) {
|
||||||
|
let that = this
|
||||||
$http.request({
|
$http.request({
|
||||||
url: "common/classExam/submitExamPaper",
|
url: "common/classExam/submitExamPaper",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
id: this.examId
|
id: that.examId
|
||||||
},
|
},
|
||||||
header: { //默认 无 说明:请求头
|
header: { //默认 无 说明:请求头
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -292,11 +323,34 @@
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
console.log('交卷结果',res);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '交卷成功',
|
title: '交卷成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
this.isOvertime = true
|
setTimeout( ()=>{
|
||||||
|
that.exameResult = res.examPaper
|
||||||
|
// this.timeup()
|
||||||
|
that.showQuestIndex = false
|
||||||
|
that.secondTimeDif = 0
|
||||||
|
that.isOvertime = true
|
||||||
|
uni.setStorage({
|
||||||
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: 0,
|
||||||
|
examId: undefined
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},300)
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: e.errMsg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
@@ -304,7 +358,7 @@
|
|||||||
console.log(e, '数据报错')
|
console.log(e, '数据报错')
|
||||||
// this.status = 3
|
// this.status = 3
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: e.errorMsg,
|
title: e.errMsg,
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -369,11 +423,11 @@
|
|||||||
}
|
}
|
||||||
return letterArr
|
return letterArr
|
||||||
},
|
},
|
||||||
getTestPage() {
|
async getTestPage() {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在生成试卷'
|
title: '正在生成试卷'
|
||||||
})
|
})
|
||||||
$http.request({
|
await $http.request({
|
||||||
url: "common/classExam/generateExamPaper",
|
url: "common/classExam/generateExamPaper",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
@@ -383,7 +437,7 @@
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(async res => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
// that.isHave = true
|
// that.isHave = true
|
||||||
@@ -401,16 +455,37 @@
|
|||||||
this.examId = res.id
|
this.examId = res.id
|
||||||
this.paperCreateTime = 1
|
this.paperCreateTime = 1
|
||||||
this.endTime = this.hourUp(res.startTime,2) // 结束的时间戳
|
this.endTime = this.hourUp(res.startTime,2) // 结束的时间戳
|
||||||
this.secondTimeDif = this.endTime - Date.now() // 时间差 毫秒
|
var severNowTime = await this.getServerTime()
|
||||||
|
this.secondTimeDif = this.endTime - severNowTime // 时间差 毫秒
|
||||||
if(this.secondTimeDif > 0){
|
if(this.secondTimeDif > 0){
|
||||||
this.setPaperEndTime({time:this.endTime})
|
// this.setPaperEndTime({time:this.endTime})
|
||||||
this.timeDif.hour = (this.secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
|
uni.setStorage({
|
||||||
this.timeDif.minutes = (this.secondTimeDif % (1000 * 60 * 60)) / (1000 * 60);
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: this.endTime,
|
||||||
|
examId: this.examId,
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.timeDif.hour = parseInt((this.secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||||
|
this.timeDif.minutes = parseInt((this.secondTimeDif % (1000 * 60 * 60)) / (1000 * 60))
|
||||||
this.timeDif.second = (this.secondTimeDif % (1000 * 60)) / 1000
|
this.timeDif.second = (this.secondTimeDif % (1000 * 60)) / 1000
|
||||||
console.log('this.endTime',this.timeDif.hour, this.timeDif.minutes, this.timeDif.second);
|
console.log('this.endTime',this.timeDif.hour, this.timeDif.minutes, this.timeDif.second);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.setPaperEndTime(0)
|
uni.setStorage({
|
||||||
|
key:'paperEndTime',
|
||||||
|
data:{
|
||||||
|
time: 0,
|
||||||
|
examId: undefined,
|
||||||
|
},
|
||||||
|
success: function () {
|
||||||
|
console.log('时间存储成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
console.log('本地存储的结束时间', this.$store.state.paperEndTime);
|
console.log('本地存储的结束时间', this.$store.state.paperEndTime);
|
||||||
this.curQuestion = {
|
this.curQuestion = {
|
||||||
@@ -613,7 +688,7 @@
|
|||||||
|
|
||||||
.item {
|
.item {
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
padding: 16rpx 12rpx;
|
padding: 20rpx 16rpx;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,22 @@
|
|||||||
<text>{{item.title}}</text>
|
<text>{{item.title}}</text>
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
</view></view>
|
</view></view>
|
||||||
|
<view class="" v-if="showCountDown" style="padding:0 10rpx;">
|
||||||
|
<view class="flex_box flex_between align-items_box learnBox homeTestBox">
|
||||||
|
<text>考试进行中</text>
|
||||||
|
<view class="">
|
||||||
|
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
|
||||||
|
:hour="timeDif.hour" :minute="timeDif.minutes" :second="timeDif.second"
|
||||||
|
color="#fff" splitorColor="#fff" />
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<text class="small_btn retake border_radius_10"
|
||||||
|
@click="continueTest(examId,classId)">继续考试</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
<!-- 正在学习 -->
|
<!-- 正在学习 -->
|
||||||
<view class="" style="padding:0 5px;" v-if="learnList.length > 0">
|
<view class="" style="padding:0 5px;" v-if="learnList.length > 0">
|
||||||
<view class="learnBox" >
|
<view class="learnBox" >
|
||||||
@@ -339,11 +354,10 @@
|
|||||||
newsList: [], // 播报新闻列表
|
newsList: [], // 播报新闻列表
|
||||||
weburl: '',
|
weburl: '',
|
||||||
classList : [],
|
classList : [],
|
||||||
// webviewStyles: {
|
examId:undefined,
|
||||||
// progress: true,
|
timeDif: {},
|
||||||
// width: '100%',
|
showCountDown: false,
|
||||||
// height: '100vh'
|
classId: undefined
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onPageScroll(e) {
|
onPageScroll(e) {
|
||||||
@@ -368,6 +382,34 @@
|
|||||||
if(this.classList.length > 6){
|
if(this.classList.length > 6){
|
||||||
this.classList = this.classList.slice(0,6)
|
this.classList = this.classList.slice(0,6)
|
||||||
}
|
}
|
||||||
|
// var paperData={}
|
||||||
|
var paperEndTime = 0
|
||||||
|
var severNowTime = -1
|
||||||
|
// paperData = await this.getlocaltestInfo('paperEndTime')
|
||||||
|
var historyPaper = await this.getingPaper()
|
||||||
|
if(historyPaper){
|
||||||
|
paperEndTime = this.hourUp(historyPaper.startTime,1) // 结束的时间戳
|
||||||
|
this.examId = historyPaper.id
|
||||||
|
this.classId = historyPaper.classId
|
||||||
|
}else{
|
||||||
|
this.classId = undefined
|
||||||
|
this.examId = undefined
|
||||||
|
paperEndTime = 0
|
||||||
|
}
|
||||||
|
console.log('this.examId////////////', paperEndTime);
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onTabItemTap() {
|
onTabItemTap() {
|
||||||
|
|
||||||
@@ -411,7 +453,83 @@
|
|||||||
//方法
|
//方法
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['setUserInfo']),
|
...mapMutations(['setUserInfo']),
|
||||||
|
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
|
||||||
|
},
|
||||||
|
// 继续考试
|
||||||
|
continueTest(id,classId) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/miniClass/continueTest?id=${id}&classId=${classId}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取考试中的试卷
|
||||||
|
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
|
||||||
|
|
||||||
|
},
|
||||||
|
// 获取本地试卷信息
|
||||||
|
// getlocaltestInfo(keystr){
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// uni.getStorage({
|
||||||
|
// key: keystr,
|
||||||
|
// success: function(res) {
|
||||||
|
// if (res.error) {
|
||||||
|
// reject(res.data)
|
||||||
|
// } else {
|
||||||
|
// resolve(res.data)
|
||||||
|
// console.log('/////getlocaltestInfo/////', res.data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// 获取服务器时间
|
||||||
|
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 getClassNoUser(){
|
async getClassNoUser(){
|
||||||
var _list = []
|
var _list = []
|
||||||
@@ -564,6 +682,9 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
timeup() {
|
||||||
|
this.showCountDown = false
|
||||||
|
},
|
||||||
// 获取正在学习课程
|
// 获取正在学习课程
|
||||||
getLearnCourse() {
|
getLearnCourse() {
|
||||||
this.$http
|
this.$http
|
||||||
@@ -1163,7 +1284,10 @@
|
|||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.homeTestBox{
|
||||||
|
background-color:#ffaa00;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
.children_cate {
|
.children_cate {
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
padding: 0 10rpx;
|
padding: 0 10rpx;
|
||||||
@@ -1602,4 +1726,8 @@
|
|||||||
width: 100%; height: 100%;
|
width: 100%; height: 100%;
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
.retake {
|
||||||
|
border: 1px solid #fff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user