Browse Source

feat: 接口调试

zhangjie 7 months ago
parent
commit
0620bca153

+ 16 - 1
src/assets/styles/pages.scss

@@ -1308,12 +1308,27 @@
   }
   .log-history {
     height: 100%;
-    width: 330px;
+    width: 350px;
     flex-grow: 0;
     flex-shrink: 0;
     overflow-y: auto;
     overflow-x: hidden;
     padding: 15px;
+
+    &-table {
+      padding: 10px;
+      border-radius: 5px;
+      background-color: #f6f6f6;
+      height: 100%;
+      border: 1px solid #f0f0f0;
+    }
+    .el-table__row {
+      cursor: pointer;
+    }
+
+    .el-table__row.is-active {
+      color: #6d5ff6;
+    }
   }
 }
 

+ 4 - 1
src/filters/filters.js

@@ -9,7 +9,7 @@ import {
   QUESTION_TYPES,
   SELECTIVE_RULE_TYPE,
 } from "@/constants/constants";
-import { numberToChinese } from "@/plugins/utils";
+import { numberToChinese, formatDate } from "@/plugins/utils";
 
 // 课程层次过滤器
 Vue.filter("levelTypeFilter", function (val) {
@@ -58,3 +58,6 @@ Vue.filter("numberToChaineseFilter", function (val) {
 Vue.filter("selectiveRuleTypeFilter", function (val) {
   return SELECTIVE_RULE_TYPE[val] || "";
 });
+Vue.filter("timestampFilter", function (val) {
+  return formatDate(undefined, new Date(val));
+});

+ 2 - 2
src/modules/paper/api.js

@@ -67,8 +67,8 @@ export const paperDetailInfoApi = ({ paperId, seqMode }) => {
 export const paperDetailApi = (paperId) => {
   return $httpWithMsg.get(`${QUESTION_API}/paper/${paperId}`, {});
 };
-export const paperEditLogsApi = (paperId) => {
-  return $httpWithMsg.get(`${QUESTION_API}/paper/log/${paperId}`, {});
+export const paperEditLogsApi = (data) => {
+  return $httpWithMsg.post(`${QUESTION_API}/log/page`, {}, { params: data });
 };
 export const paperSaveApi = (paper) => {
   return $httpWithMsg.post(`${QUESTION_API}/paper`, paper);

+ 29 - 20
src/modules/paper/components/PaperEditLogDialog.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      custom-class="question-preview-dialog"
+      custom-class="question-preview-dialog question-edit-log-dialog"
       :visible.sync="modalIsShow"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
@@ -15,24 +15,32 @@
         </div>
       </div>
 
-      <el-table element-loading-text="加载中" :data="logList">
-        <el-table-column label="内容" prop="creationTime"> </el-table-column>
-        <el-table-column label="修改时间" width="180" prop="creationTime">
-        </el-table-column>
-        <el-table-column label="修改人" prop="creator" width="120">
-        </el-table-column>
-      </el-table>
-      <div class="part-page">
-        <el-pagination
-          :current-page="currentPage"
-          :page-size="pageSize"
-          :page-sizes="[10, 20, 50, 100, 200, 300]"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="total"
-          @current-change="toPage"
-          @size-change="handleSizeChange"
-        >
-        </el-pagination>
+      <div class="part-box">
+        <el-table element-loading-text="加载中" :data="logList" border>
+          <el-table-column label="内容" prop="detail"> </el-table-column>
+          <el-table-column label="修改时间" width="180" prop="createTime">
+            <template slot-scope="scope">
+              {{ scope.row.createTime | timestampFilter }}
+            </template>
+          </el-table-column>
+          <el-table-column label="修改人" prop="loginName" width="120">
+            <template slot-scope="scope">
+              {{ scope.row.realName }}({{ scope.row.loginName }})
+            </template>
+          </el-table-column>
+        </el-table>
+        <div class="part-page">
+          <el-pagination
+            :current-page="currentPage"
+            :page-size="pageSize"
+            :page-sizes="[10, 20, 50, 100, 200, 300]"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total"
+            @current-change="toPage"
+            @size-change="handleSizeChange"
+          >
+          </el-pagination>
+        </div>
       </div>
 
       <div slot="footer"></div>
@@ -71,7 +79,8 @@ export default {
     },
     async getList() {
       const res = await paperEditLogsApi({
-        paperId: this.paperId,
+        thirdTableId: this.paperId,
+        logType: "PAPER_CHANGE_RECORDS",
         pageNumber: this.currentPage,
         pageSize: this.pageSize,
       });

+ 3 - 3
src/modules/question/api.js

@@ -96,9 +96,9 @@ export const exportQuestionApi = (data) => {
   });
 };
 
-export function questionEditLogsApi(id) {
-  const url = `${QUESTION_API}/question/log/${id}`;
-  return $httpWithMsg.get(url);
+export function questionEditLogsApi(data) {
+  const url = `${QUESTION_API}/question/version/page`;
+  return $httpWithMsg.post(url, {}, { params: data });
 }
 
 export function updateQuestionApi(data) {

+ 66 - 20
src/modules/question/components/QuestionEditLogDialog.vue

@@ -17,7 +17,11 @@
 
       <div class="log-container">
         <div class="log-question">
-          <div v-if="question.id" class="edit-part" :key="question.id">
+          <div
+            v-if="question.version"
+            class="edit-part"
+            :key="question.version"
+          >
             <div class="edit-cont">
               <div class="edit-cont-title">
                 <rich-text :text-json="question.quesBody"></rich-text>
@@ -143,17 +147,39 @@
           </div>
         </div>
         <div class="log-history">
-          <el-table
-            element-loading-text="加载中"
-            :data="logList"
-            :row-class-name="rowClassHandle"
-            @row-click="selectQuestion"
-          >
-            <el-table-column label="修改时间" width="180" prop="creationTime">
-            </el-table-column>
-            <el-table-column label="修改人" prop="creator" width="120">
-            </el-table-column>
-          </el-table>
+          <div class="log-history-table">
+            <el-table
+              element-loading-text="加载中"
+              :data="logList"
+              :row-class-name="rowClassHandle"
+              @row-click="selectQuestion"
+            >
+              <el-table-column
+                label="修改时间"
+                width="160"
+                prop="versionCreationTime"
+              >
+              </el-table-column>
+              <el-table-column label="修改人" prop="versionCreatorLoginName">
+                <template slot-scope="scope">
+                  {{ scope.row.versionCreatorRealName }}({{
+                    scope.row.versionCreatorLoginName
+                  }})
+                </template>
+              </el-table-column>
+            </el-table>
+            <div class="part-page">
+              <el-pagination
+                layout="prev, pager, next"
+                :current-page="currentPage"
+                :page-size="pageSize"
+                :total="total"
+                @current-change="toPage"
+                @size-change="handleSizeChange"
+              >
+              </el-pagination>
+            </div>
+          </div>
         </div>
       </div>
 
@@ -164,9 +190,11 @@
 
 <script>
 import { questionEditLogsApi } from "../api";
+import QuestionAnswer from "./QuestionAnswer.vue";
 
 export default {
   name: "QuestionEditLogDialog",
+  components: { QuestionAnswer },
   props: {
     questionId: {
       type: [String, Number],
@@ -178,17 +206,35 @@ export default {
       modalIsShow: false,
       question: {},
       logList: [],
-      curLogId: "",
+      curLogVersion: "",
+      currentPage: 1,
+      pageSize: 10,
+      total: 0,
     };
   },
   methods: {
     async openHandle() {
-      const res = await questionEditLogsApi(this.questionId);
-
-      this.logList = res || [];
-
+      await this.toPage(1);
       if (this.logList.length) this.selectQuestion(this.logList[0]);
     },
+    async toPage(page) {
+      this.currentPage = page;
+      await this.getList();
+    },
+    async getList() {
+      const res = await questionEditLogsApi({
+        questionId: this.questionId,
+        pageNumber: this.currentPage,
+        pageSize: this.pageSize,
+      });
+
+      this.logList = res.data.content;
+      this.total = res.data.totalElements;
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.toPage(1);
+    },
     cancel() {
       this.modalIsShow = false;
     },
@@ -211,11 +257,11 @@ export default {
       return typeQuestion.includes(questionType);
     },
     rowClassHandle({ row }) {
-      return row.id === this.curLogId ? "is-active" : "";
+      return row.version === this.curLogVersion ? "is-active" : "";
     },
     selectQuestion(row) {
-      this.curLogId = row.id;
-      this.question = row.question;
+      this.curLogVersion = row.version;
+      this.question = row;
     },
   },
 };

+ 6 - 0
src/modules/questions/views/OrgProperty.vue

@@ -212,6 +212,11 @@
             <span class="tips-info margin-left-10"
               >*低于所设字数,不进行查重计算</span
             >
+            <br />
+            <el-checkbox
+              v-model="form.properties.CHECK_DUPLICATE_WITH_OUT_ALL_PICTURE"
+              >题干全图片不进行查重计算</el-checkbox
+            >
           </el-form-item>
         </template>
       </el-form>
@@ -422,6 +427,7 @@ export default {
           CHECK_DUPLICATE_THRESHOLD: 80,
           OPTION_DUPLICATE_THRESHOLD: 94,
           CHECK_LIMIT_CHAR_COUNT: 0,
+          CHECK_DUPLICATE_WITH_OUT_ALL_PICTURE: true,
           CHECK_DUPLICATE_COUNT: 5,
           // 综合组卷
           // PAPER_BUILD_SYNTHESIS: "false",

+ 8 - 4
src/modules/statistics/api.js

@@ -1,3 +1,4 @@
+import { pickByNotNull } from "@/plugins/utils";
 import { $httpWithMsg } from "../../plugins/axios";
 import { QUESTION_API } from "@/constants/constants";
 
@@ -6,8 +7,11 @@ export const statisticsQueryApi = (data) => {
 };
 
 export const statisticsExportApi = (data) => {
-  return $httpWithMsg.post(`${QUESTION_API}/course/page/question/count`, {
-    params: data,
-    responseType: "blob",
-  });
+  return $httpWithMsg.post(
+    `${QUESTION_API}/course/question/count_export`,
+    pickByNotNull(data),
+    {
+      responseType: "blob",
+    }
+  );
 };

+ 13 - 4
src/modules/statistics/views/StatisticsManage.vue

@@ -41,14 +41,19 @@
           <el-button type="primary" @click="handleCurrentChange(1)">
             查询
           </el-button>
-          <el-button :loading="downloading" @click="exportHandle">
-            导出
-          </el-button>
         </el-form-item>
       </el-form>
       <!-- <div class="part-box-action"></div> -->
     </div>
     <div class="part-box">
+      <div class="icon-btn-group box-justify">
+        <div>
+          <svg-btn name="daochu" :loading="downloading" @click="exportHandle"
+            >导出统计数据</svg-btn
+          >
+        </div>
+        <div></div>
+      </div>
       <el-table
         ref="table"
         :data="tableData"
@@ -90,6 +95,7 @@ import { statisticsQueryApi, statisticsExportApi } from "../api";
 import pickerOptions from "@/constants/datePickerOptions";
 import { omit } from "lodash";
 import { downloadByApi } from "@/plugins/download";
+import { pick } from "lodash";
 // TODO:增加查看每套试卷的题型、难易度、知识点的分布(试卷结构分析)
 
 export default {
@@ -173,7 +179,10 @@ export default {
       this.downloading = true;
 
       const res = await downloadByApi(() => {
-        return statisticsExportApi(this.searchForm);
+        return statisticsExportApi({
+          // ...this.queryParams,
+          ...pick(this.queryParams, ["courseId", "startTime", "endTime"]),
+        });
       }).catch((e) => {
         this.$message.error(e || "导出失败,请重新尝试!");
       });