Zhengxiaowei 5 tahun lalu
induk
melakukan
9b5ad516e2

+ 7 - 1
src/api/index.js

@@ -133,4 +133,10 @@ export const userSign = () => {
 // 查询微信支付订单的成功性 - h5
 export const checkWxOrder = (order) => {
   return fly.get("/checkOrder", { order: order })
-}
+}
+//用户签到
+export const chapterOrders = params => {
+  return fly.get(
+    `/books/${params.bid}/balance/chapterOrders/${params.chapter_id}`
+  );
+};

+ 14 - 0
src/components/book/book.ux

@@ -29,6 +29,10 @@ export default {
       type: Boolean,
       default: false
     },
+    read: {
+      type: Boolean,
+      default: false
+    },
     similar: {
       type: Boolean,
       default: false
@@ -64,6 +68,16 @@ export default {
   getBooks(book) {
     if (this.prevent) return;
     console.log("click_book", book);
+    if (this.read) {
+      router.push({
+        uri: "/views/Reader",
+        params: {
+          bid: book.bid,
+          chapter_id: book.last_cid
+        }
+      })
+      return
+    }
     if (this.similar) {
       router.replace({
         uri: "/views/Detail",

+ 48 - 0
src/components/wechat/index.ux

@@ -0,0 +1,48 @@
+<template>
+	<div class="wechat-wrap">
+		<div class="wechat-content">
+			<text class="wechat-title">关注公众号方便您继续阅读</text>
+		</div>
+	</div>
+</template>
+<script>
+
+export default {
+	data: {
+
+	},
+	onInit() {
+
+	},
+
+}
+</script>
+<style lang="less" scoped>
+.wechat {
+  &-wrap {
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    background-color: rgba(0, 0, 0, 0.56);
+    flex-direction: column;
+    align-items: center;
+    z-index: 2;
+    justify-content: center;
+  }
+  &-content {
+    width: 600px;
+    height: 650px;
+    background-color: #fff;
+    flex-direction: column;
+    align-items: center;
+  }
+  &-title {
+    height: 120px;
+    line-height: 120px;
+    font-size: 32px;
+    font-weight: bold;
+  }
+}
+</style>

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

@@ -30,7 +30,7 @@ export default {
   },
   onInit() {
     let page = 1
-    var chapter_sequence_index = 1
+    var chapter_sequence_index = 0
     if (this.chapter_sequence) {
       var chapter_sequence = this.chapter_sequence
       chapter_sequence_index = chapter_sequence % 15 - 1

+ 34 - 16
src/views/Reader/index.ux

@@ -1,4 +1,5 @@
 <import name="short-page" src="../../components/short/index.ux"></import>
+ <import name="wechat-page" src="../../components/wechat/index.ux"></import> 
 <template>
   <div id="reader-content">
     <list class="reader-wrap" id='list'>
@@ -16,13 +17,14 @@
       </list-item>
     </list>
     <short-page if="{{showShortPop}}"></short-page>
+    <!-- <wechat-page></wechat-page> -->
   </div>
 
 </template>
 
 <script>
 import router from "@system.router";
-import { getChapters, getIsonshelf, postUserShelfBooks } from "../../api";
+import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders } from "../../api";
 
 export default {
   protected: {
@@ -35,11 +37,8 @@ export default {
     showShortPop: false
   },
   onInit() {
-    getChapters({ bid: this.bid, chapter_id: this.chapter_id }).then(r => {
-      this.content = r.chapter_content.trim().split(/\n/)
-      this.bookinfo = r
-    })
-    this.addShelf();
+    this.getChapters(this.bid, this.chapter_id)
+    this.addShelf()
     if (this.$app.$def.data.backClickCount === 0) {
       this.showShortPop = true;
     }
@@ -50,6 +49,33 @@ export default {
       r.is_on ? '' : postUserShelfBooks({ bid: this.bid })
     })
   },
+  getChapters(bid, chapter_id) {
+    getChapters({ bid: bid, chapter_id: chapter_id }).then(r => {
+      this.content = r.chapter_content.trim().split(/\n/)
+      this.bookinfo = r
+      this.$element('list').scrollTo({ index: 0 })
+    }).catch(e => {
+      if (e.data.code == '10016' || e.data.code == '10019') {
+        chapterOrders({ bid: bid, chapter_id: chapter_id }).then(r => {
+          console.log(r)
+          this.content = r.chapter_content.trim().split(/\n/)
+          this.bookinfo = r
+          this.$element('list').scrollTo({ index: 0 })
+        }).catch(f => {
+          if (f.data.code == '10014' || f.data.code == '10015') {
+            router.push({
+              uri: "/views/Pay",
+              params: {
+                code: f.data.code,
+                fee: e.data.data.fee,
+                bid: this.bid
+              }
+            })
+          }
+        })
+      }
+    })
+  },
   toCatalog() {
     router.push({
       uri: "/views/Catalog",
@@ -61,19 +87,11 @@ export default {
   },
   getPrevChapter() {
     console.log("get prev chapter");
-    getChapters({ bid: this.bookinfo.bid, chapter_id: this.bookinfo.prev_cid }).then(r => {
-      this.content = r.chapter_content.trim().split(/\n/)
-      this.bookinfo = r
-      this.$element('list').scrollTo({ index: 0 })
-    })
+    this.getChapters(this.bookinfo.bid, this.bookinfo.prev_cid)
   },
   getNextChapter() {
     console.log("get next chapter");
-    getChapters({ bid: this.bookinfo.bid, chapter_id: this.bookinfo.next_cid }).then(r => {
-      this.content = r.chapter_content.trim().split(/\n/)
-      this.bookinfo = r
-      this.$element('list').scrollTo({ index: 0 })
-    })
+    this.getChapters(this.bookinfo.bid, this.bookinfo.next_cid)
   }
 }
 </script>

+ 16 - 16
src/views/Recharge/index.ux

@@ -27,7 +27,7 @@
                 <text>元</text>
               </div>
             </div>
-            <text class="item-status {{$item.status==='UNPAID'?'':'paid'}}" >{{$item.status==='UNPAID'?'未支付':'已支付'}}</text>
+            <text class="item-status {{$item.status==='UNPAID'?'':'paid'}}">{{$item.status==='UNPAID'?'未支付':'已支付'}}</text>
           </div>
         </block>
       </div>
@@ -42,10 +42,10 @@ import { rechargeApi, getUserInfo } from "../../api/index";
 export default {
   private: {
     rechargeList: [],
-    user:{},
-    page:{
-      total:0,
-      current:1
+    user: {},
+    page: {
+      total: 0,
+      current: 1
     },
     user: {},
   },
@@ -53,18 +53,18 @@ export default {
     this.getOrder();
     this.getUserInfo();
   },
-  async getUserInfo(){
-    let user =await getUserInfo();
-    this.user=user;
-    console.log(this.user,'rrrrrrrrrrr')
+  async getUserInfo() {
+    let user = await getUserInfo();
+    this.user = user;
+    console.log(this.user, 'rrrrrrrrrrr')
   },
-  async getOrder(page=1,page_size=10) {
-    let res= await rechargeApi({page:page,page_size});
-    let {list,meta}=res;
-    this.rechargeList=list;
-    this.page={
-      total:meta.last_page,
-      current:meta.current_page
+  async getOrder(page = 1, page_size = 10) {
+    let res = await rechargeApi({ page: page, page_size });
+    let { list, meta } = res;
+    this.rechargeList = list;
+    this.page = {
+      total: meta.last_page,
+      current: meta.current_page
     }
   },
   toPay() {

+ 2 - 2
src/views/Shelf/index.ux

@@ -19,7 +19,7 @@
         <block for="mockList">
           <div class="book-item__wrap {{(($idx + 1)%3 === 0) ? 'm0' : ''}}">
             <stack>
-              <x-book book='{{$item}}'></x-book>
+              <x-book book='{{$item}}' read='{{true}}'></x-book>
               <div class="book-del__wrap" show="{{isDelMode}}" @click='deleteBook($item)'>
                 <image src="https://yueduyun.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/img/delete.png"></image>
                 <text>删除</text>
@@ -38,7 +38,7 @@
         <block for="mockList">
           <list-item type="recent-item" class="recent-item">
             <stack>
-              <x-book multi="{{true}}" book='{{$item}}' width="{{150}}">
+              <x-book multi="{{true}}" book='{{$item}}' read='{{true}}' width="{{150}}">
                 <div class="book-info__wrap">
                   <text class="name">{{$item.book_name}}</text>
                   <text class="lastest">最新 {{$item.last_chapter}}</text>