Jelajahi Sumber

列表统计搜索增加字段,词表排序,文章根据等级文字变色

qinpeng 2 tahun lalu
induk
melakukan
5d996f4f2c

+ 4 - 2
src/views/Textanalysis/WordTable.vue

@@ -35,6 +35,7 @@
           :data="dataList.list"
           style="width: 100%"
           @sort-change="sort_change"
+          ref="table"
         >
           <el-table-column prop="number" label="序号" width="48" align="center">
           </el-table-column>
@@ -217,8 +218,9 @@ export default {
       this.page = 1;
       this.getlist();
     },
-    sort_change(column) {
-      console.log(column);
+    sort_change(column, prop, order) {
+      if (this.$refs.table) this.$refs.table.clearSort();
+      column.column.order = column.order;
       if (column.prop == "pinyin") {
         this.sortField = "pin_yin";
       } else if (column.prop == "gradeName") {

+ 180 - 36
src/views/Textanalysis/index.vue

@@ -78,7 +78,7 @@
                     :width="26"
                     style="margin-right: 10px"
                     active-text="细分"
-                    @change="getstatistics"
+                    @change="changexifen"
                   >
                   </el-switch>
                 </span>
@@ -89,7 +89,14 @@
               </div>
             </div>
             <div class="left_list_main">
-              <div v-for="(item, index) in leftList" :key="'one' + index">
+              <div
+                v-for="(item, index) in leftList"
+                :key="'one' + index"
+                @click="levelMapListEvent(item)"
+                :class="[
+                  seleLevelMapList.indexOf(item.name) != -1 ? 'sele' : '',
+                ]"
+              >
                 <div class="leftType">
                   <span
                     class="color"
@@ -114,7 +121,7 @@
                 </div>
                 <div class="rightCount">
                   <span class="count">{{ allValue }}</span>
-                  <span class="precent">{{ allRatio }}%</span>
+                  <span class="precent">100.00%</span>
                 </div>
               </div>
             </div>
@@ -172,7 +179,9 @@
               <span>你好</span>
               <span>请问</span>
             </div>
-            <div class="back">返回课文</div>
+            <div class="back" v-if="$route.query.type != '文本分析'">
+              返回课文
+            </div>
           </div>
           <div class="btn_set">
             <div class="btn">
@@ -250,7 +259,9 @@
             <div class="right_main_top">
               <span>音节难度 1.28</span>
               <span class="line"></span>
-              <span>100 / 200</span>
+              <span v-if="leftNavIndex == 0">{{base.pinyinCount}} / {{base.pinyinTextCount}}</span>
+              <span v-else-if="leftNavIndex == 1">{{base.wordCount}} / {{base.wordTextCount}}</span>
+              <span v-else>{{base.vocabularyCount}} / {{base.vocabularyTextCount}}</span>
             </div>
             <div class="articel">
               <div
@@ -268,35 +279,126 @@
                     v-for="(itemss, indexss) in items"
                     :key="indexss + 'words'"
                   >
-                    <div
-                      class="word"
-                      v-for="(word, indexsss) in itemss"
-                      :key="indexsss + 'word'"
-                      :style="{
-                        color:
-                          searchWord.indexOf(word.word) != -1
-                            ? currentcolorValue[searchWord.indexOf(word.word)]
-                            : '',
-                      }"
-                    >
-                      <div
-                        v-if="pinyinShow"
-                        class="pinyin"
-                        :style="{
-                          fontSize: pinyinFontsize + 'px',
-                        }"
-                      >
-                        {{ word.pinyin }}
+                    <template v-if="fenci">
+                      <div class="word" style="margin: 0 2px">
+                        <div
+                          v-if="pinyinShow"
+                          class="pinyin"
+                          :style="{
+                            fontSize: pinyinFontsize + 'px',
+                          }"
+                        >
+                          <span
+                            v-for="(word, indexsss) in itemss.text"
+                            :key="indexsss + 'word'"
+                          >
+                            {{ word.pinyin }}
+                          </span>
+                        </div>
+                        <div
+                          class="hanzi"
+                          :style="{
+                            fontSize: wordFontsize + 'px',
+                          }"
+                        >
+                          <span
+                            v-for="(word, indexsss) in itemss.text"
+                            :key="indexsss + 'word'"
+                            :style="{
+                              color: !xifen
+                                ? leftNavIndex == 0
+                                  ? seleLevelMapList.indexOf(word.levels.P_G) !=
+                                    -1
+                                    ? levelMap[word.levels.P_G].color
+                                    : ''
+                                  : leftNavIndex == 1
+                                  ? seleLevelMapList.indexOf(word.levels.W_G) !=
+                                    -1
+                                    ? levelMap[word.levels.W_G].color
+                                    : ''
+                                  : leftNavIndex == 2
+                                  ? seleLevelMapList.indexOf(word.levels.C_G) !=
+                                    -1
+                                    ? levelMap[word.levels.C_G].color
+                                    : ''
+                                  : ''
+                                : leftNavIndex == 0
+                                ? seleLevelMapList.indexOf(word.levels.P_L) !=
+                                  -1
+                                  ? levelMap[word.levels.P_L].color
+                                  : ''
+                                : leftNavIndex == 1
+                                ? seleLevelMapList.indexOf(word.levels.W_L) !=
+                                  -1
+                                  ? levelMap[word.levels.W_L].color
+                                  : ''
+                                : leftNavIndex == 2
+                                ? seleLevelMapList.indexOf(word.levels.C_L) !=
+                                  -1
+                                  ? levelMap[word.levels.C_L].color
+                                  : ''
+                                : '',
+                            }"
+                          >
+                            {{ word.word }}
+                          </span>
+                        </div>
                       </div>
