feat:上传试题修改

This commit is contained in:
zty 2024-05-30 17:31:06 +08:00
parent f09effbcb0
commit f7083c7ee7
1 changed files with 49 additions and 11 deletions

View File

@ -48,6 +48,25 @@
<!-- <div> --> <!-- <div> -->
<div style="display: flex;"> <div style="display: flex;">
<el-button type="primary" @click="handleChoose" icon="el-icon-plus" style="margin-right: 10px;">选择试题</el-button> <el-button type="primary" @click="handleChoose" icon="el-icon-plus" style="margin-right: 10px;">选择试题</el-button>
<el-button type="primary" @click="handleChoose1" icon="el-icon-plus" style="margin-right: 10px;">上传试题</el-button>
<el-dialog
:visible.sync="impDialogVisible"
title="上传试题"
:left="'200px'"
:close-on-click-modal="false"
:height="'600px'"
>
<el-row>
<el-col :span="12">
<el-select v-model="impForm.question_type" style="margin-right: 10px;" placeholder="题目分类">
<el-option
v-for="item in type_list"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-col>
<el-upload <el-upload
:action="upUrl" :action="upUrl"
:on-success="handleUpSuccess" :on-success="handleUpSuccess"
@ -56,8 +75,16 @@
:file-list="fileList" :file-list="fileList"
:limit="1" :limit="1"
accept=".doc,.docx"> accept=".doc,.docx">
<el-button icon="el-icon-plus" type="primary" >上传试题</el-button> <el-col :span="12">
<el-button icon="el-icon-plus" type="primary" style="margin-right: 10px;">上传试题</el-button>
</el-col>
</el-upload> </el-upload>
</el-row>
<div style="text-align: right">
<el-button type="danger" @click="impDialogVisible=false">取消</el-button>
<el-button type="primary" @click="impDialogVisible=false">确认</el-button>
</div>
</el-dialog>
</div> </div>
<div v-for="(item, index) in questions"> <div v-for="(item, index) in questions">
<h4> <h4>
@ -103,12 +130,16 @@
panduan_count: 0 panduan_count: 0
}, },
upUrl: upUrl(), upUrl: upUrl(),
impDialogVisible: false,
fileList: [], fileList: [],
type_list:[],
upHeaders: upHeaders(), upHeaders: upHeaders(),
submitLoding: false, submitLoding: false,
impForm:{ impForm:{
doc_path:'' doc_path:'',
question_type:'',
}, },
rules: { rules: {
name: [ name: [
{ required: true, message: "名称不能为空", trigger: "blur" } { required: true, message: "名称不能为空", trigger: "blur" }
@ -136,8 +167,15 @@
getQuestioncat() { getQuestioncat() {
getQuestioncatList().then(response => { getQuestioncatList().then(response => {
this.workscopeData = response.data.results; this.workscopeData = response.data.results;
this.type_list = response.data.results;
}); });
}, },
handleChoose1(){
this.impDialogVisible = true;
},
closeDg() {
this.chooseVisible = false;
},
handleUpSuccess(res, file, filelist) { handleUpSuccess(res, file, filelist) {
let that =this; let that =this;
if (res.code == 201){ if (res.code == 201){