mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 19:06:43 +08:00
Merge branch 'exam' into third
This commit is contained in:
@@ -56,13 +56,17 @@
|
||||
<div style="font-size: 20px;"><span style="font-size: 40upx;" :class="{'redText':timerValue<5}">{{timerValue}}</span> 分钟</div>
|
||||
</div>
|
||||
<div class="qitem">
|
||||
<div class="qitem-info">【{{getTypeName(curItem.type)}}】{{curItem.content}}</div>
|
||||
<div class="qitem-info">
|
||||
<div>【{{getTypeName(curItem.type)}}】{{curItem.content}} </div>
|
||||
<div class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></div>
|
||||
</div>
|
||||
<div v-for="(opt,optIdx) in curItem.options" :key="optIdx">
|
||||
<div class="qitem-opts">
|
||||
<div class="qitem-opt" :class="{check:opt.checked}" @click="chooseOption(opt)">
|
||||
{{toLetter(optIdx+1)}}.{{opt.content}}
|
||||
<i class="el-icon-check" v-if="opt.checked" name="checkbox-mark" color="#00aa00"></i>
|
||||
</div>
|
||||
<div class="qimg" v-if="opt.images"><img class="qimg-fit" :src="imageBaseUrl+opt.images"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,16 +84,22 @@
|
||||
<div style="text-align: left;" class="upaper">
|
||||
<!--答卷信息-->
|
||||
<div v-for="(ditem,didx) in detailItems" :key="didx" class="upaper-item">
|
||||
<div class="upaper-item-q">{{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.content}}</div>
|
||||
<div class="upaper-item-q">
|
||||
<div>{{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.content}}</div>
|
||||
<div class="qimg" v-if="ditem.images"><img class="qimg-fit" :src="imageBaseUrl+ditem.images"/></div>
|
||||
</div>
|
||||
<div class="upaper-item-opts" style="padding-left: 20px;">
|
||||
<div v-for="(opt,optIdx) in ditem.options" :key="optIdx" class="upaper-item-opt" :class="{'upaper-item-opt-user':ditem.userOptIdxs.indexOf(optIdx)>-1}">
|
||||
<div>
|
||||
<div>{{toLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00;font-size: 25px; ">√</span>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)==-1" style="color: #ff0000;font-size: 25px; ">×</span>
|
||||
<div v-for="(opt,optIdx) in ditem.options" :key="optIdx">
|
||||
<div class="upaper-item-opt" :class="{'upaper-item-opt-user':ditem.userOptIdxs.indexOf(optIdx)>-1}">
|
||||
<div>
|
||||
<div>{{toLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00;font-size: 25px; ">√</span>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)==-1" style="color: #ff0000;font-size: 25px; ">×</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="qimg" v-if="opt.images"><img class="qimg-fit" :src="imageBaseUrl+opt.images"/></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upaper-item-answer" style="display: flex;">
|
||||
@@ -147,6 +157,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
viewTest:[],
|
||||
imageBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
correctJudgment:correctJudgment,
|
||||
toLetter:numberToLetter,
|
||||
formatSeconds:formatSeconds,
|
||||
@@ -275,21 +286,42 @@ export default {
|
||||
userAnswer:'',
|
||||
optShow:true,
|
||||
content:item.title,
|
||||
images:item.images,
|
||||
options:[]
|
||||
}
|
||||
item.optionList.forEach(opt=>{
|
||||
q.options.push({
|
||||
id:opt.id,
|
||||
content:opt.content,
|
||||
answer:opt.isAnswer,
|
||||
checked:false
|
||||
})
|
||||
});
|
||||
if(item.type==3){
|
||||
q.options.push({
|
||||
id:item.id+'1',
|
||||
images:'',
|
||||
content:"正确",
|
||||
answer:item.answer=='true'? true:false,
|
||||
checked:false
|
||||
});
|
||||
q.options.push({
|
||||
id:item.id+'2',
|
||||
images:'',
|
||||
content:"错误",
|
||||
answer:item.answer=='true'? false:true,
|
||||
checked:false
|
||||
})
|
||||
}else{
|
||||
item.optionList.forEach(opt=>{
|
||||
q.options.push({
|
||||
id:opt.id,
|
||||
images:opt.images,
|
||||
content:opt.content,
|
||||
answer:opt.isAnswer,
|
||||
checked:false
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if(q.type==102){
|
||||
q.userAnswer=[];
|
||||
}
|
||||
qitems.push(q);
|
||||
});
|
||||
console.log(qitems,'qitems')
|
||||
return qitems;
|
||||
},
|
||||
startTest(){
|
||||
@@ -379,7 +411,7 @@ export default {
|
||||
present(){ //提交前处理
|
||||
let $this=this;
|
||||
let score=this.countTest();
|
||||
|
||||
console.log('score='+score);
|
||||
if(this.noAnswers.length>0){
|
||||
this.$confirm('还有未答试题,您确定要提交吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -400,6 +432,7 @@ export default {
|
||||
let totalScore=0;
|
||||
this.paper.items.forEach(item => {
|
||||
item.score=parseInt(item.score);
|
||||
//console.log(item.score,'item.score');
|
||||
totalScore+=item.score;//加到总分中
|
||||
if(item.type != 102){
|
||||
item.userAnswer='';
|
||||
@@ -417,6 +450,7 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
//console.log(totalScore,'totalScore');
|
||||
let scoreNum = 0;//用户得分
|
||||
let noAnswers=[];//是否都已答
|
||||
this.paper.items.forEach((item,idx) => {
|
||||
@@ -623,4 +657,14 @@ export default {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.qimg{
|
||||
padding-left: 30px;
|
||||
width:100%;
|
||||
text-align: left;
|
||||
.qimg-fit{
|
||||
width:100%;
|
||||
|
||||
object-fit:scale-down
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -63,21 +63,26 @@
|
||||
<template slot-scope="scope">
|
||||
<!-- v-if="scope.row.collectNumber === 0" -->
|
||||
<el-button type="text" v-if="!scope.row.published" @click="releaseData(scope.row,true)">发布</el-button>
|
||||
<el-button type="text" v-if="scope.row.enabled == false" @click="enableddata(scope.row,true)">上架</el-button>
|
||||
<el-button type="text" v-if="scope.row.enabled == true" @click="enableddata(scope.row,false)">下架</el-button>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- // 成绩控制需要结束状态 -->
|
||||
<el-button type="text" v-if="scope.row.published" @click="viewResults(scope.row)">成绩</el-button>
|
||||
<el-button type="text" v-if="scope.row.published" @click="pushResults(scope.row)">推送</el-button>
|
||||
<el-button type="text" v-if="scope.row.published" @click="creatQrCode(scope.row)">二维码</el-button>
|
||||
<!-- <el-button type="text" v-if="scope.row.published" @click="creatQrCode(scope.row)">二维码</el-button> -->
|
||||
<el-button type="text" v-if="scope.row.published" @click="releaseData(scope.row,false)">取消发布</el-button>
|
||||
<el-dropdown type="text" v-if="!scope.row.published" style="margin-left:10px">
|
||||
<el-dropdown type="text" style="margin-left:10px">
|
||||
<el-button type="text" > 考试 <i class="el-icon-arrow-down el-icon--right"></i> </el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<!-- <el-dropdown-item command="a">查看</el-dropdown-item> -->
|
||||
<el-dropdown-item command="b" @click.native="editData(scope.row)">编辑</el-dropdown-item>
|
||||
<el-dropdown-item command="c" @click.native="deleteData(scope.row)">删除</el-dropdown-item>
|
||||
<el-dropdown-item command="a" @click.native="creatQrCode(scope.row)">二维码</el-dropdown-item>
|
||||
<div v-if="scope.row.published">
|
||||
<el-dropdown-item command="d" v-if="scope.row.enabled == false" @click.native="enableddata(scope.row,true)">上架</el-dropdown-item>
|
||||
<el-dropdown-item command="e" v-if="scope.row.enabled == true" @click.native="open(scope.row,false)">下架</el-dropdown-item>
|
||||
</div>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@@ -112,18 +117,19 @@
|
||||
</el-cascader>
|
||||
</el-form-item> -->
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="模式" prop="testType">
|
||||
<el-select v-model="examForm.testType">
|
||||
<el-select :disabled="swichpublished" v-model="examForm.testType">
|
||||
<el-option label="测试模式" :value="1"></el-option>
|
||||
<el-option label="练习模式" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="24">
|
||||
<el-col :span="24" >
|
||||
<el-form-item label="考试名称" prop="testName">
|
||||
<el-input v-model="examForm.testName" maxlength="50"
|
||||
<el-input :disabled="swichpublished" v-model="examForm.testName" maxlength="50"
|
||||
show-word-limit placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -157,7 +163,7 @@
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="试卷" prop="paperId">
|
||||
<el-select v-model="examForm.paperId" placeholder="请选择" @change="changePaper">
|
||||
<el-select :disabled="swichpublished" v-model="examForm.paperId" placeholder="请选择" @change="changePaper">
|
||||
<el-option
|
||||
v-for="item in questDirOptions"
|
||||
:key="item.id"
|
||||
@@ -292,7 +298,7 @@
|
||||
{{ resOwnerName(detailInfo.resOwner1) }}/{{resOwnerName(detailInfo.resOwner2)}}{{ detailInfo.resOwner3 ? '/' : ''}}{{ resOwnerName(detailInfo.resOwner3) }}
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="模式">
|
||||
<span v-if="detailInfo.testType == 1">测试模式</span>
|
||||
<span v-if="detailInfo.testType == 2">练习模式</span>
|
||||
@@ -680,6 +686,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
swichpublished:false,
|
||||
toScoreTow,
|
||||
qnum:0,//这里默认是30吧
|
||||
examDateTime:[],
|
||||
@@ -762,6 +769,24 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
open(row,num) {
|
||||
this.$confirm('确定要下架改考试么?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.enableddata(row,num);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '下架成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消下架'
|
||||
});
|
||||
});
|
||||
},
|
||||
exportsList(){
|
||||
if(this.answerData.data.length == 0){
|
||||
return this.$message.warning('暂无导出数据!')
|
||||
@@ -993,6 +1018,7 @@ export default {
|
||||
}
|
||||
},
|
||||
editData(row) {
|
||||
this.swichpublished = row.published;
|
||||
if(this.questDirOptions.length==0){
|
||||
this.findPapers();//获取试卷列表
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
<ul>
|
||||
<li>考试时长: {{ testPaper.testDuration }}分钟</li>
|
||||
<li>及格线: {{ testPaper.passLine }}</li>
|
||||
<li v-if="testPaper.entranceTime">开始时间:
|
||||
{{ testPaper.entranceTime }}</li>
|
||||
<li v-if="testPaper.entranceTime">开始时间:{{ testPaper.entranceTime }}</li>
|
||||
<li v-if="testPaper.times">尝试次数: {{ testPaper.times }}</li>
|
||||
<li v-if="testPaper.deadlineTime">结束时间: {{ testPaper.deadlineTime }}</li>
|
||||
</ul>
|
||||
@@ -72,7 +71,10 @@
|
||||
<div v-if="judge.length > 0">
|
||||
<div class="question-type">判断题</div>
|
||||
<div v-for="(question, i) in judge" :key="question.id" class="question-info">
|
||||
<div>{{ i + 1 }}、{{ question.title }} ({{question.defaultScore}}分)</div>
|
||||
<div>
|
||||
<div> {{ i + 1 }}、{{ question.title }} ({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="question-option">
|
||||
<el-radio v-model="question.userAnswer" label="true">正确</el-radio>
|
||||
@@ -86,12 +88,14 @@
|
||||
<div v-if="single.length > 0">
|
||||
<div class="question-type">单选题</div>
|
||||
<div v-for="(question, i) in single" :key="question.id" class="question-info">
|
||||
<div>{{ i + 1 + judge.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div>
|
||||
<div>{{ i + 1 + judge.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images" class="qimg"><img class="qimg-fit" object-fit="contain" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="question-option" v-for="(option, j) in question.optionList" :key="option.id">
|
||||
<el-radio v-model="question.userAnswer":label="option.id">
|
||||
{{ numberToLetter(j+1) }}、{{ option.content }}
|
||||
</el-radio>
|
||||
<el-radio v-model="question.userAnswer":label="option.id">{{ numberToLetter(j+1) }}、{{ option.content }}</el-radio>
|
||||
<div v-if="option.images" class="qimg"><img class="qimg-fit" object-fit="contain" :src="imageBaseUrl+option.images"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,12 +104,14 @@
|
||||
<div class="question-type">多选题</div>
|
||||
<div v-for="(question, i) in multiple" :key="question.id" class="question-info">
|
||||
<div>
|
||||
{{ i + 1 + judge.length + single.length }}、{{ question.title }}({{question.defaultScore}}分)
|
||||
<div> {{ i + 1 + judge.length + single.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images"><img class="img-fit" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<el-checkbox-group v-model="question.userAnswer">
|
||||
<div class="question-option" v-for="(option, j) in question.optionList" :key="option.id">
|
||||
<el-checkbox :label="option.id">{{ numberToLetter(j + 1) }}、{{ option.content }}</el-checkbox>
|
||||
<el-checkbox :label="option.id">{{ numberToLetter(j + 1) }}、{{ option.content }}</el-checkbox>
|
||||
<div v-if="option.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+option.images"/></div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@@ -122,11 +128,14 @@
|
||||
<el-button type="primary" @click="closeTest()">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showPaperAnser === true">
|
||||
<div v-if="showPaperAnser === true">
|
||||
<div v-if="judge.length > 0" style="margin-top:20px">
|
||||
<div class="question-type">判断题</div>
|
||||
<div v-for="(question, i) in judge" :key="question.id" class="question-info">
|
||||
<div>{{ i + 1 }}、{{ question.title }} ({{question.defaultScore}}分)</div>
|
||||
<div>
|
||||
<div>{{ i + 1 }}、{{ question.title }} ({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="question-option">
|
||||
<el-radio v-model="question.userAnswer" disabled :label="true">正确</el-radio>
|
||||
@@ -143,10 +152,15 @@
|
||||
<div v-if="single.length > 0">
|
||||
<div class="question-type">单选题</div>
|
||||
<div v-for="(question, i) in single" :key="question.id" class="question-info">
|
||||
<div>{{ i + 1 + judge.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div>
|
||||
<div> {{ i + 1 + judge.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="question-option" v-for="(option, j) in question.optionList" :key="option.id">
|
||||
<el-radio disabled v-model="question.userAnswer" :label="option.id" >{{ numberToLetter(j+1) }}、{{ option.content }}</el-radio>
|
||||
<el-radio disabled v-model="question.userAnswer" :label="option.id" >
|
||||
{{ numberToLetter(j+1) }}、{{ option.content }}</el-radio>
|
||||
<div v-if="option.images" class="qimg"> <img class="qimg-fit":src="imageBaseUrl+option.images"/></div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="testPaper.showAnswer">正确答案:<span v-for="(item,a) in question.optionList" :key="a">{{item.isAnswer?numberToLetter(a+1):''}}</span></p>
|
||||
@@ -157,13 +171,14 @@
|
||||
<div class="question-type">多选题</div>
|
||||
<div v-for="(question, i) in multiple" :key="question.id" class="question-info">
|
||||
<div>
|
||||
{{ i + 1 + judge.length + single.length }}、{{ question.title }}({{question.defaultScore}}分)
|
||||
<div> {{ i + 1 + judge.length + single.length }}、{{ question.title }}({{question.defaultScore}}分)</div>
|
||||
<div v-if="question.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+question.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<el-checkbox-group v-model="question.userAnswer">
|
||||
<div class="question-option" v-for="(option, j) in question.optionList" :key="option.id">
|
||||
<el-checkbox disabled
|
||||
:label="option.id">{{ numberToLetter(j + 1) }}、{{ option.content }}</el-checkbox>
|
||||
<el-checkbox disabled :label="option.id">{{ numberToLetter(j + 1) }}、{{ option.content }}</el-checkbox>
|
||||
<div v-if="option.images" class="qimg"> <img class="qimg-fit" :src="imageBaseUrl+option.images"/></div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@@ -178,11 +193,15 @@
|
||||
<el-dialog title="查看试卷" append-to-body :visible.sync="viewUserPapereShow" width="70%" custom-class="g-dialog">
|
||||
<div style="padding: 10px; font-size: 20px" class="upaper">
|
||||
<div v-for="(ditem,didx) in paperDetailData" :key="didx" class="upaper-item">
|
||||
<div class="upaper-item-q">{{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.title}}</div>
|
||||
<div class="upaper-item-q">
|
||||
<div> {{didx +1}}.【{{getTypeName(ditem.type)}}】{{ditem.title}}</div>
|
||||
<div v-if="ditem.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+ditem.images"/> </div>
|
||||
</div>
|
||||
<div class="upaper-item-opts" style="padding-left: 20px;">
|
||||
<div v-for="(opt,optIdx) in ditem.optionList" :key="optIdx" class="upaper-item-opt" :class="{'upaper-item-opt-user':ditem.userOptIdxs.indexOf(optIdx)>-1}">
|
||||
<div>
|
||||
<div>{{numberToLetter(optIdx+1)}}, {{opt.content}}</div>
|
||||
<div v-if="opt.images" class="qimg"><img class="qimg-fit" :src="imageBaseUrl+opt.images"/> </div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="ditem.userOptIdxs.indexOf(optIdx)>-1 && ditem.correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00;font-size: 25px; ">√</span>
|
||||
@@ -239,6 +258,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading:0,
|
||||
imageBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
toScoreTow,
|
||||
examId:'',//考试的id
|
||||
taskId:'',//考试任务的id
|
||||
@@ -305,7 +325,7 @@ export default {
|
||||
if(this.$route.query.refType){
|
||||
this.refType = this.$route.query.refType;
|
||||
}
|
||||
|
||||
|
||||
if(this.examId) {
|
||||
this.loadData()
|
||||
}else{
|
||||
@@ -966,7 +986,7 @@ export default {
|
||||
}
|
||||
.test-info {
|
||||
// text-align: center;
|
||||
width: 500px;
|
||||
width: 600px;
|
||||
margin: 0 auto;
|
||||
background: #eee;
|
||||
border-radius: 16px;
|
||||
@@ -986,6 +1006,15 @@ export default {
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.qimg{
|
||||
padding-left: 30px;
|
||||
width:100%;
|
||||
.qimg-fit{
|
||||
width:100%;
|
||||
object-fit:scale-down
|
||||
}
|
||||
}
|
||||
.question-type {
|
||||
font-weight: 500;
|
||||
font-size: 20px;
|
||||
|
||||
Reference in New Issue
Block a user