natasha 1 سال پیش
والد
کامیت
4b26f4cb46

+ 5 - 0
src/components/WordCard.vue

@@ -367,6 +367,8 @@ export default {
             if(this.phraseActiveIndex>0){
                 this.phraseActiveIndex--
                 this.data = this.wordList[this.phraseActiveIndex]
+                this.getInfo()
+                this.getQuerySentKwic()
             }else{
                 return
             }
@@ -374,6 +376,8 @@ export default {
             if(this.phraseActiveIndex<this.wordList.length-1){
                 this.phraseActiveIndex++
                 this.data = this.wordList[this.phraseActiveIndex]
+                this.getInfo()
+                this.getQuerySentKwic()
             }else{
                 return
             }
@@ -820,6 +824,7 @@ export default {
             padding: 0;
             margin: 0;
             display: flex;
+            list-style: none;
             li{
                 color:#929CA8;
                 font-size: 16px;

+ 3 - 0
src/icons/svg/arrow-left-line.svg

@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M5.21891 7.33327H13.3333V8.6666H5.21891L8.79489 12.2425L7.85209 13.1853L2.66663 7.99993L7.85209 2.81445L8.79489 3.75726L5.21891 7.33327Z" fill="currentColor"/>
+</svg>

+ 3 - 0
src/icons/svg/arrow-right-line.svg

@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M10.781 7.33327L7.20503 3.75726L8.14783 2.81445L13.3333 7.99993L8.14783 13.1853L7.20503 12.2425L10.781 8.6666H2.66663V7.33327H10.781Z" fill="currentColor"/>
+</svg>

+ 1 - 1
src/views/content_manage/newspaper_manage/ArticleDetail.vue

@@ -62,7 +62,7 @@
                         </template>
                         <template v-if="articleInfo.art_explain_data.length>0">
                             <h4 :style="{color:bgColorList[activeIndex].glossarySubtitle}">注释</h4>
-                            <annotation-list class="newWord-list" :list="articleInfo.art_explain_data" :style="{background:bgColorList[activeIndex].glossaryBg}" :colorObj="bgColorList[activeIndex]"></annotation-list>
+                            <annotation-list class="newWord-list" :list="articleInfo.art_explain_data" :style="{background:bgColorList[activeIndex].glossaryBg}" :colorObj="bgColorList[activeIndex]" type="preview"></annotation-list>
                         </template>
                     </div>
                 </el-collapse-transition>

+ 18 - 16
src/views/content_manage/newspaper_manage/components/AnnotationList.vue

@@ -5,21 +5,23 @@
                 <b class="prefix" :style="{color:colorObj.phraseOhterColor}">{{itemW.exp_title}}</b>
                 <div class="para-list" :style="{color:colorObj.newWordOtherColor}" v-html="itemW.exp_content"></div>
             </div>
-            <b class="border"></b>
-            <el-button
-                @click="handleEdit(itemW,indexW)"
-                type="text"
-                size="small"
-                class="primary-btn">
-                编辑
-            </el-button>
-            <el-button
-                @click="handleDelete(itemW, indexW)"
-                type="text"
-                size="small"
-                class="red-btn">
-                删除
-            </el-button>
+            <template v-if="!type">
+                <b class="border"></b>
+                <el-button
+                    @click="handleEdit(itemW,indexW)"
+                    type="text"
+                    size="small"
+                    class="primary-btn">
+                    编辑
+                </el-button>
+                <el-button
+                    @click="handleDelete(itemW, indexW)"
+                    type="text"
+                    size="small"
+                    class="red-btn">
+                    删除
+                </el-button>
+            </template>
         </li>
     </ul>
 </template>
@@ -31,7 +33,7 @@ import { getLogin } from "@/api/ajax";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["list","colorObj"],
+  props: ["list","colorObj","type"],
   data() {
     //这里存放数据
     return {

+ 1 - 0
src/views/content_manage/newspaper_manage/components/PhraseCard.vue

@@ -230,6 +230,7 @@ export default {
         ul{
             padding: 0;
             margin: 0;
+            list-style: none;
             li{
                 color:#929CA8;
                 font-size: 16px;

+ 102 - 28
src/views/content_manage/newspaper_manage/components/PhraseList.vue

@@ -1,46 +1,71 @@
 <template>
-    <ul>
-        <li v-for="(itemW,indexW) in list" :key="indexW">
-            <div class="word-info">
-                <div class="word-info-top">
-                    <b class="phrase" :style="{color:colorObj.phraseColor}">{{itemW.exp_title}}</b>
-                    <div class="para-list">
-                        <div class="para">
-                            <span class="shiyi" :style="{color:colorObj.phraseOhterColor}">{{itemW.exp_content}}</span>
+    <div>
+        <ul>
+            <li v-for="(itemW,indexW) in list" :key="indexW">
+                <div class="word-info">
+                    <div class="word-info-top">
+                        <b class="phrase" :style="{color:colorObj.phraseColor, cursor: type ? 'opinter': ''}" @click="showItem(itemW,indexW)">{{itemW.exp_title}}</b>
+                        <div class="para-list">
+                            <div class="para">
+                                <span class="shiyi" :style="{color:colorObj.phraseOhterColor}">{{itemW.exp_content}}</span>
+                            </div>
                         </div>
                     </div>
                 </div>
-            </div>
-            <b class="border"></b>
-            <el-button
-                @click="handleEdit(itemW,indexW)"
-                type="text"
-                size="small"
-                class="primary-btn">
-                编辑
-            </el-button>
-            <el-button
-                @click="handleDelete(itemW, indexW)"
-                type="text"
-                size="small"
-                class="red-btn">
-                删除
-            </el-button>
-        </li>
-    </ul>
+                <template v-if="!type">
+                    <b class="border"></b>
+                    <el-button
+                        @click="handleEdit(itemW,indexW)"
+                        type="text"
+                        size="small"
+                        class="primary-btn">
+                        编辑
+                    </el-button>
+                    <el-button
+                        @click="handleDelete(itemW, indexW)"
+                        type="text"
+                        size="small"
+                        class="red-btn">
+                        删除
+                    </el-button>
+                </template>
+                <template v-else>
+                    <svg-icon icon-class="like-line" className="icon-like" v-if="!itemW.collect" @click="handleCollect(itemW)"></svg-icon>
+                    <svg-icon icon-class="like" className="icon-like active" v-else @click="handleCollect(itemW)"></svg-icon>
+                </template>
+            </li>
+        </ul>
+        <el-dialog
+            :visible.sync="showPhraseFlag"
+            :show-close="false"
+            :close-on-click-modal="false"
+            width="580px"
+            :modal="false"
+            class="login-dialog phrase-box"
+            v-if="showPhraseFlag&&showObj">
+            <phrase-card :dataObj="showObj" @closeWord="closeExplain" :wordList="phraseList" :activeObjIndex="activeObjIndex" @changeLike="changeLike" :likePhrase="likePhrase"></phrase-card>
+        </el-dialog>
+    </div>
 </template>
 
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
 import { getLogin } from "@/api/ajax";
+import PhraseCard from "./PhraseCard.vue"
 export default {
   //import引入的组件需要注入到对象中才能使用
-  components: {},
-  props: ["list","colorObj"],
+  components: {PhraseCard},
+  props: ["list","colorObj","type"],
   data() {
     //这里存放数据
     return {
+        wordcardShow: false, // 词汇卡片flag
+        likePhrase: [],
+        phraseList: [],
+        showObj:null,
+        activeObjIndex: null,
+        showPhraseFlag: false,
     }
   },
   //计算属性 类似于data概念
@@ -75,10 +100,59 @@ export default {
     },
     handleEdit(item){
         this.$emit('handleAddPhrase',item)
+    },
+    // 收藏
+    handleCollect(item){
+        if(item.collect){
+            this.likePhrase.splice(this.likePhrase.indexOf(item.exp_title),1)
+            item.collect = false
+            this.$message({
+                message: "取消收藏",
+                type: "success",
+            });
+        }else{
+            this.likePhrase.push(item.exp_title)
+            item.collect = true
+            this.$message({
+                message: "收藏成功",
+                type: "success",
+            });
+        }
+        this.$forceUpdate()
+    },
+    showItem(item,indexi){
+        if(!this.type){
+            return
+        }
+        this.showObj = item
+        this.activeObjIndex = indexi   
+        this.showPhraseFlag = true
+    },
+    handleData(){
+        this.phraseList = []
+        let wordList = JSON.parse(JSON.stringify(this.list))
+        wordList.forEach(items => {
+            let obj = {
+                exp_title: items.exp_title,
+                exp_content: items.exp_content,
+                id: items.id,
+                collect: false
+            }
+            this.phraseList.push(obj)
+        });
+    },
+    closeExplain(){
+        this.showPhraseFlag = false
+        this.showObj = null
+    },
+    changeLike(obj,list){
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    if(this.type){
+        this.handleData()
+    }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {