zhangjie 1 gadu atpakaļ
vecāks
revīzija
8ae5d9f9fa

+ 12 - 0
src/assets/styles/pages.scss

@@ -20,6 +20,18 @@
       font-weight: 600;
     }
   }
+  .trade-table {
+    line-height: 1;
+    max-width: 600px;
+    .cell {
+      line-height: 1;
+    }
+    .el-table__header {
+      .el-table__cell {
+        padding: 8px 0;
+      }
+    }
+  }
 }
 
 // data-privilege

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

@@ -305,6 +305,9 @@ export function questionImportDownloadTemplate(datas) {
 }
 
 // gpt-question
+export function checkGptQuestionEnableApi() {
+  return $httpWithMsg.post(`${QUESTION_API}/auth/ai_question_enable`, {});
+}
 export function buildGptQuestionApi(datas) {
   return $httpWithMsg.post(`${QUESTION_API}/ai/question/build`, datas);
 }
@@ -317,8 +320,7 @@ export function gptQuestionListApi(data = {}) {
 }
 export function gptRebuildQuestionListApi(taskId) {
   return $httpWithMsg.post(
-    `${QUESTION_API}/ai/question/find_rebuild_question,
-    `,
+    `${QUESTION_API}/ai/question/find_rebuild_question`,
     {},
     { params: { taskId } }
   );

+ 5 - 1
src/modules/question/components/GptQuestionDialog.vue

@@ -376,7 +376,11 @@ export default {
     },
     toEditQuestion(row) {
       const propertyInfos =
-        this.$refs.PropertyTreeSelect.getCheckedPropertyInfos(row.propertyIds);
+        !row.propertyIds || !row.propertyIds.length
+          ? []
+          : this.$refs.PropertyTreeSelect.getCheckedPropertyInfos(
+              row.propertyIds
+            );
       this.curQuestion = { ...row, ...this.course, propertyInfos };
       this.$refs.GptQuestionEditDialog.open();
     },

+ 3 - 4
src/modules/question/components/GptQuestionEditDialog.vue

@@ -34,14 +34,14 @@
         </el-form-item>
         <el-form-item
           v-if="IS_SELECTION_QUESTION"
-          class="inline-top"
+          class="inline-top margin-left-10"
           label="选项个数:"
         >
           {{ formModel.optionCount }}
         </el-form-item>
         <el-form-item
           v-if="IS_FILL_QUESTION"
-          class="inline-top"
+          class="inline-top margin-left-10"
           label="填空个数:"
         >
           {{ formModel.blankCount }}
@@ -64,7 +64,6 @@
             >
             {{ content.secondProperty && content.secondProperty.name }}
           </el-tag>
-          <br />
           <el-input
             v-model="formModel.knowledgeNotes"
             placeholder="请录入知识点补充说明"
@@ -79,7 +78,7 @@
             :loading="hasTaskRunning || buildLoading"
             :disabled="confirmLoading"
             @click="toProduct"
-            >生成试题</el-button
+            >重新生成</el-button
           >
         </el-form-item>
       </el-form>

+ 2 - 2
src/modules/question/components/PropertyTreeSelect.vue

@@ -160,7 +160,7 @@ export default {
       if (!datas) return;
 
       this.proptree = propList.map((item, index) => {
-        let nitem = { ...item, disabled: true };
+        let nitem = { ...item, disabled: true, isCourseProperty: true };
         nitem.propertyList = datas[index].data;
         return nitem;
       });
@@ -204,7 +204,7 @@ export default {
         propertyList.forEach((item) => {
           let nitem = Object.assign({}, item, { propertyList: null });
           let nparents = [...parents, nitem];
-          if (selectedPropIds.includes(item.id)) {
+          if (!item.isCourseProperty && selectedPropIds.includes(item.id)) {
             propertyInfos.push(nparents);
           }
 

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

@@ -70,6 +70,7 @@
             >删除</el-button
           >
           <el-button
+            v-if="gptQuestionEnable"
             type="primary"
             plain
             icon="el-icon-tickets"
@@ -242,6 +243,7 @@
     ></question-import-edit>
     <!-- GptQuestionDialog -->
     <gpt-question-dialog
+      v-if="gptQuestionEnable"
       ref="GptQuestionDialog"
       :course="{
         courseId: curCourse.id,
@@ -259,6 +261,7 @@ import {
   deleteQuestionApi,
   moveQuestionApi,
   copyQuestionApi,
+  checkGptQuestionEnableApi,
 } from "../api";
 import QuestionStatisticsDialog from "../components/QuestionStatisticsDialog.vue";
 import QuestionSafetySetDialog from "../components/QuestionSafetySetDialog.vue";
@@ -307,12 +310,18 @@ export default {
       curCourse: {},
       curMoveType: "",
       questionImportData: {},
+      gptQuestionEnable: false,
     };
   },
   mounted() {
+    this.checkGptEnable();
     this.toPage(1);
   },
   methods: {
+    async checkGptEnable() {
+      const res = await checkGptQuestionEnableApi();
+      this.gptQuestionEnable = res.data;
+    },
     toPage(page) {
       this.currentPage = page;
       this.getList();

+ 11 - 2
src/modules/questions/views/OrgProperty.vue

@@ -200,7 +200,7 @@
       </el-form>
 
       <!-- 智能出题 -->
-      <el-form v-if="activeName === 'tab5'" label-width="120px">
+      <el-form v-if="activeName === 'tab5'" size="small" label-width="120px">
         <el-form-item label="购买出题数据包">
           <el-radio-group v-model="trade">
             <el-radio-button
@@ -223,7 +223,7 @@
           form.properties.AI_QUESTION_REMAINDER
         }}</el-form-item>
         <el-form-item label="已购记录">
-          <el-table :data="tradeList" border style="max-width: 600px">
+          <el-table :data="tradeList" border class="trade-table">
             <el-table-column type="index" label="序号" width="70" />
             <el-table-column prop="questionCount" label="购买出题数量" />
             <el-table-column prop="creationTime" width="170" label="购买时间" />
@@ -420,6 +420,15 @@ export default {
     async toBuy() {
       if (!this.trade) return;
 
+      const confirm = await this.$confirm(
+        `确定要购买${this.trade}道吗?`,
+        "提示",
+        {
+          type: "warning",
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+
       if (this.loading) return;
       this.loading = true;