Sfoglia il codice sorgente

记录文章阅读哪一篇

natasha 1 anno fa
parent
commit
df0fbe0ab9

+ 26 - 2
src/views/bookShelf/articleDetail.vue

@@ -730,7 +730,7 @@ export default {
         this.activeIndex = index
         this.inityuan()
     },
-    handlePage(type){
+    async handlePage(type){
         if(type==='-'){
             if(this.activeArticleIndex!==0){
                 if(!this.issueChnTanList[this.activeArticleIndex-1].canRead){
@@ -738,6 +738,14 @@ export default {
                     return
                 }
                 this.activeArticleIndex --
+                let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
+                let data = {
+                    iss_id: this.$route.query.iss_id,
+                    art_id: this.issueChnTanList[this.activeArticleIndex].id
+                }
+                await getLogin(MethodName, data)
+                .then((res) => {
+                })
                 this.$router.replace({
                     path: "/articleDetail",
                     query: {
@@ -756,6 +764,14 @@ export default {
                     return
                 }
                 this.activeArticleIndex ++
+                let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
+                let data = {
+                    iss_id: this.$route.query.iss_id,
+                    art_id: this.issueChnTanList[this.activeArticleIndex].id
+                }
+                await getLogin(MethodName, data)
+                .then((res) => {
+                })
                 this.$router.replace({
                     path: "/articleDetail",
                     query: {
@@ -771,10 +787,18 @@ export default {
         location.reload()
     },
     // 跳转
-    handleLink(item,flag){
+    async handleLink(item,flag){
         if(!flag){
             return
         }
+        let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
+        let data = {
+            iss_id: this.$route.query.iss_id,
+            art_id: item.id
+        }
+        await getLogin(MethodName, data)
+        .then((res) => {
+        })
         this.$router.replace({
             path: "/articleDetail",
             query: {

+ 48 - 9
src/views/bookShelf/bookItem.vue

@@ -605,16 +605,55 @@ export default {
         // this.paymentShow = true;
     },
     // 跳转
-    handleLink(){
+    async handleLink(){
         let url  = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg
-        this.$router.push({
-            path: this.info.type===1?"/courseDetail":"/videoDetail",
-            query: {
-                headerConfig: encodeURIComponent(url),
-                index: this.pre_play_index,
-                id: this.id
-            },
-        });
+        if(this.bookType==='baozhi'){
+            let articleId = ''
+            if(this.info.last_read_art_id){
+                articleId = this.info.last_read_art_id
+            }else{
+                for(let i = 0; i<this.issueChnList.length; i++){
+                    if(articleId){
+                        break
+                    }
+                    if(this.issueChnList[i].arts&&this.issueChnList[i].arts.length>0){
+                        for(let j=0; j<this.issueChnList[i].arts.length;j++){
+                            if(this.issueChnList[i].arts[j].id){
+                                articleId = this.issueChnList[i].arts[j].id
+                                break
+                            }
+                        }
+                    }
+                    
+                }
+            }
+            let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
+            let data = {
+                iss_id: this.$route.query.id,
+                art_id: articleId
+            }
+            await getLogin(MethodName, data)
+            .then((res) => {
+            })
+            this.$router.push({
+                path: "/articleDetail",
+                query: {
+                    headerConfig: encodeURIComponent(url),
+                    id: articleId,
+                    iss_id: this.$route.query.id
+                },
+                
+            });
+        }else{
+            this.$router.push({
+                path: this.info.type===1?"/courseDetail":"/videoDetail",
+                query: {
+                    headerConfig: encodeURIComponent(url),
+                    index: this.pre_play_index,
+                    id: this.id
+                },
+            });
+        }
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)

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

@@ -14,7 +14,7 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
-
+import { getLogin } from "@/api/ajax";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: { },
@@ -34,12 +34,20 @@ export default {
   //方法集合
   methods: {
     // 跳转
-    handleLink(item,flag,index){
+    async handleLink(item,flag,index){
         if(!flag){
             return
         }
         let url  = this.LoginNavIndex +'&&&'+ this.userBg +'&&&'+ this.headerBorder +'&&&'+ this.headerBg
         if(this.cardType==='baozhi'){
+            let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
+            let data = {
+                iss_id: this.$route.query.id,
+                art_id: item.id
+            }
+            await getLogin(MethodName, data)
+            .then((res) => {
+            })
             this.$router.push({
                 path: "/articleDetail",
                 query: {