增加裁判平台修改分数

This commit is contained in:
zyy 2020-05-28 17:09:22 +08:00
parent 6ae66333e4
commit e569702907
4 changed files with 131 additions and 96 deletions

View File

@ -81,14 +81,14 @@ export function getRaceUserList(params) {
}); });
} }
// /** 分页查询理论题列表 */ /** 裁判打分 */
// export function getCompetitionTheory(params) { export function putRefereeScoring(data) {
// return request({ return request({
// url: `/api/v1/competitionTheory`, url: `/api/v1/competition/referee/scoring`,
// method: 'get', method: 'put',
// params data
// }); });
// } }
/** 提交试卷 */ /** 提交试卷 */
export function postCompetitionTheory(data) { export function postCompetitionTheory(data) {

View File

@ -0,0 +1,118 @@
<template>
<el-dialog v-dialogDrag title="修改分数" :visible.sync="show" top="150px" width="500px" :before-do-close="doClose" :close-on-click-modal="false">
<el-form ref="form" :model="info" :rules="rules" label-width="100px" class="demo-ruleForm">
<el-form-item label="理论分数" prop="theoryScore">
<el-input v-model="info.theoryScore" style="width: 200px" />
</el-form-item>
<el-form-item label="实操分数" prop="practiceScore">
<el-input v-model="info.practiceScore" style="width: 200px" />
</el-form-item>
</el-form>
<div class="edit_score">
<el-button type="primary" size="medium" :loading="loading" @click="editScore">修改</el-button>
<el-button size="medium" @click="doClose">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { putRefereeScoring } from '@/api/competition';
export default {
name:'EditScore',
data() {
return {
show: false,
loading:false,
info: {
raceId: 0,
userId: 0,
theoryScore: 0,
practiceScore: 0
}
};
},
computed: {
rules() {
return {
theoryScore: [
{ required: true, message: '请输入理论分数', trigger: 'blur' },
{ validator: this.validatorNumber1 }
],
practiceScore: [
{ required: true, message: '请输入实操分数', trigger: 'blur' },
{ validator: this.validatorNumber2 }
]
};
}
},
methods: {
doShow(data) {
this.show = true;
this.reloadInfo(data);
},
reloadInfo(data) {
this.info = {
raceId: data.raceId,
userId: data.userId,
theoryScore: data.theoryScore,
practiceScore: data.practiceScore
};
},
doClose() {
this.show = false;
},
editScore() {
this.$refs['form'].validate(valid => {
if (valid) {
const data = {
raceId: this.info.raceId,
userId: this.info.userId,
theoryScore: this.info.theoryScore,
practiceScore: this.info.practiceScore
};
putRefereeScoring(data).then(res => {
this.doClose();
this.$message.success('修改分数成功');
}).catch(() => {
this.doClose();
this.$message.error('修改分数失败');
});
}
});
},
validatorNumber1(rule, value, callback) {
if (Number(value) < 0) {
callback(new Error('输入分数不能小于0'));
} else if (Number(value) > 0 && Number(value) <= 100) {
callback();
} else if (Number(value) > 100) {
callback(new Error('输入分数大于当前试题分值'));
} else {
callback(new Error('请输入正确的分数'));
}
},
validatorNumber2(rule, value, callback) {
if (Number(value) < 0) {
callback(new Error('输入分数不能小于0'));
} else if (Number(value) > 0 && Number(value) <= 100) {
callback();
} else if (Number(value) > 100) {
callback(new Error('输入分数大于当前试题分值'));
} else {
callback(new Error('请输入正确的分数'));
}
}
}
};
</script>
<style lang="scss" scoped>
.edit_score{
text-align:center;
margin-top:20px;
}
/deep/{
.el-dialog__body{
padding-top: 10px;
}
}
</style>

View File

@ -1,18 +1,18 @@
<template> <template>
<div class="refereeList"> <div class="refereeList">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<!-- <question-list ref="questionList" /> --> <edit-score ref="editScore" />
</div> </div>
</template> </template>
<script> <script>
import { refereeEnterSimulation, loadingPaper, getRaceUserList } from '@/api/competition'; import { refereeEnterSimulation, loadingPaper, getRaceUserList } from '@/api/competition';
// import QuestionList from './questionList'; import editScore from './editScore';
export default { export default {
name: 'RefereeList', name: 'RefereeList',
components:{ components:{
// QuestionList editScore
}, },
data() { data() {
return { return {
@ -193,8 +193,8 @@ export default {
}, },
playBack(index, row) { playBack(index, row) {
}, },
gradeScore(index, row) { gradeScore(index, row) { //
this.$refs.editScore.doShow(row);
}, },
// afterQuery(data) { // afterQuery(data) {
// clearTimeout(this.inter); // clearTimeout(this.inter);

View File

@ -1,83 +0,0 @@
<template>
<el-dialog
v-dialogDrag
title="试题列表"
:visible.sync="show"
top="20px"
width="500px"
:before-do-close="doClose"
:close-on-click-modal="false"
>
<el-table :data="questionList" style="width: 100%" border @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55"
/>
<el-table-column prop="name" label="试题名称" />
</el-table>
<div class="startExam">
<span><el-button type="primary" :loading="loading" @click="startExam">开始竞赛</el-button></span>
</div>
</el-dialog>
</template>
<script>
import {getQuestionListByMapId, loadQuestionList} from '@/api/competition';
export default {
name:'QuestionList',
data() {
return {
show: false,
loading:false,
questionList:[
{id:1, name:'实操试题1'},
{id:2, name:'实操试题2'},
{id:3, name:'实操试题3'},
{id:4, name:'实操试题4'},
{id:5, name:'实操试题5'},
{id:6, name:'实操试题6'},
{id:7, name:'实操试题7'}
],
multipleSelection:[]
};
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
reloadTable() {
getQuestionListByMapId({mapId:41, pageNum:10, pageSize:1}).then(response=>{
// this.questionList = response.data;
});
},
doClose() {
this.show = false;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
startExam() {
if (this.multipleSelection.length > 0) {
const ids = [];
this.multipleSelection.forEach(question=>{
ids.push(question.id);
});
loadQuestionList(1, ids).then((response)=>{
this.$message('开始考试成功!');
this.doClose();
}).catch(()=>{
this.$message('开始考试失败');
});
} else {
this.$messageBox('请选择试题');
}
}
}
};
</script>
<style lang="scss" scoped>
.startExam{
text-align:center;
margin-top:20px;
}
</style>