Commit f226bb3e authored by zhengke's avatar zhengke

修改

parent 4626d052
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
display: inline-block; display: inline-block;
width: 104px; width: 104px;
line-height: 34px; line-height: 34px;
margin-top: 10px;
} }
.f1 { .f1 {
...@@ -97,12 +98,48 @@ ...@@ -97,12 +98,48 @@
z-index: 99 !important; z-index: 99 !important;
} }
.Sysuser_Date .el-input__inner {
background: transparent !important;
border: 0 !important;
}
#paper_Publish .el-date-editor.el-input {
width: 100%;
}
.avatar-uploader .el-upload {
border-radius: 6px;
cursor: pointer;
width: 100%;
height: 100%;
color: #8c939d;
position: relative;
overflow: hidden;
}
.addDutyMain {
display: inline-block;
width: 118px;
height: 118px;
font-size: 70px;
border: 1px dashed #d9d9d9;
line-height: 120px;
}
.ItemImgDiv {
width: 118px;
height: 118px;
position: relative;
margin: 0 10px 10px 0;
display: inline-block;
}
</style> </style>
<template> <template>
<div class="page-body" id="paper_Publish"> <div class="page-body" id="paper_Publish">
<div style="margin:5px 0 10px 0;font-size:20px;">发布考试</div> <div style="margin:5px 0 10px 0;font-size:20px;">发布考试</div>
<div class="setCt"> <div class="setCt">
<span class="papPub_Left f1">发放对象</span> <span class="papPub_Left f1" style="margin-top:0;">发放对象</span>
<div class="f1" style="margin-top:5px;"> <div class="f1" style="margin-top:5px;">
<q-btn color="accent" size="sm" @click="showClassStu" class="q-mr-md" label="选择学员"  /><br /> <q-btn color="accent" size="sm" @click="showClassStu" class="q-mr-md" label="选择学员"  /><br />
<div class="selectClass" v-if="postMsg.StudentList&&postMsg.StudentList.length>0"> <div class="selectClass" v-if="postMsg.StudentList&&postMsg.StudentList.length>0">
...@@ -115,39 +152,29 @@ ...@@ -115,39 +152,29 @@
<div class="setCt"> <div class="setCt">
<span class="papPub_Left f1">发放时间</span> <span class="papPub_Left f1">发放时间</span>
<div class="f1"> <div class="f1">
<q-input filled v-model="postMsg.ExamStartTime" style="width:308px;" mask="####-##-## ##:##:##" label="开始时间" <div class="Sysuser_Date" style="width:308px;">
ref="StartTime" :rules="[val => !!val || '请选择开始时间']"> <q-field filled>
<template v-slot:append>  <template v-slot:control>
<q-icon name="event" class="cursor-pointer"> <el-date-picker v-model="postMsg.ExamStartTime" value-format='yyyy-MM-dd HH:mm:ss'
<q-popup-proxy ref="qDateProxy" transition-show="scale" transition-hide="scale"> :picker-options="picker" type="datetime" placeholder="开始时间" size="small"
<div class="q-gutter-md row items-start"> clear-icon="iconfont icon-guanbi"></el-date-picker>
<q-date v-model="postMsg.ExamStartTime" mask="YYYY-MM-DD HH:mm:ss"></q-date> </template>
<q-time v-model="postMsg.ExamStartTime" format24h mask="YYYY-MM-DD HH:mm:ss" /> </q-field>
</div> </div>
<q-btn v-close-popup label="关闭" color="primary" flat style="float:right" />
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div> </div>
</div> </div>
<div class="setCt"> <div class="setCt">
<span class="papPub_Left f1">结束时间</span> <span class="papPub_Left f1">结束时间</span>
<div class="f1"> <div class="f1">
<q-input filled v-model="postMsg.ExamEndTime" style="width:308px;" mask="####-##-## ##:##:##" label="结束时间" <div class="Sysuser_Date" style="width:308px;">
ref="ExamEndTime" :rules="[val => !!val || '请选择结束时间']"> <q-field filled>
<template v-slot:append>  <template v-slot:control>
<q-icon name="event" class="cursor-pointer"> <el-date-picker v-model="postMsg.ExamEndTime" value-format='yyyy-MM-dd HH:mm:ss' @change="getMinus()"
<q-popup-proxy ref="qDateProxy2" transition-show="scale" transition-hide="scale"> type="datetime" :picker-options="pickerEnd" placeholder="结束时间" size="small"
<div class="q-gutter-md row items-start"> clear-icon="iconfont icon-guanbi"></el-date-picker>
<q-date v-model="postMsg.ExamEndTime" mask="YYYY-MM-DD HH:mm:ss"></q-date> </template>
<q-time v-model="postMsg.ExamEndTime" format24h mask="YYYY-MM-DD HH:mm:ss" /> </q-field>
</div> </div>
<q-btn v-close-popup label="关闭" color="primary" flat style="float:right" />
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div> </div>
</div> </div>
<div class="setCt"> <div class="setCt">
...@@ -183,7 +210,7 @@ ...@@ -183,7 +210,7 @@
</div> </div>
</div> </div>
<div class="setCt"> <div class="setCt">
<span class="papPub_Left f1">防作弊设置</span> <span class="papPub_Left f1" style="margin-top:0;">防作弊设置</span>
<div class="f1"> <div class="f1">
<q-checkbox size="xs" v-model="postMsg.IsQuestionRandom" :true-value="1" :false-value="0" label="题目乱序" /> <q-checkbox size="xs" v-model="postMsg.IsQuestionRandom" :true-value="1" :false-value="0" label="题目乱序" />
<div class="paper_QuesDes">学生接收到的题目显示顺序不同</div> <div class="paper_QuesDes">学生接收到的题目显示顺序不同</div>
...@@ -232,7 +259,21 @@ ...@@ -232,7 +259,21 @@
<div class="paper_QuesDes">勾选后,英文大写和小写都可以得分</div> <div class="paper_QuesDes">勾选后,英文大写和小写都可以得分</div>
<q-checkbox size="xs" v-model="postMsg.IsHalfScore" :true-value="1" :false-value="0" label="多选题未选全给一半分" /> <q-checkbox size="xs" v-model="postMsg.IsHalfScore" :true-value="1" :false-value="0" label="多选题未选全给一半分" />
<div class="paper_QuesDes">不勾选时全选对才给分</div> <div class="paper_QuesDes">不勾选时全选对才给分</div>
</div> <div style="display:flex;flex-wrap: wrap;">
<template v-if="postMsg.PublishPic.length>0">
<div v-for="(item,index) in postMsg.PublishPic">
<div class="ItemImgDiv">
<q-img :src="item" spinner-color="white" style="height: 100%;height:100%" />
<q-btn size="7px" @click="deleteItemImg(index)" style="position:absolute;right:-5px;top:-5px;" round
color="red" icon="iconfont icon-guanbi1" />
</div>
</div>
</template>
<el-upload class="avatar-uploader addDutyMain" action="" v-if="postMsg.PublishPic.length<1" :before-upload="uploadFile" :show-file-list="false">
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<q-btn color="accent" @click="setPublishExam" class="q-mr-md" label="发布考试"  /> <q-btn color="accent" @click="setPublishExam" class="q-mr-md" label="发布考试"  />
...@@ -249,6 +290,10 @@ ...@@ -249,6 +290,10 @@
savePublishExam, savePublishExam,
queryExamPublish, queryExamPublish,
} from '../../api/teacher/index'; } from '../../api/teacher/index';
import {
UploadSelfFile,
} from '../../api/common/common'
export default { export default {
components: { components: {
classstutreeForm, classstutreeForm,
...@@ -263,15 +308,15 @@ ...@@ -263,15 +308,15 @@
Id: 0, //发布编号 Id: 0, //发布编号
PaperId: 0, //试卷编号 PaperId: 0, //试卷编号
PublishType: 1, // 发放类型(1-按班级发放,2-指定学生发放) PublishType: 1, // 发放类型(1-按班级发放,2-指定学生发放)
ExamStartTime: "2021-08-30 10:00:00", //考试开始时间 ExamStartTime: "", //考试开始时间
ExamEndTime: "2021-08-30 12:00:00", //考试结束时间 ExamEndTime: "", //考试结束时间
ExamTimes: 0, //考试限时 ExamTimes: '', //考试限时
SubmitTimes: 0, //限时提交(多少分钟内不允许提交) SubmitTimes: '', //限时提交(多少分钟内不允许提交)
EnterTimes: 0, //限时进入(多少分钟后不允许参加考试) EnterTimes: '', //限时进入(多少分钟后不允许参加考试)
IsQuestionRandom: 0, //题目乱序(1-是) IsQuestionRandom: 0, //题目乱序(1-是)
IsOptionRandom: 0, //选项乱序(1-是) IsOptionRandom: 0, //选项乱序(1-是)
IsLeaveAnswer: 0, //学生离开作答页面(1-是) IsLeaveAnswer: 0, //学生离开作答页面(1-是)
LeaveTimes: 0, //离开次数 LeaveTimes: '', //离开次数
IsDisableMultiTerminal: 0, //是否禁用多终端(1-是) IsDisableMultiTerminal: 0, //是否禁用多终端(1-是)
IsExamType: 0, //是否只允许(App、PC)考试(1-是) IsExamType: 0, //是否只允许(App、PC)考试(1-是)
ExamTypeValue: 1, //考试终端类型(1-App,2-PC) ExamTypeValue: 1, //考试终端类型(1-App,2-PC)
...@@ -282,6 +327,7 @@ ...@@ -282,6 +327,7 @@
FillInIsIgnore: 0, //填空题答案不区分大小写(1-是) FillInIsIgnore: 0, //填空题答案不区分大小写(1-是)
IsHalfScore: 1, //多选题未选全给一半分(1-是) IsHalfScore: 1, //多选题未选全给一半分(1-是)
StudentList: [], StudentList: [],
PublishPic: [] //图片
}, },
config: { config: {
initialFrameWidth: null, initialFrameWidth: null,
...@@ -289,6 +335,18 @@ ...@@ -289,6 +335,18 @@
}, },
isShowClassStu: false, //是否显示学员弹窗 isShowClassStu: false, //是否显示学员弹窗
sendStudent: [], //传送已选学生 sendStudent: [], //传送已选学生
picker: {
disabledDate: (time) => {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
},
},
pickerEnd: {
disabledDate: (time) => {
let StartTime = new Date(this.postMsg.ExamStartTime);
return time.getTime() <= StartTime.getTime() - 24 * 60 * 60 * 1000;
},
},
} }
}, },
created() { created() {
...@@ -323,6 +381,67 @@ ...@@ -323,6 +381,67 @@
} }
}, },
methods: { methods: {
uploadFile(files) {
UploadSelfFile('studentIcon', files, res => {
if (res.Code == 1) {
this.postMsg.PublishPic.push(res.FileUrl);
}
})
},
//删除图片
deleteItemImg(index) {
this.postMsg.PublishPic.splice(index, 1);
},
//获取两个时间相差分钟数
getMinus() {
if (this.postMsg.ExamStartTime == '' || this.postMsg.ExamStartTime == null) {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择开始时间`
})
return
}
//定义两个变量time1,time2分别保存开始和结束时间
var time1 = this.postMsg.ExamStartTime;
var time2 = this.postMsg.ExamEndTime;
//判断开始时间是否大于结束日期
if (time1 > time2) {
this.$q.notify({
type: 'negative',
position: "top",
message: `开始时间不能大于结束时间`
})
return
}
//截取字符串,得到日期部分"2009-12-02",用split把字符串分隔成数组
var begin1 = time1.substr(0, 10).split("-");
var end1 = time2.substr(0, 10).split("-");
//将拆分的数组重新组合,并实例成化新的日期对象
var date1 = new Date(begin1[1] + - +begin1[2] + - +begin1[0]);
var date2 = new Date(end1[1] + - +end1[2] + - +end1[0]);
//得到两个日期之间的差值m,以分钟为单位
//Math.abs(date2-date1)计算出以毫秒为单位的差值
//Math.abs(date2-date1)/1000得到以秒为单位的差值
//Math.abs(date2-date1)/1000/60得到以分钟为单位的差值
var m = parseInt(Math.abs(date2 - date1) / 1000 / 60);
//小时数和分钟数相加得到总的分钟数
//time1.substr(11,2)截取字符串得到时间的小时数
//parseInt(time1.substr(11,2))*60把小时数转化成为分钟
var min1 = parseInt(time1.substr(11, 2)) * 60 + parseInt(time1.substr(14, 2));
var min2 = parseInt(time2.substr(11, 2)) * 60 + parseInt(time2.substr(14, 2));
//两个分钟数相减得到时间部分的差值,以分钟为单位
var n = min2 - min1;
//将日期和时间两个部分计算出来的差值相加,即得到两个时间相减后的分钟数
var minutes = m + n;
// 返回 分钟差
this.postMsg.ExamTimes = minutes;
},
//删除发放对象 //删除发放对象
delStudentName(index) { delStudentName(index) {
this.postMsg.StudentList.splice(index, 1); this.postMsg.StudentList.splice(index, 1);
...@@ -337,15 +456,19 @@ ...@@ -337,15 +456,19 @@
this.postMsg.Id = tempData.Id; this.postMsg.Id = tempData.Id;
this.postMsg.PaperId = tempData.PaperId; this.postMsg.PaperId = tempData.PaperId;
this.postMsg.PublishType = tempData.PublishType; this.postMsg.PublishType = tempData.PublishType;
this.postMsg.ExamStartTime = tempData.ExamStartTime; if (tempData.ExamStartTime) {
this.postMsg.ExamEndTime = tempData.ExamEndTime; this.postMsg.ExamStartTime = tempData.ExamStartTime.replace('T', ' ');
this.postMsg.ExamTimes = tempData.ExamTimes; }
this.postMsg.SubmitTimes = tempData.SubmitTimes; if (tempData.ExamEndTime) {
this.postMsg.EnterTimes = tempData.EnterTimes; this.postMsg.ExamEndTime = tempData.ExamEndTime.replace('T', ' ');
}
this.postMsg.ExamTimes = tempData.ExamTimes == 0 ? '' : tempData.ExamTimes;
this.postMsg.SubmitTimes = tempData.SubmitTimes == 0 ? '' : tempData.SubmitTimes;
this.postMsg.EnterTimes = tempData.EnterTimes == 0 ? '' : tempData.EnterTimes;
this.postMsg.IsQuestionRandom = tempData.IsQuestionRandom; this.postMsg.IsQuestionRandom = tempData.IsQuestionRandom;
this.postMsg.IsOptionRandom = tempData.IsOptionRandom; this.postMsg.IsOptionRandom = tempData.IsOptionRandom;
this.postMsg.IsLeaveAnswer = tempData.IsLeaveAnswer; this.postMsg.IsLeaveAnswer = tempData.IsLeaveAnswer;
this.postMsg.LeaveTimes = tempData.LeaveTimes; this.postMsg.LeaveTimes = tempData.LeaveTimes == 0 ? '' : tempData.LeaveTimes;
this.postMsg.IsDisableMultiTerminal = tempData.IsDisableMultiTerminal; this.postMsg.IsDisableMultiTerminal = tempData.IsDisableMultiTerminal;
this.postMsg.IsExamType = tempData.IsExamType; this.postMsg.IsExamType = tempData.IsExamType;
this.postMsg.ExamTypeValue = tempData.ExamTypeValue; this.postMsg.ExamTypeValue = tempData.ExamTypeValue;
...@@ -358,6 +481,9 @@ ...@@ -358,6 +481,9 @@
if (tempData.StudentList && tempData.StudentList.length > 0) { if (tempData.StudentList && tempData.StudentList.length > 0) {
this.postMsg.StudentList = tempData.StudentList; this.postMsg.StudentList = tempData.StudentList;
} }
if(tempData.PicList && tempData.PicList.length > 0){
this.postMsg.PublishPic = tempData.PicList;
}
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment