natasha 1 year ago
parent
commit
37acca162d
1 changed files with 14 additions and 14 deletions
  1. 14 14
      src/views/bookShelf/components/NotesModel.vue

+ 14 - 14
src/views/bookShelf/components/NotesModel.vue

@@ -2,11 +2,11 @@
 <template>
   <div id="notes-model">
     <div class="NNPE-ArticleView" v-if="articleInfo">
-        <template v-if="resArr[0]&&resArr[0].wordsList">
+        <template v-if="resArr[0]">
             <h2>
-                <span v-for="(itemR,indexR) in resArr[0].wordsList" :key="indexR" :style="{color:colorObj.titleColor,fontSize:(wordFontsize+30)+'px',lineHeight:(wordFontsize+38)+'px',marginRight:'10px',fontWeight:'700',cursor:'pointer'}">
+                <span :style="{color:colorObj.titleColor,fontSize:(wordFontsize+30)+'px',lineHeight:(wordFontsize+38)+'px',marginRight:'10px',fontWeight:'700',cursor:'pointer'}">
                         <span
-                            class="NNPE-chs" v-html="itemR.text"
+                            class="NNPE-chs" v-html="resArr[0].text" @mousedown="mouseupClick(resArr[0],0)"
                             ></span
                         >
                     <!-- {{itemR.tokens[2]}} -->
@@ -41,7 +41,7 @@
             :key="'detail' + index"
             >
                 <template v-if="index!==0">
-                    <span v-for="(pItem, pIndex) in item.wordsList" :key="'wordsList' + pIndex" class="word-box" :style="{fontSize:wordFontsize + 'px',color: colorObj.contentColor}" @mousedown="mouseupClick(pItem)" v-html="pItem.text">
+                    <span class="word-box" :style="{fontSize:wordFontsize + 'px',color: colorObj.contentColor}" @mousedown="mouseupClick(item,index)" v-html="item.text">
                     </span>
                 </template>
             </div>
@@ -179,12 +179,12 @@ export default {
         });
         for(let i=0;i<leg+1;i++){
             let obj = {
-                wordsList: []
+                text: ''
             }
             resArr.push(obj)
         }
         this.sentenceList.forEach((item,index) => {
-            resArr[item.pno].wordsList.push(item)
+            resArr[item.pno].text+=item.text
         });
         this.resArr = resArr;
         this.handleHighSentence()
@@ -207,7 +207,7 @@ export default {
                     if(sources&&sources[0]){
                         _this.notesObj.title = sources[0].text
                         _this.notesObj.pos = JSON.stringify({
-                            sent_id: _this.activeSentObj.id,
+                            sent_id: _this.activeSentObj,
                             s: sources[0].startMeta.textOffset,
                             e: sources[0].endMeta.textOffset,
                         })
@@ -236,12 +236,12 @@ export default {
                     this.highDataList = res.data
                     this.highDataList.forEach(itemh=>{
                         if(JSON.parse(itemh.pos).sent_id){
-                            this.resArr.forEach(itemr=>{
-                                itemr.wordsList.forEach(itemw=>{
-                                    if(itemw.id===JSON.parse(itemh.pos).sent_id){
-                                        itemw.text = itemw.text.replace(itemh.select_text, "<span class='selece-high-sent' attr-id='"+itemh.id+"'>"+itemh.select_text+"</span>")
+                            this.resArr.forEach((itemr,indexr)=>{
+                                // itemr.wordsList.forEach(itemw=>{
+                                    if(indexr===JSON.parse(itemh.pos).sent_id){
+                                        itemr.text = itemr.text.replace(itemh.select_text, "<span class='selece-high-sent' attr-id='"+itemh.id+"'>"+itemh.select_text+"</span>")
                                     }
-                                })
+                                // })
                             })
                         }
                     })
@@ -267,8 +267,8 @@ export default {
                 }
             })
     },
-    mouseupClick(obj){
-        this.activeSentObj = obj
+    mouseupClick(obj,index){
+        this.activeSentObj = index
     },
     // 保存
     handleSave(){