XiaBx hace 3 años
padre
commit
3f060976d8

+ 17 - 18
src/App.vue

@@ -12,26 +12,19 @@
     <div class="package-wrap" @touchmove.prevent v-if="showWrap">
       <img @click.stop="closeWrap" :src="imgs" alt="" />
     </div>
-    <div class="package-wrap" @touchmove.prevent v-if="showAd">
-      <!-- <div class="close-btn" @click="showAd = false">关闭</div> -->
+    <!--  <div class="package-wrap" @touchmove.prevent v-if="showAd">
+      
       <img
         src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/zsy_ios_app/user_privacy/20220221155858.png"
         width="100%"
         class="mask-img"
       />
-    </div>
-
-    <!-- <template v-if="isTargetChannel&&showIframe">
-      <iframe src='//wap.apyingcaisw.com/xingzuo'
-              width='1px'
-              height='1px'
-              style="visibility:hidden"></iframe>
-    </template> -->
+    </div> -->
   </div>
 </template>
 
 <script>
-import {uuidsGetTokens} from "./api";
+import { setUserMode } from "./api";
 export default {
   name: "app",
   data() {
@@ -55,15 +48,15 @@ export default {
     }
   },
   async created() {
-    
     let { site_gender } = window.options;
     if (site_gender) {
       // 关注用户 根据用户性别 首页展示不同的频道
       this.theme = site_gender === "male" ? "boy" : "girl";
     } else this.theme = "girl";
     this.initWrap();
+
     //sessionSotrage判断展示加桌提醒图
-    const showBanner = sessionStorage.getItem("showBanner");
+    /* const showBanner = sessionStorage.getItem("showBanner");
     const showList = [
       "Reader",
       "BookCatalog",
@@ -74,19 +67,25 @@ export default {
       "Rank",
       "BookLimitFree",
       "Yun"
-    ];
+    ]; */
 
     //获取是否加桌过
-    const { is_add_desk } = window.options;
-    if (
+    //const { is_add_desk } = window.options;
+    const token = localStorage.getItem("token");
+    if (token) {
+      setUserMode(Number(window.navigator.standalone) || 0).then(res => {});
+    }
+
+   
+    /*  if (
       !showBanner &&
       !is_add_desk &&
-      !window.navigator.standalone &&
+      ! &&
       showList.includes(window.nextName)
     ) {
       this.showAd = true;
       sessionStorage.setItem("showBanner", true);
-    }
+    } */
   },
 
   methods: {

+ 10 - 5
src/api/axios.js

@@ -10,7 +10,7 @@ import { Toast } from "mint-ui";
 //     ? {
 //         baseURL: "http://site1.aizhuishu.com/api",
 //         withCredentials: true
-//       }
+//       }  
 //     : {
 //         baseURL: "/api"
 //       }
@@ -23,8 +23,8 @@ var instance = axios.create({
 
 instance.interceptors.response.use(
   async res => {
-    if (res.data.code === 0) {
-      //removePendingRequest(res);
+    if (res.data.code === 0) { 
+      removePendingRequest(res);
       return res.data.data;
     }
     if (
@@ -43,7 +43,7 @@ instance.interceptors.response.use(
     }
   },
   error => {
-    //removePendingRequest(error.config || {});
+    removePendingRequest(error.config || {});
     return Promise.reject(error);
   }
 );
@@ -53,7 +53,12 @@ instance.interceptors.request.use(async function(config) {
   if (!whiteList.includes(config.url) && !token) {
     console.log(config.url);
     token = await getToken(config);
+  }else{
+    config.cancelRequest = true;
+    addPendingRequest(config);
+
   }
+
   if (token) {
     config.headers.Authorization = `bearer ${token}`;
   }
@@ -74,7 +79,7 @@ instance.interceptors.request.use(async function(config) {
       })
     });
   }
-  //addPendingRequest(config);
+  
   return config;
 });
 

+ 1 - 0
src/api/cancelRepeatRquest.js

@@ -8,6 +8,7 @@ import { generateReqKey } from "./config";
 // addPendingRequest :用于把当前请求信息添加到pendingRequest对象 中;
 const pendingRequest = new Map(); // Map对象保存键值对。任何值(对象或者原始值) 都可以作为一个键或一个值。
 export function addPendingRequest(config) {
+  console.log(config.cancelRequest)
   if (config.cancelRequest) {
     const requestKey = generateReqKey(config);
     if (pendingRequest.has(requestKey)) {

+ 2 - 1
src/api/config.js

@@ -9,7 +9,8 @@ export async function login() {
   console.log("我还在登录中");
   const timestamp = parseInt(new Date().valueOf() / 1000);
   let data = {
-    timestamp
+    timestamp,
+    send_order_id:localStorage.getItem('send_order_id') || ''
   };
   let ret = await userLogin(data);
   if (ret) {

+ 13 - 10
src/api/index.js

@@ -367,7 +367,7 @@ export function recharge({ product_id, bid, cid, use_coupon }) {
     host: window.options.pay_url,
     query: {
       product_id: product_id,
-      token: token ? `${token}` : '',
+      token: token ? `${token}` : "",
       use_coupon,
       distribution_channel_id: window.options.distribution_channel_id,
       send_order_id: window.options.send_order_id,
@@ -578,8 +578,6 @@ export function getWxConfig(url) {
   return axios.post("/weixin/jsSdkConfig", { url });
 }
 
-
-
 // 个人中心客服
 export function getCustomQRCode(distribution_channel_id, openid) {
   return axios("/custom_qrcode", {
@@ -617,16 +615,21 @@ export function bindUserPhone(data) {
 }
 
 //获取中间页数据
-export function getYun(id){
-  return axios(`/yun/${id}`,);
+export function getYun(id) {
+  return axios(`/yun/${id}`);
 }
 
 //获取最近阅读记录
-export function getRecentReader(){
-  return axios(`/readrecord/getLastRead`,);
+export function getRecentReader() {
+  return axios(`/readrecord/getLastRead`);
 }
 
 //换取userId
-export function uuidsGetTokens(uuid){
-  return axios(`/hashuserToToken`,{params:{hashuser:uuid}})
-}
+export function uuidsGetTokens(uuid) {
+  return axios(`/hashuserToToken`, { params: { hashuser: uuid } });
+}
+
+//记录用户加桌状态
+export function setUserMode(status) {
+  return axios.post(`/setAddDeskStatus`, {  add_desk_status: status  });
+}

BIN
src/assets/adddeskot.gif


BIN
src/assets/close_pop.png


+ 88 - 8
src/view/reader.vue

@@ -92,7 +92,9 @@
           <div class="reader-guide-1-2"></div>
           <div class="reader-guide-1-3"></div>
           <div class="reader-guide-1-4">
-            <img src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/uppage.png" />
+            <img
+              src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/uppage.png"
+            />
           </div>
           <div class="reader-guide-1-5">
             <img
@@ -100,7 +102,9 @@
             />
           </div>
           <div class="reader-guide-1-6">
-            <img src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/downpage.png" />
+            <img
+              src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/downpage.png"
+            />
           </div>
           <div class="reader-guide-1-7"></div>
           <div class="reader-guide-1-8"></div>
@@ -113,10 +117,24 @@
           @click="new_reader_guide2 = false"
           class="reader-guide-2"
         >
-          <img src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/readremind.png" />
+          <img
+            src="https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/static/img/readremind.png"
+          />
         </div>
       </transition>
     </div>
+
+    <div class="add_desk" v-if="addDesktop">
+      <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>
+      </div>
+    </div>
     <div
       class="share"
       @touchmove.prevent
@@ -243,13 +261,16 @@ export default {
       guidepersonalaccount: window.options.guidepersonalaccount,
       banners: window.options.banners,
       showSignNoticeWrap: false,
-      collectAndroidBg: "//zhuishuyun.oss-cn-hangzhou.aliyuncs.com/h5/android_collect.png",
-      collectIOSBg: "//zhuishuyun.oss-cn-hangzhou.aliyuncs.com/h5/iphone_collect.png",
+      collectAndroidBg:
+        "//zhuishuyun.oss-cn-hangzhou.aliyuncs.com/h5/android_collect.png",
+      collectIOSBg:
+        "//zhuishuyun.oss-cn-hangzhou.aliyuncs.com/h5/iphone_collect.png",
       bannerSubText: {},
       five_template: "",
       five_template_clicked: true,
       copyVal: "",
-      uuids: ""
+      uuids: "",
+      addDesktop: false
     };
   },
   computed: {
@@ -353,7 +374,7 @@ export default {
     },
     next() {
       // 静默复制
-
+      
       if (this.text.next_jump) {
         location.href = this.text.next_jump_url;
       } else {
@@ -409,6 +430,9 @@ export default {
         this.getContent(this.$route.query.bid, this.$route.query.cid)
           .then(r => {
             this.text = r;
+            if (this.text.force_add_desk_type) {
+              if (!this.addDesktop) this.addDesktop = true;
+            }
           })
           .catch(r => {
             this.text = {};
@@ -733,7 +757,9 @@ export default {
       .then(r => {
         this.text = r;
         this.isFromSubscribe = false;
-
+        if (this.text.force_add_desk_type) {
+          if (!this.addDesktop) this.addDesktop = true;
+        }
         if (r.sign_status) {
           this.showSignNoticeWrap = true;
         }
@@ -776,6 +802,9 @@ export default {
         loadIframeAsync();
         r.jump = to.params.jump;
         this.text = r;
+        if (this.text.force_add_desk_type) {
+          if (!this.addDesktop) this.addDesktop = true;
+        }
         this.$nextTick(() => {
           this.$nextTick(() => {
             delete this.text.jump;
@@ -1101,6 +1130,57 @@ export default {
   transition: all 0.3s;
 }
 
+.add_desk {
+  position: fixed;
+  width: 100vw;
+  height: 100vh;
+  background: rgba(0, 0, 0, 0.6);
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  z-index: 1001;
+  .addgif {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    width: 100%;
+    height: 9.8rem;
+    .add-gif {
+      height: 100%;
+      background: #fff;
+      display: flex;
+      justify-content: center;
+      align-items: flex-start;
+      img {
+        width: 100%;
+      }
+    }
+    .add-title {
+      width: 100%;
+      height: 1rem;
+      display: flex;
+      align-items: center;
+      background-color: #ff6920;
+      justify-content: space-between;
+      > p {
+        font-size: 0.4rem;
+        color: #fff;
+        font-weight: bold;
+        text-align: center;
+        flex-grow: 1;
+      }
+      .closed {
+        width: 0.36rem;
+        height: 0.36rem;
+        background: url("../assets/close_pop.png");
+        margin-right: 0.3rem;
+        background-size: cover;
+      }
+    }
+  }
+}
+
 .five_template_entry {
   font-size: 0;
   position: fixed;

+ 1 - 0
src/view/yun.vue

@@ -13,6 +13,7 @@ export default {
   created() {
     if (this.$route.params.id) {
       this.getYun();
+      localStorage.setItem("send_order_id",this.$route.params.id)
     } else {
       this.$router.replace("/");
     }