فهرست منبع

人工增加校对高亮生词

natasha 1 سال پیش
والد
کامیت
0554c47c26

+ 94 - 13
src/components/Adult/inputModules/ArticleTemChs/components/ClauseresultChs.vue

@@ -22,21 +22,54 @@
           maxlength="1000"
           show-word-limit
         ></el-input>
-        <el-button
-          v-if="item.isReadonly"
-          type="danger"
-          size="small"
-          @click="editClause(item)"
-          >编辑</el-button
-        >
-        <el-button v-else type="primary" size="small" @click="sureClause(index)"
-          >生词分词</el-button
-        >
+        <div class="button-box">
+            <el-button
+                v-if="item.isReadonly"
+                type="danger"
+                size="small"
+                @click="editClause(item)"
+            >编辑</el-button
+            >
+            <el-button v-else type="primary" size="small" @click="sureClause(index)"
+            >生词分词</el-button
+            >
+            <el-button
+                type="warning"
+                size="small"
+                @click="setParagraphAttr(item.paragraphAttr, index)"
+                >段落属性</el-button
+            >
+        </div>
       </template>
     </div>
     <!-- <el-button type="primary" size="small" @click="oneClickResult"
       >一键生成分词</el-button
     > -->
+    <el-dialog
+      title="段落属性"
+      :visible.sync="paragraphAttrFlag"
+      width="60%"
+      :close-on-click-modal="false"
+      :modal-append-to-body="false"
+      append-to-body
+      top="10px"
+    >
+      <template v-if="paraCon">
+        <div class="NNPE-book-input-item">
+          <span class="NNPE-book-lable">对齐方式:</span>
+          <el-radio-group
+            v-model="paraCon.paragraphAlign"
+          >
+            <el-radio label="left">左对齐</el-radio>
+            <el-radio label="center">居中对齐</el-radio>
+            <el-radio label="right">右对齐</el-radio>
+          </el-radio-group>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="saveParagtaphAttr">保存</el-button>
+        </span>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -48,6 +81,8 @@ export default {
   data() {
     return {
       para_list: [],
+      paragraphAttrFlag: false, // 段落属性
+      paraCon: null, //段落句子,校对分词和拼音
     };
   },
   computed: {},
@@ -55,6 +90,13 @@ export default {
     "curQue.detail": {
       handler: function (newVal, oldVal) {
         this.handleSentence(JSON.parse(JSON.stringify(newVal)));
+        this.curQue.detail.forEach((item, index) => {
+          if (!item.paragraphAttr) {
+            item.paragraphAttr = {
+              paragraphAlign:'left'
+            };
+          }
+        });
       },
       deep: true,
     },
@@ -73,9 +115,19 @@ export default {
           para: para,
           isReadonly: false,
         };
+        if (!item.paragraphAttr) {
+          obj.paragraphAttr = {
+            paragraphAlign: 'left',// 段落对齐方式
+          };
+        }else {
+          obj.paragraphAttr = {
+            paragraphAlign: item.paragraphAttr.paragraphAlign?item.paragraphAttr.paragraphAlign:'left',
+          };
+        }
         paraList.push(obj);
       });
       this.para_list = paraList;
