XiaBx 3 years ago
parent
commit
b83a14d31e
10 changed files with 113 additions and 66 deletions
  1. 1 1
      build/webpack.base.conf.js
  2. 1 0
      package.json
  3. 21 3
      src/App.vue
  4. 3 2
      src/api/index.js
  5. 5 1
      src/router/index.js
  6. 6 1
      src/view/Login.vue
  7. 3 1
      src/view/book-city.vue
  8. 24 9
      src/view/pay.vue
  9. 4 2
      src/view/person.vue
  10. 45 46
      src/view/reader.vue

+ 1 - 1
build/webpack.base.conf.js

@@ -13,7 +13,7 @@ function resolve (dir) {
 module.exports = {
 module.exports = {
   context: path.resolve(__dirname, '../'),
   context: path.resolve(__dirname, '../'),
   entry: {
   entry: {
-    app: './src/main.js'
+    app: "./src/main.js"
   },
   },
   output: {
   output: {
     path: config.build.assetsRoot,
     path: config.build.assetsRoot,

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
   },
   },
   "dependencies": {
   "dependencies": {
     "axios": "^0.17.1",
     "axios": "^0.17.1",
+    "babel-polyfill": "^6.26.0",
     "clipboard": "^2.0.4",
     "clipboard": "^2.0.4",
     "fundebug-javascript": "^1.2.3",
     "fundebug-javascript": "^1.2.3",
     "html2canvas": "^1.0.0-rc.4",
     "html2canvas": "^1.0.0-rc.4",

+ 21 - 3
src/App.vue

@@ -31,7 +31,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import goLogin from "../src/components/gologin";
+
 export default {
 export default {
   name: "app",
   name: "app",
   data() {
   data() {
@@ -55,22 +55,40 @@ export default {
     }
     }
   },
   },
   created() {
   created() {
+    console.log(window.prevPage, window.nextPage);
     let { site_gender } = window.options;
     let { site_gender } = window.options;
     if (site_gender) {
     if (site_gender) {
       // 关注用户 根据用户性别 首页展示不同的频道
       // 关注用户 根据用户性别 首页展示不同的频道
       this.theme = site_gender === "male" ? "boy" : "girl";
       this.theme = site_gender === "male" ? "boy" : "girl";
     } else this.theme = "girl";
     } else this.theme = "girl";
     this.initWrap();
     this.initWrap();
-
     //sessionSotrage判断展示加桌提醒图
     //sessionSotrage判断展示加桌提醒图
     const showBanner = sessionStorage.getItem("showBanner");
     const showBanner = sessionStorage.getItem("showBanner");
+    const showList = [
+      "Reader",
+      "BookCatalog",
+      "BookCity",
+      "BookDetail",
+      "BookRecent",
+      "BookShelf",
+      "Rank",
+      "BookLimitFree",
+      "Yun"
+    ];
+
     //获取是否加桌过
     //获取是否加桌过
     const { is_add_desk } = window.options;
     const { is_add_desk } = window.options;
-    if (!showBanner && !is_add_desk && !window.navigator.standalone) {
+    if (
+      !showBanner &&
+      !is_add_desk &&
+      !window.navigator.standalone &&
+      showList.includes(window.nextName)
+    ) {
       this.showAd = true;
       this.showAd = true;
       sessionStorage.setItem("showBanner", true);
       sessionStorage.setItem("showBanner", true);
     }
     }
   },
   },
+
   methods: {
   methods: {
     closeWrap() {
     closeWrap() {
       if (window.options.fission) {
       if (window.options.fission) {

+ 3 - 2
src/api/index.js

@@ -377,8 +377,9 @@ export function recharge({ product_id, bid, cid, use_coupon }) {
       pay_redirect_url: encodeURIComponent(urlFormat(redirect))
       pay_redirect_url: encodeURIComponent(urlFormat(redirect))
     }
     }
   };
   };
-  a.href = urlFormat(href);
-  a.click();
+  window.open(urlFormat(href),'微信支付',true)
+  //a.href = urlFormat(href);
+  //a.click();
 }
 }
 
 
 //单本消费记录
 //单本消费记录

+ 5 - 1
src/router/index.js

@@ -135,11 +135,15 @@ const router = new Router({
 
 
 router.beforeEach((to, from, next) => {
 router.beforeEach((to, from, next) => {
   window.prevPage = from.fullPath;
   window.prevPage = from.fullPath;
+  //alert('即将前往'+document.domain+to.fullPath);
+
   window.nextPage = to.fullPath;
   window.nextPage = to.fullPath;
+  window.nextName = to.name;
+  if(!window.firstName ) window.firstName = to.name;
   to.meta ? (to.meta.behavior = behavior) : (to.meta = { behavior });
   to.meta ? (to.meta.behavior = behavior) : (to.meta = { behavior });
   behavior = "user";
   behavior = "user";
   next();
   next();
-});
+}); 
 
 
 router.afterEach(function(router, from) {
 router.afterEach(function(router, from) {
   if (process.env.NODE_ENV !== "development") {
   if (process.env.NODE_ENV !== "development") {

+ 6 - 1
src/view/Login.vue

@@ -82,7 +82,8 @@ export default {
       isPhoneCurrect: 0,
       isPhoneCurrect: 0,
       countTime: "",
       countTime: "",
       isGoToLogin: false,
       isGoToLogin: false,
-      timer: null
+      timer: null,
+      send:false
     };
     };
   },
   },
   mounted() {
   mounted() {
@@ -97,6 +98,7 @@ export default {
     },
     },
     //点击获取二维码
     //点击获取二维码
     async getCode() {
     async getCode() {
+      if(this.send) return false;
       const signData = {
       const signData = {
         phone: this.phone,
         phone: this.phone,
         timestamp: parseInt(new Date().valueOf() / 1000),
         timestamp: parseInt(new Date().valueOf() / 1000),
@@ -109,7 +111,9 @@ export default {
         sign: md5(qs.stringify(signData, { encode: false }))
         sign: md5(qs.stringify(signData, { encode: false }))
       };
       };
       try {
       try {
+        this.send = true;
         const res = await getCode(data);
         const res = await getCode(data);
+        this.send = false;
         this.isPhoneCurrect = 3;
         this.isPhoneCurrect = 3;
         this.countTime = 60;
         this.countTime = 60;
         //验证码倒计时
         //验证码倒计时
@@ -123,6 +127,7 @@ export default {
         }, 1000);
         }, 1000);
       } catch (e) {
       } catch (e) {
         this.$Toast(e.data.msg);
         this.$Toast(e.data.msg);
+        this.send = false;
       }
       }
     },
     },
     isAgreeChange() {
     isAgreeChange() {

+ 3 - 1
src/view/book-city.vue

@@ -40,7 +40,7 @@
         <dd class="book-city-nav__text">限免专区</dd>
         <dd class="book-city-nav__text">限免专区</dd>
       </router-link>
       </router-link>
       <router-link tag="dl"
       <router-link tag="dl"
-                   :to="BookShelf"
+                   :to="BookRecent"
                    class="book-city-nav__item">
                    class="book-city-nav__item">
         <dt><img class="book-city-nav__icon"
         <dt><img class="book-city-nav__icon"
                src="https://cdn-novel.iycdm.com/static/img/bookshelf-2.png"></dt>
                src="https://cdn-novel.iycdm.com/static/img/bookshelf-2.png"></dt>
@@ -192,6 +192,7 @@ import {
   BookStock,
   BookStock,
   Rank,
   Rank,
   BookShelf,
   BookShelf,
+  BookRecent,
   BookDetail,
   BookDetail,
   Person,
   Person,
   BookLimitFree,
   BookLimitFree,
@@ -207,6 +208,7 @@ export default {
       Rank: Rank.route,
       Rank: Rank.route,
       BookShelf: BookShelf.route,
       BookShelf: BookShelf.route,
       Person: Person.route,
       Person: Person.route,
+      BookRecent:BookRecent.route,
       BookDetail: BookDetail.route,
       BookDetail: BookDetail.route,
       BookLimitFree: BookLimitFree.route,
       BookLimitFree: BookLimitFree.route,
       is_click: true,
       is_click: true,

+ 24 - 9
src/view/pay.vue

@@ -412,6 +412,7 @@
 <script>
 <script>
 import { Pay, HelpPayQrcode } from "./namespace.js";
 import { Pay, HelpPayQrcode } from "./namespace.js";
 // import product from "../mock/pay.js";
 // import product from "../mock/pay.js";
+import { MessageBox } from "mint-ui";
 import {
 import {
   getProductList,
   getProductList,
   subscribeByRMB,
   subscribeByRMB,
@@ -513,13 +514,23 @@ export default {
       );
       );
     },
     },
     pay() {
     pay() {
-        recharge({
-          product_id: this.product[this.selectedProduct].product_id,
-          bid: this.$route.query.book_id,
-          cid: this.$route.query.chapter_id,
-          use_coupon: this.currentCoupon.id
-        });
-     
+      recharge({
+        product_id: this.product[this.selectedProduct].product_id,
+        bid: this.$route.query.book_id,
+        cid: this.$route.query.chapter_id,
+        use_coupon: this.currentCoupon.id
+      });
+      const msg = "";
+      MessageBox({
+        title: "支付确认",
+        message:
+          '1.请在微信内完成支付,如果您已经支付成功,请点击"已完成支付"按钮</br>2.请确保微信版本高于6.0.2',
+        confirmButtonText: "已完成支付",
+        confirmButtonHighlight: true,
+        showCancelButton: true
+      }).then(action => {
+        if(action==="confirm") this.$router.back();
+      });
     },
     },
     payForYear() {
     payForYear() {
       let product_id = this.product[this.product.length - 1].product_id;
       let product_id = this.product[this.product.length - 1].product_id;
@@ -600,15 +611,19 @@ export default {
       this.balance = r.balance;
       this.balance = r.balance;
     });
     });
     //用户优惠券
     //用户优惠券
-
   }
   }
 };
 };
 </script>
 </script>
 
 
-<style lang="scss">
+<style lang="scss" scoped>
 .pay-product {
 .pay-product {
   // margin-bottom: 2.3rem;
   // margin-bottom: 2.3rem;
 }
 }
+.mint-msgbox-content {
+  .mint-msgbox-message {
+    text-align: left;
+  }
+}
 
 
 .pay-box__fixed {
 .pay-box__fixed {
   position: fixed;
   position: fixed;

+ 4 - 2
src/view/person.vue

@@ -49,7 +49,7 @@
       </router-link>
       </router-link>
 
 
       <hr />
       <hr />
-      <router-link class="person-entry__shelf" :to="BookShelf" tag="div">
+      <router-link class="person-entry__shelf" :to="BookRecent" tag="div">
         <img class="person-entry__icon" src="../assets/个人中心-书架.png" />
         <img class="person-entry__icon" src="../assets/个人中心-书架.png" />
         <span class="person-entry__text">我的书架</span>
         <span class="person-entry__text">我的书架</span>
         <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
         <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
@@ -99,7 +99,8 @@ import {
   RecordSend,
   RecordSend,
   RecordSign,
   RecordSign,
   Coupon,
   Coupon,
-  Login
+  Login,
+  BookRecent
 } from "./namespace.js";
 } from "./namespace.js";
 import { getUserInfo } from "../api";
 import { getUserInfo } from "../api";
 import { Server } from "../components/prompt";
 import { Server } from "../components/prompt";
@@ -110,6 +111,7 @@ export default {
     return {
     return {
       BookShelf: BookShelf.route,
       BookShelf: BookShelf.route,
       Pay: Pay.route,
       Pay: Pay.route,
+      BookRecent:BookRecent.route,
       RecordOrder: RecordOrder.route,
       RecordOrder: RecordOrder.route,
       RecordRecharge: RecordRecharge.route,
       RecordRecharge: RecordRecharge.route,
       RecordSend: RecordSend.route,
       RecordSend: RecordSend.route,

+ 45 - 46
src/view/reader.vue

@@ -178,7 +178,8 @@ import {
   getWechatJsConfig,
   getWechatJsConfig,
   recordAdClickStatus,
   recordAdClickStatus,
   getReaderAdBanner,
   getReaderAdBanner,
-  getRecentReader
+  getRecentReader,
+  getUserInfo
 } from "../api";
 } from "../api";
 import {
 import {
   clearStorageChapter,
   clearStorageChapter,
@@ -192,7 +193,7 @@ import {
 } from "../util";
 } from "../util";
 import XReader from "../components/reader";
 import XReader from "../components/reader";
 import bus from "../components/reader/bus.js";
 import bus from "../components/reader/bus.js";
-
+import goLogin from "../../src/components/gologin";
 export default {
 export default {
   name: Reader.name,
   name: Reader.name,
   components: {
   components: {
@@ -671,56 +672,54 @@ export default {
       window.history.replaceState({}, "", url);
       window.history.replaceState({}, "", url);
     }
     }
   },
   },
-  created() {
-    this.$nextTick(async () => {
-      const { yun } = this.$route.query;
-      if (yun == "1" && this.firstReader && window.navigator.standalone) {
-        let data = await getRecentReader();
-        if (data.bid) {
-          this.$router.replace(
-            `/reader?bid=${data.bid}&cid=${data.cid}&yun=&{yun}`
-          );
-          return;
-        }
+  async created() {
+    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 ) {
+        this.$router.replace(
+          `/reader?bid=${sare.bid}&cid=${sare.cid}&yun=${yun}`
+        );
+        return;
       }
       }
-      if (!this.justifyRouter(this.$route)) return;
-      this.href = window.location.href;
-      // 获取书籍详情
-      await getDetail(this.$route.query.bid).then(m => {
-        this.bookdetail = m;
-        this.is_on = !!m.is_on_user_shelf;
-      });
+    }
+    if (!this.justifyRouter(this.$route)) return;
+    this.href = window.location.href;
+    // 获取书籍详情
+    await getDetail(this.$route.query.bid).then(m => {
+      this.bookdetail = m;
+      this.is_on = !!m.is_on_user_shelf;
+    });
 
 
-      // 获取章节内容
-      let isFromCatalog = !!~window.prevPage.indexOf("/catalog");
-      let page_from = isFromCatalog ? "chapter_dir" : "";
+    // 获取章节内容
+    let isFromCatalog = !!~window.prevPage.indexOf("/catalog");
+    let page_from = isFromCatalog ? "chapter_dir" : "";
 
 
-      this.getContent(
-        this.$route.query.bid,
-        this.$route.query.cid,
-        "",
-        page_from
-      )
-        .then(r => {
-          this.text = r;
-          this.isFromSubscribe = false;
+    this.getContent(this.$route.query.bid, this.$route.query.cid, "", page_from)
+      .then(r => {
+        this.text = r;
+        this.isFromSubscribe = false;
 
 
-          if (r.sign_status) {
-            this.showSignNoticeWrap = true;
-          }
-        })
-        .catch(r => {
-          console.log("get content err", r);
-          this.text = {
-            content: r.msg
-          };
-        });
-    });
+        if (r.sign_status) {
+          this.showSignNoticeWrap = true;
+        }
+      })
+      .catch(r => {
+        console.log("get content err", r);
+        this.text = {
+          content: r.msg
+        };
+      });
   },
   },
   async beforeRouteEnter(to, from, next) {
   async beforeRouteEnter(to, from, next) {
-    // * 初次进入加载iframe
-    let detail = null;
-    let u = navigator.userAgent;
     if (from.name !== BookCatalog.name && from.name !== Subscribe.name) {
     if (from.name !== BookCatalog.name && from.name !== Subscribe.name) {
       // 清除所有和章节相关的缓存
       // 清除所有和章节相关的缓存
       clearStorageChapter();
       clearStorageChapter();