2020-05-27 11:25:39 +08:00
|
|
|
<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>  分</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="实操竞赛时长:" prop="operateExamTime">
|
|
|
|
<el-input-number v-model="form.operateExamTime" controls-position :min="1" /><span>  分</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
2020-05-27 13:51:27 +08:00
|
|
|
<el-button type="primary" @click="handleExport">导出</el-button>
|
2020-05-27 11:25:39 +08:00
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-05-27 13:51:27 +08:00
|
|
|
import { getRaceById } from '@/api/competition';
|
2020-05-27 11:25:39 +08:00
|
|
|
export default {
|
|
|
|
mixins: [
|
|
|
|
// WindowResizeHandler
|
|
|
|
],
|
|
|
|
props: {
|
2020-05-27 13:51:27 +08:00
|
|
|
operateQuestionList: {
|
|
|
|
type: Array,
|
|
|
|
default() {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
theoryQuestionList: {
|
2020-05-27 11:25:39 +08:00
|
|
|
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;
|
2020-05-27 13:51:27 +08:00
|
|
|
},
|
|
|
|
handleExport() {
|
|
|
|
getRaceById(this.$route.query.raceId).then(resp => {
|
|
|
|
const exportData = {
|
|
|
|
operateQuestionList: this.operateQuestionList,
|
|
|
|
theoryQuestionList: this.theoryQuestionList,
|
|
|
|
raceId: this.$route.query.raceId,
|
|
|
|
theoryExamTime: this.form.theoryExamTime,
|
|
|
|
operateExamTime: this.form.operateExamTime
|
|
|
|
};
|
|
|
|
console.log(exportData, '11111111');
|
|
|
|
const content = new Blob([JSON.stringify(exportData)]);
|
|
|
|
const urlObject = window.URL || window.webkitURL || window;
|
|
|
|
const url = urlObject.createObjectURL(content);
|
|
|
|
const el = document.createElement('a');
|
|
|
|
el.href = url;
|
|
|
|
el.download = `${resp.data.name}试卷.json`;
|
|
|
|
el.click();
|
|
|
|
urlObject.revokeObjectURL(url);
|
|
|
|
this.dialogVisible = false;
|
|
|
|
}).catch(()=> {
|
|
|
|
this.$message.error('查询竞赛详情失败!');
|
|
|
|
});
|
2020-05-27 11:25:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
</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>
|