pansl 2 年之前
父节点
当前提交
ab1fce0c9c
共有 14 个文件被更改,包括 1022 次插入733 次删除
  1. 4 2
      config/index.js
  2. 二进制
      src/api/adtest.png
  3. 57 6
      src/api/index.js
  4. 3 0
      src/components/index.js
  5. 180 0
      src/components/popup_new/popup.vue
  6. 2 0
      src/router/index.js
  7. 362 0
      src/view/ad_pay.vue
  8. 36 76
      src/view/book-city.vue
  9. 32 65
      src/view/book-recent.vue
  10. 8 0
      src/view/namespace.js
  11. 146 201
      src/view/pay.vue
  12. 45 88
      src/view/person.vue
  13. 126 260
      src/view/reader.vue
  14. 21 35
      src/view/sign.vue

+ 4 - 2
config/index.js

@@ -19,12 +19,14 @@ module.exports = {
     proxyTable: {
       "/api": {
         // target: "http://site2.pre.aizhuishu.com/",
-        target: "https://site14.leyuee.com",
+        // target: "https://site14.leyuee.com",
+        target: "https://sitenry50j5o5l3e8k6p.leyuee.com",
         changeOrigin: true
       },
       "/testLogin": {
         // target: "http://site2.pre.aizhuishu.com/",
-        target: "https://site14.leyuee.com",
+        // target: "https://site14.leyuee.com",
+        target: "https://sitenry50j5o5l3e8k6p.leyuee.com",
         changeOrigin: true
       }
     },

二进制
src/api/adtest.png


+ 57 - 6
src/api/index.js

@@ -37,10 +37,10 @@ export function getIndex(type) {
 }
 /**
 获取书库书籍
-关键字 key	String 
-分类id category_id	Number 
-页码 page String	
-完结 status 完结:1 | 连载:0	
+关键字 key	String
+分类id category_id	Number
+页码 page String
+完结 status 完结:1 | 连载:0
  */
 
 export function getBook(params) {
@@ -85,10 +85,10 @@ function detailUpdate(id, status) {
     book.result.data.is_on_user_shelf = status;
   }
 }
-export function getDetail(id, s = "",pos='') {
+export function getDetail(id, s = "", pos = "") {
   return detail
     .getAsync(id, function() {
-      return axios("/book/" + id + "?s=" + s + '&pos=' + pos).then(r => {
+      return axios("/book/" + id + "?s=" + s + "&pos=" + pos).then(r => {
         return {
           id,
           data: r
@@ -381,6 +381,49 @@ export function recharge({ product_id, bid, cid, use_coupon }) {
   a.click();
 }
 
+//广告充值
+export function adRecharge({
+  product_id,
+  from_id,
+  bid = 0,
+  cid = 0,
+  use_coupon
+}) {
+  const a = document.createElement("a");
+  const redirect =
+    bid && cid
+      ? {
+          host: location.origin,
+          pathname: "/reader",
+          query: {
+            bid,
+            cid
+          }
+        }
+      : {
+          host: location.origin,
+          pathname: "/recent"
+        };
+  const href = {
+    host: window.options.pay_url,
+    query: {
+      product_id: product_id,
+      uid: window.options.uid,
+      use_coupon,
+      distribution_channel_id: window.options.distribution_channel_id,
+      send_order_id: 0,
+      from: `popup_adv_${from_id}`,
+      bid,
+      cid,
+      pay_redirect_url: encodeURIComponent(urlFormat(redirect)),
+      crm: ""
+    }
+  };
+  console.log(href);
+  a.href = urlFormat(href);
+  a.click();
+}
+
 //单本消费记录
 export function getRecordOrderByBook(page) {
   return axios("/order/bookOrderList", { params: { page } });
@@ -604,3 +647,11 @@ export function getUserCoupon() {
 export function getOrderCoupon() {
   return axios("/order/effectiveCoupon");
 }
+//弹窗广告信息
+export function advertisementPopupInfo(params) {
+  return axios("/advertisement/popup/info", { params });
+}
+//获取单个充值档位
+export function orderProductInfo(params) {
+  return axios("/order/product/info", { params });
+}

+ 3 - 0
src/components/index.js

@@ -1,5 +1,6 @@
 import Vue from "vue";
 import { BookDetail } from "../view/namespace.js";
+import popup_new from './popup_new/popup.vue'
 
 import vueTouch from "vue-touch";
 import VueClipboard from "vue-clipboard2";
@@ -31,6 +32,8 @@ VueClipboard.config.autoSetContainer = true;
 Vue.use(vueTouch);
 Vue.use(VueClipboard);
 
+Vue.component('ad-popup',popup_new)
+
 Vue.component(Swipe.name, Swipe);
 Vue.component(SwipeItem.name, SwipeItem);
 Vue.component(Spinner.name, Spinner);

+ 180 - 0
src/components/popup_new/popup.vue

@@ -0,0 +1,180 @@
+<template>
+  <transition name='fade'>
+    <!-- 蒙版 -->
+    <div class="mask" v-if="show" @touchmove.prevent>
+      <div class="wrapper">
+        <img :src="info.popup_image_url" class="ad-image" alt="" @click="toAdPay">
+        <!-- <img src="../../api/adtest.png" class="ad-image" alt="" @click="toAdPay"> -->
+        <div class="text-wrapper" @click="toAdPay">
+          <div class="title">充<span>{{ info.product_info.price }}</span>元 <span v-if="isShowGive">,送{{
+            info.product_info.given }}书币</span>
+          </div>
+          <div class="title" v-if="isShowGive">立得<span>{{ standCoin }}</span>书币</div>
+          <div class="title" v-else>得<span>{{ coin }}</span>书币</div>
+          <!-- <div class="sub-title">立省M元</div> -->
+        </div>
+        <div class="close-wrapper">
+          <img @click="close" class="close" src="../../assets/close_icon.png" alt="">
+        </div>
+      </div>
+
+    </div>
+  </transition>
+</template>
+
+<script>
+import { advertisementPopupInfo } from '../../api/index'
+import {
+  adPay,
+} from "../../view/namespace";
+export default {
+  name: 'adPay',
+  props: {
+    popup_position: {
+      type: String,
+      default: 'homePage'
+    },
+    from: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      info: {
+        "popup_image_url": "https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/wap/popup_adv_images/popup3%402x.png",  // 弹窗图片地址
+        "product_id": null, // 充值档位id
+        // 充值档位信息
+        "product_info": {
+          "price": 555, // 充值金额
+          "given": 666, //赠送金币
+        },
+        "id": null, // 弹窗广告id
+      },
+      show: false,
+      title: '',
+      content: '',
+      btnText: '',
+      click: ''
+    }
+  },
+  computed: {
+    isShowGive () {
+      return Number(this.info.product_info.given) > 0
+    },
+    standCoin () {
+      return Number(this.info.product_info.price) * 100 + Number(this.info.product_info.given)
+    },
+    coin () {
+      return Number(this.info.product_info.price) * 100
+    }
+    // show () {
+    //   return Boolean(this.info.id)
+    // }
+  },
+  created () {
+    console.log(adPay);
+    this.init()
+  },
+  methods: {
+    init () {
+      advertisementPopupInfo({ popup_position: this.popup_position })
+        .then(res => {
+          console.log(res);
+          this.info = res
+          if (this.info.id) {
+            this.show = true
+          }
+        }).catch(err => {
+          console.log(err);
+          if (this.popup_position == 'returnNotRecharge') {
+            if (this.from == 'reader') {
+              console.log('readerreaderreader');
+              this.$router.go(-2)
+            } else {
+              console.log('chongzchongzchongzchongz');
+              this.$router.go(-1)
+            }
+          }
+        })
+    },
+    close () {
+      this.show = false
+      this.info.id = null
+    },
+    toAdPay () {
+      this.$router.push({ path: 'ad_pay', query: { product_id: this.info.product_id, id: this.info.id } })
+      this.show = false
+
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+// 渐变过渡
+.fade-enter,
+.fade-leave-active {
+  opacity: 0;
+}
+
+.fade-enter-active,
+.fade-leave-active {
+  transition: opacity 0.35s;
+}
+
+.text-wrapper {
+  width: 70%;
+  position: absolute;
+  top: 48%;
+  left: 50%;
+  transform: translate(-50%, -48%);
+
+  .title {
+    font-size: 0.36rem;
+    font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
+    font-weight: bold;
+    color: #d65142;
+  }
+
+  .sub-title {
+    font-size: 0.45rem;
+    font-family: MicrosoftYaHei;
+    color: #5e5a60;
+    margin-bottom: 0.5rem;
+  }
+}
+
+.mask {
+  width: 100vw;
+  height: 100vh;
+  position: fixed;
+  z-index: 1000;
+  background: rgba(0, 0, 0, 0.65);
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  padding: 75/75rem;
+
+  .wrapper {
+    width: 95%;
+    border-radius: 8px;
+    text-align: center;
+
+    .ad-image {
+      width: 100%;
+      object-fit: contain;
+    }
+
+    .close-wrapper {
+      .close {
+        width: 42px;
+        height: 42px;
+        margin-top: 2em;
+      }
+    }
+  }
+}
+
+@media screen and (max-width: 321px) and (max-width: 375px) {}
+</style>

+ 2 - 0
src/router/index.js

@@ -25,6 +25,7 @@ const BookDetail = () => import("../view/book-detail.vue");
 const BookCatalog = () => import("../view/book-catalog.vue");
 const BookRecommend = () => import("../view/book-recommend.vue");
 const Pay = () => import("../view/pay.vue");
+const adPay = () => import("../view/ad_pay.vue");
 const Help = () => import("../view/help.vue");
 const Rank = () => import("../view/rank.vue");
 const Rank2 = () => import("../view/rank_2.vue");
@@ -86,6 +87,7 @@ const router = new Router({
   mode: "history",
   routes: generateRoute([
     [namespace.Pay, Pay],
+    [namespace.adPay, adPay],
     [namespace.Rank, Rank2],
     // [namespace.Help, Help,
     [namespace.Reader, Reader],

+ 362 - 0
src/view/ad_pay.vue

@@ -0,0 +1,362 @@
+<template>
+  <div class='pay'>
+    <x-header></x-header>
+    <template>
+      <div class="section-edge-all">
+        <template>
+          <div class="pay-account">
+            您的余额:
+            <span class="red">{{ balance }}</span>
+            书币
+            <span class="red" v-if="showTip">(余额不足)</span>
+          </div>
+          <div class="pay-explain">
+            选择充值金额
+            <span class="red">(1元=100书币)</span>
+          </div>
+        </template>
+
+        <div class="pay-coupon">
+          <p class="pay-coupon__img">
+            <img src="../assets/coupon _pay.png" />优惠券
+          </p>
+          <p class="pay-coupon__right" @click="changeCoupon">
+            <span v-if="!isCouponChecked">您有{{ availdCouponList.length }}张优惠券待使用</span><span class="usecoupon" v-else>- &yen;{{ currentCoupon.price }}</span>
+            <img src="../assets/个人中心-进入.png" />
+          </p>
+        </div>
+        <ul class="pay-product">
+          <template v-for="(v, i) in product">
+            <template>
+              <template>
+                <v-touch :class="[
+                    'pay-product__item',
+                    {
+                      'is-active': i === selectedProduct,
+                      'is-recommend': i === defaultProduct,
+                      'is-first': i === cheaperProduct
+                    }
+                  ]" :key="v.product_id" @tap="selectProduct(i)">
+                  <p class="pay-product__name">{{ v.price }}</p>
+                  <p class="pay-product__intro">{{ v.text }}</p>
+                  <p class="pay-product__intro cheaper-box" v-if="v.save_text">
+                    <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                    <span class="text" v-else><i class="is_year"></i></span>
+                    <span>{{ v.save_text }}</span>
+                  </p>
+                  <p class="item-tag" v-if="v.angle_sign_text">
+                    {{ v.angle_sign_text }}
+                  </p>
+                </v-touch>
+              </template>
+            </template>
+          </template>
+          <template v-if="showAd_entry && !is_iPhone">
+            <v-touch class="pay-product__adwrap" v-if="product.length" @tap="toFreeAds()">
+              <img src="../assets/cz.jpg" alt="" />
+            </v-touch>
+          </template>
+        </ul>
+        <template>
+          <div class="pay-box__fixed">
+            <!-- <div v-if="showHelpPay" class="help-pay__btn" @click="toHelpPay">
+              请好友代充
+            </div> -->
+            <div class="pay-btn" @click="pay">
+              立即充值
+            </div>
+          </div>
+        </template>
+        <p class="pay-shubi-tip">书币属于虚拟商品,一经充值不得退还</p>
+        <div class="reader-loading" v-show="loading">
+          <mt-spinner class="reader-loading-icon" type="fading-circle" color="#32a1ff"></mt-spinner>
+        </div>
+      </div>
+    </template>
+    <mt-popup v-model="popupVisible" position="bottom">
+      <div class="pop-coupon" ref="couponList">
+        <div class="coupon-list">
+          <div class="coupon-item" v-for="(coupon,index) in availdCouponList" :key="index">
+            <p class="coupon-item__amount">
+              <span>&yen;</span>{{ coupon.price }}
+            </p>
+            <div class="coupon-item__info">
+              <div class="info-amount">
+                <p class="title">大于{{ coupon.use_condition }}元可用</p>
+                <p class="desc">
+                  {{
+                    coupon.expire_time && coupon.expire_time.slice(0, 16)
+                  }}到期
+                </p>
+              </div>
+              <v-touch class="info-button" @tap="chooseCoupon(coupon)">
+                立即使用
+              </v-touch>
+            </div>
+          </div>
+        </div>
+      </div>
+    </mt-popup>
+  </div>
+</template>
+<script>
+import { adPay, HelpPayQrcode } from "./namespace.js";
+import {
+  getProductList,
+  orderProductInfo,
+  subscribeByRMB,
+  adRecharge,
+  getUserInfo,
+  isMonthOrderSuc,
+  getOrderCoupon
+} from "../api";
+
+import { PayForGift } from "../components/prompt";
+
+export default {
+  name: adPay.name,
+  data () {
+    return {
+      HelpPayQrcode: HelpPayQrcode.name,
+      balance: "...",
+      product: [],
+      selectedProduct: 0,
+      defaultProduct: null,
+      cheaperProduct: null,
+      loading: false,
+      showTip: !!this.$route.query.code,
+      showHelpPay: window.options.showDaiChong,
+      showAd_entry: false,
+      is_iPhone: navigator.userAgent.indexOf("iPhone") !== -1,
+      isCouponChecked: false,
+      couponList: [],
+      availdCouponList: [],
+      popupVisible: false,
+      currentCoupon: {
+        id: "",
+        price: 0
+      }
+    };
+  },
+  computed: {
+  },
+  methods: {
+    changeCoupon () {
+      if (this.availdCouponList.length <= 0) {
+        this.$MessageBox.alert(
+          "当前暂无可用优惠券,请检查充值额度是否满足优惠券使用条件,优惠券是否在有效期",
+          "温馨提示"
+        );
+        return false;
+      } else {
+        this.popupVisible = true;
+        this.$nextTick(() => {
+          if (this.$refs.couponList) {
+            this.$refs.couponList.scrollTop = 0;
+          }
+        });
+      }
+    },
+    //选择优惠券
+    chooseCoupon (coupon) {
+      this.currentCoupon = coupon;
+      this.popupVisible = false;
+      this.isCouponChecked = true;
+    },
+    selectProduct (i) {
+      this.selectedProduct = i;
+      this.getAvaildCoupon(
+        Number(this.product[this.selectedProduct].price.replace("元", ""))
+      );
+    },
+    pay () {
+      console.log(this.product[this.selectedProduct], this.$route.query.book_id, this.$route.query.chapter_id, this.currentCoupon.id);
+      adRecharge({
+        product_id: this.product[this.selectedProduct].product_id,
+        from_id: this.$route.query.id,
+        bid: this.$route.query.book_id,
+        cid: this.$route.query.chapter_id,
+        use_coupon: this.currentCoupon.id
+      });
+    },
+    toHelpPay () {
+      this.$router.push({
+        name: this.HelpPayQrcode,
+        query: { product_id: this.product[this.selectedProduct].product_id }
+      });
+    },
+    toFreeAds () {
+      window.location.href = `${window.location.origin +
+        window.options.appad_url}`;
+    },
+    //获取当前金额的可用优惠券
+    getAvaildCoupon (price) {
+      this.currentCoupon = { id: "", price: 0 };
+      this.isCouponChecked = false;
+      this.availdCouponList = this.couponList.filter(
+        item => item.use_condition < price
+      );
+    },
+    findMonthOrder () {
+      this.$Indicator.open("查询订单中...请稍等");
+      let time = 0;
+      this.timer = setInterval(() => {
+        if (time === 10) {
+          this.$Indicator.close();
+          window.clearInterval(this.timer);
+          this.$Toast("订单可能延迟几分钟,稍后到个人中心查看或联系客服");
+          return;
+        }
+        isMonthOrderSuc()
+          .then(_ => {
+            this.$Indicator.close();
+            window.clearInterval(this.timer);
+            this.$Toast("包月订购成功!");
+          })
+          .catch(e => {
+            time++;
+            console.log(e, "continue");
+          });
+      }, 1000);
+    },
+  },
+  created () {
+    console.log('-------------', this.$route.query);
+    this.loading = true;
+    getOrderCoupon().then(r => {
+      this.couponList = r;
+      orderProductInfo({ id: this.$route.query.product_id }).then(res => {
+        res.price = `${res.price}元`
+        res.product_id = res.id
+        this.product = [res]
+        this.loading = false;
+      })
+    });
+
+    getUserInfo().then(r => {
+      this.balance = r.balance;
+    });
+    // 是否包月回调
+    const { from_wxpay } = this.$route.query;
+    if (from_wxpay) this.findMonthOrder();
+  }
+};
+</script>
+
+<style lang="scss">
+.pay-product {
+  // margin-bottom: 2.3rem;
+}
+
+.pay-box__fixed {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 1.2rem;
+  background: #fff;
+  border-top: 1px solid #f7f7f7;
+  padding: 0 0.24rem;
+  overflow: hidden;
+
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  z-index: 999;
+
+  .help-pay__btn {
+    width: 3.2rem;
+    border-radius: 20px;
+    border-color: #e6e6e6;
+    color: #e6e6e6;
+    height: 0.76rem;
+    line-height: 0.76rem;
+    margin-right: 0.26rem;
+    margin-top: 0;
+    font-size: 0.28rem;
+  }
+
+  .pay-btn {
+    flex: 1;
+    margin: 0;
+    background: #ef5952;
+    border-radius: 20px;
+    border: 1px solid #ef5952;
+    height: 0.76rem;
+    line-height: 0.76rem;
+    font-size: 0.28rem;
+    font-weight: bold;
+    box-shadow: none;
+  }
+}
+
+.gift-fixed__wrap {
+  position: fixed;
+  bottom: 1.2rem;
+  max-height: 1.1rem;
+  left: 0;
+  right: 0;
+  background: #f7f7f7;
+  padding: 0.22rem 0.24rem;
+
+  .gift-title__text {
+    color: #ef5952;
+    font-size: 0.26rem;
+    font-weight: bold;
+
+    &.text-align {
+      text-align: center;
+    }
+  }
+
+  .gift-preview {
+    font-size: 0.24rem;
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    // overflow: auto;
+    // -webkit-overflow-scrolling: touch;
+
+    .title {
+      flex-basis: 2rem;
+      flex-shrink: 0;
+      white-space: nowrap;
+      color: #333;
+    }
+
+    .preview-wrap {
+      flex: 1;
+      display: flex;
+      overflow: auto;
+      -webkit-overflow-scrolling: touch;
+
+      &::-webkit-scrollbar {
+        display: none;
+      }
+    }
+
+    .gift-preview__item {
+      font-size: 0;
+      flex-shrink: 0;
+      white-space: nowrap;
+      display: flex;
+
+      i {
+        font-size: 0.22rem;
+        color: #666;
+        font-style: normal;
+      }
+
+      &:not(:last-child) {
+        margin-right: 0.18rem;
+      }
+    }
+
+    img {
+      width: 0.34rem;
+      height: 0.34rem;
+    }
+  }
+}
+</style>

+ 36 - 76
src/view/book-city.vue

@@ -1,63 +1,41 @@
 <template>
-  <div class="book-city"
-       ref="wrap">
+  <div class="book-city" ref="wrap">
+    <ad-popup popup_position="homePage"></ad-popup>
     <div class="book-city-header">
       <div class="book-city-theme">
-        <v-touch @tap="themeChange('boy')"
-                 :class="[ 'book-city-theme__item', { 'is-active': theme === 'boy' } ]">男生</v-touch>
-        <v-touch @tap="themeChange('girl')"
-                 :class="[ 'book-city-theme__item', { 'is-active': theme === 'girl' } ]">女生</v-touch>
+        <v-touch @tap="themeChange('boy')" :class="[ 'book-city-theme__item', { 'is-active': theme === 'boy' } ]">男生</v-touch>
+        <v-touch @tap="themeChange('girl')" :class="[ 'book-city-theme__item', { 'is-active': theme === 'girl' } ]">女生</v-touch>
       </div>
       <div class="x-input--search">
-        <img class="x-input__icon"
-             src="../assets/搜索.png">
-        <input class="x-input__inner"
-               placeholder="主角/书名"
-               type="text"
-               @focus="$router.push(BookStock)">
+        <img class="x-input__icon" src="../assets/搜索.png">
+        <input class="x-input__inner" placeholder="主角/书名" type="text" @focus="$router.push(BookStock)">
       </div>
     </div>
     <div class="book-city-nav">
-      <router-link tag="dl"
-                   :to="BookStock"
-                   class="book-city-nav__item">
-        <dt><img class="book-city-nav__icon"
-               src="https://cdn-novel.bookkks.com/static/img/library-2.png"></dt>
+      <router-link tag="dl" :to="BookStock" class="book-city-nav__item">
+        <dt><img class="book-city-nav__icon" src="https://cdn-novel.bookkks.com/static/img/library-2.png"></dt>
         <dd class="book-city-nav__text">书库</dd>
       </router-link>
-      <router-link tag="dl"
-                   :to="Rank"
-                   class="book-city-nav__item">
-        <dt><img class="book-city-nav__icon"
-               src="https://cdn-novel.bookkks.com/static/img/rank-2.png"></dt>
+      <router-link tag="dl" :to="Rank" class="book-city-nav__item">
+        <dt><img class="book-city-nav__icon" src="https://cdn-novel.bookkks.com/static/img/rank-2.png"></dt>
         <dd class="book-city-nav__text">排行榜</dd>
       </router-link>
-      <router-link tag="dl"
-                   :to="BookLimitFree"
-                   class="book-city-nav__item">
-        <dt><img class="book-city-nav__icon"
-               src="https://cdn-novel.bookkks.com/static/img/free-2.png"></dt>
+      <router-link tag="dl" :to="BookLimitFree" class="book-city-nav__item">
+        <dt><img class="book-city-nav__icon" src="https://cdn-novel.bookkks.com/static/img/free-2.png"></dt>
         <dd class="book-city-nav__text">限免专区</dd>
       </router-link>
-      <router-link tag="dl"
-                   :to="BookShelf"
-                   class="book-city-nav__item">
-        <dt><img class="book-city-nav__icon"
-               src="https://cdn-novel.bookkks.com/static/img/bookshelf-2.png"></dt>
+      <router-link tag="dl" :to="BookShelf" class="book-city-nav__item">
+        <dt><img class="book-city-nav__icon" src="https://cdn-novel.bookkks.com/static/img/bookshelf-2.png"></dt>
         <dd class="book-city-nav__text">书架</dd>
       </router-link>
-      <router-link tag="dl"
-                   :to="Person"
-                   class="book-city-nav__item">
-        <dt><img class="book-city-nav__icon"
-               src="https://cdn-novel.bookkks.com/static/img/personal-2.png"></dt>
+      <router-link tag="dl" :to="Person" class="book-city-nav__item">
+        <dt><img class="book-city-nav__icon" src="https://cdn-novel.bookkks.com/static/img/personal-2.png"></dt>
         <dd class="book-city-nav__text">个人中心</dd>
       </router-link>
     </div>
     <div class="book-city-banner book-city-adbanner">
       <mt-swipe stop-propagation>
-        <mt-swipe-item v-for="book in banner"
-                       :key="book.id">
+        <mt-swipe-item v-for="book in banner" :key="book.id">
           <!-- <x-book :book="book"
                   width="1.5rem"
                   multi>
@@ -65,54 +43,36 @@
             <p class="book-city-banner__intro">{{book.intro}}</p>
           </x-book> -->
           <template v-if="book.redirect_url">
-            <a href="javascript:void(0)"
-               @touchstart="onTapBegin"
-               @touchmove="onTapMove"
-               @touchend="onTapEnd($event, book)">
-              <img :src="book.banner_url"
-                   alt="">
+            <a href="javascript:void(0)" @touchstart="onTapBegin" @touchmove="onTapMove" @touchend="onTapEnd($event, book)">
+              <img :src="book.banner_url" alt="">
             </a>
           </template>
           <template v-else>
-            <img :src="book.banner_url"
-                 alt="">
+            <img :src="book.banner_url" alt="">
           </template>
         </mt-swipe-item>
       </mt-swipe>
     </div>
     <div class="book-city-recommend">
       <template v-for="(list,i) in list">
-        <div class="book-city-recommend-one"
-             v-if="!(i%2)"
-             :key="list.type">
+        <div class="book-city-recommend-one" v-if="!(i%2)" :key="list.type">
           <div class="section-title">{{list.lable}}</div>
           <div class="book-city-recommend-one__list">
-            <div class="book-city-recommend-one__item"
-                 v-for="book in list.books"
-                 :key="book.id">
+            <div class="book-city-recommend-one__item" v-for="book in list.books" :key="book.id">
               <x-book :book="book"></x-book>
             </div>
           </div>
         </div>
-        <div class="book-city-recommend-two"
-             v-else
-             :key="list.type">
+        <div class="book-city-recommend-two" v-else :key="list.type">
           <div class="section-title">{{list.lable}}</div>
           <div class="book-city-recommend-two__line">
-            <div class="book-city-recommend-two__item"
-                 v-for="book in list.books.slice(0,4)"
-                 :key="book.id">
-              <x-book :book="book"
-                      width="1.5rem"></x-book>
+            <div class="book-city-recommend-two__item" v-for="book in list.books.slice(0,4)" :key="book.id">
+              <x-book :book="book" width="1.5rem"></x-book>
             </div>
           </div>
           <div class="book-city-recommend-two__list">
-            <div class="book-city-recommend-two__section"
-                 v-for="book in list.books.slice(4)"
-                 :key="book.id">
-              <x-book :book="book"
-                      width="1.5rem"
-                      multi>
+            <div class="book-city-recommend-two__section" v-for="book in list.books.slice(4)" :key="book.id">
+              <x-book :book="book" width="1.5rem" multi>
                 <p class="book-city-recommend-two__title">{{book.book_name}}</p>
                 <p class="book-city-recommend-two__desc">{{book.book_summary}}</p>
               </x-book>
@@ -200,7 +160,7 @@ import {
 import { getIndex, getRank } from "../api";
 export default {
   name: BookCity.name,
-  data() {
+  data () {
     return {
       theme: this.$parent.theme,
       BookStock: BookStock.route,
@@ -217,7 +177,7 @@ export default {
     };
   },
   methods: {
-    rankChange(i) {
+    rankChange (i) {
       if (i === this.activeRank) return;
       getRank(i, 1).then((r) => {
         if (!this.rank[i - 1])
@@ -226,7 +186,7 @@ export default {
         this.activeRank = i;
       });
     },
-    themeChange(theme) {
+    themeChange (theme) {
       this.theme = theme;
       this.$parent.theme = theme;
       localStorage.setItem("theme", theme);
@@ -237,7 +197,7 @@ export default {
           r[this.activeRank + "+1"][this.theme === "girl" ? "female" : "male"];
       });
     },
-    getIndex() {
+    getIndex () {
       getIndex(this.theme).then((r) => {
         this.banner = r[0].books;
         this.list = r.slice(1);
@@ -247,24 +207,24 @@ export default {
         });
       });
     },
-    onTapBegin(e) {
+    onTapBegin (e) {
       const { pageX } = e.touches[0];
       this.pageX = pageX;
     },
-    onTapMove(e) {
+    onTapMove (e) {
       const { pageX } = e.touches[0];
       if (Math.abs(pageX - this.pageX) < 10) {
         this.is_click = true;
       } else this.is_click = false;
     },
-    onTapEnd(e, book) {
+    onTapEnd (e, book) {
       if (this.is_click) {
         location.href = book.redirect_url;
       }
       this.is_click = true;
     },
   },
-  mounted() {
+  mounted () {
     // 哀悼日 网页变灰
     const mournDay =
       new Date().getTime() < new Date("2020-04-04").setHours(23, 59, 59, 999);
@@ -272,7 +232,7 @@ export default {
       this.$refs.wrap.style = "filter: grayscale(100%)";
     }
   },
-  created() {
+  created () {
     this.getIndex();
     getRank().then((r) => {
       this.rank.push(r["1+1"][this.theme === "girl" ? "female" : "male"]);

+ 32 - 65
src/view/book-recent.vue

@@ -1,31 +1,21 @@
 <template>
   <div class="book-recent">
+    <ad-popup popup_position="readingRecord"></ad-popup>
     <x-header>
       <div class="book-shelf-head">
         <span class="book-shelf-head__item is-active">最近阅读</span>
-        <router-link tag="span"
-                     replace
-                     :to="BookShelf"
-                     class="book-shelf-head__item">我的书架</router-link>
+        <router-link tag="span" replace :to="BookShelf" class="book-shelf-head__item">我的书架</router-link>
       </div>
     </x-header>
-    <div class="banner-bar"
-         v-if="hotList.length">
+    <div class="banner-bar" v-if="hotList.length">
       <!-- <div class="book-shelf-bar">
         <div class="section-title">热门推荐</div>
       </div> -->
       <div class="book-city-banner">
         <mt-swipe>
-          <mt-swipe-item v-for="(book,index) in hotList"
-                         :key="index">
-            <a href="javascript:void(0)"
-               @touchstart="onTapBegin"
-               @touchmove="onTapMove"
-               @touchend="onTapEnd($event, book)">
-              <x-book :book="book"
-                      width="1.5rem"
-                      multi
-                      prevent>
+          <mt-swipe-item v-for="(book,index) in hotList" :key="index">
+            <a href="javascript:void(0)" @touchstart="onTapBegin" @touchmove="onTapMove" @touchend="onTapEnd($event, book)">
+              <x-book :book="book" width="1.5rem" multi prevent>
                 <p class="book-city-banner__title">{{book.book_name}}</p>
                 <p class="book-city-banner__intro">{{book.book_summary}}</p>
               </x-book>
@@ -36,35 +26,21 @@
     </div>
     <div class="book-shelf-bar">
       <div class="section-title">最近阅读<span>(共{{books.length}}本)</span></div>
-      <v-touch class="book-shelf-bar__edit"
-               @tap="editChange">{{edit?'完成':'管理'}}</v-touch>
+      <v-touch class="book-shelf-bar__edit" @tap="editChange">{{edit?'完成':'管理'}}</v-touch>
 
     </div>
-    <div class="book-recent-list"
-         v-infinite-scroll="loadMore"
-         infinite-scroll-disabled="loading"
-         infinite-scroll-distance="10">
-      <x-book v-for="(book,index) in books"
-              :key="book.book_id"
-              :book="book"
-              class="book-recent-book"
-              width="1.5rem"
-              prevent
-              @click="routeReader(book)"
-              multi>
+    <div class="book-recent-list" v-infinite-scroll="loadMore" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
+      <x-book v-for="(book,index) in books" :key="book.book_id" :book="book" class="book-recent-book" width="1.5rem" prevent @click="routeReader(book)" multi>
         <p class="x-book-info__name free-name">{{book.book_name}}
-          <img v-if="book.is_advertise_sub"
-               src="../assets/free-read.jpg" />
+          <img v-if="book.is_advertise_sub" src="../assets/free-read.jpg" />
         </p>
         <p class="x-book-info__flex">
           <span class="x-book-info__lastest">
             <span class="red">最新:</span>{{book.last_chapter}}</span>
-          <img src="../assets/书库-vip.png"
-               class="x-book-info__vip">
+          <img src="../assets/书库-vip.png" class="x-book-info__vip">
         </p>
         <p class="x-book-info__recent">上次阅读:{{book.chapter_name}}</p>
-        <div class="book-recent-book__add"
-             @click.stop="addShelf(book)">
+        <div class="book-recent-book__add" @click.stop="addShelf(book)">
           <template v-if="!book.is_on_user_shelf">
             <span class="book-recent-book__heart">♥</span>加入书架
           </template>
@@ -72,14 +48,9 @@
             <span class="book-recent-book__heart is-added">♥</span>已加入书架
           </template>
         </div>
-        <div slot="shadow"
-             class="x-book-shadow"
-             :class="edit?'is-edit':''"
-             @click.stop="delBook(book,index)"></div>
+        <div slot="shadow" class="x-book-shadow" :class="edit?'is-edit':''" @click.stop="delBook(book,index)"></div>
       </x-book>
-      <mt-spinner v-if="!isLoadLast"
-                  type="fading-circle"
-                  color="#32a1ff"></mt-spinner>
+      <mt-spinner v-if="!isLoadLast" type="fading-circle" color="#32a1ff"></mt-spinner>
     </div>
     <x-footer></x-footer>
     <!-- <div class="free-entry"
@@ -88,12 +59,8 @@
            alt=""
            @click="toFreePage">
     </div> -->
-    <div class="free-entry activity-entry"
-         style="top: 70%"
-         v-if="activity_link && activity_link.url">
-      <img :src="activity_link.image"
-           alt=""
-           @click="tapActivity">
+    <div class="free-entry activity-entry" style="top: 70%" v-if="activity_link && activity_link.url">
+      <img :src="activity_link.image" alt="" @click="tapActivity">
     </div>
   </div>
 </template>
@@ -109,7 +76,7 @@ import {
 // import books from "../mock/recommend.js";
 export default {
   name: BookRecent.name,
-  data() {
+  data () {
     return {
       BookShelf: BookShelf.route,
       books: [],
@@ -124,11 +91,11 @@ export default {
     };
   },
   methods: {
-    ClickStatistics(bid) {
+    ClickStatistics (bid) {
       console.log(bid);
       getbookFromWhere(bid, "readrecord");
     },
-    loadMore() {
+    loadMore () {
       this.loading = true;
       setTimeout(() => {
         console.log("loadMore");
@@ -136,16 +103,16 @@ export default {
         this.loading = false;
       }, 2500);
     },
-    editChange() {
+    editChange () {
       this.edit = !this.edit;
     },
-    addShelf(book) {
+    addShelf (book) {
       if (book.is_on_user_shelf) return;
       addShelf(book.bid).then((r) => {
         book.is_on_user_shelf = 1;
       });
     },
-    delBook(book, index) {
+    delBook (book, index) {
       if (this.edit) {
         this.edit &&
           delReadrecord(book.bid).then((r) => {
@@ -155,7 +122,7 @@ export default {
         this.routeReader(book);
       }
     },
-    routeReader(book) {
+    routeReader (book) {
       this.$router.push({
         name: Reader.name,
         query: {
@@ -164,7 +131,7 @@ export default {
         },
       });
     },
-    getRecentSwiperList() {
+    getRecentSwiperList () {
       recentSlideList().then((r) => {
         this.hotList = r.map((b) => {
           return Object.assign(b, {
@@ -173,37 +140,37 @@ export default {
         });
       });
     },
-    toFreePage() {
+    toFreePage () {
       if (this.showFreeEntry) {
         location.href = this.showFreeEntry.link + "&p_src=recent";
       }
     },
-    tapActivity() {
+    tapActivity () {
       location.href = this.activity_link.url;
     },
-    onTapBegin(e) {
+    onTapBegin (e) {
       const { pageX } = e.touches[0];
       this.pageX = pageX;
     },
-    onTapMove(e) {
+    onTapMove (e) {
       const { pageX } = e.touches[0];
       if (Math.abs(pageX - this.pageX) < 10) {
         this.is_click = true;
       } else this.is_click = false;
     },
-    onTapEnd(e, book) {
+    onTapEnd (e, book) {
       if (this.is_click) {
         this.ClickStatistics(book.book_id);
         this.$router.push({
           name: BookDetail.name,
           query: { id: book.book_id },
-          params:{pos:'recent_banner'}
+          params: { pos: 'recent_banner' }
         });
       }
       this.is_click = true;
     },
   },
-  created() {
+  created () {
     getReadrecord().then((r) => {
       this.books = r;
       this.getRecentSwiperList();
@@ -236,4 +203,4 @@ export default {
     height: 1.72rem;
   }
 }
-</style>
+</style>

+ 8 - 0
src/view/namespace.js

@@ -93,6 +93,14 @@ export const Pay = {
   route: { name: "Pay" },
   path: "/pay"
 };
+export const adPay = {
+  name: "adPay",
+  meta: {
+    Chinese: "充值中心"
+  },
+  route: { name: "adPay" },
+  path: "/ad_pay"
+};
 
 export const RecordRecharge = {
   name: "RecordRecharge",

+ 146 - 201
src/view/pay.vue

@@ -1,23 +1,19 @@
 <template>
-  <div
-    :class="[
-      'pay',
-      {
-        'has-banner':
-          showPayYearBanner || showSpecialPayTempalte || xiyue_pay_template
-      }
-    ]"
-  >
+  <div :class="[
+    'pay',
+    {
+      'has-banner':
+        showPayYearBanner || showSpecialPayTempalte || xiyue_pay_template
+    }
+  ]">
+    <ad-popup popup_position="returnNotRecharge" :from="from" v-if="showAd"></ad-popup>
     <x-header></x-header>
     <template v-if="!xiyue_pay_template">
       <div class="section-edge-all">
         <template v-if="adjust_pay_page && showBookTip">
           <div class="pay-account" style="font-size:14px">
-            您的余额:<span class="red">{{ balance }}</span
-            >书币,<span v-if="balance > 0"
-              >本书全本购买需要:<span class="red">{{ $route.query.fee }}</span
-              >书币</span
-            >
+            您的余额:<span class="red">{{ balance }}</span>书币,<span v-if="balance > 0">本书全本购买需要:<span class="red">{{
+              $route.query.fee }}</span>书币</span>
           </div>
           <div class="pay-explain">
             您的余额不足,请点击下方充值
@@ -28,18 +24,14 @@
             您的余额:
             <span class="red">{{ balance }}</span>
             书币
-            <span
-              :class="[
-                'red',
-                {
-                  'no-enough-money': showPayYearBanner || showSpecialPayTempalte
-                }
-              ]"
-              v-if="showTip"
-              >{{
-                showPayYearBanner || showSpecialPayTempalte ? "" : "(余额不足)"
-              }}</span
-            >
+            <span :class="[
+              'red',
+              {
+                'no-enough-money': showPayYearBanner || showSpecialPayTempalte
+              }
+            ]" v-if="showTip">{{
+  showPayYearBanner || showSpecialPayTempalte ? "" : "(余额不足)"
+}}</span>
           </div>
           <div class="pay-fee" v-if="showTip && !showChapterConsume">
             <template v-if="isFirstPay">
@@ -47,14 +39,10 @@
             </template>
             <template v-else>
               {{ showBookTip ? "此书全本" : "当前章节" }}需要消耗
-              <span class="red">{{ $route.query.fee }}</span
-              >书币
+              <span class="red">{{ $route.query.fee }}</span>书币
             </template>
           </div>
-          <div
-            class="pay-explain"
-            v-if="!showPayYearBanner && !showSpecialPayTempalte"
-          >
+          <div class="pay-explain" v-if="!showPayYearBanner && !showSpecialPayTempalte">
             选择充值金额
             <span class="red">(1元=100书币)</span>
           </div>
@@ -65,27 +53,18 @@
             <img src="../assets/coupon _pay.png" />优惠券
           </p>
           <p class="pay-coupon__right" @click="changeCoupon">
-            <span v-if="!isCouponChecked"
-              >您有{{ availdCouponList.length }}张优惠券待使用</span
-            ><span class="usecoupon" v-else
-              >- &yen;{{ currentCoupon.price }}</span
-            >
+            <span v-if="!isCouponChecked">您有{{ availdCouponList.length }}张优惠券待使用</span><span class="usecoupon" v-else>-
+              &yen;{{ currentCoupon.price }}</span>
             <img src="../assets/个人中心-进入.png" />
           </p>
         </div>
         <template v-if="show_month_order_entry">
-          <div
-            class="pay-product__item pay-product__month"
-            @click="chooseMonthOrder"
-          >
-            <img
-              :src="
-                isMonthOrder
-                  ? show_month_order_entry.focus_img
-                  : show_month_order_entry.unfocus_img
-              "
-              alt=""
-            />
+          <div class="pay-product__item pay-product__month" @click="chooseMonthOrder">
+            <img :src="
+              isMonthOrder
+                ? show_month_order_entry.focus_img
+                : show_month_order_entry.unfocus_img
+            " alt="" />
           </div>
         </template>
         <ul class="pay-product">
@@ -116,39 +95,29 @@
             </div>
           </template> -->
           <template v-if="showPayYearBanner">
-            <div
-              class="pay-product__item"
-              @click="selectProduct(product.length - 1)"
-            >
-              <img
-                :src="
-                  product.length - 1 === selectedProduct
-                    ? year_item_bg_check
-                    : year_item_bg
-                "
-                alt=""
-              />
+            <div class="pay-product__item" @click="selectProduct(product.length - 1)">
+              <img :src="
+                product.length - 1 === selectedProduct
+                  ? year_item_bg_check
+                  : year_item_bg
+              " alt="" />
             </div>
           </template>
           <template v-for="(v, i) in product">
             <template v-if="showPayYearBanner">
               <template v-if="i < product.length - 1">
-                <v-touch
-                  :class="[
-                    'pay-product__item',
-                    {
-                      'is-active': i === selectedProduct,
-                      'is-recommend': i === defaultProduct,
-                      'is-first': i === cheaperProduct
-                    }
-                  ]"
-                  :key="v.product_id"
-                  @tap="selectProduct(i)"
-                >
+                <v-touch :class="[
+                  'pay-product__item',
+                  {
+                    'is-active': i === selectedProduct,
+                    'is-recommend': i === defaultProduct,
+                    'is-first': i === cheaperProduct
+                  }
+                ]" :key="v.product_id" @tap="selectProduct(i)">
                   <p class="pay-product__name">{{ v.price }}</p>
                   <p class="pay-product__intro">{{ v.text }}</p>
                   <p class="pay-product__intro cheaper-box" v-if="v.save_text">
-                    <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                    <span class="text" v-if="v.type == 'TICKET_RECHARGE' || v.type == 'NEW_USER'">省</span>
                     <span class="text" v-else><i class="is_year"></i></span>
                     <span>{{ v.save_text }}</span>
                   </p>
@@ -167,25 +136,18 @@
             <template v-else>
               <template v-if="showSpecialPayTempalte">
                 <template v-if="i < product.length - 1">
-                  <v-touch
-                    :class="[
-                      'pay-product__item',
-                      {
-                        'is-active': i === selectedProduct,
-                        'is-recommend': i === defaultProduct,
-                        'is-first': i === cheaperProduct
-                      }
-                    ]"
-                    :key="v.product_id"
-                    @tap="selectProduct(i)"
-                  >
+                  <v-touch :class="[
+                    'pay-product__item',
+                    {
+                      'is-active': i === selectedProduct,
+                      'is-recommend': i === defaultProduct,
+                      'is-first': i === cheaperProduct
+                    }
+                  ]" :key="v.product_id" @tap="selectProduct(i)">
                     <p class="pay-product__name">{{ v.price }}</p>
                     <p class="pay-product__intro">{{ v.text }}</p>
-                    <p
-                      class="pay-product__intro cheaper-box"
-                      v-if="v.save_text"
-                    >
-                      <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                    <p class="pay-product__intro cheaper-box" v-if="v.save_text">
+                      <span class="text" v-if="v.type == 'TICKET_RECHARGE' || v.type == 'NEW_USER'">省</span>
                       <span class="text" v-else><i class="is_year"></i></span>
                       <span>{{ v.save_text }}</span>
                     </p>
@@ -193,65 +155,47 @@
                 </template>
                 <template v-else>
                   <template v-if="product.length < 7">
-                    <v-touch
-                      :class="[
-                        'pay-product__item',
-                        {
-                          'is-active': i === selectedProduct,
-                          'is-recommend': i === defaultProduct,
-                          'is-first': i === cheaperProduct
-                        }
-                      ]"
-                      :key="v.product_id"
-                      @tap="selectProduct(i)"
-                    >
+                    <v-touch :class="[
+                      'pay-product__item',
+                      {
+                        'is-active': i === selectedProduct,
+                        'is-recommend': i === defaultProduct,
+                        'is-first': i === cheaperProduct
+                      }
+                    ]" :key="v.product_id" @tap="selectProduct(i)">
                       <p class="pay-product__name">{{ v.price }}</p>
                       <p class="pay-product__intro">{{ v.text }}</p>
-                      <p
-                        class="pay-product__intro cheaper-box"
-                        v-if="v.save_text"
-                      >
-                        <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                      <p class="pay-product__intro cheaper-box" v-if="v.save_text">
+                        <span class="text" v-if="v.type == 'TICKET_RECHARGE' || v.type == 'NEW_USER'">省</span>
                         <span class="text" v-else><i class="is_year"></i></span>
                         <span>{{ v.save_text }}</span>
                       </p>
                     </v-touch>
                   </template>
                   <template v-else>
-                    <div
-                      class="pay-product__item pay-product__item--year"
-                      :key="'year' + i"
-                      @click="selectProduct(i)"
-                    >
-                      <img
-                        :src="
-                          i === selectedProduct
-                            ? mi_wan_year_bg_check
-                            : mi_wan_year_bg
-                        "
-                        alt=""
-                      />
+                    <div class="pay-product__item pay-product__item--year" :key="'year' + i" @click="selectProduct(i)">
+                      <img :src="
+                        i === selectedProduct
+                          ? mi_wan_year_bg_check
+                          : mi_wan_year_bg
+                      " alt="" />
                     </div>
                   </template>
                 </template>
               </template>
               <template v-else>
-                <v-touch
-                  :class="[
-                    'pay-product__item',
-                    {
-                      'is-active': i === selectedProduct,
-                      'is-recommend': i === defaultProduct,
-                      'is-first': i === cheaperProduct
-                    }
-                  ]"
-                  :key="v.product_id"
-                  @tap="selectProduct(i)"
-                >
+                <v-touch :class="[
+                  'pay-product__item',
+                  {
+                    'is-active': i === selectedProduct,
+                    'is-recommend': i === defaultProduct,
+                    'is-first': i === cheaperProduct
+                  }
+                ]" :key="v.product_id" @tap="selectProduct(i)">
                   <p class="pay-product__name">{{ v.price }}</p>
                   <p class="pay-product__intro">{{ v.text }}</p>
                   <p class="pay-product__intro cheaper-box" v-if="v.save_text">
-                    <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                    <span class="text" v-if="v.type == 'TICKET_RECHARGE' || v.type == 'NEW_USER'">省</span>
                     <span class="text" v-else><i class="is_year"></i></span>
                     <span>{{ v.save_text }}</span>
                   </p>
@@ -264,19 +208,12 @@
             </template>
           </template>
           <template v-if="showAd_entry && !is_iPhone">
-            <v-touch
-              class="pay-product__adwrap"
-              v-if="product.length"
-              @tap="toFreeAds()"
-            >
+            <v-touch class="pay-product__adwrap" v-if="product.length" @tap="toFreeAds()">
               <img src="../assets/cz.jpg" alt="" />
             </v-touch>
           </template>
         </ul>
-        <div
-          class="pay-explain"
-          v-if="showPayYearBanner || showSpecialPayTempalte"
-        >
+        <div class="pay-explain" v-if="showPayYearBanner || showSpecialPayTempalte">
           选择充值金额
           <span class="red">(1元=100书币)</span>
         </div>
@@ -288,11 +225,7 @@
           <div class="gift-preview">
             <span class="title">获赠道具详情</span>
             <div class="preview-wrap">
-              <span
-                class="gift-preview__item"
-                v-for="(g, i) in giftList"
-                :key="i"
-              >
+              <span class="gift-preview__item" v-for="(g, i) in giftList" :key="i">
                 <img :src="g.icon" :alt="g.name_desc" />
                 <i>{{ g.name_desc }}x{{ g.num }}</i>
               </span>
@@ -327,11 +260,7 @@
         </div> -->
         <p class="pay-shubi-tip">书币属于虚拟商品,一经充值不得退还</p>
         <div class="reader-loading" v-show="loading">
-          <mt-spinner
-            class="reader-loading-icon"
-            type="fading-circle"
-            color="#32a1ff"
-          ></mt-spinner>
+          <mt-spinner class="reader-loading-icon" type="fading-circle" color="#32a1ff"></mt-spinner>
         </div>
       </div>
     </template>
@@ -351,20 +280,16 @@
             </template>
             <template v-else>
               {{ showBookTip ? "此书全本" : "当前章节" }}需要消耗
-              <span class="red">{{ $route.query.fee }}</span
-              >书币
+              <span class="red">{{ $route.query.fee }}</span>书币
             </template>
           </div>
         </div>
         <div class="xiyue-entry" @click="chooseXiYueEntry">
-          <img
-            :src="
-              isXYEntrySelect
-                ? xiyue_pay_template.xiyue_pay_focus_img
-                : xiyue_pay_template.xiyue_pay_unfocus_img
-            "
-            alt=""
-          />
+          <img :src="
+            isXYEntrySelect
+              ? xiyue_pay_template.xiyue_pay_focus_img
+              : xiyue_pay_template.xiyue_pay_unfocus_img
+          " alt="" />
         </div>
         <div class="pay-wrap">
           <div class="pay-explain">
@@ -373,22 +298,18 @@
           </div>
           <ul class="pay-product">
             <template v-for="(v, i) in product">
-              <v-touch
-                :class="[
-                  'pay-product__item',
-                  {
-                    'is-active': i === selectedProduct,
-                    'is-recommend': i === defaultProduct,
-                    'is-first': i === cheaperProduct
-                  }
-                ]"
-                :key="v.product_id"
-                @tap="selectProduct(i)"
-              >
+              <v-touch :class="[
+                'pay-product__item',
+                {
+                  'is-active': i === selectedProduct,
+                  'is-recommend': i === defaultProduct,
+                  'is-first': i === cheaperProduct
+                }
+              ]" :key="v.product_id" @tap="selectProduct(i)">
                 <p class="pay-product__name">{{ v.price }}</p>
                 <p class="pay-product__intro">{{ v.text }}</p>
                 <p class="pay-product__intro cheaper-box" v-if="v.save_text">
-                  <span class="text" v-if="v.type=='TICKET_RECHARGE' || v.type=='NEW_USER'">省</span>
+                  <span class="text" v-if="v.type == 'TICKET_RECHARGE' || v.type == 'NEW_USER'">省</span>
                   <span class="text" v-else><i class="is_year"></i></span>
                   <span>{{ v.save_text }}</span>
                 </p>
@@ -405,11 +326,7 @@
           </div>
         </div>
         <div class="reader-loading" v-show="loading">
-          <mt-spinner
-            class="reader-loading-icon"
-            type="fading-circle"
-            color="#32a1ff"
-          ></mt-spinner>
+          <mt-spinner class="reader-loading-icon" type="fading-circle" color="#32a1ff"></mt-spinner>
         </div>
       </div>
     </template>
@@ -455,8 +372,9 @@ import { PayForGift } from "../components/prompt";
 
 export default {
   name: Pay.name,
-  data() {
+  data () {
     return {
+      showAd: false,//是否展示弹窗广告
       HelpPayQrcode: HelpPayQrcode.name,
       balance: "...",
       product: [],
@@ -497,18 +415,23 @@ export default {
     };
   },
   computed: {
-    giftList() {
+    from () {
+      if (this.$route.query.book_id) {
+        return 'reader'
+      }
+    },
+    giftList () {
       const { product, selectedProduct } = this;
       return selectedProduct && product.length
         ? product[selectedProduct].gift
         : [];
     },
-    giftPrice() {
+    giftPrice () {
       return this.giftList.reduce((a, b) => {
         return a + b.cost * b.num;
       }, 0);
     },
-    chargePrice() {
+    chargePrice () {
       let select_pro = this.product[this.selectedProduct];
       let normal_value = select_pro ? select_pro.price : "0";
       let special_value = this.isMonthOrder
@@ -518,7 +441,16 @@ export default {
     }
   },
   methods: {
-    changeCoupon() {
+    back () {
+      // alert('页面要返回了')
+      // getUserInfo().then(r => {
+      //   if (!r.is_paid) {
+      //     this.showAd = true
+      //   }
+      // });
+      this.showAd = true
+    },
+    changeCoupon () {
       if (this.availdCouponList.length <= 0) {
         this.$MessageBox.alert(
           "当前暂无可用优惠券,请检查充值额度是否满足优惠券使用条件,优惠券是否在有效期",
@@ -535,12 +467,12 @@ export default {
       }
     },
     //选择优惠券
-    chooseCoupon(coupon) {
+    chooseCoupon (coupon) {
       this.currentCoupon = coupon;
       this.popupVisible = false;
       this.isCouponChecked = true;
     },
-    selectProduct(i) {
+    selectProduct (i) {
       this.selectedProduct = i;
       this.isMonthOrder = false;
       this.isXYEntrySelect = false;
@@ -549,7 +481,7 @@ export default {
         Number(this.product[this.selectedProduct].price.replace("元", ""))
       );
     },
-    pay() {
+    pay () {
       if (this.isMonthOrder) {
         this.toMonthOrder();
       } else {
@@ -561,7 +493,7 @@ export default {
         });
       }
     },
-    payForYear() {
+    payForYear () {
       let product_id = this.product[this.product.length - 1].product_id;
       recharge({
         product_id,
@@ -569,25 +501,25 @@ export default {
         cid: this.$route.query.chapter_id
       });
     },
-    toHelpPay() {
+    toHelpPay () {
       this.$router.push({
         name: this.HelpPayQrcode,
         query: { product_id: this.product[this.selectedProduct].product_id }
       });
     },
-    toFreeAds() {
+    toFreeAds () {
       window.location.href = `${window.location.origin +
         window.options.appad_url}`;
     },
-    see() {
+    see () {
       PayForGift({ list: this.giftList });
     },
-    calcGiftPrice(list) {
+    calcGiftPrice (list) {
       return list.reduce((a, b) => {
         return a + b.cost * b.num;
       }, 0);
     },
-    toMonthOrder() {
+    toMonthOrder () {
       const origin = window.location.origin;
       const href = window.location.href;
       // const r = origin + "/monthpay/wait?r=" + encodeURIComponent(href);
@@ -595,7 +527,7 @@ export default {
         this.show_month_order_entry.link +
         `&use_coupon=${this.currentCoupon.id}`;
     },
-    chooseMonthOrder() {
+    chooseMonthOrder () {
       this.selectedProduct = null;
       this.isMonthOrder = true;
       this.defaultProduct = null;
@@ -605,14 +537,14 @@ export default {
       );
     },
     //获取当前金额的可用优惠券
-    getAvaildCoupon(price) {
+    getAvaildCoupon (price) {
       this.currentCoupon = { id: "", price: 0 };
       this.isCouponChecked = false;
       this.availdCouponList = this.couponList.filter(
         item => item.use_condition < price
       );
     },
-    findMonthOrder() {
+    findMonthOrder () {
       this.$Indicator.open("查询订单中...请稍等");
       let time = 0;
       this.timer = setInterval(() => {
@@ -634,12 +566,12 @@ export default {
           });
       }, 1000);
     },
-    chooseXiYueEntry() {
+    chooseXiYueEntry () {
       this.selectedProduct = null;
       this.isXYEntrySelect = true;
       this.xiyue_pay_btn_text = "了解更多";
     },
-    payInXiYue() {
+    payInXiYue () {
       if (this.isXYEntrySelect) {
         location.href = this.xiyue_pay_template.xiyue_pay_page;
       } else {
@@ -651,7 +583,7 @@ export default {
       }
     }
   },
-  created() {
+  created () {
     this.loading = true;
     getOrderCoupon().then(r => {
       this.couponList = r;
@@ -694,6 +626,19 @@ export default {
     // 是否包月回调
     const { from_wxpay } = this.$route.query;
     if (from_wxpay) this.findMonthOrder();
+  },
+  mounted () {
+    //挂载成功后给pop事件绑定一个方法
+    // 如果支持 popstate (一般移动端都支持)
+    if (window.history && window.history.pushState) {
+      // 往历史记录里面添加一条新的当前页面的url
+      history.pushState(null, null, document.URL);
+      // 给 popstate 绑定一个方法用来监听页面返回
+      window.addEventListener('popstate', this.back, false); //false阻止默认事件
+    }
+  },
+  destroyed () {
+    window.removeEventListener('popstate', this.back, false); //false阻止默认事件
   }
 };
 </script>

+ 45 - 88
src/view/person.vue

@@ -1,20 +1,17 @@
 <template>
   <div class="person">
+    <ad-popup popup_position="personalCenter"></ad-popup>
     <x-header></x-header>
     <div class="person-info__wrap">
       <div class="person-info__bg"></div>
       <div class="person-info__portrait">
-        <img v-if="user.head_img"
-             :src="user.head_img" />
-        <img v-else
-             src="../assets/个人中心-默认头像.png" />
+        <img v-if="user.head_img" :src="user.head_img" />
+        <img v-else src="../assets/个人中心-默认头像.png" />
       </div>
       <div class="person-info__username"><span v-if="user.nickname">{{user.nickname}}</span><span v-else>书友</span></div>
       <div class="person-info__id">
         ID:{{user.id}}
-        <span class="person-info__copy"
-              :data-clipboard-text="user.id"
-              @click="copyName">复制</span>
+        <span class="person-info__copy" :data-clipboard-text="user.id" @click="copyName">复制</span>
       </div>
       <div class="person-info__balancebox">
         <img src="../assets/余额.png" />
@@ -22,19 +19,14 @@
           您还剩
           <span class="red">{{user.balance}}</span>书币
         </span>
-        <router-link :to="Pay"
-                     class="person-info__btn">充值</router-link>
+        <router-link :to="Pay" class="person-info__btn">充值</router-link>
       </div>
     </div>
     <div class="person-entry__wrap">
-      <img src="https://cdn-novel.bookkks.com/h5/20191025_vip.jpg"
-           @click="toBuyVip"
-           class="person-entry__buyvip"
-           v-if="!user.is_vip && showBuyVip" />
+      <img src="https://cdn-novel.bookkks.com/h5/20191025_vip.jpg" @click="toBuyVip" class="person-entry__buyvip" v-if="!user.is_vip && showBuyVip" />
       <template v-if="user.is_vip">
         <div class="person-entry__vip">
-          <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>
           <span>还剩余{{user.vip_days}}</span>
@@ -43,8 +35,7 @@
       </template>
       <template v-if="user.is_all_life">
         <div class="person-entry__vip">
-          <img class="person-entry__icon"
-               src="../assets/我是包年图标.png" />
+          <img class="person-entry__icon" src="../assets/我是包年图标.png" />
           <span class="person-entry__text">包年有效期</span>
           <span>终身免费</span>
         </div>
@@ -52,80 +43,51 @@
       </template>
       <template v-if="xiyue_pay_template">
         <div class="person-entry__server">
-          <img class="person-entry__icon"
-               src="../assets/xiyue-person__entry.png" />
-          <span @click="toXiYue"
-                class="person-entry__text">我的微书店</span>
-          <img class="person-entry__arrow"
-               src="../assets/个人中心-进入.png" />
+          <img class="person-entry__icon" src="../assets/xiyue-person__entry.png" />
+          <span @click="toXiYue" class="person-entry__text">我的微书店</span>
+          <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
         </div>
         <hr />
       </template>
-      <router-link class="person-entry__shelf"
-                   :to="Coupon"
-                   tag="div">
-        <img class="person-entry__icon"
-             src="../assets/my_coupon.png" />
+      <router-link class="person-entry__shelf" :to="Coupon" tag="div">
+        <img class="person-entry__icon" src="../assets/my_coupon.png" />
         <span class="person-entry__text">我的优惠券</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </router-link>
       <hr />
-      <router-link class="person-entry__shelf"
-                   :to="BookShelf"
-                   tag="div">
-        <img class="person-entry__icon"
-             src="../assets/个人中心-书架.png" />
+      <router-link class="person-entry__shelf" :to="BookShelf" tag="div">
+        <img class="person-entry__icon" src="../assets/个人中心-书架.png" />
         <span class="person-entry__text">我的书架</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </router-link>
       <hr />
-      <router-link tag="div"
-                   :to="RecordRecharge"
-                   class="person-entry__pay">
-        <img class="person-entry__icon"
-             src="../assets/个人中心-充值记录.png" />
+      <router-link tag="div" :to="RecordRecharge" class="person-entry__pay">
+        <img class="person-entry__icon" src="../assets/个人中心-充值记录.png" />
         <span class="person-entry__text">充值记录</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </router-link>
       <hr />
-      <router-link tag="div"
-                   :to="RecordOrder"
-                   class="person-entry__order">
-        <img class="person-entry__icon"
-             src="../assets/个人中心-消费记录.png" />
+      <router-link tag="div" :to="RecordOrder" class="person-entry__order">
+        <img class="person-entry__icon" src="../assets/个人中心-消费记录.png" />
         <span class="person-entry__text">消费记录</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </router-link>
       <hr />
-      <router-link tag="div"
-                   :to="RecordSend"
-                   class="person-entry__send">
-        <img class="person-entry__icon"
-             src="../assets/个人中心-赠送记录.png" />
+      <router-link tag="div" :to="RecordSend" class="person-entry__send">
+        <img class="person-entry__icon" src="../assets/个人中心-赠送记录.png" />
         <span class="person-entry__text">书币详情</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </router-link>
       <hr />
-      <div class="person-entry__sign"
-           @click="toSignPage">
-        <img class="person-entry__icon"
-             src="../assets/sign.png" />
+      <div class="person-entry__sign" @click="toSignPage">
+        <img class="person-entry__icon" src="../assets/sign.png" />
         <span class="person-entry__text">签到</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </div>
       <hr />
       <template v-if="!!user.is_paid">
-        <div class="person-entry__binding"
-             @click="toBind">
-          <img src="../assets/binding.png"
-               alt
-               class="person-entry__icon" />
+        <div class="person-entry__binding" @click="toBind">
+          <img src="../assets/binding.png" alt class="person-entry__icon" />
           <span class="person-entry__text">绑定手机</span>
           <template v-if="!!user.bind">
             <span :class="['binding-text', {'binding-text__binded': !!user.bind}]">已绑定</span>
@@ -135,24 +97,19 @@
               绑定即得
               <i>100</i>书币
             </span>
-            <img class="person-entry__arrow"
-                 src="../assets/个人中心-进入.png" />
+            <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
           </template>
         </div>
         <hr />
       </template>
       <div class="person-entry__server">
-        <img class="person-entry__icon"
-             src="../assets/个人中心-客服.png" />
-        <span @click="Server"
-              class="person-entry__text">联系客服</span>
-        <img class="person-entry__arrow"
-             src="../assets/个人中心-进入.png" />
+        <img class="person-entry__icon" src="../assets/个人中心-客服.png" />
+        <span @click="Server" class="person-entry__text">联系客服</span>
+        <img class="person-entry__arrow" src="../assets/个人中心-进入.png" />
       </div>
       <hr />
     </div>
-    <p class="clear-cache"
-       @click="onClear">清除缓存</p>
+    <p class="clear-cache" @click="onClear">清除缓存</p>
   </div>
 </template>
 <script>
@@ -172,7 +129,7 @@ import { Server } from "../components/prompt";
 import Clipboard from "clipboard";
 export default {
   name: Person.name,
-  data() {
+  data () {
     return {
       BookShelf: BookShelf.route,
       Pay: Pay.route,
@@ -189,23 +146,23 @@ export default {
     };
   },
   methods: {
-    Server() {
+    Server () {
       Server({ openid: this.user.openid });
     },
-    toBind() {
+    toBind () {
       if (!!this.user.bind) return;
       this.$router.push(this.PhoneBinding);
     },
-    toSignPage() {
+    toSignPage () {
       location.href = "/sign";
     },
-    toXiYue() {
+    toXiYue () {
       location.href = this.xiyue_pay_template.xiyue_index_page;
     },
-    toBuyVip() {
+    toBuyVip () {
       location.href = "/sale/customvip";
     },
-    copyName() {
+    copyName () {
       var that = this;
       var clipboard = new Clipboard(".person-info__copy");
       clipboard.on("success", function (e) {
@@ -215,11 +172,11 @@ export default {
         console.log(e);
       });
     },
-    onClear() {
+    onClear () {
       location.href = "/reLogin";
     },
   },
-  created() {
+  created () {
     getUserInfo().then((r) => {
       this.user = r;
     });

+ 126 - 260
src/view/reader.vue

@@ -1,35 +1,15 @@
 <template>
-  <div
-    ref="reader-wrap"
-    :class="[
+  <div ref="reader-wrap" :class="[
       'reader',
       { 'reader-fixed': five_template && !five_template_clicked }
-    ]"
-  >
-    <x-reader
-      ref="reader"
-      :class="{
+    ]">
+    <ad-popup popup_position="reading"></ad-popup>
+    <x-reader ref="reader" :class="{
         'x-reader--subscribe': weakSubscribe,
         'x-reader--subscribe__qrcode':
           (subscribeQRcode && !subscribeQRcodeHorizontal) || active
-      }"
-      :text="text"
-      :ad="showAdStatus"
-      :adframe="showAdIframe"
-      :gift="true"
-      :shelf="is_on"
-      :showFans="showFans"
-      @route="go"
-      @addShelf="addShelf"
-      @next="next"
-      @prev="prev"
-      @direction="direction"
-      @horizontal-mounted="horizontalMounted"
-      @closeBanner="closeBanner"
-      @vertical-mounted="verticalMounted"
-      @show-gift="showGiftPopup"
-      @share="share"
-    >
+      }" :text="text" :ad="showAdStatus" :adframe="showAdIframe" :gift="true" :shelf="is_on" :showFans="showFans" @route="go" @addShelf="addShelf" @next="next" @prev="prev" @direction="direction" @horizontal-mounted="horizontalMounted"
+      @closeBanner="closeBanner" @vertical-mounted="verticalMounted" @show-gift="showGiftPopup" @share="share">
       <!-- <template v-if="showGift">
         <v-touch class="send-gift">
           <v-touch class="send-gift__btn"
@@ -44,53 +24,24 @@
         </div>
       </template> -->
       <!-- 5元充值入口 -->
-      <div
-        slot="top"
-        class="five_template_entry"
-        ref="five_template"
-        v-if="five_template && !five_template_clicked"
-      >
+      <div slot="top" class="five_template_entry" ref="five_template" v-if="five_template && !five_template_clicked">
         <v-touch @tap="tapFiveTemplate">
           <img :src="five_template.banner" alt="" />
         </v-touch>
-        <v-touch
-          tag="span"
-          class="close-area"
-          @tap="closeFiveTemplate"
-        ></v-touch>
-        <v-touch
-          tag="span"
-          class="close-text-area"
-          @tap="closeFiveTemplate"
-        ></v-touch>
+        <v-touch tag="span" class="close-area" @tap="closeFiveTemplate"></v-touch>
+        <v-touch tag="span" class="close-text-area" @tap="closeFiveTemplate"></v-touch>
       </div>
       <!-- 弱关添加 -->
       <template v-if="weakSubscribe">
         <!-- 横版 -->
-        <v-touch
-          v-if="weakSubscribeHorizontal"
-          v-show="!loading"
-          key="weakSubscribeHorizontal"
-          class="weak-subscribe-wrap--horizontal"
-          :style="weakSubscribeStyle"
-          @tap="weakSubscribeEv"
-        >
-          <p
-            v-for="i in weakSubscribeHorizontalNum"
-            class="weak-subscribe--horizontal weak-subscribe"
-            :key="'weakSubscribeHorizontalText-' + i"
-          >
+        <v-touch v-if="weakSubscribeHorizontal" v-show="!loading" key="weakSubscribeHorizontal" class="weak-subscribe-wrap--horizontal" :style="weakSubscribeStyle" @tap="weakSubscribeEv">
+          <p v-for="i in weakSubscribeHorizontalNum" class="weak-subscribe--horizontal weak-subscribe" :key="'weakSubscribeHorizontalText-' + i">
             {{ weakSubscribeText[i % weakSubscribeText.length] }}
           </p>
         </v-touch>
 
         <!-- 竖版 -->
-        <v-touch
-          v-else
-          v-show="!loading"
-          key="weakSubscribeVertical"
-          @tap="weakSubscribeEv"
-        >
+        <v-touch v-else v-show="!loading" key="weakSubscribeVertical" @tap="weakSubscribeEv">
           <p class="weak-subscribe--vertical weak-subscribe">
             {{ weakSubscribeTextRandom() }}
           </p>
@@ -99,11 +50,7 @@
 
       <template v-if="guidepersonalaccount && !crm_guide_pool">
         <!-- 微点需求 -->
-        <v-touch
-          v-show="!loading"
-          key="weakSubscribeVertical"
-          @tap="wdQrcodeEv('text')"
-        >
+        <v-touch v-show="!loading" key="weakSubscribeVertical" @tap="wdQrcodeEv('text')">
           <p class="weak-subscribe--vertical weak-subscribe">
             {{ guidepersonalaccount.title }}
           </p>
@@ -112,11 +59,7 @@
 
       <!-- crm_guide_pool -->
       <template v-if="crm_guide_pool">
-        <v-touch
-          v-show="!loading"
-          key="weakSubscribeVertical"
-          @tap="wdQrcodeEv('text')"
-        >
+        <v-touch v-show="!loading" key="weakSubscribeVertical" @tap="wdQrcodeEv('text')">
           <p class="weak-subscribe--vertical weak-subscribe">
             {{ crm_guide_pool.title }}
           </p>
@@ -126,22 +69,11 @@
       <!-- 关注二维码 -->
       <template v-if="subscribeQRcode && isChannel123">
         <!-- 横版 -->
-        <v-touch
-          class="subscribe-qrcode"
-          v-if="subscribeQRcodeHorizontal"
-          v-show="!loading"
-          @tap="toSubscribe"
-        >
+        <v-touch class="subscribe-qrcode" v-if="subscribeQRcodeHorizontal" v-show="!loading" @tap="toSubscribe">
           <img :src="subscribeQrcodeImg" alt />
         </v-touch>
         <!-- 竖版 -->
-        <v-touch
-          class="subscribe-qrcode"
-          slot="ufooter"
-          v-show="!loading"
-          @tap="toSubscribe"
-          v-else
-        >
+        <v-touch class="subscribe-qrcode" slot="ufooter" v-show="!loading" @tap="toSubscribe" v-else>
           <img :src="subscribeQrcodeImg" alt />
         </v-touch>
       </template>
@@ -150,12 +82,7 @@
         <v-touch slot="ufooter" class="title_list">
           <div class="title">猜你喜欢</div>
           <div class="title-list-box">
-            <v-touch
-              class="title-item"
-              v-for="(t, i) in text.push_title"
-              :key="i"
-              @tap="jumpNovel(t.link)"
-            >
+            <v-touch class="title-item" v-for="(t, i) in text.push_title" :key="i" @tap="jumpNovel(t.link)">
               <p>{{ t.title }}</p>
               <img :src="t.img" :alt="t.title" />
             </v-touch>
@@ -164,11 +91,7 @@
       </template>
       <!-- 优先级最高 轮播显示 -->
       <template v-if="showPriorityAd && pddAdArr.length">
-        <mt-swipe
-          slot="ufooter"
-          v-show="!loading"
-          class="reader-footer__banners"
-        >
+        <mt-swipe slot="ufooter" v-show="!loading" class="reader-footer__banners">
           <mt-swipe-item v-for="(ad, index) in pddAdArr" :key="index">
             <v-touch @tap="pddActivity(index)">
               <img v-lazy="ad['pic-url']" alt="" />
@@ -178,11 +101,7 @@
       </template>
       <!-- 活动添加 -->
       <template v-if="banners.length">
-        <mt-swipe
-          slot="ufooter"
-          v-show="!loading"
-          class="reader-footer__banners"
-        >
+        <mt-swipe slot="ufooter" v-show="!loading" class="reader-footer__banners">
           <mt-swipe-item v-for="(b, index) in banners" :key="index">
             <v-touch @tap="activeEv(index)">
               <img v-lazy="b.img" alt="" />
@@ -210,18 +129,10 @@
       <!-- 底部评价功能 -->
       <template v-if="showComment">
         <div class="click-box">
-          <v-touch
-            class="click-box__item"
-            :class="[chooseTap === 'dislike' ? 'cur' : '']"
-            @tap="uploadTap('dislike')"
-          >
+          <v-touch class="click-box__item" :class="[chooseTap === 'dislike' ? 'cur' : '']" @tap="uploadTap('dislike')">
             <span class="tap-icon"></span>差评
           </v-touch>
-          <v-touch
-            class="click-box__item"
-            :class="[chooseTap === 'favor' ? 'cur' : '']"
-            @tap="uploadTap('favor')"
-          >
+          <v-touch class="click-box__item" :class="[chooseTap === 'favor' ? 'cur' : '']" @tap="uploadTap('favor')">
             <span class="zan-icon"></span>好看
           </v-touch>
         </div>
@@ -229,9 +140,7 @@
 
       <!-- 引导收藏 -->
       <template>
-        <v-touch class="click-toCollection" @tap="showCollectionWrap = true"
-          >&gt;&gt;点击此处,收藏本书&lt;&lt;</v-touch
-        >
+        <v-touch class="click-toCollection" @tap="showCollectionWrap = true">&gt;&gt;点击此处,收藏本书&lt;&lt;</v-touch>
       </template>
 
       <!-- 引导文字链 -->
@@ -254,41 +163,23 @@
       </template>
       <!-- 引导活动banner -->
       <template v-if="guidepersonalaccount.banner && !crm_guide_pool">
-        <v-touch
-          slot="ufooter"
-          class="active_img"
-          @tap="wdQrcodeEv('banner')"
-          style="padding-bottom: .2rem"
-        >
+        <v-touch slot="ufooter" class="active_img" @tap="wdQrcodeEv('banner')" style="padding-bottom: .2rem">
           <img :src="guidepersonalaccount.banner" />
         </v-touch>
       </template>
       <!-- crm_guide_pool banner -->
       <template v-if="crm_guide_pool">
-        <v-touch
-          slot="ufooter"
-          class="active_img"
-          @tap="wdQrcodeEv('banner')"
-          style="padding-bottom: .2rem"
-        >
+        <v-touch slot="ufooter" class="active_img" @tap="wdQrcodeEv('banner')" style="padding-bottom: .2rem">
           <img :src="crm_guide_pool.banner" />
         </v-touch>
       </template>
     </x-reader>
     <div class="reader-loading" v-show="loading">
-      <mt-spinner
-        class="reader-loading-icon"
-        type="fading-circle"
-        color="#32a1ff"
-      ></mt-spinner>
+      <mt-spinner class="reader-loading-icon" type="fading-circle" color="#32a1ff"></mt-spinner>
     </div>
     <div class="reader-guide" v-if="new_reader && !hideGuide">
       <transition name="fade" @after-leave="new_reader_guide2 = true">
-        <div
-          class="reader-guide-1"
-          v-if="new_reader_guide1"
-          @click="new_reader_guide1 = false"
-        >
+        <div class="reader-guide-1" v-if="new_reader_guide1" @click="new_reader_guide1 = false">
           <div class="reader-guide-1-1"></div>
           <div class="reader-guide-1-2"></div>
           <div class="reader-guide-1-3"></div>
@@ -296,9 +187,7 @@
             <img src="https://cdn-novel.bookkks.com/static/img/uppage.png" />
           </div>
           <div class="reader-guide-1-5">
-            <img
-              src="https://cdn-novel.bookkks.com/static/img/readermiddel.png"
-            />
+            <img src="https://cdn-novel.bookkks.com/static/img/readermiddel.png" />
           </div>
           <div class="reader-guide-1-6">
             <img src="https://cdn-novel.bookkks.com/static/img/downpage.png" />
@@ -309,35 +198,18 @@
         </div>
       </transition>
       <transition name="fade" @after-leave="new_reader = false">
-        <div
-          v-if="new_reader_guide2"
-          @click="new_reader_guide2 = false"
-          class="reader-guide-2"
-        >
+        <div v-if="new_reader_guide2" @click="new_reader_guide2 = false" class="reader-guide-2">
           <img src="https://cdn-novel.bookkks.com/static/img/readremind.png" />
         </div>
       </transition>
     </div>
-    <div
-      class="share"
-      @touchmove.prevent
-      v-show="isshowshare"
-      @click="isshowshare = !isshowshare"
-    >
+    <div class="share" @touchmove.prevent v-show="isshowshare" @click="isshowshare = !isshowshare">
       <img src="../assets/分享.png" />
     </div>
-    <div
-      :class="['ad-status', { 'with-no-activity': !active }]"
-      v-if="showAdImg"
-      @click="toggleAdType($event)"
-    >
+    <div :class="['ad-status', { 'with-no-activity': !active }]" v-if="showAdImg" @click="toggleAdType($event)">
       <img :src="adStatusImg" />
     </div>
-    <div
-      class="coupon-entry__wrap"
-      v-if="showCouponEntry && guidepersonalaccount"
-      @click="wdQrcodeEv('reader_float')"
-    >
+    <div class="coupon-entry__wrap" v-if="showCouponEntry && guidepersonalaccount" @click="wdQrcodeEv('reader_float')">
       <img src="../assets/coupon-entry.png" alt="" />
     </div>
     <!-- 签到提示入口 -->
@@ -349,11 +221,7 @@
     </template> -->
     <!-- 收藏引导入口 -->
     <template v-if="showCollectionWrap">
-      <div
-        class="sign-notice__wrap"
-        @click="showCollectionWrap = false"
-        @touchmove.prevent
-      >
+      <div class="sign-notice__wrap" @click="showCollectionWrap = false" @touchmove.prevent>
         <img :src="isAndroid ? collectAndroidBg : collectIOSBg" alt="" />
       </div>
     </template>
@@ -420,7 +288,7 @@ import useWxConfig from "../util/share";
 // import chapter from "../components/reader/chapter.js";
 
 // 异步加载广告sdk
-function loadAdJs() {
+function loadAdJs () {
   return new Promise((resolve, reject) => {
     var script = document.createElement("script");
     script.type = "text/javascript";
@@ -443,7 +311,7 @@ export default {
   components: {
     "x-reader": XReader
   },
-  data() {
+  data () {
     return {
       showFans: false,
       readerOptions: bus.preset,
@@ -506,30 +374,30 @@ export default {
     };
   },
   computed: {
-    chapterText() {
+    chapterText () {
       return this.text.content;
     },
-    adStatusImg() {
+    adStatusImg () {
       return this.adType === "1" ? this.isOrder : this.isFree;
     },
-    showAdImg() {
+    showAdImg () {
       return (
         window.options.adTargetId &&
         this.bookdetail.charge_type === "CHAPTER" &&
         this.text.is_show_ad
       );
     },
-    adBannerUrl() {
+    adBannerUrl () {
       let randomIndex = window.options.pdd_ad[this.randomBannerIndex];
       if (randomIndex) {
         return AD_BANNER_URL + randomIndex + ".jpg";
       } else return "";
     },
-    isAndroid() {
+    isAndroid () {
       let u = navigator.userAgent;
       return u.indexOf("iPhone") === -1;
     },
-    showCouponEntry() {
+    showCouponEntry () {
       return (
         this.text.sequence >= 7 &&
         window.options.distribution_channel_id === 6687
@@ -537,7 +405,7 @@ export default {
     }
   },
   watch: {
-    text(newt, oldt) {
+    text (newt, oldt) {
       // if (newt.is_show_share_button === 1) {
       //   let href = window.location.href;
       //   if (this.isIphone()) {
@@ -577,7 +445,7 @@ export default {
         useWxConfig(wx, configuration);
       }
     },
-    disableAdMode(val) {
+    disableAdMode (val) {
       if (val) {
         console.log("ad disabled");
         this.showAdStatus = false;
@@ -585,14 +453,14 @@ export default {
         this.initPayType();
       }
     },
-    adType(v) {
+    adType (v) {
       if (v === "1") {
         this.justShowAds(this.text.is_visiable_ad);
       }
     }
   },
   methods: {
-    closeBanner() {
+    closeBanner () {
       let readQuery = localStorage.getItem("readQuery");
       if (readQuery) {
         readQuery = JSON.parse(readQuery);
@@ -601,7 +469,7 @@ export default {
       }
       this.showFans = false;
     },
-    share() {
+    share () {
       this.isshowshare = !this.isshowshare;
       getRecordShare(this.$route.query.bid, this.$route.query.cid).then(r => {
         //   this.$router.push({
@@ -615,31 +483,29 @@ export default {
         // })
       });
     },
-    toShare() {
+    toShare () {
       let { share_domain, uid, distribution_channel_id } = window.options;
       let { bid, cid } = this.$route.query;
       location.href = `${share_domain}?bid=${bid}&cid=${cid}&uid=${uid}&distribution_channel_id=${distribution_channel_id}`;
     },
-    activeEv(index) {
-      window.location.href = `${
-        this.banners[index].jump_url
-      }&redirect_url=${encodeURIComponent(window.location.href)}`;
+    activeEv (index) {
+      window.location.href = `${this.banners[index].jump_url
+        }&redirect_url=${encodeURIComponent(window.location.href)}`;
     },
-    bannerSubEv() {
-      window.location.href = `${
-        this.bannerSubText.jump_url
-      }&redirect_url=${encodeURIComponent(window.location.href)}`;
+    bannerSubEv () {
+      window.location.href = `${this.bannerSubText.jump_url
+        }&redirect_url=${encodeURIComponent(window.location.href)}`;
     },
-    pddActivity(i) {
+    pddActivity (i) {
       let token = this.pddAdArr[i].token;
       const { uid } = window.options;
       window.location.href = `${PDD_AD_REDIRECT}?token=${token}&uid=${uid}`;
     },
-    toAppAdPage() {
+    toAppAdPage () {
       window.location.href = `${window.location.origin +
         window.options.appad_url}`;
     },
-    getUuid() {
+    getUuid () {
       var s = [];
       var hexDigits = "0123456789abcdef";
       for (var i = 0; i < 36; i++) {
@@ -652,7 +518,7 @@ export default {
       var uuid = s.join("");
       return uuid;
     },
-    go(name) {
+    go (name) {
       switch (name) {
         case "back":
           history.back(-1);
@@ -677,21 +543,21 @@ export default {
             name: BookCatalog.name,
             query: this.text.bid
               ? {
-                  id: this.text.bid,
-                  sequence: this.text.sequence
-                }
+                id: this.text.bid,
+                sequence: this.text.sequence
+              }
               : { id: this.$route.query.bid }
           });
           break;
       }
     },
-    addShelf() {
+    addShelf () {
       addShelf(this.text.bid).then(r => {
         this.is_on = true;
         this.$Toast("加入书架成功");
       });
     },
-    next() {
+    next () {
       // 静默复制
       this.doCopy();
       // 显示广告的时候 不允许下一章阅读
@@ -708,7 +574,7 @@ export default {
       } else {
         if (this.text.next_cid) {
           this.$router.replace({
-            path:`/reader/${this.getUuid()}`,
+            path: `/reader/${this.getUuid()}`,
             query: {
               bid: this.text.bid,
               cid: this.text.next_cid
@@ -724,7 +590,7 @@ export default {
         }
       }
     },
-    prev() {
+    prev () {
       if (this.text.prev_cid) {
         this.$router.replace({
           name: Reader.name,
@@ -740,7 +606,7 @@ export default {
         this.$Toast("第一章!");
       }
     },
-    direction(val) {
+    direction (val) {
       if (val === "horizontal" && !localStorage.getItem("old_reader")) {
         this.bus.$emit("menu");
         localStorage.setItem("old_reader", "true");
@@ -751,7 +617,7 @@ export default {
       }
       this.weakSubscribeStyle = {};
     },
-    subscribe({ bid, chapter_id: cid }) {
+    subscribe ({ bid, chapter_id: cid }) {
       if (this.$route.query.bid == bid && this.$route.query.cid == cid) {
         this.getContent(this.$route.query.bid, this.$route.query.cid)
           .then(r => {
@@ -770,7 +636,7 @@ export default {
         });
       }
     },
-    getContent(bid, cid, next, from, code) {
+    getContent (bid, cid, next, from, code) {
       //由于beforeRouteUpdate钩子函数会调用getContent,所以路由或者页面跳转不应该在在此函数,不然会造beforeRouteUpdate钩子函数的next不被调用
       /*
         错误处理
@@ -1003,19 +869,19 @@ export default {
           return r;
         });
     },
-    weakSubscribeTextRandom() {
+    weakSubscribeTextRandom () {
       return this.weakSubscribeText[Math.floor(Math.random() * 3)];
     },
-    weakSubscribeEv() {
+    weakSubscribeEv () {
       WeakSubscribe();
     },
-    wdQrcodeEv(from) {
+    wdQrcodeEv (from) {
       location.href = this.guidepersonalaccount.link + "&p_src=" + from;
     },
-    crmEvent() {
+    crmEvent () {
       location.href = this.guidepersonalaccount.link;
     },
-    horizontalMounted(page) {
+    horizontalMounted (page) {
       if (this.weakSubscribe) {
         this.weakSubscribeHorizontal = true;
         this.weakSubscribeStyle = {
@@ -1026,12 +892,12 @@ export default {
       if (this.subscribeQRcode) this.subscribeQRcodeHorizontal = true;
       if (this.active) this.active_horizontal = true;
     },
-    verticalMounted() {
+    verticalMounted () {
       this.weakSubscribeHorizontal = false;
       this.subscribeQRcodeHorizontal = false;
       this.active_horizontal = false;
     },
-    toSubscribe() {
+    toSubscribe () {
       getweakSubscribeQR().then(r => {
         this.$router.push({
           name: Subscribe.name,
@@ -1039,10 +905,10 @@ export default {
         });
       });
     },
-    getChapterComment(bid, cid) {
+    getChapterComment (bid, cid) {
       return getChapterComment(bid, cid);
     },
-    uploadTap(type) {
+    uploadTap (type) {
       // TODOS 需要选择评论类型并上传到服务器
       if (this.canTap) return;
       let { bid, cid } = this.$route.query;
@@ -1052,15 +918,15 @@ export default {
         localStorage.setItem(cid, this.chooseTap);
       });
     },
-    resetChooseTap() {
+    resetChooseTap () {
       this.chooseTap = "";
     },
-    showGiftPopup() {
+    showGiftPopup () {
       popupGift({ bid: this.text.bid }).catch(e => {
         this.$router.push({ name: Pay.name });
       });
     },
-    jumpNovel(url) {
+    jumpNovel (url) {
       let options = {
         bg: this.readerOptions.bg,
         font: this.readerOptions.font.default,
@@ -1068,7 +934,7 @@ export default {
       };
       location.href = `${url}&bg=${options.bg}&font=${options.font}&night=${options.night}`;
     },
-    justifyRouter(router) {
+    justifyRouter (router) {
       if (!router.query.bid) {
         this.$router.replace("/");
         return false;
@@ -1094,12 +960,12 @@ export default {
       }
       return true;
     },
-    isIphone() {
+    isIphone () {
       const u = navigator.userAgent;
       // return u.indexOf("iPhone") !== -1;
       return true;
     },
-    jssdkinit(config, share_url, share_info) {
+    jssdkinit (config, share_url, share_info) {
       wx.config({
         debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
         appId: config.appId, // 必填,公众号的唯一标识
@@ -1114,16 +980,16 @@ export default {
         ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
       });
       var that = this;
-      wx.ready(function() {
+      wx.ready(function () {
         wx.onMenuShareTimeline({
           title: share_info.book_name + ":" + that.bookdetail.book_summary,
           desc: "我正在阅读《" + share_info.book_name + "》,超好看!",
           link: share_url, // 分享链接
           imgUrl: share_info.cover_url,
-          success: function() {
+          success: function () {
             // this.$Toast("分享成功");
           },
-          cancel: function() {
+          cancel: function () {
             // this.$Toast("取消分享");
           }
         });
@@ -1132,10 +998,10 @@ export default {
           desc: that.bookdetail.book_summary,
           link: share_url, // 分享链接
           imgUrl: share_info.cover_url,
-          success: function() {
+          success: function () {
             // this.$Toast("分享成功");
           },
-          cancel: function() {
+          cancel: function () {
             // this.$Toast("取消分享");
           }
         });
@@ -1144,10 +1010,10 @@ export default {
           desc: that.bookdetail.book_summary,
           link: share_url, // 分享链接
           imgUrl: share_info.cover_url,
-          success: function() {
+          success: function () {
             // this.$Toast("分享成功");
           },
-          cancel: function() {
+          cancel: function () {
             // this.$Toast("取消分享");
           }
         });
@@ -1156,19 +1022,19 @@ export default {
           desc: that.bookdetail.book_summary,
           link: share_url, // 分享链接
           imgUrl: share_info.cover_url,
-          success: function() {
+          success: function () {
             // this.$Toast("分享成功");
           },
-          cancel: function() {
+          cancel: function () {
             // this.$Toast("取消分享");
           }
         });
       });
-      wx.error(function(res) {
+      wx.error(function (res) {
         console.log(res);
       });
     },
-    observerAd(book) {
+    observerAd (book) {
       if (window.adcombo) {
         console.log(book);
         // 配置sdk
@@ -1211,7 +1077,7 @@ export default {
         adcombo.run();
       }
     },
-    showAdObserve(showAdCondition) {
+    showAdObserve (showAdCondition) {
       if (showAdCondition) {
         console.log("show monitor");
         // 显示监听器 并开启看广告任务
@@ -1220,7 +1086,7 @@ export default {
         // adcombo.monitor.show();
       }
     },
-    initAd() {
+    initAd () {
       if (window.adcombo && this.showAdStatus) {
         setTimeout(() => {
           // window.adcombo.scanAdSlot();
@@ -1232,7 +1098,7 @@ export default {
         }, 50);
       }
     },
-    hitAdTarget() {
+    hitAdTarget () {
       if (this.adType === "2") return false;
       if (
         this.bookdetail.charge_type === "CHAPTER" &&
@@ -1242,7 +1108,7 @@ export default {
       }
       return false;
     },
-    toggleAdType(e) {
+    toggleAdType (e) {
       if (this.adLimit) {
         this.$Toast("今日次数已用完,明日可继续免费阅读");
         return;
@@ -1260,7 +1126,7 @@ export default {
       }
       localStorage.setItem("adType", this.adType);
     },
-    initFreeType() {
+    initFreeType () {
       this.adType = "1";
       this.showAdStatus = !!this.text.is_show_ad;
       this.$set(this, "showAdIframe", !!this.text.is_show_ad);
@@ -1270,7 +1136,7 @@ export default {
       if (this.hitAdTarget()) this.initAd();
       console.log("init free version --- see ads");
     },
-    initPayType() {
+    initPayType () {
       this.adType = "2";
       this.showAdStatus = false;
       this.$set(this, "showAdIframe", false);
@@ -1282,7 +1148,7 @@ export default {
       }
       console.log("init pay version -- pay coins");
     },
-    limitAdTimes() {
+    limitAdTimes () {
       // 每日广告次数限制
       let times = parseInt(localStorage.getItem("ad_times") || 0);
       let ad_today = new Date().toLocaleDateString();
@@ -1305,7 +1171,7 @@ export default {
       }
       localStorage.setItem("adType", this.adType);
     },
-    initLimitAdTimes() {
+    initLimitAdTimes () {
       let times = parseInt(localStorage.getItem("ad_times") || 0);
       let ad_today = new Date().toLocaleDateString();
       let ad_days = localStorage.getItem("ad_days") || ad_today;
@@ -1327,18 +1193,18 @@ export default {
       localStorage.setItem("ad_days", ad_today);
       localStorage.setItem("adType", this.adType);
     },
-    recordReadChapter() {
+    recordReadChapter () {
       localStorage.setItem("rc", this.$route.query.cid);
     },
-    clearReadChapter() {
+    clearReadChapter () {
       localStorage.removeItem("rc");
     },
-    reportStart(chapterId) {
+    reportStart (chapterId) {
       if (window.adcombo) {
         window.adcombo.reportReadStart(chapterId);
       }
     },
-    reportEnd(chapterId, isShowAd) {
+    reportEnd (chapterId, isShowAd) {
       console.log(chapterId, isShowAd);
       if (window.adcombo && window.options.adTargetId) {
         window.adcombo
@@ -1369,12 +1235,12 @@ export default {
           .catch(e => console.log(e));
       }
     },
-    getAdTimes() {
+    getAdTimes () {
       let times = localStorage.getItem("ad_times");
       if (times && parseInt(times) >= AD_MAX_LIMIT_TIMES) return false;
       return true;
     },
-    justShowAds(status) {
+    justShowAds (status) {
       this.showAdIframe = !!status;
       if (this.showAdIframe && window.adcombo) {
         console.log("scan ads");
@@ -1387,14 +1253,14 @@ export default {
         }, 80);
       }
     },
-    getRandomBannerIndex() {
+    getRandomBannerIndex () {
       let banner_len = window.options.pdd_ad.length;
       if (banner_len) {
         let random = Math.ceil(Math.random() * banner_len);
         this.randomBannerIndex = random - 1;
       } else return banner_len;
     },
-    getReaderAdBanner() {
+    getReaderAdBanner () {
       let uid = window.options.uid;
       getReaderAdBanner()
         .then(r => {
@@ -1410,7 +1276,7 @@ export default {
           this.pddAdArr = [];
         });
     },
-    mergeBanner() {
+    mergeBanner () {
       getMergeBanner()
         .then(r => {
           if (r.img) {
@@ -1420,14 +1286,14 @@ export default {
         })
         .catch(e => console.log(e));
     },
-    replaceURLAfterChange(cid, newCid) {
+    replaceURLAfterChange (cid, newCid) {
       console.log("cid", cid);
       console.log("newCid", newCid);
       let url = window.location.href.replace(`cid=${cid}`, `cid=${newCid}`);
       console.log("replace url", url);
       window.history.replaceState({}, "", url);
     },
-    fiveTemplateLogic(five_obj) {
+    fiveTemplateLogic (five_obj) {
       if (!five_obj) return;
       let five_template_prev_clicked = localStorage.getItem("5_template_day");
       if (five_template_prev_clicked) {
@@ -1437,11 +1303,11 @@ export default {
         else this.five_template_clicked = false;
       } else this.five_template_clicked = false;
     },
-    tapFiveTemplate() {
+    tapFiveTemplate () {
       localStorage.setItem("5_template_day", new Date().toDateString());
       location.href = this.five_template.url;
     },
-    closeFiveTemplate() {
+    closeFiveTemplate () {
       if (this.inTaping) return;
       this.inTaping = true;
       this.$refs.five_template.style.height = "0";
@@ -1453,12 +1319,12 @@ export default {
         this.inTaping = false;
       }, 300);
     },
-    setCopyVal() {
+    setCopyVal () {
       // 如果本身已经有了 则不需要重复获取
       if (this.copyVal) return;
       this.copyVal = getRandomCode();
     },
-    doCopy() {
+    doCopy () {
       // 复制
       let is_need_copy = needToCopy();
       if (is_need_copy)
@@ -1467,7 +1333,7 @@ export default {
       else this.copyVal = "";
     }
   },
-  async created() {
+  async created () {
     if (!this.justifyRouter(this.$route)) return;
     this.href = window.location.href;
     // 获取书籍详情
@@ -1564,7 +1430,7 @@ export default {
       });
     window.options.self_pa_ad_switch && this.getReaderAdBanner();
   },
-  async beforeRouteEnter(to, from, next) {
+  async beforeRouteEnter (to, from, next) {
     // * 初次进入加载iframe
     loadIframeAsync();
     let detail = null;
@@ -1596,7 +1462,7 @@ export default {
     }
     next();
   },
-  beforeRouteUpdate(to, from, next) {
+  beforeRouteUpdate (to, from, next) {
     // * 移除iframe
     removeIframe();
 
@@ -1647,7 +1513,7 @@ export default {
       });
     window.options.self_pa_ad_switch && this.getReaderAdBanner();
   },
-  beforeRouteLeave(to, from, next) {
+  beforeRouteLeave (to, from, next) {
     if (to.name !== BookCatalog.name && to.name !== Subscribe.name) {
       // 清除所有和章节相关的缓存
       clearStorageChapter();
@@ -1666,7 +1532,7 @@ export default {
     removeIframe();
     next();
   },
-  beforeMount() {
+  beforeMount () {
     // 重置lazyload设置
     this.$Lazyload.config({
       preLoad: 1.3,
@@ -1674,11 +1540,11 @@ export default {
       error: ""
     });
   },
-  mounted() {
+  mounted () {
     this.bus = this.$refs.reader.getBus();
     this.mergeBanner();
   },
-  destroyed() {
+  destroyed () {
     document.title = window.options.title;
   }
 };
@@ -1776,21 +1642,21 @@ export default {
     }
 
     .tap-icon {
-      background: url("~@/assets/tap.png") center / contain no-repeat;
+      background: url('~@/assets/tap.png') center / contain no-repeat;
     }
 
     .zan-icon {
-      background: url("~@/assets/zan.png") center / contain no-repeat;
+      background: url('~@/assets/zan.png') center / contain no-repeat;
     }
   }
 
   .click-box__item.cur {
     .tap-icon {
-      background: url("~@/assets/tap-check.png") center / contain no-repeat;
+      background: url('~@/assets/tap-check.png') center / contain no-repeat;
     }
 
     .zan-icon {
-      background: url("~@/assets/zan-check.png") center / contain no-repeat;
+      background: url('~@/assets/zan-check.png') center / contain no-repeat;
     }
   }
 }

+ 21 - 35
src/view/sign.vue

@@ -1,39 +1,31 @@
 <template>
   <div class="sign-page">
+    <ad-popup popup_position="signIn"></ad-popup>
     <x-header></x-header>
     <div class="sign-container">
-      <img class="sign-bg"
-           src="https://cdn-novel.bookkks.com/static/img/sign-bg.609a51f.jpg"
-           alt="">
+      <img class="sign-bg" src="https://cdn-novel.bookkks.com/static/img/sign-bg.609a51f.jpg" alt="">
       <p class="sign-num__total">连续签到{{signDays}}天</p>
       <div class="sign-result__box">
         <p class="sign-notice">{{getNoticeText()}}</p>
         <div class="sign-day__list">
           <template v-for="i in 3">
-            <div class="day-box"
-                 :class="{'even-box':i%2===0}"
-                 :key="i">
-              <div class="day-item"
-                   v-for="(day, index) in signDayList.slice((i-1)*5, i*5)"
-                   :key="index">
+            <div class="day-box" :class="{'even-box':i%2===0}" :key="i">
+              <div class="day-item" v-for="(day, index) in signDayList.slice((i-1)*5, i*5)" :key="index">
                 <div :class="{
                    'line-v': index === 4,
                    'sign-img': total(i, index) < 15
                    }">
                   <template v-if="total(i, index) === 7">
                     <!-- 7天 -->
-                    <img :src="signRecord(7)"
-                         alt="">
+                    <img :src="signRecord(7)" alt="">
                   </template>
                   <template v-else-if="total(i, index) === 15">
                     <!-- 15天 -->
-                    <img :src="signRecord(15)"
-                         alt="">
+                    <img :src="signRecord(15)" alt="">
                   </template>
                   <template v-else>
                     <!-- 其他 -->
-                    <img :src="signRecord(0, i, index)"
-                         alt="">
+                    <img :src="signRecord(0, i, index)" alt="">
                   </template>
                 </div>
                 <span>第{{total(i, index)}}天</span>
@@ -41,12 +33,9 @@
             </div>
           </template>
         </div>
-        <router-link tag="div"
-                     :to="{ name: RecordSign.name }"
-                     class="to-sign__record">签到记录 &gt;</router-link>
+        <router-link tag="div" :to="{ name: RecordSign.name }" class="to-sign__record">签到记录 &gt;</router-link>
         <a href="/continue" class="to-read">
-          <img src="../assets/to_read.png"
-               alt="">
+          <img src="../assets/to_read.png" alt="">
         </a>
         <!-- <router-link tag="div"
                      :to="{ name: BookRecent.name }"
@@ -64,7 +53,7 @@ import { RecordSign, BookRecent } from "./namespace.js";
 import { toSign } from "../api";
 
 export default {
-  data() {
+  data () {
     return {
       RecordSign: RecordSign,
       BookRecent: BookRecent,
@@ -81,7 +70,7 @@ export default {
     };
   },
   methods: {
-    signRecord(specialDay = 0, i, index) {
+    signRecord (specialDay = 0, i, index) {
       // 有额外金币的签到日 7天 15天
       // signDays < 7 ? sign7 : signDays === 7 ? signToday : signed
       if (specialDay) {
@@ -97,37 +86,34 @@ export default {
           ? this.signToday
           : this.signCoin;
     },
-    getSpectialDay(day) {
+    getSpectialDay (day) {
       return day === 7 ? this.sign7 : this.sign15;
     },
-    total(i, index) {
+    total (i, index) {
       return (i - 1) * 5 + (index + 1);
     },
-    getNoticeText() {
+    getNoticeText () {
       let days = this.signDays;
       let html = "";
       switch (days) {
         case 1:
         case 2:
-          html = `今天签到赠送${
-            this.signReard
-          }书币,连续签到每日可领50书币,最高月送2000书币~`;
+          html = `今天签到赠送${this.signReard
+            }书币,连续签到每日可领50书币,最高月送2000书币~`;
           break;
         case 6:
           html = `今天签到赠送${this.signReard}书币,明日签到可以领取小礼包哦~`;
           break;
         case 7:
-          html = `今天签到赠送${
-            this.signReard
-          }书币,签到已满7日,额外送您100书币大礼包~`;
+          html = `今天签到赠送${this.signReard
+            }书币,签到已满7日,额外送您100书币大礼包~`;
           break;
         case 14:
           html = `今天签到赠送${this.signReard}书币,明日签到可以领取大礼包哦~`;
           break;
         case 15:
-          html = `今天签到赠送${
-            this.signReard
-          }书币,签到已满15日,送您150书币大礼包~`;
+          html = `今天签到赠送${this.signReard
+            }书币,签到已满15日,送您150书币大礼包~`;
           break;
         default:
           html = `今天签到赠送${this.signReard}书币,额外连续签到最高月送2000书币~`;
@@ -135,7 +121,7 @@ export default {
       return html;
     }
   },
-  created() {
+  created () {
     toSign().then(r => {
       if (!r.status) {
         this.$Toast({