Jelajahi Sumber

文章下载,搜索关键字(未全部完成),解析增加字段

qinpeng 2 tahun lalu
induk
melakukan
be96b1f838

+ 155 - 4
package-lock.json

@@ -6360,6 +6360,16 @@
       "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=",
       "dev": true
     },
+    "html-docx-js": {
+      "version": "0.3.1",
+      "resolved": "https://registry.npmmirror.com/html-docx-js/-/html-docx-js-0.3.1.tgz",
+      "integrity": "sha512-QSrMiRhxesqxYCa3f+2Z3ttIHPzSjDOL1tCOmIDIEET7HdabxXND6tAbsFMXAgRG4RADQ3wbl74ydMmjidaDPA==",
+      "requires": {
+        "jszip": "^2.3.0",
+        "lodash.escape": "^3.0.0",
+        "lodash.merge": "^3.2.0"
+      }
+    },
     "html-entities": {
       "version": "1.4.0",
       "resolved": "https://registry.npm.taobao.org/html-entities/download/html-entities-1.4.0.tgz",
@@ -7304,8 +7314,8 @@
     },
     "jquery": {
       "version": "3.6.0",
-      "resolved": "https://registry.npm.taobao.org/jquery/download/jquery-3.6.0.tgz",
-      "integrity": "sha1-xyoJ8Vwb3OFC9J2/EXC9+K2sJHA="
+      "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.0.tgz",
+      "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
     },
     "js-base64": {
       "version": "2.6.4",
@@ -7431,6 +7441,14 @@
         "verror": "1.10.0"
       }
     },
+    "jszip": {
+      "version": "2.7.0",
+      "resolved": "https://registry.npmmirror.com/jszip/-/jszip-2.7.0.tgz",
+      "integrity": "sha512-JIsRKRVC3gTRo2vM4Wy9WBC3TRcfnIZU8k65Phi3izkvPH975FowRYtKGT6PxevA0XnJ/yO8b0QwV0ydVyQwfw==",
+      "requires": {
+        "pako": "~1.0.2"
+      }
+    },
     "killable": {
       "version": "1.0.1",
       "resolved": "https://registry.npm.taobao.org/killable/download/killable-1.0.1.tgz",
@@ -7595,6 +7613,56 @@
       "resolved": "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz",
       "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
     },
+    "lodash._arraycopy": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmmirror.com/lodash._arraycopy/-/lodash._arraycopy-3.0.0.tgz",
+      "integrity": "sha512-RHShTDnPKP7aWxlvXKiDT6IX2jCs6YZLCtNhOru/OX2Q/tzX295vVBK5oX1ECtN+2r86S0Ogy8ykP1sgCZAN0A=="
+    },
+    "lodash._arrayeach": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmmirror.com/lodash._arrayeach/-/lodash._arrayeach-3.0.0.tgz",
+      "integrity": "sha512-Mn7HidOVcl3mkQtbPsuKR0Fj0N6Q6DQB77CtYncZcJc0bx5qv2q4Gl6a0LC1AN+GSxpnBDNnK3CKEm9XNA4zqQ=="
+    },
+    "lodash._basecopy": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmmirror.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
+      "integrity": "sha512-rFR6Vpm4HeCK1WPGvjZSJ+7yik8d8PVUdCJx5rT2pogG4Ve/2ZS7kfmO5l5T2o5V2mqlNIfSF5MZlr1+xOoYQQ=="
+    },
+    "lodash._basefor": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmmirror.com/lodash._basefor/-/lodash._basefor-3.0.3.tgz",
+      "integrity": "sha512-6bc3b8grkpMgDcVJv9JYZAk/mHgcqMljzm7OsbmcE2FGUMmmLQTPHlh/dFqR8LA0GQ7z4K67JSotVKu5058v1A=="
+    },
+    "lodash._bindcallback": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmmirror.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz",
+      "integrity": "sha512-2wlI0JRAGX8WEf4Gm1p/mv/SZ+jLijpj0jyaE/AXeuQphzCgD8ZQW4oSpoN8JAopujOFGU3KMuq7qfHBWlGpjQ=="
+    },
+    "lodash._createassigner": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmmirror.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz",
+      "integrity": "sha512-LziVL7IDnJjQeeV95Wvhw6G28Z8Q6da87LWKOPWmzBLv4u6FAT/x5v00pyGW0u38UoogNF2JnD3bGgZZDaNEBw==",
+      "requires": {
+        "lodash._bindcallback": "^3.0.0",
+        "lodash._isiterateecall": "^3.0.0",
+        "lodash.restparam": "^3.0.0"
+      }
+    },
+    "lodash._getnative": {
+      "version": "3.9.1",
+      "resolved": "https://registry.npmmirror.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
+      "integrity": "sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA=="
+    },
+    "lodash._isiterateecall": {
+      "version": "3.0.9",
+      "resolved": "https://registry.npmmirror.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
+      "integrity": "sha512-De+ZbrMu6eThFti/CSzhRvTKMgQToLxbij58LMfM8JnYDNSOjkjTCIaa8ixglOeGh2nyPlakbt5bJWJ7gvpYlQ=="
+    },
+    "lodash._root": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmmirror.com/lodash._root/-/lodash._root-3.0.1.tgz",
+      "integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ=="
+    },
     "lodash.debounce": {
       "version": "4.0.8",
       "resolved": "https://registry.npm.taobao.org/lodash.debounce/download/lodash.debounce-4.0.8.tgz",
@@ -7607,12 +7675,64 @@
       "integrity": "sha1-US6b1yHSctlOPTpjZT+hdRZ0HKY=",
       "dev": true
     },
