natasha 1 år sedan
förälder
incheckning
9b1f918640

+ 95 - 5
src/views/bookShelf/articleDetail.vue

@@ -22,14 +22,14 @@
             <div class="atricle-data">
                 <normal-model :titleFontsize="wordFontsize+30" :wordFontsize="wordFontsize" :colorObj="bgColorList[activeIndex]" :articleType="articleType" :style="{'padding':'0 40px'}" v-if="menuType==='original'" :articleInfo="articleInfo"></normal-model>
                 <phrase-model :titleFontsize="wordFontsize+30" :wordFontsize="wordFontsize" :colorObj="bgColorList[activeIndex]" :articleType="articleType" :style="{'padding':'0 40px'}" v-if="menuType==='newWord'" :articleInfo="articleInfo"></phrase-model>
-                <div class="article-btn">
+                <div class="article-btn" v-if="this.$route.query.iss_id">
                     <div class="left">
                         <span :class="['support colloct-article',!noRead?'active':'']" @click="changeStatus('noRead')"><svg-icon icon-class="like-line"></svg-icon>2847</span>
                         <!-- <span :class="['oppose',oppose?'active':'']" @click="changeStatus('oppose')"><svg-icon icon-class="oppose"></svg-icon></span> -->
                     </div>
                     <div class="center">
-                        <el-button type="text" class="btn-left" @click="handlePage('-')"><svg-icon icon-class="arrow-left-line"></svg-icon>上一篇</el-button>
-                        <el-button type="text" class="btn-right" @click="handlePage('+')">下一篇<svg-icon icon-class="arrow-right-line"></svg-icon></el-button>
+                        <el-button type="text" class="btn-left" :class="[activeArticleIndex===0?'not-allow':'']" @click="handlePage('-')"><svg-icon icon-class="arrow-left-line"></svg-icon>上一篇</el-button>
+                        <el-button type="text" class="btn-right" :class="[activeArticleIndex===issueChnTanList.length-1?'not-allow':'']" @click="handlePage('+')">下一篇<svg-icon icon-class="arrow-right-line"></svg-icon></el-button>
                     </div>
                     <div class="right">
                         <!-- <template v-if="noRead">
@@ -136,6 +136,7 @@ import PhraseModel from "./components/PhraseModel.vue"
 import MenuRight from "./components/MenuRight.vue"
 import * as echarts from "echarts";
 import { getLogin } from "@/api/ajax";
+import { getToken } from '@/utils/auth'
 export default {
   name: 'articleDetail',
   computed: {
@@ -588,6 +589,10 @@ export default {
         likeWordList: [], // 收藏短语list
         likePhraseList: [],
         likeSentencelist: [],
+        issueChnList:[], // 报刊文章目录
+        issueChnTanList: [], //文章摊平
+        userMessage: getToken()?JSON.parse(getToken()):null,
+        activeArticleIndex: 0
     }
   },
   methods: {
@@ -668,10 +673,41 @@ export default {
     },
     handlePage(type){
         if(type==='-'){
-            
+            if(this.activeArticleIndex!==0){
+                if(!this.issueChnTanList[this.activeArticleIndex-1].canRead){
+                    return
+                }
+                this.activeArticleIndex --
+                this.$router.replace({
+                    path: "/articleDetail",
+                    query: {
+                        headerConfig: this.$route.query.headerConfig?this.$route.query.headerConfig:'',
+                        id: this.issueChnTanList[this.activeArticleIndex].id,
+                        iss_id: this.$route.query.iss_id
+                    },
+                })
+            }else{
+                return
+            }
         }else{
-            
+            if(this.activeArticleIndex!==this.issueChnTanList.length-1){
+                if(!this.issueChnTanList[this.activeArticleIndex+1].canRead){
+                    return
+                }
+                this.activeArticleIndex ++
+                this.$router.replace({
+                    path: "/articleDetail",
+                    query: {
+                        headerConfig: this.$route.query.headerConfig?this.$route.query.headerConfig:'',
+                        id: this.issueChnTanList[this.activeArticleIndex].id,
+                        iss_id: this.$route.query.iss_id
+                    },
+                })
+            }else{
+                return
+            }
         }
+        location.reload()
     },
     getArticleDetail(){
         this.loading = true
@@ -873,6 +909,53 @@ export default {
     },
     changeLike(type,list){
         this[type] = list
+    },
+    // 报刊信息
+    getIssueDetail(){
+        this.issueChnTanList = []
+        this.issueChnList = []
+        let articleindex = 0
+        let MethodName = '/PaperServer/Client/Issue/GetIssueBriefInfo'
+        let data = {
+                id: this.$route.query.iss_id
+            }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+                let issueChnList = res.data.chn_art_data
+                if(this.userMessage){
+                    getLogin('/ShopServer/Client/BookshelfQuery/GetGoodsBuyStatus', {
+                        goods_type: 2,
+                        goods_id: this.$route.query.iss_id
+                    })
+                    .then((res) => {
+                        if(res.status===1){
+                            let isBuy = res.buy_info.is_buy==='true'
+                            issueChnList.forEach((item,index)=>{
+                                item.canRead = isBuy||index===0
+                                item.arts.forEach(items=>{
+                                    if(items.id===this.$route.query.id){
+                                        this.activeArticleIndex = articleindex
+                                    }
+                                    this.issueChnTanList.push({
+                                        id: items.id,
+                                        canRead: isBuy||index===0
+                                    })
+                                    articleindex ++
+                                })
+                                
+                            })
+                        }
+                    })
+                    .catch(() => {
+                        
+                    }); 
+                }
+            }
+        })
+        .catch(() => {
+            
+        }); 
     }
   },
   created(){
@@ -887,6 +970,9 @@ export default {
     if(this.articleId){
         this.getArticleDetail()
     }
+    if(this.$route.query.iss_id){
+        this.getIssueDetail()
+    }
   },
   mounted(){
     let this_ = this;
@@ -1103,6 +1189,10 @@ export default {
         .svg-icon{
             margin-right: 12px;
         }
+        &.not-allow{
+            color: #5E89EF;
+            cursor: not-allowed;
+        }
     }
     .btn-right{
         .svg-icon{

+ 1 - 1
src/views/bookShelf/components/NormalModel.vue

@@ -1,7 +1,7 @@
 <!--  -->
 <template>
   <div class="NNPE-ArticleView" v-if="articleInfo">
-    <template v-if="resArr[0]&&resArr[0].wordsList[0].pno===0">
+    <template v-if="resArr[0]&&resArr[0].wordsList[0]&&resArr[0].wordsList[0].hasOwnProperty('pno')&&resArr[0].wordsList[0].pno===0">
         <h2 @click="
                 handleChangeTime(
                     resArr[0].timeList &&

+ 2 - 1
src/views/bookShelf/components/TreeList.vue

@@ -44,7 +44,8 @@ export default {
                 path: "/articleDetail",
                 query: {
                     headerConfig: encodeURIComponent(url),
-                    id: item.id
+                    id: item.id,
+                    iss_id: this.$route.query.id
                 },
                 
             });