فهرست منبع

修反馈得bug,词表bug修改。

qinpeng 2 سال پیش
والد
کامیت
f3a7b4e39d
4فایلهای تغییر یافته به همراه133 افزوده شده و 76 حذف شده
  1. 6 2
      public/ciyun/ciyunindex.html
  2. 2 2
      src/common/data.js
  3. 17 11
      src/views/Textanalysis/WordTable.vue
  4. 108 61
      src/views/Textanalysis/index.vue

+ 6 - 2
public/ciyun/ciyunindex.html

@@ -488,8 +488,12 @@
                 dataType: "json",
                 type: "post",
                 success: function (data) {
-                    oldstopWordList = JSON.parse(JSON.stringify(data.data.result))
-                    stopWordList = JSON.parse(JSON.stringify(data.data.result))
+                    let arr = []
+                    data.data.forEach(item => {
+                        arr.push(item.word)
+                    })
+                    oldstopWordList = JSON.parse(JSON.stringify(arr))
+                    stopWordList = JSON.parse(JSON.stringify(arr))
                     $("#allwordnumber").text(oldstopWordList.length)
                     changeWordData()
                 }, error: function (jqXHR, textStatus, errorThrown) {

+ 2 - 2
src/common/data.js

@@ -1,6 +1,6 @@
 const LevelMap = {
-    "初等": { name: '初等', color: '#35776B', },
-    "中等": { name: '中等', color: '#3873CB', },
+    "初等": { name: '初等', color: '#66AE5B', },
+    "中等": { name: '中等', color: '#4CA6EE', },
     "高等": { name: '高等', color: '#9031AA', },
     "超纲": { name: '超纲', color: '#EA1F1F', },
     "专有": { name: '专有', color: '#CBCBCB', },

+ 17 - 11
src/views/Textanalysis/WordTable.vue

@@ -98,6 +98,9 @@
             <td :class="['sort-td', typeIndex == 0 ? 'pinyin' : '']">
               <span
                 :style="{
+                  fontFamily: typeIndex != 0 ? '楷体' : '',
+                  fontWeight: '400',
+                  fontSize: '18px',
                   color:
                     item.levelName && levelMap[item.levelName]
                       ? levelMap[item.levelName].color
@@ -116,6 +119,7 @@
             <td class="sort-td">
               <span
                 :style="{
+                  fontFamily: '楷体',
                   color:
                     item.gradeName && levelMap[item.gradeName]
                       ? levelMap[item.gradeName].color
@@ -127,6 +131,7 @@
             <td class="sort-td">
               <span
                 :style="{
+                  fontFamily: '楷体',
                   color:
                     item.levelName && levelMap[item.levelName]
                       ? levelMap[item.levelName].color
@@ -169,21 +174,18 @@
                     cursor: 'pointer',
                     borderColor:
                       items.levelName && levelMap[items.levelName]
-                        ? levelMap[items.levelName].color
+                        ? levelMap[items.levelName].color + '16'
                         : '',
                     background:
                       items.levelName && levelMap[items.levelName]
-                        ? levelMap[items.levelName].color + '08'
+                        ? levelMap[items.levelName].color + '50'
                         : '',
                   }"
                 >
-                  <span
-                    style="font-size: 18px; font-weight: 400"
-                    v-html="items.word"
-                  >
-                  </span>
+                  <span v-html="items.word" style="font-family: '楷体'"> </span>
                   <span
                     :style="{
+                      fontFamily: '楷体',
                       color:
                         items.levelName && levelMap[items.levelName]
                           ? levelMap[items.levelName].color
@@ -479,10 +481,14 @@ export default {
       data.remarks = JSON.stringify(arr);
       data.color = color;
       sessionStorage.setItem("tablehighlight", true);
-      this.$router.push({
-        path: "/textanalysis/Result",
-        query: data,
-      });
+
+      window.open(
+        this.$router.resolve({
+          path: "/textanalysis/Result",
+          query: data,
+        }).href,
+        "_blank"
+      );
     },
     handleCurrentChange(val) {
       this.page = val;

+ 108 - 61
src/views/Textanalysis/index.vue

@@ -17,6 +17,7 @@
               @keyup.enter="onSearch"
               :style="{ color: colorValue }"
               @blur="searchVal = searchVal.trim()"
+              @keydown="searchValChange"
             />
             <i
               class="search-icon"
@@ -127,18 +128,14 @@
             </div>
           </div>
           <div class="tubiao" id="echarts">
-            <div class="tubiao_top">
-              <span v-show="currentTBdata.name">
-                {{ currentTBdata.name }}
-              </span>
-
-              <span v-show="currentTBdata.value">
-                {{ currentTBdata.value }}
-              </span>
-              <span v-show="currentTBdata.ratio">
-                {{ currentTBdata.ratio }}%
-              </span>
-            </div>
+            <el-switch
+              v-model="ratioShow"
+              inactive-text="比例"
+              :width="26"
+              style="margin-left: 24px"
+              @change="changeratioShow"
+            >
+            </el-switch>
             <div id="main_echarts" class="main_echarts"></div>
             <div class="cut_download">
               <span
@@ -445,6 +442,7 @@ export default {
   },
   data() {
     return {
+      ratioShow: false,
       chsFhList: [",", "。", "”", ":", "》", "《", "?", "!", ";"],
       loading: false,
       LeftLoading: false,
@@ -467,11 +465,21 @@ export default {
         "#FF8000",
         "#FF55F3",
         "#CEB800",
-        "#CB1975",
-        "#00D8B4",
-        "#00CEFF",
-        "#3274FF",
-        "#00B60A",
+        // "#CB1975",
+        // "#00D8B4",
+        // "#00CEFF",
+        // "#3274FF",
+        // "#00B60A",
+        // 等级颜色
+        "#B6D58A",
+        "#66AE5B",
+        "#35776B",
+        "#73CDDE",
+        "#4CA6EE",
+        "#3873CB",
+        "#9031AA",
+        "#CBCBCB",
+        "#888888",
       ],
       SearchwordNumber: 0,
       searchWord: [],
@@ -495,6 +503,7 @@ export default {
       routerData: null,
     };
   },
+  watch: {},
   methods: {
     // 词表
     gowordTable() {
@@ -509,11 +518,11 @@ export default {
     closeSearchhighlight() {
       this.ArticelData.forEach((item) => {
         // item.forEach((items) => {
-          item.forEach((itemss) => {
-            itemss.text.forEach((itemsss) => {
-              itemsss.color = null;
-            });
+        item.forEach((itemss) => {
+          itemss.text.forEach((itemsss) => {
+            itemsss.color = null;
           });
+        });
         // });
       });
     },
@@ -667,6 +676,18 @@ export default {
       this.colorValue = item;
       this.colorIndex = index;
     },
+    searchValChange(e) {
+      if (this.searchVal.length == 1 && e.keyCode == 8) {
+        if (
+          this.colorIndex == this.searchWord.length + 1 ||
+          this.searchWord.length == 0
+        ) {
+          return;
+        }
+        this.colorIndex = this.searchWord.length + 1;
+        this.colorValue = this.searchColorList[this.colorIndex];
+      }
+    },
     onSearch() {
       if (!this.searchVal) {
         return;
@@ -682,18 +703,24 @@ export default {
       }
       this.type = "";
       this.calculateSearchwordNumber();
-      this.searchVal = "";
-      this.colorIndex++;
-      this.colorValue = this.searchColorList[this.colorIndex];
+      // this.searchVal = "";
     },
     // 词表跳转高亮
     async wordTablehighlight(data, color) {
+      this.colorValue = color;
+      this.searchColorList.forEach((item, i) => {
+        if (color == item) {
+          this.colorIndex = i;
+        }
+      });
+      this.searchVal = data[data.length - 1];
       let arr = [];
       await data.forEach((item) => {
         this.calculateIndex(this.textContent, item).then((res) => {
           arr.push(res);
         });
       });
+      this.SearchwordNumber = arr[arr.length - 1].length; //高亮最后一次
       // 匹配高亮
       this.ArticelData.forEach((item) => {
         item.forEach((items) => {
@@ -724,10 +751,10 @@ export default {
       });
       this.SearchwordNumber = 0;
       // 高亮全部
-      arr.forEach((item) => {
-        this.SearchwordNumber += item.length;
-      });
-      // this.SearchwordNumber = arr[arr.length - 1].length; //高亮最后一次
+      // arr.forEach((item) => {
+      //   this.SearchwordNumber += item.length;
+      // });
+      this.SearchwordNumber = arr[arr.length - 1].length; //高亮最后一次
       // 匹配高亮
       this.ArticelData.forEach((item) => {
         item.forEach((items) => {
@@ -755,18 +782,6 @@ export default {
     // 找出对应字符的索引
     calculateIndex(txt, key) {
       return new Promise((reslove, reject) => {
-        // let newtxt = "";
-        // let txtarr = [];
-        // txtarr = txt.split("");
-        // txtarr.forEach((item, i) => {
-        //   if (this.chsFhList.indexOf(item) != -1) {
-        //     txtarr.splice(i, 1);
-        //   }
-        // });
-        // txtarr.forEach((item, i) => {
-        //   newtxt += item;
-        // });
-
         // 去除标点
         let keylength = key.length;
         let arr = [];
@@ -803,6 +818,8 @@ export default {
         this.seleLevelMapList = [];
         sessionStorage.setItem("tablehighlight", false);
       }
+      this.colorIndex = 0;
+      this.colorValue = this.searchColorList[this.colorIndex];
       this.closeSearchhighlight();
     },
     cutHeaderText(type) {
@@ -824,7 +841,7 @@ export default {
         }
         let newnode = document.createElement("div");
         newnode.id = "main_echarts";
-        newnode.style.width = "256px";
+        newnode.style.width = "342px";
         newnode.style.height = "256px";
         newnode.style.margin = "0 auto";
 
@@ -833,6 +850,9 @@ export default {
         reslove();
       });
     },
+    changeratioShow() {
+      this.createEcharts("main_echarts", "柱状图", this.leftList, 0);
+    },
     // 图表
     createEcharts(id, type, data, index) {
       this.chartIndex = index;
@@ -845,21 +865,44 @@ export default {
         let valueStype = [];
         let value = [];
         let leidaList = [];
-        newdata.forEach((item) => {
-          item.value = item.value;
-          item.name = item.name;
-          name.push(item.name);
-          valueStype.push({
-            value: item.value,
-            percent: item.ratio + "%",
+        // 去除括号
+        if (this.xifen) {
+          newdata.forEach((item) => {
+            item.name = item.name.replace("(", "");
+            item.name = item.name.replace(")", "");
           });
-          value.push(item.value);
-          leidaList.push({
-            name: item.name,
-            // max: data[data.length - 1].number,
-            // max: 100, //这个总数需要等接口
+        }
+        // 比例开关
+        if (this.ratioShow) {
+          newdata.forEach((item) => {
+            item.value = item.ratio;
+            item.name = item.name;
+            name.push(item.name);
+            valueStype.push({
+              value: item.ratio,
+              percent: item.ratio + "%",
+            });
+            value.push(item.ratio);
+            leidaList.push({
+              name: item.name,
+            });
           });
-        });
+        } else {
+          newdata.forEach((item) => {
+            item.value = item.value;
+            item.name = item.name;
+            name.push(item.name);
+            valueStype.push({
+              value: item.value,
+              percent: item.ratio + "%",
+            });
+            value.push(item.value);
+            leidaList.push({
+              name: item.name,
+            });
+          });
+        }
+
         var chartDom = document.getElementById(id);
         this.myChart = echarts.init(chartDom);
         var option = null;
@@ -884,6 +927,9 @@ export default {
           "#888888",
         ];
         if (type == "饼状图") {
+          newdata.forEach((item) => {
+            item.name = item.name + item.ratio + "%";
+          });
           option = {
             color: this.xifen ? color2 : color1,
             series: [
@@ -892,10 +938,6 @@ export default {
                 type: "pie",
                 radius: ["40%", "70%"],
                 data: newdata,
-                label: {
-                  show: false,
-                  position: "center",
-                },
                 itemStyle: {
                   borderColor: "#f5f5f5",
                   borderWidth: 5,
@@ -1006,7 +1048,6 @@ export default {
               arr.splice(index, 1, item);
               return arr;
             });
-
             return [data, ...helper].map((item, index) => {
               return {
                 type: "radar",
@@ -1107,6 +1148,11 @@ export default {
             this.allRatio += item.ratio * 1;
             this.allValue += item.value;
           });
+          res.data.result.forEach((item) => {
+            if (item.value != 0) {
+              item.ratio = ((item.value / this.allValue) * 100).toFixed(2);
+            }
+          });
           this.allRatio = this.allRatio.toFixed(2);
           this.leftList = res.data.result;
 
@@ -1625,7 +1671,7 @@ export default {
           padding: 12px 15px;
           .right_main_top {
             display: flex;
-            justify-content: space-around;
+            justify-content: end;
             align-items: center;
             font-weight: 600;
             font-size: 14px;
@@ -1642,11 +1688,12 @@ export default {
           .articel {
             width: 640px;
             margin: 0 auto;
-            margin-top: 17px;
+            margin-top: 40px;
             font-weight: 500;
             .paragraph {
               display: flex;
               flex-wrap: wrap;
+              margin-bottom: 22px;
               // .sentence {
               //   display: flex;
               //   flex-wrap: wrap;