+      console.log(this.para_list)
     },
     //input内容变化
     handleChange(value, index) {
@@ -101,13 +153,36 @@ export default {
       item.isReadonly = false;
     },
     oneClickResult() {},
+    saveParagtaphAttr() {
+      let _this = this;
+      let paraCon = JSON.parse(JSON.stringify(_this.paraCon));
+      _this.$set(
+        _this.curQue.detail[_this.proofParaIndex],
+        "paragraphAttr",
+        paraCon
+      );
+      _this.$message.success("保存成功");
+    },
+    setParagraphAttr(item, index) {
+        console.log(item)
+      this.paragraphAttrFlag = true;
+      this.proofParaIndex = index;
+      this.paraCon = item;
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    this.curQue.detail.forEach((item, index) => {
+      if (!item.paragraphAttr) {
+        item.paragraphAttr = {
+          paragraphAlign: 'left'
+        };
+      }
+    });
+    console.log(this.curQue)
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    console.log("====分句====");
-    console.log(this.curQue);
     let detail = JSON.parse(JSON.stringify(this.curQue.detail));
     this.handleSentence(detail);
   },
@@ -128,4 +203,10 @@ export default {
   align-items: flex-end;
   margin-bottom: 10px;
 }
+.button-box {
+    width: 90px;
+    .el-button {
+      margin: 0 0 5px 0;
+    }
+}
 </style>

+ 27 - 3
src/components/Adult/inputModules/ArticleTemChs/components/SegbywordChs.vue

@@ -40,7 +40,7 @@
     <el-dialog
       title="校对分词"
       :visible.sync="proofVisible"
-      width="60%"
+      width="80%"
       :close-on-click-modal="false"
       top="10px"
     >
@@ -107,7 +107,7 @@
               <el-table
                 :data="paraCon.wordsList[sentIndex]"
                 border
-                style="width: 400px"
+                style="width: 75%"
               >
                 <el-table-column prop="chs" label="词" width="180">
                     <template slot-scope="scope">
@@ -131,6 +131,27 @@
                     ></el-input>
                   </template>
                 </el-table-column>
+                <el-table-column label="配置">
+                    <template slot-scope="scope">
+                        <!-- <div class="adult-book-input-item">
+                            <span class="adult-book-lable">禁止高亮:</span>
+                            <el-radio-group v-model="scope.row.banLight">
+                            <el-radio :label="false">允许</el-radio>
+                            <el-radio :label="true">禁止</el-radio>
+                            </el-radio-group>
+                        </div> -->
+                        <div class="adult-book-input-item">
+                            <span class="adult-book-lable">高亮生词:</span>
+                            <el-input
+                                placeholder="请输入生词"
+                                v-model="scope.row.new_word"
+                                @input="handleInput"
+                                @blur="onBlur(scope.row, 'new_word')"
+                                class="adult-book-input"
+                            ></el-input>
+                        </div>
+                    </template>
+                </el-table-column>
               </el-table>
               <div></div>
             </div>
@@ -206,6 +227,9 @@ export default {
   },
   //方法集合
   methods: {
+    handleInput() {
+      this.$forceUpdate();
+    },
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : "";
       this.$forceUpdate()
@@ -453,7 +477,7 @@ export default {
 }
 .yunmu {
   position: absolute;
-  left: 460px;
+  right: 10px;
   top: 80px;
   &-table {
     width: 260px;

+ 27 - 4
src/components/Adult/inputModules/DialogueArticleChs/components/SegbywordChs.vue

@@ -40,7 +40,7 @@
     <el-dialog
       title="校对分词"
       :visible.sync="proofVisible"
-      width="60%"
+      width="80%"
       :close-on-click-modal="false"
       top="10px"
     >
@@ -105,7 +105,7 @@
               <el-table
                 :data="paraCon.wordsList[sentIndex]"
                 border
-                style="width: 400px"
+                style="width: 75%"
               >
                 <el-table-column prop="chs" label="词" width="180">
                 </el-table-column>
@@ -120,8 +120,28 @@
                     ></el-input>
                   </template>
                 </el-table-column>
+                <el-table-column label="配置">
+                    <template slot-scope="scope">
+                        <!-- <div class="adult-book-input-item">
+                            <span class="adult-book-lable">禁止高亮:</span>
+                            <el-radio-group v-model="scope.row.banLight">
+                            <el-radio :label="false">允许</el-radio>
+                            <el-radio :label="true">禁止</el-radio>
+                            </el-radio-group>
+                        </div> -->
+                        <div class="adult-book-input-item">
+                            <span class="adult-book-lable">高亮生词:</span>
+                            <el-input
+                                placeholder="请输入生词"
+                                v-model="scope.row.new_word"
+                                @input="handleInput"
+                                @blur="onBlur(scope.row, 'new_word')"
+                                class="adult-book-input"
+                            ></el-input>
+                        </div>
+                    </template>
+                </el-table-column>
               </el-table>
-              <div></div>
             </div>
             <div class="yunmu">
               <span>点击可复制</span>
@@ -195,6 +215,9 @@ export default {
   },
   //方法集合
   methods: {
+    handleInput() {
+      this.$forceUpdate();
+    },
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : "";
     },
@@ -438,7 +461,7 @@ export default {
 }
 .yunmu {
   position: absolute;
-  left: 460px;
+  right: 10px;
   top: 80px;
   &-table {
     width: 260px;

+ 11 - 1
src/components/Adult/preview/ArticleViewChs/NormalModelChs.vue

@@ -49,7 +49,7 @@
             v-for="(item, index) in resArr"
             :key="'detail' + index"
             >
-            <div class="wordsList-box">
+            <div class="wordsList-box" :class="[curQue.detail[index].paragraphAttr?'wordsList-box-'+curQue.detail[index].paragraphAttr.paragraphAlign:'']">
                 <img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
                 <div :class="[item.isTitle ? 'NNPE-title' : '']">
                 <div
@@ -1345,6 +1345,16 @@ export default {
     .wordsList-box {
       width: 100%;
       padding: 6px 24px 12px 24px;
+      display: flex;
+      &-left{
+        justify-content: flex-start;
+      }
+      &-center{
+        justify-content: center;
+      }
+      &-right{
+        justify-content: flex-end;
+      }
       > div {
         clear: both;
         overflow: hidden;

+ 117 - 23
src/components/Adult/preview/ArticleViewChs/PhraseModelChs.vue

@@ -45,7 +45,7 @@
             v-for="(item, index) in resArr"
             :key="'detail' + index"
             >
-            <div class="wordsList-box">
+            <div class="wordsList-box" :class="[curQue.detail[index].paragraphAttr?'wordsList-box-'+curQue.detail[index].paragraphAttr.paragraphAlign:'']">
                 <img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
                 <div>
                 <div
@@ -58,7 +58,7 @@
                         : 'textCenter',
                     pItem.chs == '“' ? 'textRight' : '',
                     ]"
-                    @click="showWordDetail($event, pItem.chs)"
+                    @click="showWordDetail($event, pItem.chs, pItem.words)"
                 >
                     <template v-if="!pItem.width">
                     <template v-if="pItem.isShow">
@@ -87,8 +87,9 @@
                             :class="[
                                 'NNPE-chs',
                                 newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
+                                pItem.words ? 'active' : '',
                             ]"
-                            @click.stop="viewNotes($event, pItem.chs)"
+                            @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                             >{{ NumberList.indexOf(pItem.pinyin) == -1
                                     ? pItem.chs
                                     : "" }}</span
@@ -128,7 +129,7 @@
                             <span class="NNPE-chs" style="text-align: left" @click.stop="
                                 viewNotes(
                                     $event,
-                                    item.wordsList[pIndex + 1].chs
+                                    item.wordsList[pIndex + 1].words?item.wordsList[pIndex + 1].words:item.wordsList[pIndex + 1].chs
                                 )
                                 ">{{
                             NumberList.indexOf(
@@ -192,7 +193,7 @@
                             <span class="NNPE-chs" style="text-align: left" @click.stop="
                                 viewNotes(
                                     $event,
-                                    item.wordsList[pIndex + 2].chs
+                                    item.wordsList[pIndex + 2].words?item.wordsList[pIndex + 2].words:item.wordsList[pIndex + 2].chs
                                 )
                                 ">{{
                             NumberList.indexOf(
@@ -240,8 +241,9 @@
                             :class="[
                             pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
                             newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
+                            pItem.words ? 'active' : '',
                             ]"
-                            @click.stop="viewNotes($event, pItem.chs)"
+                            @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                             >{{ NumberList.indexOf(pItem.pinyin) == -1
                                 ? pItem.chs
                                 : "" }}</span
@@ -305,7 +307,7 @@
                         : 'textCenter',
                         pItem.chs == '“' ? 'textRight' : '',
                     ]"
-                    @click="showWordDetail($event, pItem.chs)"
+                    @click="showWordDetail($event, pItem.chs, pItem.words)"
                     >
                     <template v-if="!pItem.width">
                         <template v-if="pItem.isShow">
@@ -338,6 +340,7 @@
                                 pItem.padding && config.isShowPY ? 'padding' : '',
                                 sentIndex == index ? 'wordBlank' : '',
                                 newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
+                                pItem.words ? 'active' : '',
                                 ]"
                             >
                                 <template>
@@ -347,7 +350,7 @@
                                     :class="[
                                     
                                     ]"
-                                    @click.stop="viewNotes($event, pItem.chs)"
+                                    @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                                     >{{ NumberList.indexOf(pItem.pinyin) == -1
                                         ? pItem.chs[wIndex]
                                         : "" }}</span
@@ -389,7 +392,7 @@
                                 :class="[
                                     
                                 ]"
-                                @click.stop="viewNotes($event, item.sentArr[pIndex + 1].chs)"
+                                @click.stop="viewNotes($event, item.sentArr[pIndex + 1].words?item.sentArr[pIndex + 1].words:item.sentArr[pIndex + 1].chs)"
                                 >
                                 {{ NumberList.indexOf(item.sentArr[pIndex + 1].pinyin) == -1
                                         ? item.sentArr[pIndex + 1].chs
@@ -440,7 +443,7 @@
                                 :class="[
                                     
                                 ]"
-                                @click.stop="viewNotes($event, item.sentArr[pIndex + 2].chs)"
+                                @click.stop="viewNotes($event, item.sentArr[pIndex + 2].words?item.sentArr[pIndex + 2].words:item.sentArr[pIndex + 2].chs)"
                                 >
                                 {{ NumberList.indexOf(item.sentArr[pIndex + 2].pinyin) == -1
                                         ? item.sentArr[pIndex + 2].chs
@@ -487,6 +490,7 @@
                                 : '',
                                 sentIndex == index ? 'wordBlank' : '',
                                 newWordList.indexOf(pItem.chs) > -1 ? 'active' : '',
+                                pItem.words ? 'active' : '',
                             ]"
                             >
                             <template>
@@ -496,7 +500,7 @@
                                 :class="[
                                     
                                 ]"
-                                @click.stop="viewNotes($event, pItem.chs)"
+                                @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                                 >{{ NumberList.indexOf(pItem.pinyin) == -1
                                         ? pItem.chs[wIndex]
                                         : "" }}</span
@@ -643,6 +647,9 @@ export default {
       clientY: 0,
       clickType: "",
       sentIndex: -1,
+      highWords: null,
+      highWordsArr: [],
+      highIndex: 0,
     };
   },
   computed: {},
@@ -746,8 +753,24 @@ export default {
         }
         dItem.wordsList.forEach((sItem, sIndex) => {
           sItem.forEach((wItem, wIndex) => {
+            let sentence = dItem.sentences[sIndex];
             //this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(sItem, wItem, wIndex);
+                        let words = "";
+            if (this.newWordList.length > 0) {
+              if (!this.highWords) {
+                this.findLightWord(wItem, wIndex, sentence,sItem);
+                words = this.highWords ? this.highWords.words : "";
+              } else {
+                if (wIndex > this.highWords.endIndex - 1) {
+                  this.highWords = null;
+                  this.findLightWord(wItem, wIndex, sentence,sItem);
+                  words = this.highWords ? this.highWords.words : "";
+                } else {
+                  words = this.highWords ? this.highWords.words : "";
+                }
+              }
+            }
             let obj = {
               paraIndex: dIndex, //段落索引
               sentIndex: sIndex, //在段落中句子索引
@@ -758,6 +781,7 @@ export default {
               className: wItem.className,
               isShow: wItem.isShow,
               isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
+              words: words,
             };
             paraArr.push(obj);
             if(wItem.pinyin) dhaspinyin=true
@@ -837,6 +861,43 @@ export default {
       });
       this.resObj = { sentList: resArrs, timeList: timeList };
     },
+    findLightWord(wItem, startIndex, sentence,sItem) {
+      let words = "",
+        endIndex = 0;
+      this.newWordList.forEach((item) => {
+        if (item.length == 1) {
+          if (item == wItem.chs&&!wItem.banLight) {
+            words = wItem.chs;
+            endIndex = startIndex + 1;
+          }
+        } else {
+          if (item[0] == wItem.chs && sentence.indexOf(item) > -1) {
+            let index = null
+            let chsStr = ""
+            for(let i=startIndex;i<sItem.length+1;i++){
+                index = i
+                if(chsStr.length==item.length){
+                    break
+                }else{
+                    chsStr += sItem[i]?sItem[i].chs:''
+                }
+            }
+            if(chsStr==item&&!wItem.banLight){
+                words = item;
+                endIndex = index;
+            }
+          }else if(wItem.new_word&&wItem.new_word==item&&!wItem.banLight){
+                words = item;
+                endIndex = startIndex + 1;
+          }
+        }
+      });
+      if (words) {
+        this.highWords = { words: words, endIndex: endIndex };
+      } else {
+        this.highWords = null;
+      }
+    },
     //词和标点合一起
     mergeWordSymbol(sItem, wItem, curIndex) {
       let leg = sItem.length;
@@ -915,24 +976,47 @@ export default {
       let NewWordList = [];
       this.NNPENewWordList.forEach((item) => {
         item.forEach((wItem) => {
-          NewWordList.push(wItem.new_word);
+          if (wItem.new_word) {
+            NewWordList.push(wItem.new_word);
+          } else if (wItem.detail && wItem.detail.sentence) {
+            NewWordList.push(wItem.detail.sentence);
+          }
         });
       });
       this.newWordList = JSON.parse(JSON.stringify(NewWordList));
     },
 
-    showWordDetail(e, word) {
+    showWordDetail(e, word, words) {
       let _this = this;
-      if (this.newWordList.indexOf(word) > -1) {
-        if (_this.oldHz != word) {
-          this.isShow = false;
-          setTimeout(() => {
-            _this.hz = word;
-          }, 50);
+      _this.highIndex = 0;
+      _this.highWordsArr = [];
+      if (word && this.newWordList.indexOf(word) > -1) {
+        this.highWordsArr.push(word);
+      }
+      if (words && word != words && this.newWordList.indexOf(words) > -1) {
+        this.highWordsArr.push(words);
+      }
+      if (this.newWordList.indexOf(word) > -1 ||
+        this.newWordList.indexOf(words) > -1) {
+        if (word && this.newWordList.indexOf(word) > -1) {    
+            if (_this.oldHz != word) {
+            this.isShow = false;
+            setTimeout(() => {
+                _this.hz = word;
+            }, 50);
+            }
+        }else if (words && this.newWordList.indexOf(words) > -1) {
+          if (_this.oldHz != words) {
+            this.isShow = false;
+            setTimeout(() => {
+              _this.hz = words;
+            }, 50);
+          }
         }
         _this.clientY = e.clientY;
         let left = e.clientX;
         let width = 0;
+
         if (word.length == 1 || word.length == 2) {
           width = 304;
         } else if (word.length == 3 || word.length == 4) {
@@ -940,6 +1024,7 @@ export default {
         } else if (word.length > 3) {
           width = 560;
         }
+
         if (left - this.bodyLeft > this.contentWidth / 2) {
           _this.left = left - width + 10;
         } else {
@@ -1071,13 +1156,12 @@ export default {
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    if (this.curQue) {
-      this.handleData();
-    }
-
     if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
       this.handleNewword();
     }
+    if (this.curQue) {
+      this.handleData();
+    }
     $(window).resize(() => {
       this.getScreenHeight();
     });
@@ -1221,6 +1305,16 @@ export default {
     .wordsList-box {
       width: 100%;
       padding: 6px 24px 12px 24px;
+      display: flex;
+      &-left{
+        justify-content: flex-start;
+      }
+      &-center{
+        justify-content: center;
+      }
+      &-right{
+        justify-content: flex-end;
+      }
       > div {
         overflow: hidden;
         clear: both;

+ 11 - 1
src/components/Adult/preview/ArticleViewChs/WordModelChs.vue

@@ -45,7 +45,7 @@
             v-for="(item, index) in resArr"
             :key="'detail' + index"
             >
-            <div class="wordsList-box">
+            <div class="wordsList-box" :class="[curQue.detail[index].paragraphAttr?'wordsList-box-'+curQue.detail[index].paragraphAttr.paragraphAlign:'']">
                 <img :src="articleImg[index]" v-if="articleImg[0] && index == 0" />
                 <div>
                 <div
@@ -1056,6 +1056,16 @@ export default {
     .wordsList-box {
       width: 100%;
       padding: 6px 24px 12px 24px;
+      display: flex;
+      &-left{
+        justify-content: flex-start;
+      }
+      &-center{
+        justify-content: center;
+      }
+      &-right{
+        justify-content: flex-end;
+      }
       > div {
         overflow: hidden;
         clear: both;

+ 1 - 1
src/components/Adult/preview/DialogueArticleViewChs/AnswerModel.vue

@@ -835,7 +835,7 @@ export default {
           fontSize: config ? config.fontSize : '20px',
           fontFamily: config ? config.fontFamily : 'FZJCGFKTK',
           textAlign: config&&config.DiaTextAlign?config.DiaTextAlign:'left',
-          width: config&&config.DiaInputLength?config.DiaInputLength*Number(sizeVal)+'px':''
+          minWidth: config&&config.DiaInputLength?config.DiaInputLength*Number(sizeVal)+28+'px':''
         };
       };
     },

+ 97 - 17
src/components/Adult/preview/DialogueArticleViewChs/PhraseModelChs.vue

@@ -91,7 +91,7 @@
                       : 'textCenter',
                     pItem.chs == '“' ? 'textRight' : '',
                   ]"
-                  @click="showWordDetail($event, pItem.chs)"
+                  @click="showWordDetail($event, pItem.chs, pItem.words)"
                 >
                   <template v-if="!pItem.width">
                     <template v-if="pItem.isShow">
@@ -126,8 +126,9 @@
                               newWordList.indexOf(pItem.chs) > -1
                                 ? 'newActive'
                                 : '',
+                              pItem.words ? 'newActive' : '',
                             ]"
-                            @click.stop="viewNotes($event, pItem.chs)"
+                            @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                             >{{
                               NumberList.indexOf(pItem.pinyin) == -1
                                 ? pItem.chs
@@ -176,7 +177,7 @@
                           <span class="NNPE-chs" style="text-align: left" @click.stop="
                               viewNotes(
                                 $event,
-                                item.wordsList[pIndex + 1].chs
+                                item.wordsList[pIndex + 1].words?item.wordsList[pIndex + 1].words:item.wordsList[pIndex + 1].chs
                               )
                             ">{{
                             NumberList.indexOf(
@@ -258,7 +259,7 @@
                                 : '',
                             ]"
                             @click.stop="
-                              viewNotes($event, item.wordsList[pIndex + 2].chs)
+                              viewNotes($event, item.wordsList[pIndex + 2].words?item.wordsList[pIndex + 2].words:item.wordsList[pIndex + 2].chs)
                             "
                             >{{
                               NumberList.indexOf(
@@ -317,8 +318,9 @@
                               ? 'newActive'
                               : '',
                             pItem.chs != '“' && pItem.padding && config.isShowPY ? 'padding' : '',
+                            pItem.words ? 'newActive' : '',
                           ]"
-                          @click.stop="viewNotes($event, pItem.chs)"
+                          @click.stop="viewNotes($event, pItem.words?pItem.words:pItem.chs)"
                           >{{
                             NumberList.indexOf(pItem.pinyin) == -1
                               ? pItem.chs
@@ -504,6 +506,9 @@ export default {
       oldNoteNum: "",
       curNoteCon: null,
       contentWidth: 732,
+      highWords: null,
+      highWordsArr: [],
+      highIndex: 0,
     };
   },
   computed: {},
@@ -596,9 +601,25 @@ export default {
         }
         let paraArr = [];
         dItem.wordsList.forEach((sItem, sIndex) => {
+          let sentence = dItem.sentences[sIndex];
           sItem.forEach((wItem, wIndex) => {
             //this.judgePad(sItem, wItem, wIndex);
             this.mergeWordSymbol(wItem);
+            let words = "";
+            if (this.newWordList.length > 0) {
+              if (!this.highWords) {
+                this.findLightWord(wItem, wIndex, sentence,sItem);
+                words = this.highWords ? this.highWords.words : "";
+              } else {
+                if (wIndex > this.highWords.endIndex - 1) {
+                  this.highWords = null;
+                  this.findLightWord(wItem, wIndex, sentence,sItem);
+                  words = this.highWords ? this.highWords.words : "";
+                } else {
+                  words = this.highWords ? this.highWords.words : "";
+                }
+              }
+            }
             let obj = {
               paraIndex: dIndex, //段落索引
               sentIndex: sIndex, //在段落中句子索引
@@ -608,6 +629,7 @@ export default {
               padding: true, //wItem.padding,
               className: wItem.className,
               isShow: wItem.isShow,
+              words: words,
               isNewWord: this.newWords.indexOf(wItem.chs) > -1 ? true : false,
             };
             paraArr.push(obj);
@@ -636,6 +658,43 @@ export default {
         });
       }
     },
+    findLightWord(wItem, startIndex, sentence,sItem) {
+      let words = "",
+        endIndex = 0;
+      this.newWordList.forEach((item) => {
+        if (item.length == 1) {
+          if (item == wItem.chs&&!wItem.banLight) {
+            words = wItem.chs;
+            endIndex = startIndex + 1;
+          }
+        } else {
+          if (item[0] == wItem.chs && sentence.indexOf(item) > -1) {
+            let index = null
+            let chsStr = ""
+            for(let i=startIndex;i<sItem.length+1;i++){
+                index = i
+                if(chsStr.length==item.length){
+                    break
+                }else{
+                    chsStr += sItem[i]?sItem[i].chs:''
+                }
+            }
+            if(chsStr==item&&!wItem.banLight){
+                words = item;
+                endIndex = index;
+            }
+          }else if(wItem.new_word&&wItem.new_word==item&&!wItem.banLight){
+                words = item;
+                endIndex = startIndex + 1;
+          }
+        }
+      });
+      if (words) {
+        this.highWords = { words: words, endIndex: endIndex };
+      } else {
+        this.highWords = null;
+      }
+    },
     //词和标点合一起
     mergeWordSymbol(wItem) {
       if (
@@ -701,21 +760,42 @@ export default {
       let NewWordList = [];
       this.NNPENewWordList.forEach((item) => {
         item.forEach((wItem) => {
-          NewWordList.push(wItem.new_word);
+          if (wItem.new_word) {
+            NewWordList.push(wItem.new_word);
+          } else if (wItem.detail && wItem.detail.sentence) {
+            NewWordList.push(wItem.detail.sentence);
+          }
         });
       });
       this.newWordList = JSON.parse(JSON.stringify(NewWordList));
     },
 
-    showWordDetail(e, word) {
-
+    showWordDetail(e, word, words) {
       let _this = this;
-      if (this.newWordList.indexOf(word) > -1) {
-        if (_this.oldHz != word) {
-          this.isShow = false;
-          setTimeout(() => {
-            _this.hz = word;
-          }, 50);
+      _this.highIndex = 0;
+      _this.highWordsArr = [];
+      if (word && this.newWordList.indexOf(word) > -1) {
+        this.highWordsArr.push(word);
+      }
+      if (words && word != words && this.newWordList.indexOf(words) > -1) {
+        this.highWordsArr.push(words);
+      }
+      if (this.newWordList.indexOf(word) > -1 ||
+        this.newWordList.indexOf(words) > -1) {
+        if (word && this.newWordList.indexOf(word) > -1) {    
+            if (_this.oldHz != word) {
+            this.isShow = false;
+            setTimeout(() => {
+                _this.hz = word;
+            }, 50);
+            }
+        }else if (words && this.newWordList.indexOf(words) > -1) {
+          if (_this.oldHz != words) {
+            this.isShow = false;
+            setTimeout(() => {
+              _this.hz = words;
+            }, 50);
+          }
         }
         _this.clientY = e.clientY;
         let left = e.clientX;
@@ -855,12 +935,12 @@ export default {
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    if (this.curQue) {
-      this.handleData();
-    }
     if (this.NNPENewWordList && this.NNPENewWordList.length > 0) {
       this.handleNewword();
     }
+    if (this.curQue) {
+      this.handleData();
+    }
     $(window).resize(() => {
       this.getScreenHeight();
     });

+ 9 - 1
src/components/Adult/preview/components/Wordcard.vue

@@ -423,7 +423,15 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    let new_word_str = ""
+    for(let i = 0;i<this.word.detail.new_word.length;i++){
+        if(/[\u4E00-\u9FA5\uF900-\uFA2D]/.test(this.word.detail.new_word[i])){
+            new_word_str+=this.word.detail.new_word[i]
+        }
+    }
+    this.word.detail.new_word = new_word_str
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;