XiaBx 3 gadi atpakaļ
vecāks
revīzija
0169eaad48
4 mainītis faili ar 54 papildinājumiem un 27 dzēšanām
  1. 1 1
      src/App.vue
  2. 1 0
      src/api/axios.js
  3. 6 7
      src/router/index.js
  4. 46 19
      src/view/reader.vue

+ 1 - 1
src/App.vue

@@ -55,7 +55,7 @@ export default {
     }
   },
   created() {
-    console.log(window.prevPage, window.nextPage);
+    
     let { site_gender } = window.options;
     if (site_gender) {
       // 关注用户 根据用户性别 首页展示不同的频道

+ 1 - 0
src/api/axios.js

@@ -41,6 +41,7 @@ instance.interceptors.response.use(async function(res) {
 });
 instance.interceptors.request.use(async function(config) {
   let token = localStorage.getItem("token");
+  
   if (!whiteList.includes(config.url) && !token) {
     token = await getToken(config);
   }

+ 6 - 7
src/router/index.js

@@ -51,7 +51,7 @@ const BookLimitFree = () => import("../view/book-limit-free.vue");
 const Coupon = () => import("../view/my_coupon.vue");
 const Login = () => import("../view/Login.vue");
 const Useragreement = () => import("../view/Useragreement.vue");
-const Yun = ()=> import('../view/yun.vue')
+const Yun = () => import("../view/yun.vue");
 // import test from '../view/test.vue'
 
 Vue.use(Router);
@@ -110,8 +110,8 @@ const router = new Router({
     [namespace.RecordSend, RecordSend],
     [namespace.Undertheshelf, Undertheshelf],
     [namespace.Sign, Sign],
-    [namespace.Yun,Yun],
-    [namespace.PhoneBind,PhoneBind],
+    [namespace.Yun, Yun],
+    [namespace.PhoneBind, PhoneBind],
     [namespace.Coupon, Coupon],
     [namespace.Login, Login],
     [namespace.Useragreement, Useragreement],
@@ -136,14 +136,13 @@ const router = new Router({
 router.beforeEach((to, from, next) => {
   window.prevPage = from.fullPath;
   //alert('即将前往'+document.domain+to.fullPath);
-
   window.nextPage = to.fullPath;
   window.nextName = to.name;
-  if(!window.firstName ) window.firstName = to.name;
+  if (!window.firstName) window.firstName = to.name;
   to.meta ? (to.meta.behavior = behavior) : (to.meta = { behavior });
   behavior = "user";
-  next();
-}); 
+ next();
+});
 
 router.afterEach(function(router, from) {
   if (process.env.NODE_ENV !== "development") {

+ 46 - 19
src/view/reader.vue

@@ -248,7 +248,8 @@ export default {
       bannerSubText: {},
       five_template: "",
       five_template_clicked: true,
-      copyVal: ""
+      copyVal: "",
+      uuids: ""
     };
   },
   computed: {
@@ -301,18 +302,33 @@ export default {
           history.back(-1);
           break;
         case "home":
-          this.$router.push(BookCity.route);
+          this.$router.push({
+            name: BookCity.route,
+            query: {
+              uuids: this.uuids
+            }
+          });
           break;
         case "category":
-          this.$router.push(BookStock.route);
+          this.$router.push({
+            name: BookStock.route,
+            query: {
+              uuids: this.uuids
+            }
+          });
           break;
         case "rank":
-          this.$router.push(Rank.route);
+          this.$router.push({
+            name: Rank.route,
+            query: {
+              uuids: this.uuids
+            }
+          });
           break;
         case "detail":
           this.$router.push({
             name: BookDetail.name,
-            query: { id: this.text.bid }
+            query: { id: this.text.bid, uuids: this.uuids }
           });
           break;
         case "catalog":
@@ -321,9 +337,10 @@ export default {
             query: this.text.bid
               ? {
                   id: this.text.bid,
-                  sequence: this.text.sequence
+                  sequence: this.text.sequence,
+                  uuids: this.uuids
                 }
-              : { id: this.$route.query.bid }
+              : { id: this.$route.query.bid, uuids: this.uuids }
           });
           break;
       }
@@ -345,13 +362,14 @@ export default {
             path: `/reader/${this.getUuid()}`,
             query: {
               bid: this.text.bid,
-              cid: this.text.next_cid
+              cid: this.text.next_cid,
+              uuids:this.uuids
             }
           });
         } else if (this.text.next_cid === 0) {
           this.$router.push({
             name: BookRecommend.name,
-            query: { bid: this.$route.query.bid }
+            query: { bid: this.$route.query.bid,uuids:this.uuids }
           });
         } else {
           this.$Toast("系统错误");
@@ -364,7 +382,8 @@ export default {
           name: Reader.name,
           query: {
             bid: this.text.bid,
-            cid: this.text.prev_cid
+            cid: this.text.prev_cid,
+            uuids:this.uuids
           },
           params: {
             jump: -1
@@ -399,7 +418,8 @@ export default {
           name: Reader.name,
           query: {
             bid: bid,
-            cid: cid
+            cid: cid,
+            uuids:this.uuids
           }
         });
       }
@@ -625,7 +645,7 @@ export default {
     },
     justifyRouter(router) {
       if (!router.query.bid) {
-        this.$router.replace("/");
+        this.$router.replace({path:'/',query:{uuids:this.uuids}});
         return false;
       }
       if (typeof router.query.bid !== "string") {
@@ -633,7 +653,8 @@ export default {
           name: Reader.name,
           query: {
             bid: router.query.bid[0],
-            cid: router.query.cid
+            cid: router.query.cid,
+            uuids:this.uuids
           }
         });
         return false;
@@ -642,7 +663,8 @@ export default {
           name: Reader.name,
           query: {
             bid: router.query.bid.split(",")[0],
-            cid: router.query.cid
+            cid: router.query.cid,
+            uuids:this.uuids
           }
         });
         return false;
@@ -673,20 +695,25 @@ export default {
     }
   },
   async created() {
-    let data =  await getUserInfo();
-    if(!data.bind_phone){
+    let uuid = localStorage.getItem("uuids");
+    let { yun, bid, cid, uuids } = this.$route.query;
+    this.uuids = uuids || uuid;
+
+    let data = await getUserInfo();
+    if (!data.bind_phone) {
       goLogin();
     }
-    const { yun,bid,cid } = this.$route.query;
+
     if (
       yun == "1" &&
       window.firstName == this.$route.name &&
       window.navigator.standalone
     ) {
       let sare = await getRecentReader();
-      if (sare.bid && sare.bid!= bid && sare.cid !=cid ) {
+      if (sare.bid && sare.bid != bid && sare.cid != cid) {
+
         this.$router.replace(
-          `/reader?bid=${sare.bid}&cid=${sare.cid}&yun=${yun}`
+          `/reader?bid=${sare.bid}&cid=${sare.cid}&yun=${yun}&uuids=${this.uuids}`
         );
         return;
       }