This commit is contained in:
@fawn-nine
2024-09-04 17:10:50 +08:00
parent 69cbc35e0a
commit a9f706e96f
11 changed files with 1491 additions and 569 deletions

View File

@@ -51,7 +51,7 @@
</view>
</uni-forms-item>
</view>
<view class="input_box" v-if="form.type == 2">
<view class="input_box" v-if="false">
<radio-group @change="radioChange" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" :checked="0 == form.display" />他人不可见</label>
@@ -133,7 +133,10 @@ import $http from '@/config/requestConfig.js';
console.log('收到的值', e);
if(e.sort != 'undefined' && e.sort){
this.form.sort = e.sort
}
}
if(e.type = 2){
this.form.display = '0'
}
this.pageType = e.type
this.form.classId = e.classId
this.form.type = e.type

View File

@@ -209,13 +209,13 @@
</view>
</view>
</view>
<view class="" v-if="tijiaoTitleId == 2" style="margin: 20rpx 0;">
<view class="" v-if="tijiaoTitleId == 2 && false" style="margin: 20rpx 0;">
<radio-group @change="radioChange1" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" checked="true" />全部同学的</label>
<radio value="0" />全部同学的</label>
</view>
<view class="">
<radio value="1" />只看我自己的</label>
<radio value="1" checked="true" />只看我自己的</label>
</view>
</radio-group>
</view>
@@ -472,7 +472,7 @@
tijiaoTitleId: '0',
taskList: [], // 任务列表
taskHaveMore: false, // 是否还有更多
myExperience: '0',
myExperience: '1',
performanceScore: {
task1Score: 0,
experienceScore: 0,
@@ -833,7 +833,7 @@
console.log('e班内提交子按钮', this.tijiaoTitleId);
this.pPage = 0
this.taskList = []
this.myExperience = 0
this.myExperience = '1'
this.getList()
},
getUserInfo() {

View File

@@ -369,9 +369,9 @@
<view class="item">
<text><b>电话</b>{{thisStudent.student.tel}}</text>
</view>
<view class="item">
<!-- <view class="item">
<b>课程购买情况</b><br />{{thisStudent.buyState}}
</view>
</view> -->
<view class="scoreBox flex_box flex_between border_radius_10 " >
<view class="">
<view class="ciyao">
@@ -407,11 +407,7 @@
></view> -->
</view>
</view>
</u-popup>
<!-- <view class="fabBox">
<uni-fab ref="fab" :pattern="pattern" :content="fabContent" :horizontal="horizontal" :vertical="vertical"
:direction="direction" @trigger="fabTrigger" @fabClick="fabClick" />
</view> -->
</u-popup>
</view>
</template>
@@ -441,20 +437,7 @@
buttonColor: '#007AFF',
iconColor: '#fff'
},
fabContent: [{
iconPath: '/static/icon/pigai2.png',
selectedIconPath: '/static/icon/pigai2.png',
text: '发布作业',
active: false
},
{
iconPath: '/static/icon/pigai1.png',
selectedIconPath: '/static/icon/pigai1.png',
text: '发布医案',
active: false
},
],
thisClass: {
showOverBtn: false
},
@@ -541,17 +524,17 @@
onLoad(e) {
uni.hideTabBar();
this.classId = e.id
this.interval = setInterval(() => {
if (this.thisClass.id) {
uni.showLoading({
title: '加载中'
})
this.getRealRole()
// this.interval = setInterval(() => {
// if (this.thisClass.id) {
// uni.showLoading({
// title: '加载中'
// })
this.getUserInfo()
clearInterval(this.interval)
console.log('定时清了吗');
}
}, 500)
// clearInterval(this.interval)
// console.log('定时清了吗');
// }
// }, 500)
},
onPullDownRefresh() {
@@ -662,7 +645,7 @@
url: "common/class/getUserRole",
method: "POST",
data: {
"classId": this.thisClass.id
"classId": this.classId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -870,31 +853,7 @@
},
closeManager() {
this.showMan = false
},
fabClick() {
// uni.showToast({
// title: '点击了悬浮按钮',
// icon: 'none'
// })
},
fabTrigger(e) {
console.log(e)
this.fabContent[e.index].active = !e.item.active
var _url = '/pages/miniClass/addHomeWork'
var _type = '0'
if (e.index == 0) {
// 发布作业/医案
_type = '0'
} else {
_type = '1'
}
this.$refs.fab.close()
setTimeout(() => {
uni.navigateTo({
url: `${_url}?classId=${this.thisClass.id}&type=${_type}`
})
}, 200)
},
},
// 获取固定作业的数量
async getHomeWorkLength() {
var list = []
@@ -1639,6 +1598,7 @@
.item {
border: 1px solid #fff;
padding: 10rpx;
}
}
@@ -1860,14 +1820,14 @@
color: #666;
font-size: 30rpx;
margin-top: 20rpx;
}
}
.zhengshu{width: 80rpx; height: 80rpx; background-size: contain;}
.Azheng{background-image: url(@/static/icon/Az.png);}
.Bzheng{background-image: url(@/static/icon/Bz.png);}
.scoreBox{
align-items: center;
align-items: center; border: 1px solid #f1f1f1;
margin-top: 20rpx;
text-align: center; background-color: #fff; padding: 20rpx;
text-align: center; background-color: #fff; padding: 10rpx 20rpx;
.ciyao{color: #999;}
.score{color: #258feb; font-weight: bold; font-size: 36rpx;}
.seePaper{width: 50rpx; height: 50rpx;

View File

@@ -4,14 +4,12 @@
<z-nav-bar title="班级详情"></z-nav-bar>
<!-- <view class="" style="background-color: #f4f7ff; min-height: calc(100vh - 200rpx);"> -->
<view class="mainContent" v-if="thisClass.id">
<!-- <view class="" style="height: 40rpx;">
</view> -->
<view class="mainContent" v-if="thisClass.id">
<view :class="['classStatus',
this.thisClass.state == 0 ? 'daikai' :'',
this.thisClass.state == 1 ? 'xuexizhong' :'',
this.thisClass.state == 2 ? 'yijieban' :''
thisClass.state == '0' ? 'daikai' :'',
thisClass.state == '1' ? 'xuexizhong' :'',
thisClass.state == '2' ? 'yijieban' :'',
thisClass.state == '3' ? 'kaoshizhou' :''
]">
{{getClassStatus}}
</view>
@@ -24,7 +22,7 @@
<view class="waitOpen" v-if="thisClass.state == '0'">
<text>等待开班</text>
</view>
<class-infoWork-blank v-else :thisClass="thisClass" :roleCode="roleCode"></class-infoWork-blank>
<class-infoWork-blank v-else :thisClass="thisClass" :roleCode="roleCode" :classModel="classModel"></class-infoWork-blank>
</view>
<view class="mainBox">
<view class="">
@@ -35,39 +33,113 @@
<!-- 学员列表 -->
<view class="" v-if="tabId == '2'">
<view class="classMateBox" v-show="students.length> 0 ">
<uni-section class="mb-10 nobg xueyuanTitle" title="班内学员" type="line" sub-title="">
{{students.length}} 名学员</uni-section>
<view class="" style=" overflow: hidden;">
<uni-section class="mb-10 nobg xueyuanTitle" title="班内学员" type="line" sub-title="">
{{students.length}} 名学员</uni-section>
</view>
<view class=" tips">
<view class="flex_box">
<view class="item flex_box">
<span class=""></span><text>普通用户</text>
</view>
<view class="item flex_box">
<span class="superVip"></span><text>超级VIP</text>
</view>
<view class="item flex_box">
<span class="wumenVip"></span><text>医学VIP</text>
</view>
<view class="item flex_box">
<span class="zmVip"></span><text>国学VIP</text>
</view>
</view>
<view v-if="thisClass.state == '2'" class=" zhiliang flex_box flex_between align-items_box" style="margin-top: 20rpx;">
<view class="">
<text>A证</text>
<text>20 </text>
</view>
<view class="">
<text>B证</text>
<text>20 </text>
</view>
<view class="">
<text>不合格</text>
<text>20 </text>
</view>
</view>
</view>
<view class="newBox">
<view :class="['item','flexbox',
<view :class="['item',
item.student.vip == '1' ? 'superVip' : '',
item.student.vip == '2' ? 'wumenVip' : '',
item.student.vip == '3' ? 'zmVip' : '',
thisStudent.student && thisStudent.student.id == item.student.id ? 'cur' : ''
]" v-for="(item, index) in students" :key="index" @click="clickStudent(item)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="classmateImg">
<image v-if="item.student.avatar != null && item.student.avatar != ''"
:src="item.student.avatar" mode="aspectFit"></image>
<image v-else src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
</view>
<view :class="['textItems','flex_box']">
<text class="txt555"
v-if="item.student.nickname != null && item.student.nickname != ''">
{{item.student.nickname}}
<template>
<text>{{item.student.tel}}</text>
</template>
</text>
<text class="txt555" v-else>
匿名用户
</text>
<!-- <text class="userType" v-if="item.student.vip == '1'">超级VIP用户</text>
<view class="flexbox align-items_box">
<view class="classmateImg">
<image v-if="item.student.avatar != null && item.student.avatar != ''"
:src="item.student.avatar" mode="aspectFit"></image>
<image v-else src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
</view>
<view :class="['textItems','flex_box']">
<text class="txt555"
v-if="item.student.nickname != null && item.student.nickname != ''">
{{item.student.nickname}}
<template>
<text>{{item.student.tel}}</text>
</template>
</text>
<text class="txt555" v-else>
匿名用户
</text>
<text @click.stop="outClass(item.student.id)" class="outBtn"
v-if="thisClass.state != '2' && thisClass.state != '3'">踢出班级</text>
<!-- <text class="userType" v-if="item.student.vip == '1'">超级VIP用户</text>
<text class="userType" v-if="item.student.vip == '2' ">医学VIP用户</text>
<text class="userType" v-if="item.student.vip == '3' ">国学VIP用户</text> -->
</view>
</view>
<view class="" v-if="thisClass.state == '3' || thisClass.state == '2'">
<view class="scoreBox flex_box flex_between border_radius_10 ">
<view class="">
<view class="ciyao">
平时成绩
</view>
<text class="score">{{item.student.score.peacetimeScore}}</text>
</view>
<template v-if="classModel.isExam == 1">
<template v-if="item.student.score.testScore.length == 0">
<view class="" v-if="thisClass.state == '3'">
<view class="" style="color: #ff9496;">
未考试
</view>
</view>
<view class="" v-if="thisClass.state == '2'">
<view class="ciyao">
考试成绩
</view>
<text class="score">0</text>
</view>
</template>
<template v-else >
<view class="" v-if="thisClass.state == '3'">
<view class="" style="color: #55aa7f;">
等待公布分数
</view>
</view>
<view v-if="thisClass.state == '2'">
<view class="ciyao">
考试成绩
</view>
<text class="score">{{item.student.score.testScoreNumber}}</text>
</view>
</template>
</template>
<!-- -->
<view v-if="classModel.isExam == 1 && thisClass.state == '2'" :class="['PM_font','zhengshu',item.student.score.certificateType == 'A' ? 'Azheng' : 'Bzheng']"
></view>
</view>
</view>
</view>
</view>
</view>
@@ -77,18 +149,18 @@
</view>
<view class="" v-if="tabId == '0'">
<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="mainTxt">{{thisClass.createTime.substring(0,10)}}</text>
</view>
<view class="itt" v-if="thisClass.state == 1">
<view class="itt" v-if="thisClass.state == '1' || thisClass.state == '3'">
<text class="ciyao">开班日期</text>
<text
class="mainTxt">{{thisClass.startTime.substring(0,10)}}</text>
</view>
<view class="itt" v-if="thisClass.state == 2">
<view class="itt" v-if="thisClass.state == '2'">
<text class="ciyao">结班日期</text>
<text
class="mainTxt">{{thisClass.endTime.substring(0,10)}}</text>
@@ -184,19 +256,51 @@
<view class="item">
<text><b>电话</b>{{thisStudent.student.tel}}</text>
</view>
<view class="item">
<!-- <view class="item">
<b>课程购买情况</b><br />{{thisStudent.buyState}}
</view> -->
<view class="scoreBox flex_box flex_between border_radius_10 " >
<view class="">
<view class="ciyao">
平时成绩
</view>
<text class="score">{{thisStudent.student.score.peacetimeScore}}</text>
</view>
<template v-if="classModel.isExam == 1">
<template v-if="thisStudent.student.score.testScore.length == 0">
<view class="">
<view class="">
未参加考试
</view>
</view>
</template>
<template v-else >
<view class="" v-for="(item1, index1) in thisStudent.student.score.testScore">
<view class="ciyao">
{{index1 == 0 ? '一' : '二'}}次考试成绩
</view>
<view class="flex_box flex_center" @click.stop="seePaper(item1.testPaperId)">
<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>
<!-- <view class="fabBox">
<uni-fab ref="fab" :pattern="pattern" :content="fabContent" :horizontal="horizontal" :vertical="vertical"
:direction="direction" @trigger="fabTrigger" @fabClick="fabClick" />
</view> -->
</u-popup>
</view>
</template>
<script>
const classData = require('@/data/classInfoMan.json')
const studentList = require('@/data/manStudentsList.json')
import classInfoWorkBlank from "@/components/classInfoWorkBlank.vue";
import $http from '@/config/requestConfig.js';
import {
@@ -214,20 +318,7 @@
selectedColor: '#7A7E83',
buttonColor: '#007AFF',
iconColor: '#fff'
},
fabContent: [{
iconPath: '/static/icon/pigai2.png',
selectedIconPath: '/static/icon/pigai2.png',
text: '发布作业',
active: false
},
{
iconPath: '/static/icon/pigai1.png',
selectedIconPath: '/static/icon/pigai1.png',
text: '发布医案',
active: false
},
],
},
thisClass: {},
students: [],
@@ -296,7 +387,7 @@
taskHaveMore: false, // 是否还有更多
roleCode: [], // 角色数组
interval: null,
homeWorkList: [],
// homeWorkList: [],
thisStudent: {},
showStudentBlank: false,
}
@@ -304,17 +395,17 @@
onLoad(e) {
uni.hideTabBar();
this.classId = e.id
this.interval = setInterval(() => {
if (this.thisClass.id) {
uni.showLoading({
title: '加载中'
})
this.getRealRole()
// this.interval = setInterval(() => {
// if (this.thisClass.id) {
// uni.showLoading({
// title: '加载中'
// })
this.getUserInfo()
clearInterval(this.interval)
console.log('定时清了吗');
}
}, 500)
// clearInterval(this.interval)
// console.log('定时清了吗');
// }
// }, 500)
},
onPullDownRefresh() {
@@ -382,6 +473,9 @@
case '2':
_roleName = '已结班';
break;
case '3':
_roleName = '考试周';
break;
}
return _roleName
}
@@ -414,7 +508,7 @@
url: "common/class/getUserRole",
method: "POST",
data: {
"classId": this.thisClass.id
"classId": this.classId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -422,7 +516,7 @@
})
.then((res) => {
uni.hideLoading()
console.log('res获取身份信息', this.thisClass.id, res);
console.log('res获取身份信息', res);
this.roleCode = res.result
}).catch(e => {
uni.hideLoading()
@@ -543,10 +637,8 @@
if (this.userInfo.id != undefined) {
this.$http.post("common/user/getUserInfo").then((res) => {
uni.hideLoading()
this.userMes = res.result;
this.isMonitor = res.isMonitor
this.isDirector = res.isDirector
this.getRealRole()
this.userMes = res.result;
// this.getRealRole()
}).catch(e => {
uni.hideLoading()
@@ -618,122 +710,7 @@
closeManager() {
this.showMan = false
},
fabClick() {
// uni.showToast({
// title: '点击了悬浮按钮',
// icon: 'none'
// })
},
fabTrigger(e) {
console.log(e)
this.fabContent[e.index].active = !e.item.active
var _url = '/pages/miniClass/addHomeWork'
var _type = '0'
if (e.index == 0) {
// 发布作业/医案
_type = '0'
} else {
_type = '1'
}
this.$refs.fab.close()
setTimeout(() => {
uni.navigateTo({
url: `${_url}?classId=${this.thisClass.id}&type=${_type}`
})
}, 200)
},
// 获取固定作业的数量
async getHomeWorkLength() {
var list = []
await $http.request({
url: "common/class/getClassTaskList",
method: "POST",
data: {
"limit": 100,
"page": 1,
"classId": this.thisClass.id,
"type": "0", //类型 0班内任务1医案2心得
"title": ""
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
}
}).then((res) => {
// console.log('班内作业的输俩个',res);
if (res.code == 0) {
list = res.page.records
}
}).catch(e => {
list = []
console.log('e', e);
})
return list
},
// 改变班级状态
changeClassStatu(statusCode) {
// var mm = 0
// mm = await this.getHomeWorkLength()
let that = this
if (statusCode == '1') {
console.log('this.admins', this.admins);
if (this.homeWorkList.length == 0) {
uni.showToast({
title: '开班前请发布班内作业,开班后将不可添加和更改',
icon: 'none',
duration: 3000
})
return
}
if (this.students.length < this.thisClass.number) {
uni.showModal({
title: "提示",
content: '班内成员还没有招满,确定开班操作吗?',
success(res) {
if (res.confirm) {
that.opClass(statusCode)
} else {
return
}
},
})
}
} else {
that.opClass(statusCode)
}
},
// 班级操作
opClass(statusCode) {
$http.request({
url: "common/class/editClass",
method: "POST",
data: {
"id": this.thisClass.id,
"title": this.thisClass.title,
"qrcode": this.thisClass.qrcode,
"state": statusCode, //小班状态0待开班1已开班2完成
"icon": this.thisClass.icon,
"content": this.thisClass.content,
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
// that.isHave = true
uni.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
this.getClassInfo()
}, 500)
}
}).catch(e => {
console.log(e, '数据报错')
});
},
taskEdit(item) {
console.log('taskEdit'.item);
},
@@ -742,6 +719,19 @@
url: `/pages/miniClass/classCaskList?id=${this.thisClass.id}&type=${this.tijiaoTitleId}`
})
},
// 考试周和结班状态下,学员的信息
async getStudentScoreList() {
var list = undefined
await this.$http
.post('book/user/info/' + this.userInfo.id)
.then(res => {
// this.userMsg = res.user
list = studentList
}).catch(e => {
list = []
});
return list
},
async getClassInfo() {
uni.showLoading({
title: '正在加载'
@@ -760,8 +750,18 @@
console.log('res--------', this.classId, res, );
this.refresh = false
if (res.code == 0) {
res = classData // 测试数据
this.isHave = res.result.isJoin
this.thisClass = res.result.class
if (!this.showAlert && this.thisClass.state == '3') {
uni.showModal({
title: '提示',
content: '您好,当前教学进度已进入考试周,请完成平时成绩打分,考试周结束后将无法评分,感谢您对吴门医述教务的大力支持。',
confirmText: '好的',
showCancel: false
})
this.showAlert = true
}
this.admins.list = res.result.admins
this.admins.monitor = {}
this.admins.dmonitor = {}
@@ -793,11 +793,14 @@
this.classModel = res.result.classModel
this.courses = res.result.courses
this.students = res.result.students
this.refresh = true
if (this.thisClass.state == 0) {
this.homeWorkList = await this.getHomeWorkLength()
if (this.thisClass.state == '3' || this.thisClass.state == '2') {
// 考试周 结班状态下的
this.students = await this.getStudentScoreList()
// console.log('students', this.students);
} else {
this.students = res.result.students
}
this.refresh = true
}
uni.hideLoading()
@@ -920,7 +923,9 @@
.xuexizhong {
background-image: linear-gradient(-90deg, #55aa00 0%, rgba(255, 255, 255, 0.1) 80%, rgba(255, 255, 255, 0) 100%);
}
.kaoshizhou {
background-image: linear-gradient(-90deg, #ffaa00 0%, rgba(255, 255, 255, 0.1) 80%, rgba(255, 255, 255, 0) 100%);
}
.yijieban {
background-image: linear-gradient(-90deg, #999 0%, rgba(255, 255, 255, 0.1) 80%, rgba(255, 255, 255, 0) 100%);
}
@@ -1102,7 +1107,33 @@
background-image: linear-gradient(30deg, #d4eaf0 0%, #d4eaf0 50%, #fdf0ed 100%);
min-height: 100vh;
}
.zhiliang{
font-size: 28rpx;
}
.tips {
padding: 20rpx 10rpx;
background-color: #fff;
border-radius: 10rpx;
font-size: 24rpx;
color: #666;
margin: 20rpx 0;
margin-bottom: 30rpx;
.item {
align-items: center;
}
span {
display: inline-block;
margin-right: 10rpx;
border-radius: 4rpx;
;
width: 30rpx;
height: 30rpx;
background-color: #fff;
border: 1px solid #999;
}
}
.classMateBox {
.zmVip {
background-image: linear-gradient(-60deg, #53966a 0%, #e1feef 50%, #e1feef 100%);
@@ -1350,7 +1381,19 @@
font-size: 30rpx;
margin-top: 20rpx;
}
.zhengshu{width: 80rpx; height: 80rpx; background-size: contain;}
.Azheng{background-image: url(@/static/icon/Az.png);}
.Bzheng{background-image: url(@/static/icon/Bz.png);}
.scoreBox{
align-items: center; border: 1px solid #f1f1f1;
margin-top: 20rpx;
text-align: center; background-color: #fff; padding: 10rpx 20rpx;
.ciyao{color: #999; font-size: 28rpx;}
.score{color: #258feb; font-weight: bold; font-size: 36rpx;}
.seePaper{width: 50rpx; height: 50rpx;
image{width: 100%; height: 100%;}
}
}
.className {
padding: 30rpx 0;
position: relative;

View File

@@ -0,0 +1,616 @@
<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>
<view class="border_radius_10 haveResult">
<view class="scoreBox">
本次考试卷面成绩为<text class="score PM_font">90</text>
</view>
<view class="">
<button type="primary" @click="goToClass">返回班级</button>
</view>
<view class="result_imgBox">
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
</view>
</view>
</template>
<!-- 没有考试结果的时候 -->
<template>
<!-- <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"
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="">
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text>
<view class="questionItem" v-if="curQuestion.id">
<view class="">
<text>{{curQuestion.content}}</text>
</view>
<!-- <view class="">
{{curQuestion}}-{{curIndex1}}
</view> -->
<view class="optionsBox">
<view
:class="['item','border_radius_10',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">
<button @click="showNextQuestion" type="primary"
:disabled="curIndex1 == testPaper.length-1" size="mini">下一题</button>
</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>
</template>
<u-popup key="1" :show="showPopup" :round="10" @close="hidePopup">
<view class="guanli">
<h3>考试说明</h3>
<view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br />
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view>
</view>
</u-popup>
</view>
</template>
<script>
const paperBack = require('@/data/paperBack.json')
import $http from '@/config/requestConfig.js';
import {
mapState
} 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, // 结束时间戳
isOvertime: false, // 是否超时
step: 8, /// 步长
// questIndexList: [],
nowPart: 1,
maxNumber: 0,
minNumber: 0,
noAnswerList: [],
haveAnswerList:[]
}
},
async onLoad(e) {
console.log('收到得值');
this.classId = e.classId
if (this.testPaper.length == 0) {
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()
}
},
computed: {
...mapState(["userInfo"]),
getallLIst() {
const numbers = Array.from(Array(100).keys(), n => n + 1);
console.log('numbers', numbers);
return numbers
}
},
methods: {
// 单个题的提交
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'
})
});
},
getNoAnswerList() {
var list = []
if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) {
if (this.testPaper[i].answerIds.length == 0) {
console.log('fuhe?');
list.push(i)
}
}
}
return list
},
gethaveAnswerList() {
var list = []
if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) {
if (this.testPaper[i].answerIds.length > 0) {
console.log('fuhe?');
list.push(i)
}
}
}
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() {
// 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()
},
// 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() {
// 上一题
this.curIndex1--
// this.curQuestion.answerIds = []
this.curQuestion = {
...this.testPaper[this.curIndex1]
}
console.log('----------------', this.testPaper );
// this.haveAnswerList = this.gethaveAnswerList()
},
showNextQuestion() {
// 下一题
this.curIndex1++
// this.curQuestion.answerIds = []
this.curQuestion = {
...this.testPaper[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() {
const letterArr = []
// 字母A的code值是65但因为已经到字母D了所以直接从69E开始循环
for (let i = 65; i < 91; i++) {
letterArr[i] = String.fromCharCode(i)
}
return letterArr
},
getTestPage() {
uni.showLoading({
title: '正在生成试卷'
})
$http.request({
url: "common/classExam/generateExamPaper",
method: "POST",
data: {
"classId": this.classId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
uni.hideLoading()
if (res.code == 0) {
// that.isHave = true
res.examPaper.forEach(item => {
item.answerIds = []
var code = 0
item.options.forEach(item1 => {
const randomAbc = this.setDesc().splice(65)
item1.content = randomAbc[code] + '、' + item1.content
code++
})
})
this.testPaper = res.examPaper
this.examId = res.id
this.paperCreateTime = 1
this.endTime = this.hourUp(1)
console.log('this.endTime', this.endTime);
this.curQuestion = {
...this.testPaper[this.curIndex1]
}
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
})
});
},
giveZero() {
// 没有完成完成考试记为0分
},
showElart() {
// uni.showModal({
// title:'提示',
// content:"您还没有完成考试确定要离开吗离开后成绩会记为0分是否继续"
// })
},
goToClass() {
uni.navigateTo({
url: `/pages/miniClass/classInfo?id=${this.classId}`
})
},
hidePopup() {
this.showPopup = false
},
clickIndex(val) {
this.curIndex1 = val - 1
console.log('val', val, this.curIndex1, this.testPaper.length);
this.curQuestion = this.testPaper[this.curIndex1]
this.noAnswerList = this.getNoAnswerList()
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>
<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 {
background-color: #fff;
padding: 6rpx 10rpx;
display: flex;
justify-content: center;
border-radius: 10rpx;
align-items: center;
width: 60rpx;
height: 60rpx;
text-align: center;
border: 1px solid #eee;
}
.cur {
background-color: #409eff;
color: #fff;
}
}
.guanli {
padding: 40rpx;
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;
}
.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: 24rpx 20rpx;
margin-bottom: 20rpx;
}
.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 {
background-color: #409eff;
color: #fff;
}
}
.btnBox {
.item {
width: 40%;
display: flex;
justify-content: center;
}
}
</style>

View File

@@ -33,7 +33,7 @@
<!-- 提交记录 -->
<view v-show="thisTask.reply">
<uni-section class="mb-10 nobg" title="提交记录" type="line"></uni-section>
<view class="">
<view class="" v-if="thisTask.type == '1'">
<radio-group @change="radioChange1" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" />全部同学的提交</label>
@@ -124,7 +124,7 @@
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
</view>
<view class="input_box">
<view class="input_box" v-if="thisTask.type == '1'">
<radio-group @change="radioChange" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" :checked="0 == form.display" />他人不可见</label>
@@ -168,7 +168,7 @@
form: {
taskId: undefined,
id: undefined,
display: "1", //0不展示1展示
display: "0", //0不展示1展示
content: "",
img: ""
},

View File

@@ -115,7 +115,7 @@
<view class="score noscore" v-show="curReplay.scoreSuccess == 0">
未生成成绩
</view>
<template v-if="roleCode.includes('4') || roleCode.includes('5') && curReplay.scoreSuccess < 2">
<template v-if="roleCode.includes('4') || roleCode.includes('5') && curReplay.scoreSuccess < 2 && (classState == '1' || classState == '3')">
<view class="" style=" padding: 10rpx 10rpx; margin-top: 20rpx;">
<view class="scoreBox flex_box">
<text>分数</text>

View File

@@ -1,8 +1,9 @@
<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 title="正在考试" backState="2000">
<text slot="right" style="padding-right: 20rpx; font-size: 26rpx; color: #666;"
@click="showPopup = true">考试说明</text>
</z-nav-bar>
<!-- 有考试结果时候 -->
<template>
@@ -11,84 +12,100 @@
本次考试卷面成绩为<text class="score PM_font">90</text>
</view>
<view class="">
<button type="primary" @click="goToClass">返回班级</button>
<button type="primary" @click="goToClass">返回班级</button> <button type="primary" @click="goToPaper">查看试卷</button>
</view>
<view class="result_imgBox">
<image src="../../static/jiesuan_Icon.jpg" mode="widthFix"></image>
</view>
</view>
</view>
</template>
<!-- 没有考试结果的时候 -->
<template>
<view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br/>
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br/>
<!-- <view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br />
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view>
<view class="questIndx flex_between flex_box">
<text @click="prev"> << </text>
<text v-for="index of NowList" :key="index" >{{index}}</text>
<text @click="next"> >> </text>
</view>
<view style="padding: 20rpx; " class="timeBox border_radius_10 flex_box flex_between align-items_box" v-if="paperCreateTime > 0">
<!-- <view class=""> -->
</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>
<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" />
<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="">
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text>
<view class="questionItem" v-if="curQuestion.id">
<view class="">
<text>{{curQuestion.content}}</text>
</view>
<!-- <view class="">
<!-- </view> -->
<!-- <pre>{{testPaper}}</pre> -->
</view>
<view class="question border_radius_10" v-if="curQuestion.id">
<view class="">
<text class="questionType">{{curQuestion.type == 0 ? '单选题' : '多选题'}}</text>
<view class="questionItem" v-if="curQuestion.id">
<view class="">
<text>{{curQuestion.content}}</text>
</view>
<!-- <view class="">
{{curQuestion}}-{{curIndex1}}
</view> -->
<view class="optionsBox">
<view :class="['item','border_radius_10',curQuestion.answerIds.includes(item.id) ? 'choosed' : '']" @click="clickOption(item, index)" v-for="(item, index) in curQuestion.options" :key="index">
<text>{{item.content}}</text>
<view class="optionsBox">
<view
:class="['item','border_radius_10',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>
<view class="btnBox ">
<view class="flex_box flex_between">
<view class="item">
<button @click="showPrevQuestion" type="default" plain="true" v-if="curIndex1 > 0" size="mini">上一题</button>
</view>
<view class="item" >
<button @click="showNextQuestion" type="primary" v-show="curIndex1 < testPaper.length-1" :disabled="curQuestion.answerIds.length == 0" size="mini">下一题</button>
</view>
</view>
<view class="" style="margin-top: 20rpx;" v-show="curIndex1 == testPaper.length-1 && !isOvertime">
<button @click="sumitAnswer" type="primary" > </button>
</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">
<button @click="showNextQuestion" type="primary"
:disabled="curIndex1 == testPaper.length-1" size="mini">下一题</button>
</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>
</template>
<u-popup key="1" :show="showPopup" :round="10" @close="hidePopup">
<view class="guanli">
<h3>考试说明</h3>
<view class="tips border_radius_10">
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br/>
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br/>
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view>
<text>每位学员共有两次考试的机会考试成绩以两次成绩的最高分作为最终的卷面成绩请认真对待每次考试;<br />
请在倒计时结束前完成答题倒计时结束后将自动交卷;<br />
考试结束前中途离开视为放弃此次考试成绩为0分</text>
</view>
</view>
</u-popup>
</view>
</view>
</template>
<script>
@@ -99,113 +116,164 @@
export default {
data() {
return {
showPopup:false,
code:0, // 英文code
classId:undefined,
testPaper:[],
curQuestion:{
answerIds:[]
showPopup: false,
code: 0, // 英文code
classId: undefined,
testPaper: [],
curQuestion: {
answerIds: []
},
result:{}, // 考试结果
curIndex1:0,
paperCreateTime:0,
examId:undefined,
endTime:undefined, // 结束时间戳
isOvertime:false, // 是否超时
nowPart:1, // 段数
result: {}, // 考试结果
curIndex1: 0,
paperCreateTime: 0,
examId: undefined,
endTime: undefined, // 结束时间戳
isOvertime: false, // 是否超时
step: 8, /// 步长
// questIndexList: [],
nowPart: 1,
maxNumber: 0,
minNumber: 0,
noAnswerList: [],
haveAnswerList:[]
}
},
onLoad(e) {
async onLoad(e) {
console.log('收到得值');
this.classId = e.classId
if(this.testPaper.length == 0){
this.getTestPage()
if (this.testPaper.length == 0) {
this.getTestPage()
}
// this.questIndexList = await this.getNowList('add')
},
onHide(){
if(!this.isOvertime){}
onHide() {
if (!this.isOvertime) {}
},
onShow() {
this.endTime = this.hourUp(1)
console.log('this.endTime',this.endTime.getTime());
console.log('this.endTime', this.endTime.getTime());
},
beforeDestroy() {
if(!this.isOvertime){ // 如果中途退出
if (!this.isOvertime) { // 如果中途退出
this.giveZero()
}
},
computed: {
...mapState(["userInfo"]),
NowList(){
var _list = []
console.log('this.nowPart * 8', this.nowPart);
var maxNumber = 0
var minNumber = 0
if(this.nowPart == 1){
maxNumber = this.nowPart + 7
minNumber = 1
}else{
minNumber = (this.nowPart - 1) * 8
maxNumber = this.nowPart * 8
}
for (var i = minNumber-1; i < maxNumber-1; i++) {
_list.push(i)
}
return _list
getallLIst() {
const numbers = Array.from(Array(100).keys(), n => n + 1);
console.log('numbers', numbers);
return numbers
}
},
},
methods: {
prev(){
if(this.nowPart > 1){
this.nowPart--
}
// 单个题的提交
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'
})
});
},
next(){
if(this.nowPart < 12){
this.nowPart++
getNoAnswerList() {
var list = []
if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) {
if (this.testPaper[i].answerIds.length == 0) {
console.log('fuhe?');
list.push(i)
}
}
}
return list
},
gethaveAnswerList() {
var list = []
if (this.curIndex1 > 0) {
for (var i = 0; i < this.curIndex1; i++) {
if (this.testPaper[i].answerIds.length > 0) {
console.log('fuhe?');
list.push(i)
}
}
}
return list
},
// 倒计时结束 (超时)
timeup(){
timeup() {
this.isOvertime = true
this.sumitAnswer()
let that = this
uni.showModal({
title:'提示',
content:"考试结束,系统已为您自动交卷",
confirmText:'知道了',
showCancel:false,
title: '提示',
content: "考试结束,系统已为您自动交卷",
confirmText: '知道了',
showCancel: false,
success: (res) => {
if (res.confirm) {
// that.goToClass()
}
// that.goToClass()
}
}
})
},
// 获取交卷数据
sumitAnswer(){
var _newList = this.testPaper.map( item =>{
return item.answerIds
goToPaper(){
uni.navigateTo({
url: `/pages/miniClass/paperBack?id=${this.classId}`
})
_newList = _newList.map(item => {
return item.join(',')
})
console.log('_newList',_newList);
this.sumbitPaper(_newList)
},
// 获取交卷数据
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()
},
// q请求提交试卷
sumbitPaper(ids){
sumbitPaper(ids) {
$http.request({
url: "common/classExam/submitExamPaper",
method: "POST",
data: {
id: this.examId,
"answer": ids
id: this.examId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -213,14 +281,14 @@
})
.then(res => {
uni.hideLoading()
if (res.code == 0) {
if (res.code == 0) {
uni.showToast({
title:'交卷成功',
icon:'success'
title: '交卷成功',
icon: 'success'
})
this.isOvertime = true
}
}).catch(e => {
uni.hideLoading()
console.log(e, '数据报错')
@@ -231,54 +299,65 @@
})
});
},
showPrevQuestion(){
showPrevQuestion() {
// 上一题
this.curIndex1--
// this.curQuestion.answerIds = []
this.curQuestion = {...this.testPaper[this.curIndex1]}
console.log('----------------',this.testPaper,);
this.curQuestion = {
...this.testPaper[this.curIndex1]
}
console.log('----------------', this.testPaper );
// this.haveAnswerList = this.gethaveAnswerList()
},
showNextQuestion(){
showNextQuestion() {
// 下一题
this.curIndex1++
// this.curQuestion.answerIds = []
this.curQuestion = {...this.testPaper[this.curIndex1]}
console.log('+++++++++++++++',this.testPaper,);
this.curQuestion = {
...this.testPaper[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){
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.curQuestion.answerIds = [item.id]
// console.log('666666666', this.testPaper, this.curQuestion.answerIds);
this.$forceUpdate()
}else if(this.curQuestion.type == 1){
} else if (this.curQuestion.type == 1) {
console.log('多选');
var isIN = this.curQuestion.answerIds.findIndex( itemss => {
var isIN = this.curQuestion.answerIds.findIndex(itemss => {
return itemss == item.id
})
if(isIN >= 0){
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.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() {
const letterArr = []
// 字母A的code值是65但因为已经到字母D了所以直接从69E开始循环
// 字母A的code值是65但因为已经到字母D了所以直接从69E开始循环
for (let i = 65; i < 91; i++) {
letterArr[i] = String.fromCharCode(i)
letterArr[i] = String.fromCharCode(i)
}
return letterArr
},
getTestPage(){
},
getTestPage() {
uni.showLoading({
title:'正在生成试卷'
title: '正在生成试卷'
})
$http.request({
url: "common/classExam/generateExamPaper",
@@ -292,107 +371,251 @@
})
.then(res => {
uni.hideLoading()
if (res.code == 0) {
if (res.code == 0) {
// that.isHave = true
res.examPaper.forEach(item => {
item.answerIds = []
var code = 0
item.options.forEach(item1 => {
const randomAbc = this.setDesc().splice(65)
item1.content = randomAbc[code]+'、'+item1.content
item1.content = randomAbc[code] + '、' + item1.content
code++
})
})
this.testPaper = res.examPaper
this.examId = res.id
this.paperCreateTime = 1
this.paperCreateTime = 1
this.endTime = this.hourUp(1)
console.log('this.endTime',this.endTime);
this.curQuestion = {...this.testPaper[this.curIndex1] }
uni.showToast({
title: '获取成功',
icon: 'success'
})
console.log(res, '试卷',this.curQuestion)
console.log('this.endTime', this.endTime);
this.curQuestion = {
...this.testPaper[this.curIndex1]
}
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.errorMsg,
icon: 'error'
title: e.errMsg,
icon: 'none',
duration: 3000
})
});
},
giveZero(){
giveZero() {
// 没有完成完成考试记为0分
},
showElart(){
showElart() {
// uni.showModal({
// title:'提示',
// content:"您还没有完成考试确定要离开吗离开后成绩会记为0分是否继续"
// })
},
goToClass(){
goToClass() {
uni.navigateTo({
url:`/pages/miniClass/classInfo?id=${this.classId}`
url: `/pages/miniClass/classInfo?id=${this.classId}`
})
},
hidePopup(){
hidePopup() {
this.showPopup = false
},
hourUp(e){
clickIndex(val) {
this.curIndex1 = val - 1
console.log('val', val, this.curIndex1, this.testPaper.length);
this.curQuestion = this.testPaper[this.curIndex1]
this.noAnswerList = this.getNoAnswerList()
this.haveAnswerList = this.gethaveAnswerList()
},
hourUp(e) {
// 比现在多几个小时
var end = Date.now()
var start = 1000*60*60*e
var start = 1000 * 60 * 60 * e
var interval = end + start; //结束 - 开始 = 毫秒值
var a =new Date(interval)
var a = new Date(interval)
return a
},
},
}
}
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.questIndx{
text{padding: 6rpx 10rpx; display: flex; justify-content: center; border-radius: 10rpx; align-items: center; width: 60rpx; height: 60rpx; text-align: center; }
.cur{background-color: #409eff; color: #fff;}
.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 {
background-color: #fff;
padding: 6rpx 10rpx;
display: flex;
justify-content: center;
border-radius: 10rpx;
align-items: center;
width: 60rpx;
height: 60rpx;
text-align: center;
border: 1px solid #eee;
}
.cur {
background-color: #409eff;
color: #fff;
}
}
.guanli {
padding: 40rpx;
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;
}
.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: 24rpx 20rpx; margin-bottom: 20rpx;}
.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%;}
.tips {
background: #fbe8e8;
color: #f56c6c;
line-height: 50rpx;
font-size: 28rpx;
padding: 10rpx 20rpx;
text-align: justify;
}
.timeBox{background-color: #fff; margin-bottom: 20rpx;}
.btnBox{
.item{width:40%; display: flex; justify-content: center;}
.questionType {
position: absolute;
left: 0;
top: 20rpx;
background-color: $themeColor;
color: #fff;
padding: 10rpx 20rpx;
border-radius: 0 50rpx 50rpx 0;
}
</style>
.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: 24rpx 20rpx;
margin-bottom: 20rpx;
}
.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 {
background-color: #409eff;
color: #fff;
}
}
.btnBox {
.item {
width: 40%;
display: flex;
justify-content: center;
}
}
</style>

View File

@@ -2,26 +2,26 @@
<view style="min-height: calc(100vh - 120rpx); background-color: #ebf2f5;">
<z-nav-bar :title="pageName"></z-nav-bar>
<view class="pad20">
<view v-if="taskList.length > 0 ">
<view class="submitRecode">
<view class="newBox">
<view class="item " v-for="(item, index) in taskList" @click="clickTask(item)">
<view class="leve1 flex_box">
<text>{{item.title}}</text>
</view>
</view>
<view class="leve2">
{{item.content}}
</view>
{{item.content}}
</view>
<view class="leve3">
<view class="score" v-if="item.scoreSuccess == 1">
分数{{item.score}}
</view>
<view class="score noscore" v-else>未评分</view>
<view class="date">
{{item.createTime}}
</view>
</view>
<view class="score" v-if="item.scoreSuccess == 1">
分数{{item.score}}
</view>
<view class="score noscore" v-else>未评分</view>
<view class="date">
{{item.createTime}}
</view>
</view>
</view>
</view>
</view>
@@ -30,13 +30,14 @@
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider>
</view>
<u-popup key="1" :show="showEditBlank" :round="10" @close="closePup" ref="" z-index="998" overlay-style="z-index:998">
<u-popup key="1" :show="showEditBlank" :round="10" @close="closePup" ref="" z-index="998"
overlay-style="z-index:998">
<view class="" style="padding: 40rpx; max-height: 80vh; overflow-y:scroll">
<view class="anserBox">
<h3>心得详情</h3>
<view class="" style="border-bottom: 1px solid #eee; padding-bottom: 20rpx; margin-bottom: 20rpx;">
<view class="anserContent" v-html="curReplay.content">
</view>
<view class="图片">
<view class="imgBox flex_box" v-if="fileList1.length > 0">
@@ -52,7 +53,7 @@
<view class="" v-if="curReplay.createUser" style="color: #999;padding: 10rpx 0;">
学员信息{{curReplay.createUser.nickname != null && curReplay.createUser.nickname != '' ? curReplay.createUser.nickname : '匿名用户'}}
/ {{curReplay.createUser.tel}}
</view>
</view>
<view class="score" v-show="curReplay.scoreSuccess == 1">
分数{{curReplay.score}}
</view>
@@ -60,13 +61,15 @@
未生成成绩
</view>
<!-- -->
<template v-if="roleCode.includes('4') && curReplay.scoreSuccess != 1 || roleCode.includes('5') && curReplay.scoreSuccess != 1 ">
<template
v-if="roleCode.includes('4') && curReplay.scoreSuccess != 1 || roleCode.includes('5') && curReplay.scoreSuccess != 1 && (classState == '1' || classState == '3')">
<view class="" style=" padding: 10rpx 10rpx; margin-top: 20rpx;">
<view class="scoreBox flex_box">
<text>分数</text>
<text v-for="(item, index) in scoreList" @click="setScore(item)" :class="[item == form.score ?'active' : '' ]">
{{item}}
</text>
<text v-for="(item, index) in scoreList" @click="setScore(item)"
:class="[item == form.score ?'active' : '' ]">
{{item}}
</text>
</view>
<!-- <uni-forms :modelValue="form" :rules="rules" ref="form">
<uni-forms-item label="分数" name="score" >
@@ -84,8 +87,8 @@
</template>
<script>
import $http from '@/config/requestConfig.js';
// const taskLIst1 = require('@/data/taskList.json')
import $http from '@/config/requestConfig.js';
// const taskLIst1 = require('@/data/taskList.json')
export default {
data() {
return {
@@ -96,9 +99,9 @@
loadFlag: false,
pageName: '',
taskList: [],
fileList1:[],
scoreList:[
0,0.5,1,1.5,2,2.5
fileList1: [],
scoreList: [
0, 0.5, 1, 1.5, 2, 2.5
],
rules: {
score: {
@@ -106,27 +109,29 @@
required: true,
errorMessage: '请输入分数',
}
]
},
},
roleCode:'',
showEditBlank:false,
curReplay:{},
form: {
score: undefined, //分数
id: undefined,
},
// ispreviewImage :false,
roleCode: '',
showEditBlank: false,
curReplay: {},
form: {
score: undefined, //分数
id: undefined,
},
classState : undefined
// ispreviewImage :false,
}
},
onLoad(e) {
console.log('e',e);
console.log('e', e);
this.classId = e.classId
this.pageType = e.type
this.roleCode = e.roleCode
this.roleCode = e.roleCode
this.pageName = '心得列表'
this.classState = e.classState
this.getList()
},
onPullDownRefresh() {
@@ -150,52 +155,52 @@
// onBackPress() {
// },
methods: {
setScore(val){
setScore(val) {
// if(this.form.score == val) return
this.form.score = val
},
onSubmit() {
// this.$refs.form.validate().then(res => {
if(!this.form.score && this.form.score != 0){
if (!this.form.score && this.form.score != 0) {
uni.showToast({
title: '请选择分值',
icon: 'none'
})
return
}
var _url = "common/class/editTaskScore"
var data = {
"score": this.form.score,
"taskId": this.form.id
}
console.log('data后台提交数据', data);
$http.request({
url: _url,
method: "POST",
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
uni.showToast({
title:'请选择分值',
icon:'none'
title: '操作成功!',
icon: 'success'
})
return
}
var _url = "common/class/editTaskScore"
var data = {
"score": this.form.score,
"taskId": this.form.id
}
console.log('data后台提交数据', data);
$http.request({
url: _url,
method: "POST",
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
setTimeout(() => {
this.pPage = 0
this.taskList = []
this.getList()
this.closePup()
}, 1000)
}).catch(e => {
uni.showToast({
title: '操作失败',
icon: 'error'
})
.then(res => {
uni.showToast({
title: '操作成功!',
icon: 'success'
})
setTimeout(()=>{
this.pPage = 0
this.taskList = []
this.getList()
this.closePup()
},1000)
}).catch(e => {
uni.showToast({
title: '操作失败',
icon: 'error'
})
});
});
// }).catch(err => {
// console.log('表单错误信息:', err);
// uni.showToast({
@@ -222,31 +227,35 @@
this.showEditBlank = false
this.form = {
score: undefined,
id: undefined,
id: undefined,
}
this.curReplay = {}
this.fileList1 = []
console.log('this.fileList1',this.fileList1);
console.log('this.fileList1', this.fileList1);
// setTimeout(()=>{
// this.pPage = 0
// this.taskList = []
// this.getList()
// },1000)
},
clickTask(item){
},
clickTask(item) {
// console.log('item',item);
this.curReplay = item
this.form = {...item}
if(this.form.scoreSuccess == 0){
this.form.score = undefined
}
if(item.img != ''){
var _list = item.img.split(',')
_list.forEach( item => {
this.fileList1.push({url:item})
this.curReplay = item
this.form = {
...item
}
if (this.form.scoreSuccess == 0) {
this.form.score = undefined
}
if (item.img != '') {
var _list = item.img.split(',')
_list.forEach(item => {
this.fileList1.push({
url: item
})
}
this.showEditBlank = true
})
}
this.showEditBlank = true
},
getList() {
this.status = 1;
@@ -325,8 +334,8 @@
/* #endif */
flex: 1
}
.anserBox {
.anserBox {
border: 4rpx dotted #2bb447;
margin-top: 30rpx;
padding: 20rpx;
@@ -334,20 +343,28 @@
border-radius: 20rpx;
overflow: hidden;
padding-top: 0;
.imgBox {
flex-wrap: wrap;
.item {
width: 20%;
margin-right: 10rpx;
border: 1px solid #eee;
padding: 0 !important;
image {
width: 100%;
}
}
}
.anserContent{line-height: 50rpx; padding: 20rpx 0; display: block;}
.anserContent {
line-height: 50rpx;
padding: 20rpx 0;
display: block;
}
h3 {
line-height: 80rpx;
width: 50%;
@@ -358,15 +375,33 @@
border-radius: 0 0 20rpx 20rpx;
}
}
.scoreBox{
text{display: inline-block; font-size: 26rpx; width: 100%; border: 1px solid #ddd; text-align: center; line-height:60rpx; border-right: none;}
text:last-child{border-right: 1px solid #ddd;}
text.active{background-color: #55aaff; color: #fff; border-color: #55aaff;}
.scoreBox {
text {
display: inline-block;
font-size: 26rpx;
width: 100%;
border: 1px solid #ddd;
text-align: center;
line-height: 60rpx;
border-right: none;
}
text:last-child {
border-right: 1px solid #ddd;
}
text.active {
background-color: #55aaff;
color: #fff;
border-color: #55aaff;
}
}
.btn_box {
margin-top: 70rpx;
padding-bottom: 20rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
@@ -375,10 +410,27 @@
border-radius: 50rpx;
}
}
::v-deep .uni-forms-item{margin-bottom: 0 !important;}
.date {font-size: 26rpx; color: #999;}
.score{color: #55aaff; font-size: 30rpx !important; font-weight: bold;;}
.noscore{color: #ffaa7f;}
::v-deep .uni-forms-item {
margin-bottom: 0 !important;
}
.date {
font-size: 26rpx;
color: #999;
}
.score {
color: #55aaff;
font-size: 30rpx !important;
font-weight: bold;
;
}
.noscore {
color: #ffaa7f;
}
.submitRecode {
// padding: 20rpx;
@@ -399,29 +451,47 @@
box-shadow: none !important;
// border-bottom: 1px solid #eee;
border-radius: 20rpx;
padding: 20rpx ;
padding: 20rpx;
margin-bottom: 20rpx;
.leve1 {
align-items: center;
border-bottom: 1px dashed #eee;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
// .userName{}
}
.leve2 { justify-content: space-between;
color: #666; font-size: 28rpx; line-height: 50rpx;
@include bov(3);
.item{text-align: center; padding-top: 0; padding-bottom: 0; margin-bottom: 0;}
.leve2 {
justify-content: space-between;
color: #666;
font-size: 28rpx;
line-height: 50rpx;
@include bov(3);
.item {
text-align: center;
padding-top: 0;
padding-bottom: 0;
margin-bottom: 0;
}
}
.leve3 { overflow: hidden;
.leve3 {
overflow: hidden;
color: #999;
text-align: center;
padding-top: 10rpx;
.score{float: left;}
.date{float: right;}
.score {
float: left;
}
.date {
float: right;
}
.tips {
width: 100%;
justify-content: space-between;
@@ -429,7 +499,7 @@
color: #999;
}
.btn {
border: 1px solid $themeColor;