+    "lodash.escape": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/lodash.escape/-/lodash.escape-3.2.0.tgz",
+      "integrity": "sha512-n1PZMXgaaDWZDSvuNZ/8XOcYO2hOKDqZel5adtR30VKQAtoWs/5AOeFA0vPV8moiPzlqe7F4cP2tzpFewQyelQ==",
+      "requires": {
+        "lodash._root": "^3.0.0"
+      }
+    },
+    "lodash.isarguments": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmmirror.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
+      "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg=="
+    },
+    "lodash.isarray": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmmirror.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
+      "integrity": "sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ=="
+    },
+    "lodash.isplainobject": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz",
+      "integrity": "sha512-P4wZnho5curNqeEq/x292Pb57e1v+woR7DJ84DURelKB46lby8aDEGVobSaYtzHdQBWQrJSdxcCwjlGOvvdIyg==",
+      "requires": {
+        "lodash._basefor": "^3.0.0",
+        "lodash.isarguments": "^3.0.0",
+        "lodash.keysin": "^3.0.0"
+      }
+    },
+    "lodash.istypedarray": {
+      "version": "3.0.6",
+      "resolved": "https://registry.npmmirror.com/lodash.istypedarray/-/lodash.istypedarray-3.0.6.tgz",
+      "integrity": "sha512-lGWJ6N8AA3KSv+ZZxlTdn4f6A7kMfpJboeyvbFdE7IU9YAgweODqmOgdUHOA+c6lVWeVLysdaxciFXi+foVsWw=="
+    },
     "lodash.kebabcase": {
       "version": "4.1.1",
       "resolved": "https://registry.npm.taobao.org/lodash.kebabcase/download/lodash.kebabcase-4.1.1.tgz",
       "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY=",
       "dev": true
     },
+    "lodash.keys": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmmirror.com/lodash.keys/-/lodash.keys-3.1.2.tgz",
+      "integrity": "sha512-CuBsapFjcubOGMn3VD+24HOAPxM79tH+V6ivJL3CHYjtrawauDJHUk//Yew9Hvc6e9rbCrURGk8z6PC+8WJBfQ==",
+      "requires": {
+        "lodash._getnative": "^3.0.0",
+        "lodash.isarguments": "^3.0.0",
+        "lodash.isarray": "^3.0.0"
+      }
+    },
+    "lodash.keysin": {
+      "version": "3.0.8",
+      "resolved": "https://registry.npmmirror.com/lodash.keysin/-/lodash.keysin-3.0.8.tgz",
+      "integrity": "sha512-YDB/5xkL3fBKFMDaC+cfGV00pbiJ6XoJIfRmBhv7aR6wWtbCW6IzkiWnTfkiHTF6ALD7ff83dAtB3OEaSoyQPg==",
+      "requires": {
+        "lodash.isarguments": "^3.0.0",
+        "lodash.isarray": "^3.0.0"
+      }
+    },
     "lodash.mapvalues": {
       "version": "4.6.0",
       "resolved": "https://registry.npm.taobao.org/lodash.mapvalues/download/lodash.mapvalues-4.6.0.tgz",
@@ -7625,6 +7745,38 @@
       "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
       "dev": true
     },
