xia il y a 4 ans
Parent
commit
90355ad5a8

+ 3 - 2
src/api/config.js

@@ -6,8 +6,9 @@
  * @Description: api配置文件
  */
 const apiConfig = {
-   baseURL: "https://quickapp.leyuee.com/api",
- //baseURL: "https://quickapptest.leyuee.com/api",
+   //baseURL: "https://quickapp.leyuee.com/api",
+ baseURL: "https://quickapptest.leyuee.com/api",
+ package:'com.beidao.kuaiying.zsy'
 };
 
 export default apiConfig;

+ 1 - 1
src/api/fly.js

@@ -17,7 +17,7 @@ var qs = require('qs');
 var appInfo = it.getAppInfo();
 var provider = it.getProvider();
 var appDev, sendOrderId;
-var packages = 'com.beidao.kuaiying.zsy';
+var packages = apiConfig.package;
 var requestTime = 0;
 
 

+ 5 - 0
src/api/index.js

@@ -213,4 +213,9 @@ export const getAcitivity = token => {
 
 export const getHotMain = (pages) => {
   return fly.get("/books/hotwords", { page: pages});
+}
+
+//限免书籍
+export const getFreeBook = (sex) => {
+  return fly.get(`/books/free/${sex}`);
 }

+ 2 - 2
src/api/utils.js

@@ -8,7 +8,7 @@ import request from "@system.request";
 import media from "@system.media";
 import prompt from "@system.prompt";
 import { userOptions } from "./index"
-
+import apiConfig from "./config";
 // 获取token
 let token = null;
 let requestLoginTime = 0;
@@ -44,7 +44,7 @@ export const login = async () => {
     let loginResponed = await loginPromise();
   }
   const signKey = "a!A&AFRWT65Nb3NlklezUiqHyQAA@Z8M";
-  const packages = 'com.beidao.kuaiying.zsy';
+  const packages = apiConfig.package;
   let device_info = (await device.getInfo()).data;
   let androidid = (await device.getUserId()).data;
   let send_order_id = (await storage.get({ key: "send_order_id" })).data;

BIN
src/assets/imgs/home_fl.png


BIN
src/assets/imgs/home_free.png


BIN
src/assets/imgs/home_rank.png


+ 9 - 1
src/assets/less/shelf.less

@@ -1,7 +1,15 @@
 .shelf-wrap {
   // border-top: 36px solid #f7f7f7;
   flex-direction: column;
-
+  .blank_img{
+    width:100%;
+    height:100%;
+    align-items: center;
+    justify-content: center;
+    image{
+      width:500px;
+    }
+  }
   .type-bar {
     background-color: #fff;
 

+ 1 - 1
src/components/book/book.ux

@@ -76,7 +76,7 @@ export default {
           chapter_id: book.recent_cid
         }
       })
-      return
+      return;
     }
     if (this.similar) {
       router.replace({

+ 7 - 0
src/manifest.json

@@ -86,6 +86,9 @@
       "views/My": {
         "component": "index"
       },
+      "views/Free": {
+        "component": "index"
+      },
       "views/Reader": {
         "component": "index"
       },
@@ -151,6 +154,10 @@
         "titleBarText": "任务中心",
         "menu": false
       },
+      "views/Free": {
+        "titleBarText": "限时免费",
+        "menu": false
+      },
       "views/Activity": {
         "titleBarText": "活动中心",
         "menu": false

+ 29 - 5
src/views/Activity/index.ux

@@ -4,18 +4,20 @@
     <div class="stack" style="background-color: #ff8b63" if={{activity}}>
       <image src="https://cdn-novel.iycdm.com/h5/channelActivity/activity-2020-04-17/20200417173207-bg.jpeg"></image>
       <div class="contain">
-        <text class="promotion-title">活动时间:{{activity.startTime.substring(0,10)}} 至 {{activity.endTime.substring(0,10)}}</text>
+        <text class="promotion-title" if="{{activity.isForever!=='1'}}">活动时间:{{activity.startTime.substring(0,10)}} 至 {{activity.endTime.substring(0,10)}}</text>
         <div class="charge-item {{currentIdx==$idx?'charge-on':''}}" for="{{activity.products}}" @click="chooseItem($item,$idx)">
           <block if="{{$item.type=='YEAR_ORDER'}}">
+             <text class="limit {{currentIdx==$idx?'checked':''}}">限充{{$item.limit}}次</text>
             <text class="title"><span>365包年</span></text>
             <text class="desc">全站小说免费阅读</text>
           </block>
           <block elif="{{$item.type=='QUARTER'}}">
+             <text class="limit {{currentIdx==$idx?'checked':''}}">限充{{$item.limit}}次</text>
             <text class="title"><span>98元包季</span></text>
             <text class="desc">全站小说免费阅读</text>
-           
           </block>
           <block else>
+            <text class="limit {{currentIdx==$idx?'checked':''}}">限充{{$item.limit}}次</text>
             <text class="title">充<span>{{$item.price}}元</span>得<span>{{$item.total}}书币</span></text>
             <text class="desc">多得{{$item.given}}书币</text>
           </block>
@@ -99,10 +101,11 @@ export default {
     return false;
   },
   closeMask() {
+    let a = 'this.token'
     this.showPay = false;
   },
   async getAcitvy() {
-    let activity = await getAcitivity(this.token);
+    let activity = await getAcitivity('8148bcb29074dafe1edd21dc06db9249');
      this.activity = activity;
     this.currentProduct = this.activity.products[0];
   },
@@ -123,10 +126,10 @@ export default {
     let product_id = this.currentProduct.product_id;
     let ret = null;
     if (cur_pay_type == 1) {
-      ret = await configAliPay({ product_id: product_id, send_order_id: this.send_order_id });
+      ret = await configAliPay({ product_id: product_id, send_order_id: this.send_order_id, activity_token:this.token });
     }
     else {
-      ret = await configWxPay({ product_id: product_id, send_order_id: this.send_order_id });
+      ret = await configWxPay({ product_id: product_id, send_order_id: this.send_order_id,  activity_token:this.token});
     }
     // 成功支付后的回调操作
     if (ret.code === "9000") this.showWaitingWrap(ret);
@@ -272,6 +275,27 @@ export default {
   image {
     width: 100%;
   }
+  .charge-item{
+    position: relative;
+    .limit{
+      width: 100px;
+      height: 38px;
+      font-size: 20px;
+      line-height: 38px;
+      text-align: center;
+      background-color: #E6E6E6;
+      color: #B3B3B3;
+      border-bottom-left-radius: 10px;
+      border-top-right-radius: 10px;
+      position: absolute;
+      right:0;
+      top:0;
+    }
+    .checked{
+       color:#fff;
+      background-color: #E82B2F;
+    }
+  }
   .rule {
     flex-direction: column;
     margin-top: 30px;

+ 17 - 1
src/views/Catalog/index.ux

@@ -26,7 +26,9 @@ const PER_PAGE_NUM = 50;
 export default {
   protected: {
     bid: "",
+    chapter_id:'',
     chapter_sequence: "",
+    fromReader:false,
   },
   private: {
     list: [],
@@ -86,7 +88,7 @@ export default {
       })
       return
     }
-    router.push({
+    router.replace({
       uri: "/views/Reader",
       params: {
         bid: info.bid,
@@ -138,6 +140,20 @@ export default {
         this.meta = r.meta;
       }
     })
+  },
+  onBackPress() {
+    if(this.fromReader){
+      router.replace({
+      uri: "/views/Reader",
+      params: {
+        bid: this.bid,
+        chapter_id: this.chapter_id
+      }
+    })
+    }else{
+      router.back();
+    }
+    return true;
   }
 }
 </script>

+ 186 - 0
src/views/Free/index.ux

@@ -0,0 +1,186 @@
+<import name="x-book" src="../../components/book/book.ux"></import>
+<template>
+  <list id="free" class="free-wrap" v-if="list.length>0 && isInit">
+    <list-item type="tab">
+      <div class="type-bar">
+        <block for="type in typeList">
+          <div class="type-item" @click="typeChange(type.index)">
+            <text class="{{type.index === current ? 'cur' : ''}}">{{type.name}}</text>
+            <text class="choose-bar" show="{{type.index === current}}"></text>
+          </div>
+        </block>
+      </div>
+    </list-item>
+    <list-item type="banner" class="free-title">
+      <text>限时免费结束时间:{{endTime}}</text>
+    </list-item>
+    <block for="list">
+      <list-item type="books-item" class="book-list__wrap book-list__wrap--multi" >
+        <div class="book-list__multi">
+            <block for="book in list">
+              <div class="book-item">
+                <x-book multi="{{true}}" width="{{150}}" book="{{book}}">
+                  <div class="book-info__multi">
+                    <text class="name">{{book.book_name}}</text>
+                    <text class="intro">{{book.intro}}</text>
+                  </div>
+                </x-book>
+              </div>
+            </block>
+          </div>
+        </list-item>
+    </block>
+  </list>
+</template>
+
+<script>
+import { getFreeBook } from "../../api";
+import router from '@system.router';
+import prompt from '@system.prompt';
+
+
+
+export default {
+  protected: {
+    bid: "",
+    chapter_sequence: "",
+  },
+  private: {
+    isInit:false,
+    list: [],
+    endTime:'',
+    typeList: [
+      {
+        name: "男生",
+        index: 1
+      },
+      {
+        name: "女生",
+        index: 2
+      }
+    ],
+    current:2
+  },
+  onInit() {
+    this.getBookList(this.current)
+  },
+
+  typeChange(index) {
+    this.current = index;
+    this.getBookList(index);
+
+  },
+  async getBookList(index = 2){
+    let data = await getFreeBook(index);
+    this.list = data.list;
+    this.endTime = data.end_time;
+    this.isInit = true;
+  },
+
+
+}
+</script>
+
+<style lang="less">
+.free-title {
+  margin: 30px 0;
+  justify-content: center;
+  text {
+    width: 600px;
+    height: 60px;
+    line-height: 60px;
+    text-align: center;
+    background-color: rgba(239, 89, 82, 0.1);
+    border: 1px solid rgba(239, 89, 82, 1);
+    color: #ef5952;
+    font-size: 26px;
+    border-radius: 30px;
+  }
+}
+  .book-list__wrap {
+    background-color: #fff;
+    // margin-top: 24px;
+    padding: 0 24px;
+    flex-direction: column;
+
+    .book-list__title {
+      padding: 30px 0;
+      align-items: center;
+
+      text {
+        color: #333;
+        font-size: 32px;
+      }
+    }
+  }
+
+  .book-list {
+    flex: 1;
+    flex-direction: row;
+    flex-wrap: wrap;
+    justify-content: space-between;
+  }
+  .book-list__multi {
+    margin-top: 30px;
+    flex-direction: column;
+
+    .book-item {
+      margin-bottom: 30px;
+    }
+
+    .book-info__multi {
+      flex: 1;
+      flex-direction: column;
+      justify-content: flex-start;
+      align-items: flex-start;
+      margin-left: 38px;
+      // margin-bottom: 40px;
+
+      .name {
+        font-size: 32px;
+        color: #333;
+        lines: 1;
+        text-overflow: ellipsis;
+      }
+
+      .intro {
+        font-size: 24px;
+        color: #666;
+        lines: 3;
+        text-overflow: ellipsis;
+        margin-top: 36px;
+        line-height: 36px;
+      }
+    }
+  }
+.type-bar {
+  width: 100%;
+  .type-item {
+    flex: 1;
+    justify-content: center;
+    align-items: center;
+    flex-direction: column;
+    position: relative;
+
+    text {
+      font-size: 30px;
+      color: #999;
+      // padding: 34px 0;
+    }
+
+    .cur {
+      color: #ef5952;
+      font-size: 36px;
+      font-weight: bold;
+    }
+
+    .choose-bar {
+      width: 38px;
+      height: 4px;
+      background-color: #ef5952;
+      border-radius: 2px;
+      margin-top: 10px;
+    }
+  }
+}
+</style>

+ 25 - 5
src/views/Home/index.ux

@@ -28,8 +28,9 @@
       </list-item>
       <list-item type="entrance">
         <div class="entrance_block">
-          <image src="https://cdn-novel.iycdm.com/quickapp/activity/rank_banner.png" @click="jump('Leaderboard')"></image>
-          <image src="https://cdn-novel.iycdm.com/quickapp/activity/cate_banner.png" @click="jump('Category')"></image>
+          <div><image src="../../assets/imgs/home_fl.png" @click="jump('Category')"></image><text>分类</text></div>
+          <div><image src="../../assets/imgs/home_rank.png" @click="jump('Leaderboard')"></image><text>排行榜</text></div>
+          <div><image src="../../assets/imgs/home_rank.png" @click="jump('Free')"></image><text>限时免费</text></div>
         </div>
       </list-item>
       <block for="bookObj in list">
@@ -104,11 +105,21 @@ export default {
   },
   async onInit() {
     await this.getCityListByTabChange();
-    this.$watch('current', 'getCityListByTabChange')
+    this.$on('refreshData',this.broadevt);
+    this.$watch('current', 'getCityListByTabChange');
+    this.$watch('tabindex', 'watchPropsChange');
   },
   typeChange(index) {
     this.current = index;
   },
+  watchPropsChange(v){
+     if (v === 0) this.getCityListByTabChange(this.current);
+  },
+  async broadevt(evt){
+    if(evt.detail.current==0){
+      await this.getCityListByTabChange(this.current);
+    }
+  },
   toCategory() {
     //this.$emit('change');
     router.push({
@@ -149,9 +160,18 @@ export default {
     width: 100%;
     padding: 30px;
     display: flex;
-    justify-content: space-between;
+    justify-content: space-around;
+    div{
+      flex-direction: column;
+      text{
+        margin-top: 10px;
+        text-align: center;
+      }
+    }
     image {
-      width: 330px;
+      width:80px;
+      height:80px;
+      margin:0 auto;
     }
   }
 

+ 11 - 6
src/views/Index/index.ux

@@ -100,9 +100,11 @@ export default {
     // current: 0,
     showPopup: false,
     showActivitys: false,
+    showShortPop: false,
     showSignPop: false,
     home_show: 0,
-    home_alert:null
+    home_alert:null,
+    isInit:false,
   },
   async onInit() {
     this.$on('dispathEvt', this.changeSignPop);
@@ -141,18 +143,20 @@ export default {
     this.showActivitys = 0;
   },
   async onShow() {
-    const data = this.$app.getAppData('backfrom');
+    const hasInit = this.$app.getAppData('hasInit');
+    if(hasInit){
+      this.$broadcast('refreshData',{current:this.current});
+    }
     let device_info = (await device.getInfo()).data;
     this.brand = device_info.brand;
-    if (data == 'phone') {
+    /* if (data == 'phone') {
       this.current = 0;
       this.$app.setAppData('backfrom', '');
-    }
-
+    } */
     it.getShortCut((value) => {
       this.showShortPop = !value;
     })
-
+    this.$app.setAppData('hasInit', true);  
   },
   shortEnd(value) {
     if (value.detail.msg) {
@@ -169,6 +173,7 @@ export default {
   async getUser() {
     let user = await getUserInfo();
     this.user = user;
+    this.isInit = true;
   },
   goTask() {
     router.push({

+ 6 - 0
src/views/My/index.ux

@@ -96,6 +96,7 @@ export default {
   },
   async onInit() {
     this.$watch('tabindex', 'watchPropsChange');
+     this.$on('refreshData',this.broadevt);
   },
   async getUser() {
     let user = await getUserInfo();
@@ -110,6 +111,11 @@ export default {
   watchPropsChange(v) {
     if (v === 2) this.getUser();
   },
+  broadevt(evt){
+    if(evt.detail.current==2){
+      this.getUser()
+    }
+  },
   showCustomerQrcode() {
     this.$emit('customer');
   },

+ 4 - 2
src/views/Reader/index.ux

@@ -281,11 +281,13 @@ export default {
   },
   toCatalog(evt) {
     evt.stopPropagation();
-    router.push({
+    router.replace({
       uri: "/views/Catalog",
       params: {
         chapter_sequence: this.bookinfo.chapter_sequence,
-        bid: this.bid
+        bid: this.bid,
+        chapter_id:this.chapter_id,
+        fromReader:true,
       }
     })
   },

+ 12 - 3
src/views/Shelf/index.ux

@@ -10,10 +10,13 @@
         </div>
       </block>
     </div> -->
-    <div class="shelf-total {{current === 1 ? 'shelf-total__inRecent' : ''}}">
+    <div class="shelf-total {{current === 1 ? 'shelf-total__inRecent' : ''}}" if="{{mockList.length>0}}">
       <text>共{{booksize}}本</text>
       <text class="manager" @click="changeMode">{{modeText}}</text>
     </div>
+    <div if="{{mockList.length<=0}}" class="blank_img">
+      <image src="https://cdn-novel.iycdm.com/quickapp/activity/white_shelf.png"></image>
+    </div>
     <block if="current === 0">
       <div class="shelf-books__wrap">
         <block for="mockList">
@@ -34,7 +37,7 @@
       </div>
     </block>
     <block else>
-      <list class="recent-list">
+      <list class="recent-list" if="{{mockList.length>0}}">
         <block for="mockList">
           <list-item type="recent-item" class="recent-item">
             <stack>
@@ -91,13 +94,19 @@ export default {
     console.log("tabindex:", this.tabindex);
     // this.getUserShelfBooks()
     this.$watch('isDelMode', 'listenMode')
-    this.$watch('tabindex', 'watchPropsChange')
+    this.$watch('tabindex', 'watchPropsChange');
+    this.$on('refreshData',this.broadevt);
   },
   watchPropsChange(newV, oldV) {
     if (newV == 1) {
       this.getUserShelfBooks()
     }
   },
+   broadevt(evt){
+    if(evt.detail.current==1){
+      this.getUserShelfBooks()
+    }
+  },
   getUserShelfBooks() {
     getUserShelfBooks().then(r => {
       r.map(m => {