+                    </template>
+                    <template v-else>
                       <div
-                        class="hanzi"
+                        class="word"
+                        v-for="(word, indexsss) in itemss.text"
+                        :key="indexsss + 'word'"
                         :style="{
-                          fontSize: wordFontsize + 'px',
+                          color: !xifen
+                            ? leftNavIndex == 0
+                              ? seleLevelMapList.indexOf(word.levels.P_G) != -1
+                                ? levelMap[word.levels.P_G].color
+                                : ''
+                              : leftNavIndex == 1
+                              ? seleLevelMapList.indexOf(word.levels.W_G) != -1
+                                ? levelMap[word.levels.W_G].color
+                                : ''
+                              : leftNavIndex == 2
+                              ? seleLevelMapList.indexOf(word.levels.C_G) != -1
+                                ? levelMap[word.levels.C_G].color
+                                : ''
+                              : ''
+                            : leftNavIndex == 0
+                            ? seleLevelMapList.indexOf(word.levels.P_L) != -1
+                              ? levelMap[word.levels.P_L].color
+                              : ''
+                            : leftNavIndex == 1
+                            ? seleLevelMapList.indexOf(word.levels.W_L) != -1
+                              ? levelMap[word.levels.W_L].color
+                              : ''
+                            : leftNavIndex == 2
+                            ? seleLevelMapList.indexOf(word.levels.C_L) != -1
+                              ? levelMap[word.levels.C_L].color
+                              : ''
+                            : '',
                         }"
                       >
-                        {{ word.word }}
+                        <div
+                          v-if="pinyinShow"
+                          class="pinyin"
+                          :style="{
+                            fontSize: pinyinFontsize + 'px',
+                          }"
+                        >
+                          {{ word.pinyin }}
+                        </div>
+                        <div
+                          class="hanzi"
+                          :style="{
+                            fontSize: wordFontsize + 'px',
+                          }"
+                        >
+                          {{ word.word }}
+                        </div>
                       </div>
-                    </div>
+                    </template>
                   </div>
                 </div>
               </div>
