|
@@ -2,27 +2,33 @@
|
|
|
<import name="wechat-page" src="../../components/wechat/index.ux"></import>
|
|
|
<template>
|
|
|
<div id="reader-content">
|
|
|
- <div class="reader-wrap" id='list'>
|
|
|
- <div class="reader-title">
|
|
|
- <text class="title">{{bookinfo.chapter_name}}</text>
|
|
|
- <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
|
|
|
+ <stack>
|
|
|
+ <div class="reader-wrap" id='list'>
|
|
|
+ <div class="reader-title">
|
|
|
+ <text class="title">{{bookinfo.chapter_name}}</text>
|
|
|
+ <!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
|
|
|
+ </div>
|
|
|
+ <div class="reader-content">
|
|
|
+ <text class="chapter-text" for='content'>{{$item}}</text>
|
|
|
+ </div>
|
|
|
+ <div class="reader-operator">
|
|
|
+ <text class="operator prev" @click="getPrevChapter">上一章</text>
|
|
|
+ <text class="operator catalog" @click="toCatalog">目录</text>
|
|
|
+ <text class="operator next" @click="getNextChapter">下一章</text>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="reader-content">
|
|
|
- <text class="chapter-text" for='content'>{{$item}}</text>
|
|
|
+ <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
|
|
|
+ <!-- <wechat-page></wechat-page> -->
|
|
|
+ <div class='toast' if="{{showtoast}}">
|
|
|
+ <text>正在加载中...</text>
|
|
|
</div>
|
|
|
- <div class="reader-operator">
|
|
|
- <text class="operator prev" @click="getPrevChapter">上一章</text>
|
|
|
- <text class="operator catalog" @click="toCatalog">目录</text>
|
|
|
- <text class="operator next" @click="getNextChapter">下一章</text>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
|
|
|
- <!-- <wechat-page></wechat-page> -->
|
|
|
+ </stack>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import prompt from '@system.prompt';
|
|
|
import router from "@system.router";
|
|
|
import storage from '@system.storage';
|
|
|
import it from "../../helper/interface.js";
|
|
@@ -37,7 +43,8 @@ export default {
|
|
|
bid: '',
|
|
|
chapter_id: '',
|
|
|
send_order_id: "",
|
|
|
- canReadecid: ""
|
|
|
+ canReadecid: "",
|
|
|
+ showtoast: false
|
|
|
},
|
|
|
private: {
|
|
|
bookinfo: {},
|
|
@@ -68,12 +75,14 @@ export default {
|
|
|
this.showShortPop = !value.detail.installed;
|
|
|
},
|
|
|
getChapters(bid, chapter_id) {
|
|
|
+ this.showtoast = true
|
|
|
console.log("router length:", router.getLength());
|
|
|
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 })
|
|
|
this.addShelf();
|
|
|
+ this.showtoast = false
|
|
|
}).catch(e => {
|
|
|
console.log('e code')
|
|
|
console.log(e.data)
|
|
@@ -82,10 +91,12 @@ export default {
|
|
|
chapterOrders({ bid: bid, chapter_id: chapter_id }).then(r => {
|
|
|
this.content = r.chapter_content.trim().split(/\n/)
|
|
|
this.bookinfo = r
|
|
|
+ this.showtoast = false
|
|
|
// this.$element('list').scrollTo({ index: 0 })
|
|
|
}).catch(f => {
|
|
|
console.log('f code')
|
|
|
console.log(f.data)
|
|
|
+ this.showtoast = false
|
|
|
if (f.data.code == '10014' || f.data.code == '10015') {
|
|
|
this.getChapters(bid, this.canReadecid)
|
|
|
router.push({
|
|
@@ -99,6 +110,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
} else if (e.data.code == '10014' || e.data.code == '10015') {
|
|
|
+ this.showtoast = false
|
|
|
this.getChapters(bid, this.canReadecid)
|
|
|
router.push({
|
|
|
uri: "/views/Pay",
|
|
@@ -122,7 +134,9 @@ export default {
|
|
|
},
|
|
|
getPrevChapter() {
|
|
|
console.log("get prev chapter");
|
|
|
- // this.getChapters(this.bookinfo.bid, this.bookinfo.prev_cid)
|
|
|
+ if (this.bookinfo.prev_cid == 0) {
|
|
|
+ return prompt.showToast({ message: '已经是第一章啦' });
|
|
|
+ }
|
|
|
router.replace({
|
|
|
uri: "/views/Reader",
|
|
|
params: {
|