+    "lodash.merge": {
+      "version": "3.3.2",
+      "resolved": "https://registry.npmmirror.com/lodash.merge/-/lodash.merge-3.3.2.tgz",
+      "integrity": "sha512-ZgGZpRhWLjivGUbjtApZR4HyLv/UAyoYqESVYkK4aLBJVHRrbFpG+GNnE9JPijliME4LkKM0SFI/WyOiBiv1+w==",
+      "requires": {
+        "lodash._arraycopy": "^3.0.0",
+        "lodash._arrayeach": "^3.0.0",
+        "lodash._createassigner": "^3.0.0",
+        "lodash._getnative": "^3.0.0",
+        "lodash.isarguments": "^3.0.0",
+        "lodash.isarray": "^3.0.0",
+        "lodash.isplainobject": "^3.0.0",
+        "lodash.istypedarray": "^3.0.0",
+        "lodash.keys": "^3.0.0",
+        "lodash.keysin": "^3.0.0",
+        "lodash.toplainobject": "^3.0.0"
+      }
+    },
+    "lodash.restparam": {
+      "version": "3.6.1",
+      "resolved": "https://registry.npmmirror.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz",
+      "integrity": "sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw=="
+    },
+    "lodash.toplainobject": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmmirror.com/lodash.toplainobject/-/lodash.toplainobject-3.0.0.tgz",
+      "integrity": "sha512-wMI0Ju1bvSmnBS3EcRRH/3zDnZOPpDtMtNDzbbNMKuTrEpALsf+sPyMeogmv63Y11qZQO7H1xFzohIEGRMjPYA==",
+      "requires": {
+        "lodash._basecopy": "^3.0.0",
+        "lodash.keysin": "^3.0.0"
+      }
+    },
     "lodash.transform": {
       "version": "4.6.0",
       "resolved": "https://registry.npm.taobao.org/lodash.transform/download/lodash.transform-4.6.0.tgz",
@@ -8733,8 +8885,7 @@
     "pako": {
       "version": "1.0.11",
       "resolved": "https://registry.npm.taobao.org/pako/download/pako-1.0.11.tgz",
-      "integrity": "sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8=",
-      "dev": true
+      "integrity": "sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8="
     },
     "parallel-transform": {
       "version": "1.2.0",

+ 2 - 0
package.json

@@ -15,6 +15,8 @@
     "element-ui": "^2.15.1",
     "emoji-vue": "^0.2.4",
     "file-saver": "^2.0.5",
+    "html-docx-js": "^0.3.1",
+    "jquery": "^3.6.0",
     "js-cookie": "^2.2.1",
     "js-md5": "^0.7.3",
     "mockjs": "^1.1.0",

+ 5 - 5
public/ciyun/ciyunindex.html

@@ -364,12 +364,12 @@
                 searchType = item.split("=")[1];
             }
         });
