This commit is contained in:
@fawn-nine
2024-09-05 17:10:11 +08:00
parent a9f706e96f
commit 409e808a3c
6 changed files with 578 additions and 408 deletions

View File

@@ -715,7 +715,8 @@
"path" : "pages/miniClass/test", "path" : "pages/miniClass/test",
"style" : "style" :
{ {
"navigationBarTitleText" : "考试页面" "navigationBarTitleText" : "考试页面",
"enablePullDownRefresh": false
} }
}, },
{ {

View File

@@ -38,6 +38,58 @@
class="mainTxt">{{students.length}}/{{thisClass.number}}</text></view> class="mainTxt">{{students.length}}/{{thisClass.number}}</text></view>
<view><text class="ciyao">管理成员</text><text class="mainTxt" @click="seeManager">点击查看</text></view> <view><text class="ciyao">管理成员</text><text class="mainTxt" @click="seeManager">点击查看</text></view>
</view> </view>
<view class="pingfenBox testBox"
v-if="(thisClass.state == '3' || thisClass.state == '2') && classModel.isExam == 1">
<view class="scoreTitle">
<view class="titles flex_box">
<text>笔试分</text><uni-icons type="help" size="18" color="#fff"
@click="showTestTips = true"></uni-icons>
</view>
</view>
<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>
</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>
<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>
</view>
<view class="" v-if="paperList.length == 1">
<text class="small_btn retake border_radius_10" @click="goTest">再考一次</text>
</view>
</view>
</view>
</view>
<view class="chengji" v-show="thisClass.state == '2'">
<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>
<view class="" style="margin-top: 20rpx; text-align: center;">
<text class="small_btn chongxiu border_radius_10">加入新班级重修</text>
</view>
<!-- <view style="margin-top: 20rpx;">总成绩为<text class="scoreNumber greenScore">90</text> <text
class="c999">50考试分+40平时表现分</text></view> -->
</view>
</view>
</view>
<view class="pingfenBox" v-if="thisClass.state != 0"> <view class="pingfenBox" v-if="thisClass.state != 0">
<view class="scoreTitle"> <view class="scoreTitle">
<view class="titles flex_box"> <view class="titles flex_box">
@@ -67,30 +119,8 @@
<text class="ciyao"><i class="mainTxt PM_font">{{performanceScore.questionScore}}</i></text> <text class="ciyao"><i class="mainTxt PM_font">{{performanceScore.questionScore}}</i></text>
</view> --> </view> -->
</view> </view>
<view class="optionsBox">
<view class=" ">
<view class="">
<view class="gotoExams" @click="goTest">
<text>去考试</text>
</view>
<view class="">
<text>卷面成绩60</text><text class="small_btn retake border_radius_10">再考一次</text>
</view>
</view>
</view>
<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>
<view class="" style="margin-top: 20rpx; text-align: center;">
<text class="small_btn chongxiu border_radius_10">加入新班级重修</text>
</view>
<view style="margin-top: 20rpx;">总成绩为<text class="scoreNumber greenScore">90</text> <text
class="c999">50考试分+40平时表现分</text></view>
</view> </view>
</view>
</view>
<view class="mainBox"> <view class="mainBox">
<view class=""> <view class="">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="tabClick" :current="curTagIndex" <u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="tabClick" :current="curTagIndex"
@@ -237,7 +267,8 @@
<view class="leve3"> <view class="leve3">
<view class="tips flex_box"> <view class="tips flex_box">
<view class="btn1" @click.stop="changeZheDie(item, index)"> <view class="btn1" @click.stop="changeZheDie(item, index)">
{{item.zhedie ? '收起' : '展开'}}</view> {{item.zhedie ? '收起' : '展开'}}
</view>
<!-- <text>发布者{{item.createUser.nickname != null && item.createUser.nickname != '' ? item.createUser.nickname : '匿名用户'}}</text> --> <!-- <text>发布者{{item.createUser.nickname != null && item.createUser.nickname != '' ? item.createUser.nickname : '匿名用户'}}</text> -->
<text style="" class="date">日期{{item.createTime}}</text> <text style="" class="date">日期{{item.createTime}}</text>
</view> </view>
@@ -254,10 +285,12 @@
<view class="leve3" v-show="item.reply && tijiaoTitleId != 2"> <view class="leve3" v-show="item.reply && tijiaoTitleId != 2">
<text>已提交答案</text> <text>已提交答案</text>
</view> </view>
<view class="leve3 no" v-show="!item.reply && tijiaoTitleId != 2 && thisClass.state == '1'"> <view class="leve3 no"
v-show="!item.reply && tijiaoTitleId != 2 && thisClass.state == '1'">
<text>未提交答案 点击开始答题</text> <text>未提交答案 点击开始答题</text>
</view> </view>
<view class="leve3 cantAnswer" v-show="!item.reply && tijiaoTitleId != 2 && (thisClass.state == '2' || thisClass.state == '3')"> <view class="leve3 cantAnswer"
v-show="!item.reply && tijiaoTitleId != 2 && (thisClass.state == '2' || thisClass.state == '3')">
<text>未作答 已不可作答</text> <text>未作答 已不可作答</text>
</view> </view>
</template> </template>
@@ -332,6 +365,50 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<u-popup key="2" :show="showTestTips" :round="10" @close="closeManager">
<view class="guanli">
<h3>考试说明</h3>
<view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷</text>
</view>
</view>
</u-popup>
<u-popup key="3" :show="showPaperList" :round="10" @close="closeManager">
<view class="upopBox" style="">
<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="">
未参加考试
</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>
</view>
</view>
</view>
</template>
</template>
<!-- && thisClass.state == '2' -->
<!-- <view v-if="classModel.isExam == 1" :class="['PM_font','zhengshu',thisStudent.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
></view> -->
</view>
</view>
</u-popup>
<!-- <z-navigation></z-navigation> --> <!-- <z-navigation></z-navigation> -->
</view> </view>
@@ -373,6 +450,8 @@
active: false active: false
}, },
], ],
timeDif:{},
showCountDown:false,
thisClass: {}, thisClass: {},
students: [], students: [],
@@ -481,7 +560,11 @@
}, },
roleCode: [], roleCode: [],
firstLoad: true, // 是否是第一次请求 firstLoad: true, // 是否是第一次请求
blankNumber: 0 blankNumber: 0,
paperList: [],
paperSore: 0, // 最终的笔试成绩
showTestTips: false,
showPaperList:false,
} }
}, },
onLoad(e) { onLoad(e) {
@@ -515,10 +598,32 @@
this.getList() this.getList()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onShow() { async onShow() {
this.getClassInfo() var ss = await this.getClassInfo()
this.getScore() 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') {
var ll = await this.getPaperList()
console.log('this.paperList.length',this.paperList.length);
if (!this.showAlert && this.paperList.length <= 0 ) {
uni.showModal({
title: '提示',
content: '您好当前教学进度已进入考试周请尽快完成最终的笔试考试如在结班endTime之前未完成考试则卷面成绩记为0分',
confirmText: '好的',
showCancel: false
})
this.showAlert = true
}
}
}, },
computed: { computed: {
...mapState(["userInfo"]), ...mapState(["userInfo"]),
@@ -552,6 +657,7 @@
} }
return list return list
}, },
// 获得提交项目的tab // 获得提交项目的tab
getTijiaoTitleList() { getTijiaoTitleList() {
var _list = [] var _list = []
@@ -589,6 +695,65 @@
} }
}, },
methods: { methods: {
goToPaper(id){
uni.navigateTo({
url: `/pages/miniClass/paperBack?id=${id}`
})
},
timeup(){
this.showCountDown = false
},
// 获取试卷列表
async getPaperList() {
console.log('--------------',parseInt(this.classId),this.userInfo.id);
await $http.request({
url: "common/classExam/getExamPaperList",
method: "POST",
data: {
"classId": parseInt(this.classId),
"userId": this.userInfo.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then((res) => {
if (res.code == 0) {
console.log('获取试卷列表', res);
this.paperList = res.examPaper
if (this.paperList.length > 0) {
var _list = [...this.paperList]
_list = _list.map(item => {
return item.score
})
var maxNmber = 0
for (var i = 0; i < _list.length; i++) {
if (_list[i] > maxNmber) {
maxNmber = _list[i]
}
}
this.paperSore = maxNmber
} else {
this.paperSore = 0
}
} else {
this.paperSore = 0
uni.showToast({
title: errMsg,
icon: 'none'
})
}
}).catch(e => {
this.paperSore = 0
console.log('获取试卷列表失败', e);
uni.showToast({
title: '获取试卷列表失败',
icon: 'none'
})
});
},
// 查询考试成绩 // 查询考试成绩
getPaperScore() { getPaperScore() {
console.log('获取卷面成绩'); console.log('获取卷面成绩');
@@ -761,6 +926,7 @@
} }
}) })
}, },
getList() { getList() {
console.log('进入函数了吗'); console.log('进入函数了吗');
this.status = 1; this.status = 1;
@@ -943,6 +1109,8 @@
}, },
closeManager() { closeManager() {
this.showMan = false this.showMan = false
this.showTestTips = false
this.showPaperList = false
}, },
fabClick() { fabClick() {
// uni.showToast({ // uni.showToast({
@@ -1088,7 +1256,7 @@
uni.showLoading({ uni.showLoading({
title: '正在加载' title: '正在加载'
}) })
$http.request({ await $http.request({
url: "common/class/getClassInfo", url: "common/class/getClassInfo",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
@@ -1104,15 +1272,6 @@
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.showAlert && this.thisClass.state == '3') {
uni.showModal({
title: '提示',
content: '您好当前教学进度已进入考试周请尽快完成最终的笔试考试如在结班endTime之前未完成考试则卷面成绩记为0分',
confirmText: '好的',
showCancel: false
})
this.showAlert = true
}
if (this.thisClass.state == '0') { if (this.thisClass.state == '0') {
this.tabId = '0' this.tabId = '0'
} else { } else {
@@ -1288,6 +1447,15 @@
} }
} }
.testBox {
.mainTxt{color: #55aa00 !important;}
.scoreTitle {
.titles {
background-color: #55aa00;
}
}
}
.pingfenBox { .pingfenBox {
border: 2px dotted #bed4ee; border: 2px dotted #bed4ee;
padding: 20rpx; padding: 20rpx;
@@ -1321,6 +1489,11 @@
} }
} }
.testBox {
border-color: #aee5b5;
margin-bottom: 20rpx;
}
.zhengshu { .zhengshu {
color: #ffaa7f; color: #ffaa7f;
border: 1px solid #ffaa7f border: 1px solid #ffaa7f
@@ -1347,6 +1520,28 @@
font-size: 60rpx; font-size: 60rpx;
} }
.upopBox {
padding: 40rpx;
max-height: 80vh;
overflow-y: scroll;
color: #666;
.item {
padding: 10rpx 0;
border-bottom: 1px solid #eee;
}
}
.scoreBox{
align-items: center;
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%;}
}
}
.chengji { .chengji {
padding-top: 20rpx; padding-top: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
@@ -1461,6 +1656,7 @@
color: #ff9277; color: #ff9277;
text-align: center; text-align: center;
} }
.leve3.cantAnswer { .leve3.cantAnswer {
color: #999; color: #999;
text-align: center; text-align: center;
@@ -1537,9 +1733,7 @@
} }
.gotoExams { .gotoExams {
margin: 20rpx 0; margin: 60rpx 0;
margin-top: -10rpx;
text { text {
display: block; display: block;
text-align: center; text-align: center;
@@ -1552,7 +1746,9 @@
} }
} }
.scoreBox { border-top: 1px solid #eee; padding-top: 10rpx; .scoreBox {
border-top: 1px solid #eee;
padding-top: 10rpx;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
margin-top: 20rpx; margin-top: 20rpx;
@@ -1826,8 +2022,10 @@
} }
} }
.optionsBox {}
.retake { .retake {
border: 1px solid #5049cf; border: 1px solid #55aa00;
color: #5049cf; color: #55aa7f;
} }
</style> </style>

