龚焕茏
2024-06-04 a57f1cab5efbbd118759b77568ffe0b5369d8599
feat:题目查询、新增
6个文件已修改
116 ■■■■■ 已修改文件
src/components/PopUp/gap-filling.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PopUp/multiple-choice.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PopUp/short-answer.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PopUp/single-choice.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PopUp/true-false.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Manage/TestPaper/QuestionBank.vue 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PopUp/gap-filling.vue
@@ -186,9 +186,7 @@
          questionApi.edit(this.form).then(re => {
            if (re.code === 1) {
              _this.$message.success(re.message)
              _this.delCurrentView(_this).then(() => {
                _this.$router.push('/exam/question/list')
              })
              this.$emit('callback')
            } else {
              _this.$message.error(re.message)
              this.formLoading = false
src/components/PopUp/multiple-choice.vue
@@ -175,9 +175,7 @@
          questionApi.edit(this.form).then(re => {
            if (re.code === 1) {
              _this.$message.success(re.message)
              _this.delCurrentView(_this).then(() => {
                _this.$router.push('/exam/question/list')
              })
              this.$emit('callback')
            } else {
              _this.$message.error(re.message)
              this.formLoading = false
src/components/PopUp/short-answer.vue
@@ -146,9 +146,7 @@
          questionApi.edit(this.form).then(re => {
            if (re.code === 1) {
              _this.$message.success(re.message)
              _this.delCurrentView(_this).then(() => {
                _this.$router.push('/exam/question/list')
              })
              this.$emit('callback')
            } else {
              _this.$message.error(re.message)
              this.formLoading = false
src/components/PopUp/single-choice.vue
@@ -175,9 +175,7 @@
          questionApi.edit(this.form).then(re => {
            if (re.code === 1) {
              _this.$message.success(re.message)
              _this.delCurrentView(_this).then(() => {
                _this.$router.push('/exam/question/list')
              })
              this.$emit('callback')
            } else {
              _this.$message.error(re.message)
              this.formLoading = false
src/components/PopUp/true-false.vue
@@ -157,9 +157,7 @@
          questionApi.edit(this.form).then(re => {
            if (re.code === 1) {
              _this.$message.success(re.message)
              _this.delCurrentView(_this).then(() => {
                _this.$router.push('/exam/question/list')
              })
              this.$emit('callback')
            } else {
              _this.$message.error(re.message)
              this.formLoading = false
src/views/Manage/TestPaper/QuestionBank.vue
@@ -17,12 +17,12 @@
          </div>
          <!-- 搜索 -->
          <div>
            <el-form :inline="true" :model="formLabelAlign" class="demo-form-inline" label-width="80px">
            <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px">
              <el-form-item>
                <el-input v-model="formLabelAlign.type" placeholder="题目名"></el-input>
                <el-input v-model="queryParam.content" placeholder="题目名"></el-input>
              </el-form-item>
              <el-form-item>
                <el-select v-model="formLabelAlign.region" placeholder="全部科目">
                <el-select v-model="queryParam.subjectId" placeholder="全部科目">
                  <el-option label="全部科目" value="shanghai"></el-option>
                  <el-option label="语文" value="beijing"></el-option>
                  <el-option label="数学" value="beijing"></el-option>
@@ -30,7 +30,7 @@
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-select v-model="formLabelAlign.region" placeholder="选择题">
                <el-select v-model="queryParam.questionType" placeholder="选择题">
                  <el-option label="选择题" value="shanghai"></el-option>
                  <el-option label="问答题" value="beijing"></el-option>
                  <el-option label="判断题" value="beijing"></el-option>
@@ -44,17 +44,22 @@
          </div>
          <!-- 表格 -->
          <el-table v-loading="listLoading" :header-cell-style="getRowClass" :data="tableData" border style="width: 100%;">
            <el-table-column align="center" prop="title" label="题目名">
            <el-table-column align="center" prop="shortTitle" label="题目名">
            </el-table-column>
            <el-table-column align="center" prop="subject" label="科目">
            <el-table-column align="center" prop="subjectName" label="科目">
            </el-table-column>
            <el-table-column align="center" prop="type" label="题目类型">
            <el-table-column align="center" prop="questionTypeName" label="题型">
            </el-table-column>
            <el-table-column align="center" prop="score" label="参考答案">
            <el-table-column align="center" prop="score" label="分数">
            </el-table-column>
            <el-table-column label="操作" align="center">
              <el-button type="text">编辑</el-button>
              <el-button type="text">删除</el-button>
            <el-table-column prop="difficult" label="难度" width="60px"/>
            <el-table-column prop="createTime" label="创建时间" width="160px"/>
            <el-table-column label="操作" align="center" width="220px">
              <template slot-scope="{row}">
                <el-button size="mini"   @click="showQuestion(row)">预览</el-button>
                <el-button size="mini"  @click="editQuestion(row)">编辑</el-button>
                <el-button size="mini"  type="danger" @click="deleteQuestion(row)" class="link-left">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="display: flex; margin-top: 40px;">
@@ -67,23 +72,27 @@
    </div>
    <!-- 填空 -->
    <el-dialog :visible.sync="gapVisible" :close-on-click-modal="false">
      <gap ref="gap" @children="parentGoods" />
      <gap ref="gap" @children="parentGoods" @callback="callback" />
    </el-dialog>
    <!-- 多选 -->
    <el-dialog :visible.sync="multipleVisible" :close-on-click-modal="false">
      <multiple ref="multiple" @children="parentGoods" />
      <multiple ref="multiple" @children="parentGoods" @callback="callback" />
    </el-dialog>
    <!-- 简答 -->
    <el-dialog :visible.sync="shortVisible" :close-on-click-modal="false">
      <short ref="short" @children="parentGoods" />
      <short ref="short" @children="parentGoods" @callback="callback" />
    </el-dialog>
    <!-- 单选 -->
    <el-dialog :visible.sync="singleVisible" :close-on-click-modal="false">
      <single ref="single" @children="parentGoods" />
      <single ref="single" @children="parentGoods" @callback="callback" />
    </el-dialog>
    <!-- 判断 -->
    <el-dialog :visible.sync="truesVisible" :close-on-click-modal="false">
      <trues ref="trues" @children="parentGoods" />
      <trues ref="trues" @children="parentGoods" @callback="callback" />
    </el-dialog>
    <el-dialog :visible.sync="questionShow.dialog" style="width: 100%;height: 100%">
      <QuestionShow :qType="questionShow.qType" :question="questionShow.question" :qLoading="questionShow.loading"/>
    </el-dialog>
  </div>
</template>
@@ -96,6 +105,7 @@
import trues from "@/components/PopUp/true-false.vue";
import { mapGetters, mapState } from 'vuex'
import questionApi from '@/api/question'
import QuestionShow from '@/components/PopUp/question/Show'
export default {
  // 注册
@@ -105,13 +115,21 @@
    short,
    single,
    trues,
    QuestionShow
  },
  data() {
    return {
      questionShow: {
        qType: 0,
        dialog: false,
        question: null,
        loading: false
      },
      listLoading: true,
      queryParam: {
        questionType: null,
        subjectId: null,
        content: null,
        pageIndex: 1,
        pageSize: 10
      },
@@ -121,11 +139,6 @@
      shortVisible: false,
      singleVisible: false,
      truesVisible: false,
      formLabelAlign: {
        type: "",
        user: "",
        region: "",
      },
      tableData: [],
    };
  },
@@ -133,13 +146,22 @@
    this.search()
  },
  methods: {
    callback() {
      this.gapVisible = false;
      this.multipleVisible = false;
      this.shortVisible = false;
      this.singleVisible = false;
      this.truesVisible = false;
      this.search()
    },
    // 获取列表
    search() {
      this.listLoading = true
      questionApi.pageList(this.queryParam).then(re => {
        this.tableData = re.data
        this.total = re.total
        this.queryParam.pageIndex = re.pageNum
        this.tableData = re.data.list
        this.total = re.data.total
        this.queryParam.pageSize = re.data.pageSize
        this.queryParam.pageIndex = re.data.pageNum
        this.listLoading = false
      })
    },
@@ -184,6 +206,31 @@
    parentGoods(obj) {
      console.log(obj, "弹窗组件的表单值");
    },
    showQuestion (row) {
      let _this = this
      this.questionShow.dialog = true
      this.questionShow.loading = true
      questionApi.select(row.id).then(re => {
        _this.questionShow.qType = re.data.questionType
        _this.questionShow.question = re.data
        _this.questionShow.loading = false
      })
    },
    editQuestion (row) {
      let url = this.enumFormat(this.editUrlEnum, row.questionType)
      this.$router.push({ path: url, query: { id: row.id } })
    },
    deleteQuestion (row) {
      let _this = this
      questionApi.deleteQuestion(row.id).then(re => {
        if (re.code === 1) {
          _this.search()
          _this.$message.success(re.message)
        } else {
          _this.$message.error(re.message)
        }
      })
    },
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
@@ -191,6 +238,7 @@
      questionTypeEnum: state => state.exam.question.typeEnum,
      editUrlEnum: state => state.exam.question.editUrlEnum
    }),
    ...mapGetters('exam', ['subjectEnumFormat']),
    ...mapState('exam', { subjects: state => state.subjects })
  }
};