-        function getdata(isSelectStopWords) {
+        function getdata(stopWordStatus) {
             console.log(123);
             let data = {
                 searchType: searchType,
                 partitionKey: partitionKey,
-                // isSelectStopWords: isSelectStopWords,
+                stopWordStatus: stopWordStatus,
             }
             $.ajax({
                 url: window.g.BASE_URL + "/GCLSTRCServer/tools/TS/glossary/ciyun",
@@ -615,7 +615,7 @@
             var $stop = $(".stop");
             let isSelectCaseSensitive = false
             let isSelectLemma = false
-            let isSelectStopWords = false
+            let stopWordStatus = false
             if ($biglittle.hasClass("checkbox-active")) {
                 isSelectCaseSensitive = true
             }
@@ -623,10 +623,10 @@
                 isSelectCaseSensitive = false
             }
             if ($stop.hasClass("checkbox-active")) {
-                isSelectStopWords = true
+                stopWordStatus = true
             }
             else {
-                isSelectStopWords = false
+                stopWordStatus = false
             }
             var selvalue = $("#dataTypeSel").children('option:selected').val();
             if (selvalue == 'Lemma') {

+ 2 - 3
src/main.js

@@ -8,9 +8,8 @@ import 'element-ui/lib/theme-chalk/index.css';
 Vue.use(ElementUI);
 
 import "./style/deleelement.css"
-// import $ from "jquery";
-// window.$ = $;
-// window.jQuery = $;
+import $ from "jquery"
+Vue.prototype.$ = $
 
 import "@/common/font/font.css"
 import "@/permission"

+ 231 - 70
src/views/Textanalysis/index.vue

@@ -176,8 +176,9 @@
           <div class="word_back">
             <div class="word">
               <span class="title">主题词:</span>
-              <span>你好</span>
-              <span>请问</span>
+              <span v-for="(item, i) in subjectWords" :key="i + 'word'">{{
+                item
+              }}</span>
             </div>
             <div class="back" v-if="$route.query.type != '文本分析'">
               返回课文
@@ -209,7 +210,11 @@
                 <img src="../../assets/teacherdev/icon-cibiao.png" alt="" />
                 词表
               </div>
-              <div class="btn_dv" style="margin-right: 24px">
+              <div
+                class="btn_dv"
+                style="margin-right: 24px"
+                @click="downArticle"
+              >
                 <img src="../../assets/teacherdev/icon-down.png" alt="" />
                 下载
               </div>
@@ -257,11 +262,29 @@
           </div>
           <div class="right_main">
             <div class="right_main_top">
-              <span>音节难度 1.28</span>
+              <span
+                >音节难度
+                <template v-if="leftNavIndex == 0">
+                  {{ difficulty.pinyinDifficulty }}
+                </template>
+                <template v-else-if="leftNavIndex == 1">
+                  {{ difficulty.wordDifficulty }}
+                </template>
+                <template v-else>
+                  {{ difficulty.vocabularyDifficulty }}
+                </template>
+              </span>
               <span class="line"></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>
+              <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
@@ -269,19 +292,19 @@
                 v-for="(item, index) in ArticelData"
                 :key="index + 'paragraph'"
               >
-                <div
+                <span
                   class="sentence"
                   v-for="(items, indexs) in item"
                   :key="indexs + 'sentence'"
                 >
-                  <div
+                  <span
                     class="words"
                     v-for="(itemss, indexss) in items"
                     :key="indexss + 'words'"
                   >
                     <template v-if="fenci">
-                      <div class="word" style="margin: 0 2px">
-                        <div
+                      <span class="word" style="margin: 0 2px">
+                        <span
                           v-if="pinyinShow"
                           class="pinyin"
                           :style="{
@@ -294,8 +317,8 @@
                           >
                             {{ word.pinyin }}
                           </span>
-                        </div>
-                        <div
+                        </span>
+                        <span
                           class="hanzi"
                           :style="{
                             fontSize: wordFontsize + 'px',
@@ -305,7 +328,9 @@
                             v-for="(word, indexsss) in itemss.text"
                             :key="indexsss + 'word'"
                             :style="{
-                              color: !xifen
+                              color: word.color
+                                ? word.color
+                                : !xifen
                                 ? leftNavIndex == 0
                                   ? seleLevelMapList.indexOf(word.levels.P_G) !=
                                     -1
@@ -342,45 +367,16 @@
                           >
                             {{ word.word }}
                           </span>
-                        </div>
-                      </div>
+                        </span>
+                      </span>
                     </template>
                     <template v-else>
-                      <div
+                      <span
                         class="word"
                         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
-                              : ''
-                            : '',
-                        }"
                       >
-                        <div
+                        <span
                           v-if="pinyinShow"
                           class="pinyin"
                           :style="{
@@ -388,19 +384,51 @@
                           }"
                         >
                           {{ word.pinyin }}
-                        </div>
-                        <div
+                        </span>
+                        <span
                           class="hanzi"
                           :style="{
                             fontSize: wordFontsize + 'px',
+                            color: word.color
+                              ? word.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>
-                      </div>
+                        </span>
+                      </span>
                     </template>
-                  </div>
-                </div>
+                  </span>
+                </span>
               </div>
             </div>
           </div>
@@ -420,6 +448,8 @@ import { postapi } from "@/api/api";
 import staticData from "../../common/data";
 import { json2excel } from "@/utils/setMethods";
 
+import FileSaver from "file-saver";
+import htmlDocx from "html-docx-js/dist/html-docx";
 export default {
   components: {
     Header,
@@ -465,13 +495,77 @@ export default {
       chartIndex: 0,
       ArticelData: null,
       seleLevelMapList: [],
+      difficulty: {},
+      textContent: "",
     };
   },
   methods: {
+    // 取消搜索高亮
+    closeSearchhighlight() {
+      this.ArticelData.forEach((item) => {
+        item.forEach((items) => {
+          items.forEach((itemss) => {
+            itemss.text.forEach((itemsss) => {
+              itemsss.color = null;
+            });
+          });
+        });
+      });
+    },
+    // 取消等级高亮
+    closelevelMaphighlight() {
+      this.seleLevelMapList = [];
+    },
+    // 下载文章
+    downArticle() {
+      let html = "";
+      if (this.$(".articel").length > 0) {
+        html = this.$(".articel").html();
+      }
+      let style = `    <style>
+       .sentence {
+  margin-bottom: 8px;
+}
+.word {
+  writing-mode: vertical-lr;
+}
+.word > span {
+  writing-mode: horizontal-tb;
+}
+.pinyin {
+  color: rgba(255, 255, 255, 0.5);
+  text-align: center;
+  line-height: 12px;
+  font-family: "GB-PINYINOK-B";
+}
+.hanzi {
+  color: rgb(255, 255, 255);
+  text-align: center;
+  line-height: 28px;
+  font-family: "FZJCGFKTK";
+}
+    </style>`;
+      let content = `<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    ${style}
+</head>
+<body>
+<div style="background:#26272a">
+    ${html}
+</div>
+</body>
+</html>`;
+      let converted = htmlDocx.asBlob(content);
+      FileSaver.saveAs(converted, "文章.docx");
+    },
     // 选择高亮等级
     levelMapListEvent(item) {
+      this.clearSelected();
       let index = this.seleLevelMapList.indexOf(item.name);
-      console.log(index);
       if (index == -1) {
         this.seleLevelMapList.push(item.name);
       } else {
@@ -558,6 +652,7 @@ export default {
       if (!this.searchVal) {
         return;
       }
+      this.closelevelMaphighlight();
       let index = this.searchWord.indexOf(this.searchVal.toLowerCase());
       if (index == -1) {
         this.searchWord.push(this.searchVal.toLowerCase());
@@ -568,33 +663,73 @@ export default {
       }
       this.type = "";
       this.calculateSearchwordNumber();
-      this.calculateSearchhighlight();
     },
     // 计算匹配个数
-    calculateSearchwordNumber() {
+    async calculateSearchwordNumber() {
+      let arr = [];
+      await this.searchWord.forEach((item) => {
+        this.calculateIndex(this.textContent, item).then((res) => {
+          arr.push(res);
+        });
+      });
+      this.SearchwordNumber = 0;
+      arr.forEach((item) => {
+        this.SearchwordNumber += item.length;
+      });
+      // 匹配高亮
       this.ArticelData.forEach((item) => {
         item.forEach((items) => {
           items.forEach((itemss) => {
-            itemss.forEach((itemsss) => {
-              this.searchWord.forEach((search) => {
-                if (itemsss.word == search) {
-                  this.SearchwordNumber++;
-                }
+            itemss.text.forEach((itemsss) => {
+              arr.forEach((searchItem, i) => {
+                searchItem.forEach((searchItems) => {
+                  searchItems.forEach((searchItemss) => {
+                    if (itemsss.index == searchItemss) {
+                      itemsss.color = this.currentcolorValue[i];
+                    }
+                  });
+                });
               });
             });
           });
         });
       });
     },
-    // 计算高亮
-    calculateSearchhighlight() {},
+    // 找出对应字符的索引
+    calculateIndex(txt, key) {
+      return new Promise((reslove, reject) => {
+        let keylength = key.length;
+        let arr = [];
+        for (let i = 0; i < txt.length; i++) {
+          if (txt[i] == key[0]) {
+            arr.push(i);
+          }
+        }
+        let indexArr = [];
+        arr.forEach((item) => {
+          let arr = [];
+          for (let i = 0; i < keylength; i++) {
+            if (txt[item + i] == key[i]) {
+              arr.push(item + i);
+            } else {
+              arr = [];
+            }
+          }
+          if (arr.length > 0) {
+            indexArr.push(arr);
+          }
+        });
+        reslove(indexArr);
+      });
+    },
     clearSelected() {
       let _this = this;
       _this.type = "";
       _this.searchVal = "";
       _this.searchWord = [];
       _this.currentcolorValue = [];
-      _this.SearchwordNumber = [];
+      _this.SearchwordNumber = 0;
+      this.closeSearchhighlight();
     },
     cutHeaderText(type) {
       this.headerText = type;
@@ -948,6 +1083,20 @@ export default {
       })
         .then((res) => {
           this.ArticelData = res.data.result;
+          let str = "";
+          let index = 0;
+          this.ArticelData.forEach((item) => {
+            item.forEach((items) => {
+              items.forEach((itemss) => {
+                itemss.text.forEach((itemsss) => {
+                  str += itemsss.word;
+                  itemsss.index = index;
+                  index++;
+                });
+              });
+            });
+          });
+          this.textContent = str;
           this.loading = false;
         })
         .catch((res) => {
@@ -957,13 +1106,17 @@ export default {
   },
   created() {
     this.partitionKey = this.$route.query.partitionKey * 1;
-    this.subjectWords = this.$route.query.subjectWords;
+    this.subjectWords = JSON.parse(this.$route.query.subjectWords);
     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.difficulty.pinyinDifficulty = this.$route.query.pinyinDifficulty;
+    this.difficulty.vocabularyDifficulty =
+      this.$route.query.vocabularyDifficulty;
+    this.difficulty.wordDifficulty = this.$route.query.wordDifficulty;
     this.levelMap = staticData.LevelMap;
     this.getstatistics();
   },
@@ -1399,25 +1552,33 @@ export default {
             margin-top: 17px;
             font-weight: 500;
             .paragraph {
-              display: flex;
+              // display: flex;
               .sentence {
-                display: flex;
+                // display: flex;
                 margin-bottom: 8px;
                 .words {
-                  display: flex;
+                  // display: flex;
+                  .word {
+                    writing-mode: vertical-lr;
+                    > span {
+                      writing-mode: horizontal-tb;
+                    }
+                  }
                   .pinyin {
+                    float: left;
                     color: rgba(255, 255, 255, 0.5);
                     text-align: center;
                     line-height: 12px;
                     font-family: "GB-PINYINOK-B";
-                    display: flex;
+                    // display: flex;
                   }
                   .hanzi {
+                    float: left;
                     color: rgb(255, 255, 255);
                     text-align: center;
                     line-height: 28px;
                     font-family: "FZJCGFKTK";
-                    display: flex;
+                    // display: flex;
                   }
                 }
               }

+ 3 - 0
src/views/teacher-dev/TextAnalysis.vue

@@ -84,6 +84,9 @@ export default {
             vocabularyCount: item.vocabularyCount,
             pinyinCount: item.pinyinCount,
             pinyinTextCount: item.pinyinTextCount,
+            pinyinDifficulty: item.pinyinDifficulty,
+            wordDifficulty: item.wordDifficulty,
+            vocabularyDifficulty: item.vocabularyDifficulty,
             type: "文本分析",
           },
         }).href,