Explorar o código

阅读器更新

wangzq %!s(int64=2) %!d(string=hai) anos
pai
achega
a32b137fe9
Modificáronse 1 ficheiros con 33 adicións e 5 borrados
  1. 33 5
      src/views/Reader/index.ux

+ 33 - 5
src/views/Reader/index.ux

@@ -75,13 +75,14 @@
 
 </template>
 
+
 <script>
 import prompt from '@system.prompt';
 import router from "@system.router";
 import storage from '@system.storage';
 import pkg from '@system.package'
 import it from "../../helper/interface.js";
-import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders, userAddDsktop } from "../../api";
+import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders, userAddDsktop,noAdvBookInfo, recommendBooks,advReplaceBookInfo} from "../../api";
 import { getAppConfig } from '../../api/utils.js';
 let getConfig;
 export default {
@@ -92,6 +93,7 @@ export default {
   public: {
     bid: '',
     tx_bid:"",
+    ad_bid:"",
     chapter_id: '',
     send_order_id: "",
     push_id: "",
@@ -194,6 +196,21 @@ export default {
     if (this.push_id) {
       await storage.set({ key: "push_id", value: this.push_id });
     }
+    if (this.send_order_id) {
+      this.ad_bid = this.bid;
+      await storage.set({ key: "currue_ad_bid", value: this.bid });
+      await storage.set({ key: "send_order_id", value: this.send_order_id });
+      
+    } else {
+      let send_order_id = (await storage.get({ key: "send_order_id" })).data;
+      if (send_order_id) this.send_order_id = send_order_id;
+      let ad_bid = (await storage.get({ key: "currue_ad_bid" })).data;
+      if(ad_bid){
+        this.ad_bid = ad_bid;
+      }else{
+        this.ad_bid = "";
+      }
+    }
     this.back_name = decodeURI(this.back_name)
     if (this.platform && (this.platform == 'tx_adq' || this.platform == 'tx_adq_new')) {
       if (this.back_url) {
@@ -225,7 +242,18 @@ export default {
         }
       }
 
+    }else{
+      //  如果书籍id为派单书籍id则检测是否需要替换书籍
+      if(this.send_order_id > 0 && this.ad_bid == this.bid){
+        let realBook = await advReplaceBookInfo(this.send_order_id);
+        // let realBook = {};
+        if(realBook && realBook.bid && realBook.bid && realBook.cid){
+          this.bid = realBook.bid;
+          this.chapter_id = realBook.cid;
+        }
+      }
     }
+
     /* let s = (await storage.get({ key: "send_order_id" })).data;
     console.log("save send_order_id in storage");
     console.log("send_order_id", this.send_order_id);
@@ -246,12 +274,12 @@ export default {
     this.reader_banner = reader_banner;
     let { sign_out_reader_show } = await getConfig('add_desk_alert');
     this.back_reader = sign_out_reader_show;
+    this.getRecomList();
     userAddDsktop(this.$app.$def.data.backClickCount).then(res => {
       //TODO 加桌后统计上报
     }).catch(r => {
       //TODO 失败后统计上报
     });
-    this.getRecomList();
   },
   goActivity(item) {
     router.push({
@@ -266,7 +294,6 @@ export default {
     })
   },
   backRouter() {
-    this.back_reader = 1;
     if (this.back_reader == 1) {
       it.backCreateShortCut(res => {
         if (res == 'back') {
@@ -462,7 +489,7 @@ export default {
     }
   },
   goNext() {
-    let self = this;
+    let self =this;
     if (this.bookinfo.next_cid == 0) {
       router.push({
         uri: "/views/Raderover",
@@ -589,8 +616,9 @@ export default {
       }
   }
 }
+
 </script>
 
 <style lang="less">
 @import '../../assets/less/reader.less';
-</style>
+</style>