刘洋 9 月之前
父節點
當前提交
a86dbb8d26

+ 4 - 0
src/modules/question/api.js

@@ -313,6 +313,10 @@ export function questionImportDownloadTemplate(datas) {
   });
 }
 
+export function checkOptionRepeatApi() {
+  return $httpWithMsg.post(`${QUESTION_API}/auth/check_option_repeat`, {});
+}
+
 // gpt-question
 export function checkGptQuestionEnableApi() {
   return $httpWithMsg.post(`${QUESTION_API}/auth/ai_question_enable`, {});

+ 5 - 1
src/modules/question/components/edit/SelectQuestion.vue

@@ -93,7 +93,11 @@
           </el-checkbox>
         </el-checkbox-group> -->
       </el-form-item>
-      <el-form-item prop="ignoreOptionRepeat" label="允许答案重复">
+      <el-form-item
+        prop="ignoreOptionRepeat"
+        label="允许答案重复"
+        v-if="!$store.state.checkOptionRepeat"
+      >
         <el-switch
           v-model="modalForm.ignoreOptionRepeat"
           active-text="是"

+ 9 - 1
src/modules/question/views/QuestionManage.vue

@@ -368,6 +368,7 @@ import {
   aiQuestionConfirmApi,
   classifyQuestionPageListApi,
   getAiNums,
+  checkOptionRepeatApi,
 } from "../api";
 import QuestionStatisticsDialog from "../components/QuestionStatisticsDialog.vue";
 import QuestionSafetySetDialog from "../components/QuestionSafetySetDialog.vue";
@@ -379,7 +380,7 @@ import FolderQuestionManageDialog from "../components/FolderQuestionManageDialog
 import PropertyTreeSelect from "../components/PropertyTreeSelect.vue";
 import QuestionImportEdit from "../components/QuestionImportEdit.vue";
 import GptQuestionDialog from "../components/GptQuestionDialog.vue";
-import { mapActions, mapGetters } from "vuex";
+import { mapActions, mapGetters, mapMutations } from "vuex";
 import { USER_SIGNIN } from "../../portal/store/user";
 import QuestionFolder from "@/modules/question/components/QuestionFolder.vue";
 
@@ -443,9 +444,12 @@ export default {
     this.$refs.QuestionFolder.selectDefaultNode();
 
     this.checkGptEnable();
+    this.checkRepeatEnable();
     this.toPage(1);
   },
   methods: {
+    ...mapMutations(["setCheckOptionRepeat"]),
+
     folderFilterSelected(folder) {
       console.log("left tree choose folder:", folder);
       if (!folder) return;
@@ -461,6 +465,10 @@ export default {
       this.toPage(1);
     },
     ...mapActions([USER_SIGNIN]),
+    async checkRepeatEnable() {
+      let res = await checkOptionRepeatApi();
+      this.setCheckOptionRepeat(res.data);
+    },
     async checkGptEnable() {
       const res = await checkGptQuestionEnableApi();
       // this.gptQuestionEnable = res.data;

+ 4 - 0
src/store/index.js

@@ -13,6 +13,7 @@ export default new Vuex.Store({
   state: {
     version: "",
     authButtons: [],
+    checkOptionRepeat: true,
   },
   mutations: {
     setVersion(state, version) {
@@ -22,6 +23,9 @@ export default new Vuex.Store({
     setAuthButtons(state, arr) {
       state.authButtons = arr;
     },
+    setCheckOptionRepeat(state, bool) {
+      state.checkOptionRepeat = bool;
+    },
   },
   actions: {},
   modules: {