View File

@@ -258,7 +258,6 @@
</view> </view>
<view class="" v-if="tabId == '0'"> <view class="" v-if="tabId == '0'">
<view class="otherItems flex_box"> <view class="otherItems flex_box">
<view class="itt" v-if="thisClass.state == 0"> <view class="itt" v-if="thisClass.state == 0">
<text class="ciyao">创建日期</text> <text class="ciyao">创建日期</text>
<text class="mainTxt">{{thisClass.createTime.substring(0,10)}}</text> <text class="mainTxt">{{thisClass.createTime.substring(0,10)}}</text>

View File

@@ -1,7 +1,7 @@
<template style=""> <template style="">
<view class="" style="background-color: #d4eaf0; min-height: calc(100vh); padding: 20rpx;"> <view class="" style="background-color: #d4eaf0; min-height: calc(100vh); padding: 20rpx;">
<public-module></public-module> <public-module></public-module>
<z-nav-bar title="正在考试" backState="2000"> <z-nav-bar title="试卷答案">
<text slot="right" style="padding-right: 20rpx; font-size: 26rpx; color: #666;" <text slot="right" style="padding-right: 20rpx; font-size: 26rpx; color: #666;"
@click="showPopup = true">考试说明</text> @click="showPopup = true">考试说明</text>
</z-nav-bar> </z-nav-bar>
@@ -9,58 +9,59 @@
<template> <template>
<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">{{testPaper.score}}</text>
</view> </view>
<view class=""> <view class="otherItems flex_box flex_between">
<button type="primary" @click="goToClass">返回班级</button> <view class="itt">
<text class="ciyao">总题数</text>
<text class="mainTxt">{{questionList.length}}</text>
</view>
<view class="itt">
<text class="ciyao">已答</text>
<text class="mainTxt">{{questionList.length - haveNoAnswerNumber}}</text>
</view>
<view class="itt">
<text class="ciyao">未答</text>
<text class="mainTxt">{{haveNoAnswerNumber}}</text>
</view>
<view class="itt">
<text class="ciyao">正确率</text>
<text class="mainTxt">{{rightNumber / questionList.length * 100}} %</text>
</view> </view>
<view class="result_imgBox">
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
</view> </view>
</view> </view>
</template> </template>
<!-- 没有考试结果的时候 --> <!-- 没有考试结果的时候 -->
<template> <template>
<!-- <view class="tips border_radius_10"> <!-- <view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box"
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br /> >
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br />
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view> --> </view> -->
<view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box"
v-if="paperCreateTime > 0">
<!-- <view class=""> -->
<view class="">
<text><i style="color: #00aaff; font-style: normal; margin-right: 10rpx;" class="">{{curIndex1+1}}
</i> / {{testPaper.length}}</text>
</view>
<view class="flex_box align-items_box">
<view class="">
剩余时间
</view>
<view class="">
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false" :hour="paperCreateTime"
color="#ffaa7f" />
</view>
</view>
<!-- </view> -->
<!-- <pre>{{testPaper}}</pre> -->
</view>
<view class="question border_radius_10" v-if="curQuestion.id"> <view class="question border_radius_10" v-if="curQuestion.id">
<view class=""> <view class="">
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text> <text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text>
<text style="position: absolute; right: 20rpx; top: 30rpx; z-index: 2;"><i style="color: #00aaff; font-style: normal; margin-right: 10rpx;" class="">{{curIndex1+1}}
</i> / {{questionList.length}}</text>
<view class="questionItem" v-if="curQuestion.id"> <view class="questionItem" v-if="curQuestion.id">
<view class=""> <view class="">
<text>{{curQuestion.content}}</text> <text>{{curQuestion.content}}</text>
</view> </view>
<!-- <view class="">
{{curQuestion}}-{{curIndex1}}
</view> -->
<view class="optionsBox"> <view class="optionsBox">
<view <view :class="['item','border_radius_10',
:class="['item','border_radius_10',curQuestion.answerIds.includes(item.id) ? 'choosed' : '']" item.rightWrong == 1 ? 'right' : '',
@click="clickOption(item, index)" v-for="(item, index) in curQuestion.options" checkAnswer(item.id) && item.rightWrong == 0 ? 'wrong' : '',
:key="index"> checkAnswer(item.id) && item.rightWrong == 1 ? 'right' : ''
]"
v-for="(item, index) in curQuestion.options" :key="index">
<!-- {{checkAnswer(item.id) ? '包含' : '不包含'}} -->
<view class="flex_box flex_between">
<text>{{item.content}}</text> <text>{{item.content}}</text>
<text
v-if="checkAnswer(item.id)">{{item.rightWrong == 1 ? '正确':'错误'}}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -72,25 +73,9 @@
</view> </view>
<view class="item"> <view class="item">
<button @click="showNextQuestion" type="primary" <button @click="showNextQuestion" type="primary"
:disabled="curIndex1 == testPaper.length-1" size="mini">下一题</button> :disabled="curIndex1 == questionList.length-1" size="mini">下一题</button>
</view> </view>
</view> </view>
<!-- v-show="curIndex1 == testPaper.length-1 && !isOvertime" -->
<view class="" style="margin-top: 20rpx;"
>
<button @click="sumitAnswer" type="primary"> </button>
</view>
</view>
<view class="questIndx ">
<view class="" style="text-align: center; font-size: 24rpx; color: #666;">
<span>题目索引</span>
</view>
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="scroll-view-item_H" v-for="index of getallLIst" :key="index">
<text @click="clickIndex(index)"
:class="[ haveAnswerList.includes(index-1) ? 'green' : '', noAnswerList.includes(index-1) ? 'red' : '',(curIndex1+1) == index ? 'cur' :'']">{{index}}</text>
</view>
</scroll-view>
</view> </view>
</view> </view>
</view> </view>
@@ -100,8 +85,8 @@
<h3>考试说明</h3> <h3>考试说明</h3>
<view class="tips border_radius_10"> <view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br /> <text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br /> 请在倒计时结束前完成答题倒计时结束后将自动交卷
考试结束前中途离开视为放弃此次考试成绩为0分</text> </text>
</view> </view>
</view> </view>
</u-popup> </u-popup>
@@ -119,92 +104,49 @@
return { return {
showPopup: false, showPopup: false,
code: 0, // 英文code code: 0, // 英文code
classId: undefined, exameId: undefined,
testPaper: [], testPaper: [],
curQuestion: { curQuestion: {
answerIds: [] answerIds: []
}, },
questionList: [], // 试题列表
result: {}, // 考试结果 result: {}, // 考试结果
curIndex1: 0, curIndex1: 0,
paperCreateTime: 0, answerIdsList: [],
examId: undefined, haveNoAnswerNumber: 0, // 未作答数量
endTime: undefined, // 结束时间戳 rightNumber: 0 // 答题正确个数
isOvertime: false, // 是否超时
step: 8, /// 步长
// questIndexList: [],
nowPart: 1,
maxNumber: 0,
minNumber: 0,
noAnswerList: [],
haveAnswerList:[]
} }
}, },
async onLoad(e) { async onLoad(e) {
console.log('收到得值'); console.log('收到得值', e);
this.classId = e.classId this.exameId = e.id
if (this.testPaper.length == 0) {
this.getTestPage() 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() {
if (!this.isOvertime) { // 如果中途退出
this.giveZero()
}
}, },
onHide() {},
onShow() {},
computed: { computed: {
...mapState(["userInfo"]), ...mapState(["userInfo"]),
getallLIst() { // getallLIst() {
const numbers = Array.from(Array(100).keys(), n => n + 1); // const numbers = Array.from(Array(100).keys(), n => n + 1);
console.log('numbers', numbers); // console.log('numbers', numbers);
return numbers // return numbers
} // }
}, },
methods: { methods: {
// 单个题的提交 checkAnswer(id){
saveQuestAnswer(paperId,questIndex,ids){ var _list = [...this.answerIdsList]
console.log('收到的值',paperId,questIndex,ids); var _list1 = []
$http.request({ _list = _list.map( item => {
url: "common/classExam/submitOption", return item.split(',')
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'
}) })
for (var i = 0; i < _list.length; i++) {
for (var j = 0; j < _list[i].length; j++) {
if(id == _list[i][j]){
return true
} }
}
}).catch(e => { }
console.log(e, '数据报错') return false
uni.showToast({
title: e.errMsg,
icon: 'error'
})
});
}, },
getNoAnswerList() { getNoAnswerList() {
var list = [] var list = []
@@ -230,78 +172,19 @@
} }
return list return list
}, },
// 倒计时结束 (超时)
timeup() {
this.isOvertime = true
this.sumitAnswer()
let that = this
uni.showModal({
title: '提示',
content: "考试结束,系统已为您自动交卷",
confirmText: '知道了',
showCancel: false,
success: (res) => {
if (res.confirm) {
// that.goToClass()
}
}
})
},
// 获取交卷数据 // 获取交卷数据
sumitAnswer() { sumitAnswer() {
// var list = []
// var _newList = this.testPaper.map(item => {
// return item.answerIds
// })
// _newList = _newList.map(item => {
// return item.join(',')
// })
// console.log('_newList', _newList);
// list = _newList
// return list
this.sumbitPaper() this.sumbitPaper()
}, },
// q请求提交试卷
sumbitPaper(ids) {
$http.request({
url: "common/classExam/submitExamPaper",
method: "POST",
data: {
id: this.examId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
uni.hideLoading()
if (res.code == 0) {
uni.showToast({
title: '交卷成功',
icon: 'success'
})
this.isOvertime = true
}
}).catch(e => {
uni.hideLoading()
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: e.errorMsg,
icon: 'error'
})
});
},
showPrevQuestion() { showPrevQuestion() {
// 上一题 // 上一题
this.curIndex1-- this.curIndex1--
// this.curQuestion.answerIds = [] // this.curQuestion.answerIds = []
this.curQuestion = { this.curQuestion = {
...this.testPaper[this.curIndex1] ...this.questionList[this.curIndex1]
} }
console.log('----------------', this.testPaper ); // console.log('----------------', this.testPaper );
// this.haveAnswerList = this.gethaveAnswerList() // this.haveAnswerList = this.gethaveAnswerList()
}, },
showNextQuestion() { showNextQuestion() {
@@ -309,38 +192,9 @@
this.curIndex1++ this.curIndex1++
// this.curQuestion.answerIds = [] // this.curQuestion.answerIds = []
this.curQuestion = { this.curQuestion = {
...this.testPaper[this.curIndex1] ...this.questionList[this.curIndex1]
} }
console.log('+++++++++++++++', this.testPaper, );
this.haveAnswerList = this.gethaveAnswerList()
},
clickOption(item, index) {
console.log('item', item, index, this.curIndex1);
if (this.curQuestion.type == 0) {
this.testPaper[this.curIndex1].answerIds = [item.id]
this.curQuestion.answerIds = [item.id]
// console.log('666666666', this.testPaper, 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.testPaper[this.curIndex1].answerIds.splice(isIN, 1)
this.curQuestion.answerIds.splice(isIN, 1)
} else {
this.testPaper[this.curIndex1].answerIds.push(item.id)
this.curQuestion.answerIds = [...this.testPaper[this.curIndex1].answerIds]
}
}
this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList()
console.log('this.testPaper.',this.testPaper.id);
this.saveQuestAnswer(this.examId,this.curIndex1+1,this.curQuestion.answerIds.join(','))
console.log('noAnswerList', this.noAnswerList)
}, },
setDesc() { setDesc() {
const letterArr = [] const letterArr = []
@@ -352,13 +206,13 @@
}, },
getTestPage() { getTestPage() {
uni.showLoading({ uni.showLoading({
title: '正在生成试卷' title: '正在展开试卷'
}) })
$http.request({ $http.request({
url: "common/classExam/generateExamPaper", url: "common/classExam/getExamPaperInfo",
method: "POST", method: "POST",
data: { data: {
"classId": this.classId "id": this.exameId
}, },
header: { //默认 无 说明:请求头 header: { //默认 无 说明:请求头
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -368,8 +222,10 @@
uni.hideLoading() uni.hideLoading()
if (res.code == 0) { if (res.code == 0) {
// that.isHave = true // that.isHave = true
res.examPaper.forEach(item => { var subOptions = JSON.parse(res.examPaper.subject)
item.answerIds = []
subOptions.forEach(item => {
var code = 0 var code = 0
item.options.forEach(item1 => { item.options.forEach(item1 => {
const randomAbc = this.setDesc().splice(65) const randomAbc = this.setDesc().splice(65)
@@ -377,22 +233,38 @@
code++ code++
}) })
}) })
this.questionList = subOptions
this.testPaper = res.examPaper this.testPaper = res.examPaper
this.examId = res.id this.answerIdsList = JSON.parse(res.examPaper.answer)
this.paperCreateTime = 1 var newList = JSON.parse(res.examPaper.answer)
this.endTime = this.hourUp(1) newList = newList.map(item => {
console.log('this.endTime', this.endTime); // console.log('item.substring(0,item.length - 2)',item.substring(0,item.length - 2));
this.curQuestion = { return item.substr(item.length - 1)
...this.testPaper[this.curIndex1]
}
uni.showToast({
title: '获取成功',
icon: 'success'
}) })
console.log(res, '试卷', this.curQuestion) this.rightNumber = 0
// setTimeout(() => { newList.forEach(item => {
// this.getClassInfo() if (item == '1') {
// }, 500) this.rightNumber += 1
}
})
console.log('newList', newList);
this.answerIdsList = this.answerIdsList.map(item => {
// console.log('item.substring(0,item.length - 2)',item.substring(0,item.length - 2));
return item.substring(0, item.length - 2)
})
this.haveNoAnswerNumber = 0
this.answerIdsList.forEach(item => {
if (item == '') {
this.haveNoAnswerNumber += 1
}
})
// this.examId = res.id
this.curQuestion = {
...this.questionList[this.curIndex1]
}
console.log('subOptions', subOptions, 'answerIdsList', this.answerIdsList);
// console.log(questionList, '试卷', this.curQuestion)
} else { } else {
uni.showToast({ uni.showToast({
title: res.errMsg, title: res.errMsg,
@@ -412,15 +284,7 @@
}) })
}); });
}, },
giveZero() {
// 没有完成完成考试记为0分
},
showElart() {
// uni.showModal({
// title:'提示',
// content:"您还没有完成考试确定要离开吗离开后成绩会记为0分是否继续"
// })
},
goToClass() { goToClass() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/miniClass/classInfo?id=${this.classId}` url: `/pages/miniClass/classInfo?id=${this.classId}`
@@ -430,21 +294,12 @@
this.showPopup = false this.showPopup = false
}, },
clickIndex(val) { clickIndex(val) {
this.curIndex1 = val - 1 this.curIndex1 = val - 1
console.log('val', val, this.curIndex1, this.testPaper.length); console.log('val', val, this.curIndex1, this.testPaper.length);
this.curQuestion = this.testPaper[this.curIndex1] this.curQuestion = this.testPaper[this.curIndex1]
this.noAnswerList = this.getNoAnswerList() this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList() this.haveAnswerList = this.gethaveAnswerList()
}, },
hourUp(e) {
// 比现在多几个小时
var end = Date.now()
var start = 1000 * 60 * 60 * e
var interval = end + start; //结束 - 开始 = 毫秒值
var a = new Date(interval)
return a
},
} }
} }
</script> </script>
@@ -452,14 +307,26 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/style/mixin.scss"; @import "@/style/mixin.scss";
.questIndx { overflow: hidden; .questIndx {
overflow: hidden;
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
span{padding: 20rpx 0; display: inline-block;}
.red{border-color: #f56c6c; color: #f56c6c;} span {
.green{ padding: 20rpx 0;
border-color: #67c23a; color: #67c23a; display: inline-block;
} }
.red {
border-color: #f56c6c;
color: #f56c6c;
}
.green {
border-color: #67c23a;
color: #67c23a;
}
text { text {
background-color: #fff; background-color: #fff;
padding: 6rpx 10rpx; padding: 6rpx 10rpx;
@@ -535,18 +402,20 @@
} }
.haveResult { .haveResult {
margin-bottom: 20rpx;
background-color: #fff; background-color: #fff;
padding: 20rpx; padding: 20rpx;
text-align: center; text-align: center;
} }
.scoreBox { .scoreBox {
margin-top: 100rpx; overflow: hidden;
color: #333; color: #333; margin:20rpx 0;
margin-bottom: 50rpx;
} }
.score { .score {
color: $themeColor;
font-size: 50rpx; font-size: 50rpx;
} }
@@ -557,15 +426,50 @@
position: relative; position: relative;
} }
.otherItems {
// border: 1px solid #dadada;
text-align: center;
// background-color: rgba(255, 255, 255, .5);
border-radius: 20rpx;
justify-content: space-around;
.itt {
margin: 0 20rpx;
}
text {
display: block;
font-size: 28rpx;
}
.ciyao {
color: #999;
margin-bottom: 10rpx;
}
}
.optionsBox { .optionsBox {
margin: 30rpx 0; margin: 30rpx 0;
.item { .item {
border: 1px solid #eee; border: 1px solid #eee;
padding: 24rpx 20rpx; padding: 16rpx 12rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.right {
border-color: #c2e7b0;
color: #67c23a;
background-color: #fef0f0;
}
.wrong {
border-color: #fbc4c4;
color: #f56c6c;
background-color: #f0f9eb;
}
.choosed { .choosed {
border-color: #b3d8ff; border-color: #b3d8ff;
color: #409eff; color: #409eff;

View File

@@ -6,13 +6,14 @@
@click="showPopup = true">考试说明</text> @click="showPopup = true">考试说明</text>
</z-nav-bar> </z-nav-bar>
<!-- 有考试结果时候 --> <!-- 有考试结果时候 -->
<template> <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">90</text>
</view> </view>
<view class=""> <view class="">
<button type="primary" @click="goToClass">返回班级</button> <button type="primary" @click="goToPaper">查看试卷</button> <button type="primary" @click="goToClass">返回班级</button>
<button type="primary" @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>
@@ -20,12 +21,7 @@
</view> </view>
</template> </template>
<!-- 没有考试结果的时候 --> <!-- 没有考试结果的时候 -->
<template> <template v-else>
<!-- <view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br />
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view> -->
<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="paperCreateTime > 0">
<!-- <view class=""> --> <!-- <view class=""> -->
@@ -33,12 +29,15 @@
<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}}
</i> / {{testPaper.length}}</text> </i> / {{testPaper.length}}</text>
</view> </view>
<view class="flex_box align-items_box"> <view class="flex_box align-items_box" v-if="secondTimeDif > 0">
<view class=""> <view class="">
剩余时间 剩余时间
</view> </view>
<view class=""> <view class="">
<uni-countdown @timeup="timeup" :font-size="20" :show-day="false" :hour="paperCreateTime" <uni-countdown @timeup="timeup" :font-size="20" :show-day="false"
:hour="timeDif.hour"
:minute="timeDif.minutes"
:second="timeDif.second"
color="#ffaa7f" /> color="#ffaa7f" />
</view> </view>
</view> </view>
@@ -48,13 +47,11 @@
<view class="question border_radius_10" v-if="curQuestion.id"> <view class="question border_radius_10" v-if="curQuestion.id">
<view class=""> <view class="">
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text> <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="questionItem" v-if="curQuestion.id">
<view class=""> <view class="">
<text>{{curQuestion.content}}</text> <text>{{curQuestion.content}}</text>
</view> </view>
<!-- <view class="">
{{curQuestion}}-{{curIndex1}}
</view> -->
<view class="optionsBox"> <view class="optionsBox">
<view <view
:class="['item','border_radius_10',curQuestion.answerIds.includes(item.id) ? 'choosed' : '']" :class="['item','border_radius_10',curQuestion.answerIds.includes(item.id) ? 'choosed' : '']"
@@ -70,27 +67,14 @@
<button @click="showPrevQuestion" type="default" plain="true" :disabled="curIndex1 == 0" <button @click="showPrevQuestion" type="default" plain="true" :disabled="curIndex1 == 0"
size="mini">上一题</button> size="mini">上一题</button>
</view> </view>
<view class="item" v-show="curIndex1 == testPaper.length-1 && !isOvertime">
<button @click="sumitAnswer" type="primary" size="mini"> </button>
</view>
<view class="item"> <view class="item">
<button @click="showNextQuestion" type="primary" <button @click="showNextQuestion" type="primary"
:disabled="curIndex1 == testPaper.length-1" size="mini">下一题</button> :disabled="curIndex1 == testPaper.length-1" size="mini">下一题</button>
</view> </view>
</view> </view>
<!-- v-show="curIndex1 == testPaper.length-1 && !isOvertime" -->
<view class="" style="margin-top: 20rpx;"
>
<button @click="sumitAnswer" type="primary"> </button>
</view>
</view>
<view class="questIndx ">
<view class="" style="text-align: center; font-size: 24rpx; color: #666;">
<span>题目索引</span>
</view>
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="scroll-view-item_H" v-for="index of getallLIst" :key="index">
<text @click="clickIndex(index)"
:class="[ haveAnswerList.includes(index-1) ? 'green' : '', noAnswerList.includes(index-1) ? 'red' : '',(curIndex1+1) == index ? 'cur' :'']">{{index}}</text>
</view>
</scroll-view>
</view> </view>
</view> </view>
</view> </view>
@@ -100,8 +84,25 @@
<h3>考试说明</h3> <h3>考试说明</h3>
<view class="tips border_radius_10"> <view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br /> <text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br /> 请在倒计时结束前完成答题倒计时结束后将自动交卷</text>
考试结束前中途离开视为放弃此次考试成绩为0分</text> </view>
</view>
</u-popup>
<u-popup key="2" :show="showQuestIndex" :round="10" @close="hidePopup">
<view class="guanli">
<h3>题目索引</h3>
<view class="">
<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">
<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>
</view> </view>
</u-popup> </u-popup>
@@ -111,7 +112,7 @@
<script> <script>
import $http from '@/config/requestConfig.js'; import $http from '@/config/requestConfig.js';
import { import {
mapState mapState,mapMutations
} from "vuex"; } from "vuex";
export default { export default {
data() { data() {
@@ -128,6 +129,7 @@
paperCreateTime: 0, paperCreateTime: 0,
examId: undefined, examId: undefined,
endTime: undefined, // 结束时间戳 endTime: undefined, // 结束时间戳
timeDif:{}, // 时间差(结束 - 现在)
isOvertime: false, // 是否超时 isOvertime: false, // 是否超时
step: 8, /// 步长 step: 8, /// 步长
// questIndexList: [], // questIndexList: [],
@@ -136,7 +138,9 @@
maxNumber: 0, maxNumber: 0,
minNumber: 0, minNumber: 0,
noAnswerList: [], noAnswerList: [],
haveAnswerList:[] haveAnswerList:[],
exameResult:{},
showQuestIndex:false,
} }
}, },
async onLoad(e) { async onLoad(e) {
@@ -152,8 +156,8 @@
if (!this.isOvertime) {} if (!this.isOvertime) {}
}, },
onShow() { onShow() {
this.endTime = this.hourUp(1) // this.endTime = this.hourUp(1)
console.log('this.endTime', this.endTime.getTime()); // console.log('this.endTime', this.endTime.getTime());
}, },
beforeDestroy() { beforeDestroy() {
if (!this.isOvertime) { // 如果中途退出 if (!this.isOvertime) { // 如果中途退出
@@ -171,6 +175,7 @@
}, },
methods: { methods: {
...mapMutations(['setPaperEndTime']),
// 单个题的提交 // 单个题的提交
saveQuestAnswer(paperId,questIndex,ids){ saveQuestAnswer(paperId,questIndex,ids){
console.log('收到的值',paperId,questIndex,ids); console.log('收到的值',paperId,questIndex,ids);
@@ -207,32 +212,32 @@
}, },
getNoAnswerList() { getNoAnswerList() {
var list = [] var list = []
if (this.curIndex1 > 0) { // if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) { for (var i = 0; i < this.testPaper.length; i++) {
if (this.testPaper[i].answerIds.length == 0) { if (this.testPaper[i].answerIds.length == 0 && this.testPaper[i].hadOpend) {
console.log('fuhe?'); console.log('fuhe?');
list.push(i) list.push(i)
} }
} }
} // }
return list return list
}, },
gethaveAnswerList() { gethaveAnswerList() {
var list = [] var list = []
if (this.curIndex1 > 0) { // if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) { for (var i = 0; i < this.testPaper.length; i++) {
if (this.testPaper[i].answerIds.length > 0) { if (this.testPaper[i].answerIds.length > 0 && this.testPaper[i].hadOpend) {
console.log('fuhe?'); // console.log('fuhe?');
list.push(i) list.push(i)
} }
} }
} // }
return list return list
}, },
// 倒计时结束 (超时) // 倒计时结束 (超时)
timeup() { timeup() {
this.isOvertime = true this.isOvertime = true
this.sumitAnswer() this.sumbitPaper()
let that = this let that = this
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -248,24 +253,29 @@
}, },
goToPaper(){ goToPaper(){
uni.navigateTo({ uni.navigateTo({
url: `/pages/miniClass/paperBack?id=${this.classId}` url: `/pages/miniClass/paperBack?id=${this.examId}`
}) })
}, },
// 获取交卷数据 // 获取交卷数据
sumitAnswer() { sumitAnswer() {
// var list = [] let that = this
// var _newList = this.testPaper.map(item => { // this.noAnswerList = await this.getNoAnswerList()
// return item.answerIds if(this.noAnswerList.length > 0){
// }) this.showQuestIndex = true
uni.showModal({
title:'提示',
content:'您有未作答的题目,是否继续交卷操作?',
cancelText:'点错了',
confirmText:'确定',
success(res) {
if (res.confirm) {
that.sumbitPaper()
}
},
})
}
// _newList = _newList.map(item => {
// return item.join(',')
// })
// console.log('_newList', _newList);
// list = _newList
// return list
this.sumbitPaper()
}, },
// q请求提交试卷 // q请求提交试卷
sumbitPaper(ids) { sumbitPaper(ids) {
@@ -306,8 +316,10 @@
this.curQuestion = { this.curQuestion = {
...this.testPaper[this.curIndex1] ...this.testPaper[this.curIndex1]
} }
this.testPaper[this.curIndex1].hadOpend = true
console.log('----------------', this.testPaper ); console.log('----------------', this.testPaper );
// this.haveAnswerList = this.gethaveAnswerList() this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList()
}, },
showNextQuestion() { showNextQuestion() {
// 下一题 // 下一题
@@ -316,7 +328,9 @@
this.curQuestion = { this.curQuestion = {
...this.testPaper[this.curIndex1] ...this.testPaper[this.curIndex1]
} }
console.log('+++++++++++++++', this.testPaper, ); this.testPaper[this.curIndex1].hadOpend = true
// console.log('+++++++++++++++', this.testPaper, );
this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList() this.haveAnswerList = this.gethaveAnswerList()
}, },
clickOption(item, index) { clickOption(item, index) {
@@ -375,6 +389,7 @@
// that.isHave = true // that.isHave = true
res.examPaper.forEach(item => { res.examPaper.forEach(item => {
item.answerIds = [] item.answerIds = []
item.hadOpend = false // 是否呗打开过
var code = 0 var code = 0
item.options.forEach(item1 => { item.options.forEach(item1 => {
const randomAbc = this.setDesc().splice(65) const randomAbc = this.setDesc().splice(65)
@@ -385,11 +400,23 @@
this.testPaper = res.examPaper this.testPaper = res.examPaper
this.examId = res.id this.examId = res.id
this.paperCreateTime = 1 this.paperCreateTime = 1
this.endTime = this.hourUp(1) this.endTime = this.hourUp(res.startTime,2) // 结束的时间戳
console.log('this.endTime', this.endTime); this.secondTimeDif = this.endTime - Date.now() // 时间差 毫秒
if(this.secondTimeDif > 0){
this.setPaperEndTime({time:this.endTime})
this.timeDif.hour = (this.secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
this.timeDif.minutes = (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{
this.setPaperEndTime(0)
}
console.log('本地存储的结束时间', this.$store.state.paperEndTime);
this.curQuestion = { this.curQuestion = {
...this.testPaper[this.curIndex1] ...this.testPaper[this.curIndex1]
} }
this.testPaper[this.curIndex1].hadOpend = true
uni.showToast({ uni.showToast({
title: '获取成功', title: '获取成功',
icon: 'success' icon: 'success'
@@ -433,22 +460,30 @@
}, },
hidePopup() { hidePopup() {
this.showPopup = false this.showPopup = false
this.showQuestIndex = false
}, },
clickIndex(val) { clickIndex(val) {
this.curIndex1 = val - 1 this.curIndex1 = val - 1
console.log('val', val, this.curIndex1, this.testPaper.length); console.log('val', val, this.curIndex1, this.testPaper.length);
for (var i = 0; i < this.curIndex1; i++) {
this.testPaper[i].hadOpend = true
}
this.curQuestion = this.testPaper[this.curIndex1] this.curQuestion = this.testPaper[this.curIndex1]
this.testPaper[this.curIndex1].hadOpend = true
this.hidePopup()
this.noAnswerList = this.getNoAnswerList() this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList() this.haveAnswerList = this.gethaveAnswerList()
}, },
hourUp(e) { hourUp(start,e) {
// 比现在多几个小时 // 比现在多几个小时
var end = Date.now() // var end = Date.now()
var start = 1000 * 60 * 60 * e var startTimeDate = new Date(start)
var interval = end + start; //结束 - 开始 = 毫秒值 var startTime = startTimeDate.getTime();
var a = new Date(interval) var step = 1000 * 60 * 60 * e // 时间间隔
return a var interval = startTime + step; //开始 + 时长 = 结束的毫秒数
// var a = new Date(interval)
console.log('aaaaaaaaaa结束时间的毫秒数时间戳',interval);
return interval
}, },
} }
} }
@@ -466,14 +501,16 @@
border-color: #67c23a; color: #67c23a; border-color: #67c23a; color: #67c23a;
} }
text { text {
font-size: 28rpx;
background-color: #fff; background-color: #fff;
padding: 6rpx 10rpx; // padding: 6rpx 10rpx;
display: flex; display: flex;
justify-content: center; // justify-content: center;
border-radius: 10rpx; border-radius: 10rpx;
align-items: center; // align-items: center;
width: 60rpx; width: 70rpx;
height: 60rpx; height: 70rpx;
line-height: 70rpx;
text-align: center; text-align: center;
border: 1px solid #eee; border: 1px solid #eee;
} }
@@ -486,7 +523,8 @@
.guanli { .guanli {
padding: 40rpx; padding: 40rpx;
max-height: 60vh;
overflow-y: scroll;
h3 { h3 {
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
@@ -512,7 +550,15 @@
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
border-radius: 0 50rpx 50rpx 0; border-radius: 0 50rpx 50rpx 0;
} }
.checkQuestBtn {
position: absolute;
right: 20rpx;
top: 20rpx;
border: 1px solid $themeColor;
color: $themeColor;
// padding: 10rpx 20rpx;
// border-radius: 0 50rpx 50rpx 0;
}
.scroll-Y { .scroll-Y {
height: 300rpx; height: 300rpx;
} }
@@ -567,8 +613,8 @@
.item { .item {
border: 1px solid #eee; border: 1px solid #eee;
padding: 24rpx 20rpx; padding: 16rpx 12rpx;
margin-bottom: 20rpx; margin-bottom: 16rpx;
} }
.choosed { .choosed {
@@ -605,12 +651,20 @@
} }
.questIndx { .questIndx {
.cur { .cur {
border-color:#409eff ;
background-color: #409eff; background-color: #409eff;
color: #fff; color: #fff;
} }
} }
.questIndxPup{
justify-content: space-around;
flex-wrap: wrap;
text{
display: inline-block; margin: 10rpx;
}
}
.btnBox { .btnBox {
.item { .item {
width: 40%; width: 40%;

View File

@@ -1,8 +1,22 @@
export const state = { export const state = {
//用户数据 //用户数据
userInfo: {}, userInfo: {},
// paperEndTime:0
}; };
export const mutations = { export const mutations = {
setPaperEndTime(state, data) {
// console.log(state)
// console.log(data)
if (data) {
state.paperEndTime = Object.assign({}, state.paperEndTime, data);
// #ifdef H5
window.sessionStorage.setItem('paperEndTime', JSON.stringify(state.paperEndTime));
// #endif
// #ifndef H5
uni.setStorageSync('paperEndTime', state.paperEndTime);
// #endif
}
},
//储存用户信息 //储存用户信息
setUserInfo(state, data) { setUserInfo(state, data) {
// console.log(state) // console.log(state)