XiaBx 3 vuotta sitten
vanhempi
commit
f7b5db82c9

+ 6 - 3
src/App.vue

@@ -25,6 +25,8 @@
 
 <script>
 import { setUserMode } from "./api";
+import Vue from "vue";
+
 export default {
   name: "app",
   data() {
@@ -72,11 +74,12 @@ export default {
     //获取是否加桌过
     //const { is_add_desk } = window.options;
     const token = localStorage.getItem("token");
-    if (token) {
+    const sendId = Vue.prototype.sendid || localStorage.getItem("sendid") || "";
+    if (token && sendId) {
       setUserMode(Number(window.navigator.standalone) || 0).then(res => {});
     }
-    localStorage.setItem('userMode',Number(window.navigator.standalone))
-   
+    localStorage.setItem("userMode", Number(window.navigator.standalone));
+
     /*  if (
       !showBanner &&
       !is_add_desk &&

+ 2 - 1
src/api/axios.js

@@ -11,7 +11,7 @@ import { Toast } from "mint-ui";
 //     ? {
 //         baseURL: "http://site1.aizhuishu.com/api",
 //         withCredentials: true
-//       }  
+//       }   
 //     : {
 //         baseURL: "/api"
 //       }
@@ -62,6 +62,7 @@ instance.interceptors.request.use(async function(config) {
 
   if (token) {
     config.headers.Authorization = `bearer ${token}`;
+    config.headers.version = 'v1.0.1';
   }
   if (
     config.method === "get" &&

+ 1 - 1
src/api/config.js

@@ -10,7 +10,7 @@ export async function login() {
   const timestamp = parseInt(new Date().valueOf() / 1000);
   let data = {
     timestamp,
-    send_order_id: Vue.prototype.sendid || localStorage.getItem("sendid") || '',
+    send_order_id: Vue.prototype.sendid || localStorage.getItem("sendid") || sessionStorage.getItem('sendid')||'',
     form_url: location.href
   };
   let ret = await userLogin(data);

+ 5 - 0
src/api/index.js

@@ -635,3 +635,8 @@ export function uuidsGetTokens(uuid) {
 export function setUserMode(status,send_order_id) {
   return axios.post(`/setAddDeskStatus`, {  add_desk_status: status,send_order_id  });
 }
+
+//强加桌模型切换
+export function changeAddMode(){
+  return axios('/getAddDeskImage');
+}

BIN
src/assets/adddeskot.gif


BIN
src/assets/addtips.png


BIN
src/assets/popimg.png


+ 7 - 3
src/components/reader/bus.js

@@ -6,10 +6,14 @@ function parseQueryString(url) {
 
 
   var search = url.substring(url.lastIndexOf("?") + 1);
-
-  return qs.s
   if (url.indexOf('reader') === -1) return {};
   if (!search) return {};
+  return qs.parse(search);
+
+
+
+/*  
+  
   return JSON.parse(
     '{"' +
       decodeURIComponent(search)
@@ -17,7 +21,7 @@ function parseQueryString(url) {
         .replace(/&/g, '","')
         .replace(/=/g, '":"') +
       '"}'
-  );
+  ); */
 }
 
 // 如果url携带阅读器配置参数 则使用携带参数

+ 32 - 13
src/view/reader.vue

@@ -123,16 +123,21 @@
         </div>
       </transition>
     </div>
-
-    <div class="add_desk" v-if="addDesktop && !isStandalone" @touchmove.prevent>
+    <div class="add_desk" @touchmove.prevent v-if="addDesktop && !isStandalone">
       <div class="addgif">
-        <div class="add-title">
-          <p>添加至桌面,方便下次继续阅读</p>
-          <!-- <i class="closed" ></i> -->
-        </div>
-        <div class="add-gif">
-          <img src="../../src/assets/adddeskot.gif" />
-        </div>
+        <template v-if="modes == 'B' ">
+          <div class="addpng">
+            <img src="../../src/assets/addtips.png" width="100%" />
+          </div>
+          <div class="add-gif">
+            <img src="../../src/assets/adddeskot.gif" />
+          </div>
+        </template>
+        <template v-else>
+          <div class="popimg">
+            <img src="../assets/popimg.png" width="100%" />
+          </div>
+        </template>
       </div>
     </div>
     <div
@@ -167,7 +172,7 @@ import {
   BookShare,
   BookRecent
 } from "./namespace.js";
-
+import Vue from 'vue';
 import {
   SingActive,
   Book1,
@@ -199,7 +204,8 @@ import {
   getReaderAdBanner,
   getRecentReader,
   getUserInfo,
-  setUserMode
+  setUserMode,
+  changeAddMode
 } from "../api";
 import {
   clearStorageChapter,
@@ -237,6 +243,7 @@ export default {
       weakSubscribeHorizontalNum: 0,
       weakSubscribeStyle: {},
       firstReader: false,
+      modes: "A",
       weakSubscribeText: [
         "【更多精彩内容  请点击阅读】",
         "【点击阅读海量小说】"
@@ -743,7 +750,11 @@ export default {
   async created() {
     let uuid = localStorage.getItem("uuids");
     let { yun, bid, cid, uuids, sendid = 0, isreplace = 0 } = this.$route.query;
-    if (sendid) localStorage.setItem("sendid", this.$route.query.sendid);
+    if (sendid){
+      localStorage.setItem("sendid", this.$route.query.sendid);
+      sessionStorage.setItem("sendid", this.$route.query.sendid);
+       Vue.prototype.sendid = sendid;
+    } 
     this.uuids = uuids || uuid;
     if (yun) this.yun = yun;
 
@@ -778,7 +789,12 @@ export default {
     if (!this.justifyRouter(this.$route)) return;
     this.href = window.location.href;
     // 获取书籍详情
-    await getDetail(this.$route.query.bid).then(m => {
+
+    //获取AB测试
+    let modes = await changeAddMode();
+    this.modes = modes.type;
+
+    getDetail(this.$route.query.bid).then(m => {
       this.bookdetail = m;
       this.is_on = !!m.is_on_user_shelf;
     });
@@ -1183,6 +1199,9 @@ export default {
     width: 80%;
     height: 9.8rem;
     margin: auto;
+    .addpng {
+      margin-bottom: 0.2rem;
+    }
     .add-gif {
       background: #fff;
       display: flex;

+ 2 - 1
src/view/yun.vue

@@ -15,6 +15,7 @@ export default {
     if (this.$route.params.id) {
       Vue.prototype.sendid = this.$route.params.id;
       localStorage.setItem("sendid", this.$route.params.id);
+      sessionStorage.setItem("sendid", this.$route.params.id);
       this.getYun();
       
     } else {
@@ -29,7 +30,7 @@ export default {
           this.$router.replace("/");
         } else {
           this.$router.replace(
-            `/reader?yun=1&bid=${bid}&cid=${cid}&sendid=${this.$route.params.id} || 0`
+            `/reader?yun=1&bid=${bid}&cid=${cid}&sendid=${this.$route.params.id  || 0}`
           );
         }
       });