@@ -362,9 +464,20 @@ export default {
       allRatio: 0,
       chartIndex: 0,
       ArticelData: null,
+      seleLevelMapList: [],
     };
   },
   methods: {
+    // 选择高亮等级
+    levelMapListEvent(item) {
+      let index = this.seleLevelMapList.indexOf(item.name);
+      console.log(index);
+      if (index == -1) {
+        this.seleLevelMapList.push(item.name);
+      } else {
+        this.seleLevelMapList.splice(index, 1);
+      }
+    },
     downloadLeft() {
       let data = JSON.parse(JSON.stringify(this.leftList));
       data.forEach((item) => {
@@ -427,6 +540,8 @@ export default {
     },
     cutNav(index) {
       this.leftNavIndex = index;
+      this.seleLevelMapList = [];
+      this.xifen = false;
       this.getstatistics();
     },
     showSearchColorList() {
@@ -453,6 +568,7 @@ export default {
       }
       this.type = "";
       this.calculateSearchwordNumber();
+      this.calculateSearchhighlight();
     },
     // 计算匹配个数
     calculateSearchwordNumber() {
@@ -470,6 +586,8 @@ export default {
         });
       });
     },
+    // 计算高亮
+    calculateSearchhighlight() {},
     clearSelected() {
       let _this = this;
       _this.type = "";
@@ -480,6 +598,11 @@ export default {
     },
     cutHeaderText(type) {
       this.headerText = type;
+      this.seleLevelMapList = [];
+      this.getstatistics();
+    },
+    changexifen() {
+      this.seleLevelMapList = [];
       this.getstatistics();
     },
     // 添加dom
@@ -770,16 +893,30 @@ export default {
     // 获取图标统计信息
     getstatistics() {
       this.loading = true;
+      let base = null;
+      if (this.leftNavIndex == 0) {
+        base =
+          this.headerText == "wordCount"
+            ? this.base.pinyinCount
+            : this.base.pinyinTextCount;
+      } else if (this.leftNavIndex == 1) {
+        base =
+          this.headerText == "wordCount"
+            ? this.base.wordCount
+            : this.base.wordTextCount;
+      } else {
+        base =
+          this.headerText == "wordCount"
+            ? this.base.vocabularyCount
+            : this.base.vocabularyTextCount;
+      }
       postapi({
         url: "GCLSTRCServer/tools/TS/statistics",
         data: {
           searchType: this.leftNavIndex,
           partitionKey: this.partitionKey,
           statisticsType: this.xifen ? 0 : 1,
-          base:
-            this.headerText == "wordCount"
-              ? this.base.wordCount
-              : this.base.textCount,
+          base: base ? base : null,
         },
       })
         .then((res) => {
@@ -803,7 +940,6 @@ export default {
     // 获取分析结果
     getArticleData() {
       this.loading = true;
-
       postapi({
         url: "GCLSTRCServer/tools/TS/analysis/parsed/text",
         data: {
@@ -822,10 +958,13 @@ export default {
   created() {
     this.partitionKey = this.$route.query.partitionKey * 1;
     this.subjectWords = this.$route.query.subjectWords;
-    this.base.textCount = this.$route.query.textCount * 1;
+    this.base.wordTextCount = this.$route.query.wordTextCount * 1;
     this.base.wordCount = this.$route.query.wordCount * 1;
+    this.base.vocabularyTextCount = this.$route.query.vocabularyTextCount * 1;
+    this.base.vocabularyCount = this.$route.query.vocabularyCount * 1;
+    this.base.pinyinCount = this.$route.query.pinyinCount * 1;
+    this.base.pinyinTextCount = this.$route.query.pinyinTextCount * 1;
     this.levelMap = staticData.LevelMap;
-
     this.getstatistics();
   },
   mounted() {},
@@ -1050,6 +1189,9 @@ export default {
               line-height: 22px;
               color: #333333;
             }
+            .sele {
+              background: #eaeaea;
+            }
             > div {
               // width: 100%;
               height: 48px;
@@ -1268,12 +1410,14 @@ export default {
                     text-align: center;
                     line-height: 12px;
                     font-family: "GB-PINYINOK-B";
+                    display: flex;
                   }
-                  .word {
+                  .hanzi {
                     color: rgb(255, 255, 255);
                     text-align: center;
                     line-height: 28px;
                     font-family: "FZJCGFKTK";
+                    display: flex;
                   }
                 }
               }

+ 17 - 9
src/views/teacher-dev/TextAnalysis.vue

@@ -72,15 +72,23 @@ export default {
   methods: {
     // 分析结果统计
     goresult(item) {
-      this.$router.push({
-        path: "/textanalysis/Result",
-        query: {
-          partitionKey: item.partitionKey,
-          subjectWords: item.subjectWords,
-          textCount: item.textCount,
-          wordCount: item.wordCount,
-        },
-      });
+      window.open(
+        this.$router.resolve({
+          path: "/textanalysis/Result",
+          query: {
+            partitionKey: item.partitionKey,
+            subjectWords: item.subjectWords,
+            wordTextCount: item.textCount,
+            wordCount: item.wordCount,
+            vocabularyTextCount: item.vocabularyTextCount,
+            vocabularyCount: item.vocabularyCount,
+            pinyinCount: item.pinyinCount,
+            pinyinTextCount: item.pinyinTextCount,
+            type: "文本分析",
+          },
+        }).href,
+        "_blank"
+      );
     },
     // 删除
     deleteOne(id, index) {