|
@@ -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>
|