zhangjie 1 rok pred
rodič
commit
024e7b9fee

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

@@ -1,6 +1,10 @@
 import { $httpWithMsg } from "../../plugins/axios";
 import { QUESTION_API } from "@/constants/constants";
 
+export function aiQuestionConfirmApi() {
+  const url = `${QUESTION_API}/user/ai/question/confirm`;
+  return $httpWithMsg.post(url, {});
+}
 // common select
 export const courseQueryApi = (name, enable) => {
   return $httpWithMsg.get(`${QUESTION_API}/course/query`, {

+ 14 - 3
src/modules/question/views/QuestionManage.vue

@@ -273,6 +273,7 @@ import {
   moveQuestionApi,
   copyQuestionApi,
   checkGptQuestionEnableApi,
+  aiQuestionConfirmApi,
 } from "../api";
 import QuestionStatisticsDialog from "../components/QuestionStatisticsDialog.vue";
 import QuestionSafetySetDialog from "../components/QuestionSafetySetDialog.vue";
@@ -284,6 +285,8 @@ 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 } from "vuex";
+import { USER_SIGNIN } from "../../portal/store/user";
 
 export default {
   name: "QuestionMamage",
@@ -324,11 +327,17 @@ export default {
       gptQuestionEnable: false,
     };
   },
+  computed: {
+    user() {
+      return this.$store.state.user;
+    },
+  },
   mounted() {
     this.checkGptEnable();
     this.toPage(1);
   },
   methods: {
+    ...mapActions([USER_SIGNIN]),
     async checkGptEnable() {
       const res = await checkGptQuestionEnableApi();
       this.gptQuestionEnable = res.data;
@@ -495,8 +504,7 @@ export default {
         this.$message.error("请先选择课程!");
         return;
       }
-      let gptTips = sessionStorage.getItem("gptTips");
-      if (!gptTips) {
+      if (!this.user.aiQuestionConfirm) {
         const confirm = await this.$confirm(
           `请务必仔细阅读本协议内容,若您不同意本协议的任何内容,将无法使用该功能,智能出题功能借助AI工具来辅助出题,提高出题效率,减轻命题老师工作量,并不确保出题的正确性及适用性,请在出题后务必仔细检查核对,以免将有问题的试题加入试卷,用于考试。`,
           "提示",
@@ -505,7 +513,10 @@ export default {
           }
         ).catch(() => {});
         if (confirm !== "confirm") return;
-        sessionStorage.setItem("gptTips", "true");
+        await aiQuestionConfirmApi();
+        this.USER_SIGNIN(
+          Object.assign({}, this.user, { aiQuestionConfirm: true })
+        );
       }
 
       this.$refs.GptQuestionDialog.open();