fuliqi
2024-06-06 711555c3d5c36a0b2ca34eb9dc8b31a8101d9e81
模板可见性配置
2个文件已修改
33 ■■■■■ 已修改文件
src/api/examTemplate.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Manage/TestPaper/PaperTemplate.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/examTemplate.js
@@ -45,7 +45,7 @@
// 修改随机试卷模板
export const editExamTemplate = (params) => {
    return axios({
        url: "/api/admin/exam-template/",
        url: "/api/admin/exam-template",
        method: "PUT",
        data: params
    })
@@ -54,7 +54,7 @@
// 添加随机试卷模板
export const addExamTemplate = (params) => {
    return axios({
        url: "/api/admin/exam-template/",
        url: "/api/admin/exam-template",
        method: "POST",
        data: params
    })
src/views/Manage/TestPaper/PaperTemplate.vue
@@ -123,6 +123,10 @@
            <el-form-item label="考试时长(分钟)" prop="suggestTime">
              <el-input-number v-model="form.suggestTime" placeholder="请输入考试时长"/>
            </el-form-item>
            <el-form-item label="权限" prop="visibility">
              <el-radio v-model="form.visibility" :label="1">私有</el-radio>
              <el-radio v-model="form.visibility" :label="2">公开</el-radio>
            </el-form-item>
            <el-form-item label="多选题得分类型" prop="deductType" v-show="addedQuestionTypes.includes(2)"><!-- 有多选才出现 -->
              <div>
                <el-select v-model="form.deductType" placeholder="请选择多选题得分类型" style="width: 200px;margin-right: 30px">
@@ -188,6 +192,7 @@
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 添加题目对话框 -->
        <el-dialog :title="questionTitle" :visible.sync="questionOpen" width="400px" append-to-body>
          <el-form ref="questionForm" :model="questionForm" :rules="questionRules">
@@ -234,7 +239,7 @@
  data() {
    var validateDeductType = (rule, value, callback) => {
      const index = this.addedQuestionTypes.findIndex(item => item.questionType === 2)
      if (index && (!value || value === '')) {
      if (index !== -1 && (!value || value === '')) {
        callback(new Error('请选择多选题得分方式'));
      } else {
        callback();
@@ -255,7 +260,9 @@
        currentPage: 1,
        pageSize: 10
      },
      form: {},
      form: {
        visibility: 1
      },
      questionForm: {},
      tableData: [],
      subjects: [],
@@ -393,6 +400,7 @@
        name: null,
        subjectId: null,
        suggestTime: null,
        visibility: 1
      };
      this.addedQuestionTypes = []
      this.questionList = []
@@ -474,25 +482,22 @@
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.deptId && this.form.deptId.length > 0) {
            this.form.deptId = this.form.deptId[this.form.deptId.length - 1]
          }
          let temp = {
            ...this.form,
            category: parseInt(this.form.category)
          };
          temp.questionList = this.questionList
          if (temp.id != null) {
            updatePoint(temp).then(response => {
              this.$modal.msgSuccess("修改成功");
            editExamTemplate(temp).then(response => {
              this.$message("修改成功");
              this.open = false;
              this.getList();
              this.getPage();
            });
          } else {
            addPoint(temp).then(response => {
              this.$modal.msgSuccess("新增成功");
            addExamTemplate(temp).then(response => {
              this.$message("新增成功");
              this.open = false;
              this.reset()
              this.getList();
              this.getPage();
            });
          }
        } else {