Bläddra i källkod

文章已读规则调整

natasha 1 månad sedan
förälder
incheckning
6e22e72038
2 ändrade filer med 27 tillägg och 8 borttagningar
  1. 18 4
      src/views/bookShelf/articleDetail.vue
  2. 9 4
      src/views/bookShelf/articlePeruseDetail.vue

+ 18 - 4
src/views/bookShelf/articleDetail.vue

@@ -1223,6 +1223,9 @@ export default {
             this.$message.error("您没有阅读其他文章的相关权益");
             return;
           }
+          if (this.support) {
+            this.handleReadArticle();
+          }
           this.activeArticleIndex--;
           let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
           let data = {
@@ -1249,6 +1252,9 @@ export default {
             this.$message.error("您没有阅读其他文章的相关权益");
             return;
           }
+          if (this.support) {
+            this.handleReadArticle();
+          }
           this.activeArticleIndex++;
           let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
           let data = {
@@ -1277,6 +1283,9 @@ export default {
       if (!flag) {
         return;
       }
+      if (this.support) {
+        this.handleReadArticle();
+      }
       let MethodName = "/PaperServer/Client/Issue/SaveLastReadArtInIss";
       let data = {
         iss_id: this.$route.query.iss_id,
@@ -1468,10 +1477,10 @@ export default {
         .then((res) => {
           if (res.status === 1) {
             this.support = res.reading_info.is_reading === "false";
-            if (!this.support) {
-              clearInterval(this_.timer);
-              this_.timer = null;
-            }
+            // if (!this.support) {
+            //   clearInterval(this_.timer);
+            //   this_.timer = null;
+            // }
           }
         })
         .catch(() => {
@@ -1801,6 +1810,11 @@ export default {
       this_.readLength++;
     }, 1000);
   },
+  beforeDestroy() {
+    if (this.support) {
+      this.handleReadArticle();
+    }
+  },
 };
 </script>
 

+ 9 - 4
src/views/bookShelf/articlePeruseDetail.vue

@@ -564,10 +564,10 @@ export default {
         .then((res) => {
           if (res.status === 1) {
             this.noRead = res.reading_info.is_reading === "false";
-            if (!this.noRead) {
-              clearInterval(this_.timer);
-              this_.timer = null;
-            }
+            // if (!this.noRead) {
+            //   clearInterval(this_.timer);
+            //   this_.timer = null;
+            // }
           }
         })
         .catch(() => {
@@ -739,6 +739,11 @@ export default {
       _this.readLength++;
     }, 1000);
   },
+  beforeDestroy() {
+    if (this.noRead) {
+      this.handleReadArticle();
+    }
+  },
 };
 </script>