zhangjie 8 сар өмнө
parent
commit
8eb26d2306

+ 29 - 4
src/modules/mark/components/report/ReportQuestion.vue

@@ -1,6 +1,10 @@
 <template>
   <div class="report-question">
-    <report-box v-for="(page, pindex) in pages" :key="pindex" :title="title">
+    <report-box
+      v-for="(page, pindex) in pages"
+      :key="pindex"
+      :title="page.title"
+    >
       <div v-if="page.charts" class="question-chart" :style="page.charts.style">
         <v-chart
           :option="page.charts.chart"
@@ -68,9 +72,23 @@ export default {
   },
   methods: {
     initData() {
-      const question =
-        this.type === "subjective" ? this.subjective : this.objective;
+      if (this.type === "subjective") {
+        this.pages = this.buildPapers(this.subjective);
+        return;
+      }
+
+      const pages = [];
+      this.objective.forEach((item) => {
+        const result = this.buildPapers(
+          item.list,
+          this.objective.length > 1 ? item.paperType : ""
+        );
+        pages.push(...result);
+      });
 
+      this.pages = pages;
+    },
+    buildPapers(question, paperType = "") {
       const questionCharts = sectionArr(question, this.chartSplitRange).map(
         (data) => {
           return {
@@ -82,10 +100,15 @@ export default {
       );
       const questionTables = sectionArr(question, this.chartSplitRange);
 
+      const title = paperType
+        ? `${this.title}-${paperType}卷`
+        : `${this.title}`;
+
       let pages = [];
       if (question.length <= 14) {
         pages = [
           {
+            title,
             charts: questionCharts[0],
             tables: questionTables[0],
           },
@@ -93,18 +116,20 @@ export default {
       } else {
         questionCharts.forEach((chart) => {
           pages.push({
+            title,
             charts: chart,
             tables: null,
           });
         });
         questionTables.forEach((table) => {
           pages.push({
+            title,
             charts: null,
             tables: table,
           });
         });
       }
-      this.pages = pages;
+      return pages;
     },
     getChartStyle(count) {
       const labelHeight = 28;

+ 5 - 1
src/router.js

@@ -108,6 +108,7 @@ function getRouteType(routeMatched) {
 }
 
 // route interceptor
+const whiteRoutes = ["CardRulePreview"];
 router.beforeEach(async (to, from, next) => {
   const token = Vue.ls.get("token");
   if (to.meta.noRequire) {
@@ -160,7 +161,10 @@ router.beforeEach(async (to, from, next) => {
   // console.log(store.state.app.validRoutes);
   // console.log(to.name);
 
-  if (!store.state.app.validRoutes.includes(to.name)) {
+  if (
+    !whiteRoutes.includes(to.name) &&
+    !store.state.app.validRoutes.includes(to.name)
+  ) {
     next({ name: "NotFound" });
     return;
   }