Administrator
2021-08-05 1cfd2dea036eeab43b1d4b6db60bc79d957b8111
考试题目修改
4 files modified
192 ■■■■ changed files
public/papers.html 16 ●●●● patch | view | raw | blame | history
src/styles/element-ui.scss 18 ●●●● patch | view | raw | blame | history
src/views/exam/addsubject.vue 107 ●●●● patch | view | raw | blame | history
src/views/exam/subject.vue 51 ●●●●● patch | view | raw | blame | history
public/papers.html
@@ -12,7 +12,7 @@
            justify-content: center;
            flex-direction: column;
        }
        .user-info-table {
            margin-top: 30px;
            width: 60%;
@@ -20,25 +20,25 @@
            border: 1px solid #000;
            background-color: #fff;
        }
        .user-info-tr {
            height: 50px;
        }
        .avatar {
            width: 140px;
            height: 190px;
        }
        .title {
            margin-top: 20px;
        }
        .avatar {
            width: 140px;
            height: 190px;
        }
        .my-picture {
            width: 150px;
            /* height: 200px; */
@@ -121,7 +121,7 @@
            var examType = JSON.parse(getData("data")).examType;
            // console.log(JSON.parse(getData("data")), 111);
            axios.get('http://47.49.21.216:82/apply/getApplyInfo?id=' + id + "&applyExamType=" + examType).then(function(res) {
            axios.get('http://localhost:81/apply/getApplyInfo?id=' + id + "&applyExamType=" + examType).then(function(res) {
                var data = res.data.data;
                var str = `<span class="title">${data.examName}</span>
                    <span class="title">准考证信息</span>
@@ -204,4 +204,4 @@
        </script>
</body>
</html>
</html>
src/styles/element-ui.scss
@@ -20,7 +20,7 @@
}
.el-menu--display,
.el-menu--display + .el-submenu__icon-arrow {
.el-menu--display .el-submenu__icon-arrow {
    display: none;
}
@@ -49,17 +49,17 @@
.el-dropdown-menu__item--divided:before,
.el-menu,
.el-menu--horizontal > .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal > .el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal>.el-submenu .el-submenu__title:hover {
    background-color: transparent;
}
.el-dropdown-menu__item--divided:before,
.el-menu,
.el-menu--horizontal > .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal > .el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal>.el-submenu .el-submenu__title:hover {
    background-color: transparent !important;
}
@@ -241,8 +241,8 @@
}
//top 导航 按钮
.el-menu--horizontal > .el-menu-item.is-active,
.el-menu--horizontal>.el-menu-item.is-active,
.avue-top,
.el-dropdown {
    color: #fff !important;
}
}
src/views/exam/addsubject.vue
@@ -1,18 +1,19 @@
<template>
    <el-dialog
      :title="this.id?'新增':'修改'"
      :title="this.id?'修改':'新增'"
      width="60%"
      modal-append-to-body='false'
      append-to-body='true'
      :close-on-click-model="true"
      :visible.sync="visible"
      @close='closeDialog'
    >
        <el-row style="margin-left:60px;margin-bottom:40px">
          <el-radio-group v-model="choicesType">
            <el-radio label="0">单选题</el-radio>
            <el-radio label="1">多选题</el-radio>
            <el-radio label="2">判断题</el-radio>
            <el-radio label="3">填空题</el-radio>
            <el-radio label="3">实操题</el-radio>
          </el-radio-group>
        </el-row>
        <avue-form ref="form" :option="option" v-model="form" @submit="submit" v-if="choicesType=='0'"></avue-form>
@@ -31,22 +32,15 @@
                  <el-button type="danger" class="optionContent-botton" icon="el-icon-delete" circle @click="deleteRows(index)"></el-button>
                </div>
              </div> -->
              <!-- <el-row :span="24">
                <el-col :span="6">
                  值:{{arrContent}}<br />
                  <avue-array v-model="arrContent" placeholder="请输入内容"></avue-array>
                </el-col>
              </el-row> -->
          </template>
        </avue-form>
    </el-dialog>
</template>
<script>
import { mapState } from 'vuex'
import {saveSubjectChoicesAndOption} from "@/api/examapi/examSubjects";
import {getSubjectAnswer} from "@/api/exam/subject";
export default {
  name: "add",
@@ -55,6 +49,10 @@
      inputs:{
        input1: 1,
      },
      optionContentAId:null,
      optionContentBId:null,
      optionContentCId:null,
      optionContentDId:null,
      arrContent:["1"],
      list:[
        {
@@ -67,7 +65,6 @@
          data:1
        },
      ],
      id:1,
      // index:1,
      visible:false,
      choicesType:"0",
@@ -101,6 +98,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "类型",
@@ -128,6 +126,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "选项",
@@ -270,6 +269,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "类型",
@@ -297,6 +297,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "选项",
@@ -439,6 +440,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "类型",
@@ -466,6 +468,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          // {
          //   label: "选项",
@@ -561,6 +564,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "类型",
@@ -588,6 +592,7 @@
                trigger: "blur",
              },
            ],
            span:24
          },
          {
            label: "选项",
@@ -687,9 +692,61 @@
  methods: {
    //初始化
    inits(id) {
      this.id = id || 1;
      this.id = id || 0;
      this.visible = true;
      this.list = [{data:1}]
      if(this.id){
        //查询题目信息
        this.getSubjectInfo(id);
      }
    },
    //查询题目信息
    getSubjectInfo(id){
      var that = this;
      var param = {
        id:id
      }
      getSubjectAnswer((param)).then(res => {
        var data = res.data.data;
        that.choicesType = data.choicesType.toString();
        //单选题
        if(data.choicesType==0){
           that.form = data;
           that.optionContentAId = data.examSubjectOptions[0].id;
           that.optionContentBId = data.examSubjectOptions[1].id;
           that.optionContentCId = data.examSubjectOptions[2].id;
           that.optionContentDId = data.examSubjectOptions[3].id;
           that.form.optionContentA = data.examSubjectOptions[0].optionContent;
           that.form.optionContentB = data.examSubjectOptions[1].optionContent;
           that.form.optionContentC = data.examSubjectOptions[2].optionContent;
           that.form.optionContentD = data.examSubjectOptions[3].optionContent;
        }
        //多选题
        if(data.choicesType==1){
           that.formCheckbox = data;
           that.optionContentAId = data.examSubjectOptions[0].id;
           that.optionContentBId = data.examSubjectOptions[1].id;
           that.optionContentCId = data.examSubjectOptions[2].id;
           that.optionContentDId = data.examSubjectOptions[3].id;
           that.formCheckbox.optionContentA = data.examSubjectOptions[0].optionContent;
           that.formCheckbox.optionContentB = data.examSubjectOptions[1].optionContent;
           that.formCheckbox.optionContentC = data.examSubjectOptions[2].optionContent;
           that.formCheckbox.optionContentD = data.examSubjectOptions[3].optionContent;
        }
        //判断题
        if(data.choicesType==2){
           that.formJudge = data;
        }
        //实操题
        if(data.choicesType==3){
           that.formFill = data;
           that.formFill.optionContent1 = data.examSubjectOptions[0].optionContent;
           that.formFill.optionContent2 = data.examSubjectOptions[1].optionContent;
           that.formFill.optionContent3 = data.examSubjectOptions[2].optionContent;
           that.formFill.optionContent4 = data.examSubjectOptions[3].optionContent;
           that.formFill.optionContent5 = data.examSubjectOptions[4].optionContent;
        }
      });
    },
    //加一行
    addRows(){
@@ -723,21 +780,25 @@
      //选项信息
      const examSubjectOptions = [
        {
         id:that.optionContentAId,
         optionName:"A",
         optionContent:row.optionContentA,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentBId,
         optionName:"B",
         optionContent:row.optionContentB,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentCId,
         optionName:"C",
         optionContent:row.optionContentC,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentDId,
         optionName:"D",
         optionContent:row.optionContentD,
         creator:this.userInfo.user_name,
@@ -770,21 +831,25 @@
      //选项信息
      const examSubjectOptions = [
        {
         id:that.optionContentAId,
         optionName:"A",
         optionContent:row.optionContentA,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentBId,
         optionName:"B",
         optionContent:row.optionContentB,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentCId,
         optionName:"C",
         optionContent:row.optionContentC,
         creator:this.userInfo.user_name,
        },
        {
         id:that.optionContentDId,
         optionName:"D",
         optionContent:row.optionContentD,
         creator:this.userInfo.user_name,
@@ -889,8 +954,24 @@
        }
      );
    },
    //关闭窗口清除数据
    closeDialog(){
      if(this.choicesType==0){
          this.$refs.form.resetFields();
      }
      if(this.choicesType==1){
        this.$refs.formCheckbox.resetFields();
      }
      if(this.choicesType==2){
        this.$refs.formJudge.resetFields();
      }
      if(this.choicesType==3){
        this.$refs.formFill.resetFields();
      }
    }
  },
};
</script>
src/views/exam/subject.vue
@@ -34,6 +34,14 @@
                                       icon="el-icon-plus"
                                       @click="questionBankHandleAdd">新 增
                            </el-button>
                            <!-- <el-button
                                type="success"
                                size="small"
                                plain
                                icon="el-icon-upload2"
                                @click="handleImport"
                                >导入
                            </el-button> -->
                            <el-button type="danger"
                                       size="small"
                                       icon="el-icon-delete"
@@ -41,7 +49,39 @@
                            </el-button>
                        </template>
                        <template slot-scope="{row}" slot="menu">
                            <el-button type="text"
                                       size="mini"
                                       icon="el-icon-edit"
                                       @click="questionBankHandleAdd(row)">编辑
                            </el-button>
                            <el-button type="text"
                                       size="mini"
                                       icon="el-icon-delete"
                                       @click="questionBankHandleDel(row)">删除
                            </el-button>
                        </template>
                    </avue-crud>
                    <el-dialog
                        title="题目导入"
                        append-to-body
                        :visible.sync="excelBox"
                        width="555px"
                        >
                        <avue-form
                            :option="excelOption"
                            v-model="excelForm"
                            :upload-after="uploadAfter"
                        >
                            <template slot="excelTemplate">
                            <el-button type="primary" @click="handleTemplate">
                                点击下载<i class="el-icon-download el-icon--right"></i>
                            </el-button>
                            </template>
                        </avue-form>
                    </el-dialog>
                </div>
@@ -68,7 +108,7 @@
        return {
            questionBankOption: {
                // 操作栏多余按钮去除
                delBtn: true,
                delBtn: false,
                editBtn: false,
@@ -116,6 +156,9 @@
                        }, {
                            label: '判断题',
                            value: 2,
                        }, {
                            label: '实操题',
                            value: 3,
                        }],
                        slot: true,
                        width: 96,
@@ -190,8 +233,8 @@
        },
    },
    methods: {
        questionBankHandleAdd(){
            this.$refs.addsubject.inits();
        questionBankHandleAdd(row){
            this.$refs.addsubject.inits(row.id);
        },
        questionBankOnLoad (page, params = {}) {
            this.questionBankLoading = false;
@@ -268,8 +311,6 @@
                    this.$refs.questionBankCrud.toggleSelection();
                });
        },
    }
}
</script>