生成试卷实操调整

This commit is contained in:
fan 2020-05-27 11:25:39 +08:00
parent 31f516abb2
commit a44fe915b8
2 changed files with 156 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<template>
<div style="width: 100%;height: 100%;">
<div style="margin-top: 10px;position: absolute; right: 50px;">
<el-button size="small" type="primary">导出试题</el-button>
<el-button size="small" type="primary" @click="exportPaper">导出试题</el-button>
<el-button size="small" type="primary" @click="goBack">返回</el-button>
</div>
<el-card style="width: 45%;margin-left: 50px;margin-top: 60px;display: inline-block;height: calc(100% - 100px);">
@ -36,7 +36,7 @@
<template slot-scope="scope">
<span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span>
<i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" />
<el-input v-if="scope.row.editScope" :ref="'input'+scope.row.id" v-model="scope.row.score" size="small" style="width: 50px;" @blur="editScopeBlur(scope.row)" />
<el-input v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" size="small" style="width: 50px;" @blur="editScopeBlur(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="operate" label="操作11">
@ -66,7 +66,9 @@
/>
<el-table-column prop="score" label="分值">
<template slot-scope="scope">
<el-input v-model="scope.row.score" size="small" />
<span v-if="!scope.row.editScope" @click="editScope(scope.row)">{{ scope.row.score }}</span>
<i v-if="!scope.row.editScope" class="el-icon-edit" @click="editScope(scope.row)" />
<el-input v-if="scope.row.editScope" v-model="scope.row.score" v-focus="scope.row.editFocus" size="small" style="width: 50px;" @blur="editScopeBlur(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="operate" label="操作">
@ -76,6 +78,7 @@
</el-table-column>
</el-table>
</el-card>
<set-exam-time ref="setExamTime" />
<theory-review ref="theoryReview" :theory-question-list="theoryQuestionList" />
<theory-question ref="theoryQuestion" :theory-index-list="theoryIndexList" @addQuestion="addTheoryQuestionList" @removeQuestion="removeTheoryQuestion" />
<operate-question ref="operateQuestion" :operate-index-list="operateIndexList" @addQuestion="addOperateQuestionList" @removeQuestion="removeOperateQuestion" />
@ -86,9 +89,11 @@
import TheoryReview from './theoryReview';
import TheoryQuestion from './theoryQuestion';
import OperateQuestion from './operateQuestion';
import SetExamTime from './setExamTime';
export default {
name: 'GeneratPaper',
components: {
SetExamTime,
TheoryReview,
TheoryQuestion,
OperateQuestion
@ -141,11 +146,15 @@ export default {
editScope(row) {
this.$set(row, 'editScope', true);
this.$nextTick(() => {
this.$refs['input' + row.id].focus();
this.$set(row, 'editFocus', true);
});
},
editScopeBlur(row) {
this.$set(row, 'editScope', false);
this.$set(row, 'editFocus', true);
},
exportPaper() {
this.$refs.setExamTime.doShow();
}
}
};

View File

@ -0,0 +1,143 @@
<template>
<el-dialog :visible.sync="dialogVisible" :before-close="handleClose" title="试卷导出" width="500px">
<el-form ref="form" :model="form" label-width="150px" :rules="rules">
<el-form-item label="理论竞赛时长:" prop="theoryExamTime">
<el-input-number v-model="form.theoryExamTime" controls-position :min="1" /><span>&nbsp&nbsp分</span>
</el-form-item>
<el-form-item label="实操竞赛时长:" prop="operateExamTime">
<el-input-number v-model="form.operateExamTime" controls-position :min="1" /><span>&nbsp&nbsp分</span>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleClose">导出</el-button>
<el-button @click="handleClose">取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
mixins: [
// WindowResizeHandler
],
props: {
operateIndexList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
index: 0,
height: 0,
loading: false,
dialogVisible: false,
form: {
theoryExamTime: 1,
operateExamTime: 1
},
rules: {
theoryExamTime: [
{ required: true, message: '请输入理论竞赛时长', trigger: 'blur' }
],
operateExamTime: [
{ required: true, message: '请输入实操竞赛时长', trigger: 'blur' }
]
}
};
},
computed: {
},
watch: {
},
methods: {
doShow() {
this.dialogVisible = true;
},
handleClose() {
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
.layer-center {
width: 900px;
height: 100%;
margin: auto;
background: #fff;
}
.quiz {
background: #eee;
height: 100%;
&::-webkit-scrollbar {
display:none
}
&__card {
height: 100%;
.dir-item {
padding-left: 25px;
}
.dir-caption {
padding-left: 10px;
line-height: 26px;
background: #f1f1f1;
}
}
&__container {
height: 100%;
&-header {
height: auto !important;
.title {
font-size: 24px;
line-height: 60px;
font-weight: bold;
text-align: center;
}
.notes {
color:#606266;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 20px;
}
}
&-main {
.section {
padding: 5px 20px;
.caption {
line-height: 26px;
}
.context {
}
}
}
&-footer {
text-align: right;
position: sticky;
bottom: 0px;
padding: 40px ;
.buttons {
position: relative;
bottom: 20px;
}
}
}
}
</style>