|
@@ -1,48 +1,59 @@
|
|
|
<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" >
|
|
|
+ <div id="reader-content">
|
|
|
<stack>
|
|
|
<div class="reader-wrap" id='list' style="background-color:{{currentColor.color}}">
|
|
|
<div class="reader-title">
|
|
|
- <text class="title">{{bookinfo.chapter_name}}</text>
|
|
|
+ <text class="title" style="color:{{isNight=='night'?'#666':'#333'}}">{{bookinfo.chapter_name}}</text>
|
|
|
<!-- <text class="add-shelf" @click="addShelf">加入书架</text> -->
|
|
|
</div>
|
|
|
- <div class="reader-content" @click="showMore">
|
|
|
- <text class="chapter-text" for='content' style="color:{{currentColor.fontColor}};font-size:{{`${readFontSize}px`}}">{{$item}}</text>
|
|
|
- <div class="bottom-setting" style="background-color:{{currentColor.btColor}}" show={{showSetting}} @click="stopPop">
|
|
|
+ <div class="reader-content">
|
|
|
+ <div class="readContent" @click="showMore"><text class="chapter-text" for='content' style="color:{{currentColor.fontColor}};font-size:{{`${readFontSize}px`}}">{{$item}}</text></div>
|
|
|
+ <div class="bottom-setting" style="background-color:{{currentColor.btColor}}" if={{showSetting}} @click="stopPop">
|
|
|
<div class="item-content">
|
|
|
- <text class="label-min" style="color:{{isNight?'#666':'#1A1A1A'}}">A</text>
|
|
|
+ <text class="label-min" style="color:{{isNight=='night'?'#666':'#333'}}">A</text>
|
|
|
<slider class="slider" min="30" max="48" step="2" value="{{readFontSize}}" onchange="changeFontSize" style="blockColor: #fff"></slider>
|
|
|
- <text class="label-max" style="color:{{isNight?'#666':'#1A1A1A'}}">A</text>
|
|
|
+ <text class="label-max" style="color:{{isNight=='night'?'#666':'#333'}}">A</text>
|
|
|
</div>
|
|
|
<div class="item-color">
|
|
|
<text class="colori" for="colorList" onclick="changeColor($item,undefined)" style="border-color:{{currentColor.color==$item.color? currentBorder: $item.borderColor}};background-color:{{$item.color}};"></text>
|
|
|
- <text class="color-icon {{ isNight }}" onclick="changeColor(nightColor,isNight)" ></text>
|
|
|
+ <text class="color-icon {{ isNight }}" onclick="changeColor(nightColor,isNight)"></text>
|
|
|
</div>
|
|
|
<div class="item-page">
|
|
|
- <text @click="getPrevChapter" style="color:{{isNight?'#666':'#1A1A1A'}}">上一章</text>
|
|
|
- <text @click="toCatalog" style="color:{{isNight?'#666':'#1A1A1A'}}">目录</text>
|
|
|
- <text @click="getNextChapter" style="color:{{isNight?'#666':'#1A1A1A'}}">下一章</text>
|
|
|
+ <text @click="getPrevChapter" style="color:{{isNight=='night'?'#666':'#333'}}">上一章</text>
|
|
|
+ <text @click="toCatalog" style="color:{{isNight=='night'?'#666':'#333'}}">目录</text>
|
|
|
+ <text @click="getNextChapter" style="color:{{isNight=='night'?'#666':'#333'}}">下一章</text>
|
|
|
</div>
|
|
|
<div>
|
|
|
+ </div>
|
|
|
+ <div class="setting-top" style="background-color:{{currentColor.color}}" if={{showSetting}} @click="backRouter">
|
|
|
+ <image src="{{getImgUrl}}" class="back-icon"></image> <text style="color:{{isNight=='night'?'#666':'#333'}}">{{bookinfo.chapter_name}}</text><text style="text-indent:-999px">1</text>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="setting-top" style="background-color:{{currentColor.color}}" show={{showSetting}}>
|
|
|
- <text>{{bookinfo.chapter_name}}</text>
|
|
|
+ <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-operator">
|
|
|
- <text class="operator prev" @click="getPrevChapter">上一章</text>
|
|
|
- <text class="operator catalog" @click="toCatalog">目录</text>
|
|
|
- <text class="operator next" @click="getNextChapter">下一章</text>
|
|
|
+ <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
|
|
|
+ <!-- <wechat-page></wechat-page> -->
|
|
|
+ <div class='toast' if="{{showtoast}}">
|
|
|
+ <text>正在加载中...</text>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <short-page if="{{showShortPop}}" @addshort="shortEnd"></short-page>
|
|
|
- <!-- <wechat-page></wechat-page> -->
|
|
|
- <div class='toast' if="{{showtoast}}">
|
|
|
- <text>正在加载中...</text>
|
|
|
- </div>
|
|
|
</stack>
|
|
|
+ <div class="mustToask" show="{{showMustTost}}">
|
|
|
+ <div class="mustBox">
|
|
|
+ <text class="title-must">
|
|
|
+ 提示
|
|
|
+ </text>
|
|
|
+ <text class="content">
|
|
|
+ 添加桌面后方可继续阅读精彩内容
|
|
|
+ </text>
|
|
|
+ <text class="button-must" @click="addDestop">添加到桌面</text>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
@@ -52,7 +63,7 @@ import prompt from '@system.prompt';
|
|
|
import router from "@system.router";
|
|
|
import storage from '@system.storage';
|
|
|
import it from "../../helper/interface.js";
|
|
|
-import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders } from "../../api";
|
|
|
+import { getChapters, getIsonshelf, postUserShelfBooks, chapterOrders, userAddDsktop } from "../../api";
|
|
|
|
|
|
export default {
|
|
|
// protected: {
|
|
@@ -71,26 +82,34 @@ export default {
|
|
|
content: [],
|
|
|
showShortPop: false,
|
|
|
readFontSize: 38,
|
|
|
- isNight:'sun',
|
|
|
- showSetting:false,
|
|
|
- colorList:[
|
|
|
- {color:'#E6E6E6',borderColor:'#CCC',btColor:'#F2F2F2',isIcon:false},
|
|
|
- {color:'#EED9BB',borderColor:'#C6A473',btColor:'#FFFBE8',isIcon:false},
|
|
|
- {color:'#B3E2CB',borderColor:'#68AA8A',btColor:'#D5F2D8',isIcon:false},
|
|
|
- {color:'#B3D0E2',borderColor:'#6090AE',btColor:'#E8F6FF',isIcon:false},
|
|
|
+ isNight: 'sun',
|
|
|
+ hasShort: false,
|
|
|
+ showSetting: false,
|
|
|
+ force_add_desk_type: 0,
|
|
|
+ showMustTost: false,
|
|
|
+ colorList: [
|
|
|
+ { color: '#E6E6E6', borderColor: '#CCC', btColor: '#F2F2F2', isIcon: false },
|
|
|
+ { color: '#EED9BB', borderColor: '#C6A473', btColor: '#FFFBE8', isIcon: false },
|
|
|
+ { color: '#B3E2CB', borderColor: '#68AA8A', btColor: '#D5F2D8', isIcon: false },
|
|
|
+ { color: '#B3D0E2', borderColor: '#6090AE', btColor: '#E8F6FF', isIcon: false },
|
|
|
],
|
|
|
- currentBorder:'#EE6159',
|
|
|
- nightColor:{
|
|
|
- fontColor:'#666',
|
|
|
- btColor:'#333',
|
|
|
- color:'#1a1a1a'
|
|
|
+ currentBorder: '#EE6159',
|
|
|
+ nightColor: {
|
|
|
+ fontColor: '#666',
|
|
|
+ btColor: '#333',
|
|
|
+ color: '#1a1a1a'
|
|
|
},
|
|
|
- currentColor:{
|
|
|
- color:'#E6E6E6',btColor:'#F2F2F2',fontColor:'#1a1a1a'
|
|
|
+ currentColor: {
|
|
|
+ color: '#E6E6E6', btColor: '#F2F2F2', fontColor: '#1a1a1a'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ getImgUrl() {
|
|
|
+ return this.isNight == 'night' ? '../../assets/imgs/white_back.png' : '../../assets/imgs/black_back.png'
|
|
|
}
|
|
|
},
|
|
|
async onInit() {
|
|
|
- if(this.send_order_id){
|
|
|
+ if (this.send_order_id) {
|
|
|
await storage.set({ key: "send_order_id", value: this.send_order_id });
|
|
|
}
|
|
|
/* let s = (await storage.get({ key: "send_order_id" })).data;
|
|
@@ -99,60 +118,74 @@ export default {
|
|
|
console.log("storage send_order_id", s); */
|
|
|
await this.getChapters(this.bid, this.chapter_id);
|
|
|
let setting = (await storage.get({ key: "readSetting" })).data;
|
|
|
- if(setting){
|
|
|
- let sets = JSON.parse(setting)
|
|
|
- this.currentColor = sets;
|
|
|
- this.isNight = sets.isNight;
|
|
|
- }
|
|
|
+ if (setting) {
|
|
|
+ let sets = JSON.parse(setting)
|
|
|
+ this.currentColor = sets;
|
|
|
+ this.isNight = sets.isNight;
|
|
|
+ }
|
|
|
let font = (await storage.get({ key: "readFont" })).data;
|
|
|
- if(font){
|
|
|
+ if (font) {
|
|
|
this.readFontSize = font;
|
|
|
}
|
|
|
+ userAddDsktop(this.$app.$def.data.backClickCount).then(res => {
|
|
|
+ //TODO 加桌后统计上报
|
|
|
+ }).catch(r => {
|
|
|
+ //TODO 失败后统计上报
|
|
|
+ });
|
|
|
+ },
|
|
|
+ backRouter() {
|
|
|
+ it.backCreateShortCut(res => {
|
|
|
+ if (res == 'back') router.back()
|
|
|
+ });
|
|
|
},
|
|
|
async onShow() {
|
|
|
-
|
|
|
it.getShortCut((value) => {
|
|
|
- this.showSetting = value;
|
|
|
+ this.showSetting = false;
|
|
|
this.showShortPop = !value;
|
|
|
+ this.hasShort = value;
|
|
|
})
|
|
|
-
|
|
|
+ let params = {
|
|
|
+ bid: this.bid,
|
|
|
+ chapter_id: this.chapter_id,
|
|
|
+ }
|
|
|
+ await storage.set({ key: "lastCapter", value: JSON.stringify(params) });
|
|
|
},
|
|
|
- stopPop(evt){
|
|
|
+ stopPop(evt) {
|
|
|
evt.stopPropagation();
|
|
|
return;
|
|
|
},
|
|
|
- showMore(){
|
|
|
+ showMore() {
|
|
|
this.showSetting = !this.showSetting;
|
|
|
- if(this.showSetting){
|
|
|
+ if (this.showSetting) {
|
|
|
this.showShortPop = false;
|
|
|
- }else{
|
|
|
- this.showShortPop = true;
|
|
|
+ } else {
|
|
|
+ if (!this.hasShort) this.showShortPop = true;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- async changeFontSize(evt){
|
|
|
- this.readFontSize= evt.progress;
|
|
|
+
|
|
|
+ async changeFontSize(evt) {
|
|
|
+ this.readFontSize = evt.progress;
|
|
|
await storage.set({ key: "readFont", value: this.readFontSize });
|
|
|
},
|
|
|
- async changeColor(item,type){
|
|
|
- if(type){
|
|
|
- if(type=='sun'){
|
|
|
- this.isNight='night';
|
|
|
+ async changeColor(item, type) {
|
|
|
+ if (type) {
|
|
|
+ if (type == 'sun') {
|
|
|
+ this.isNight = 'night';
|
|
|
this.currentColor = this.nightColor;
|
|
|
- await storage.set({ key: "readSetting", value: JSON.stringify({...this.nightColor,isNight:'night'}) });
|
|
|
- }else{
|
|
|
- this.isNight='sun';
|
|
|
- this.currentColor = {color:'#E6E6E6',borderColor:'#CCC',btColor:'#F2F2F2',isIcon:false};
|
|
|
- await storage.set({ key: "readSetting", value: JSON.stringify({...this.currentColor,isNight:'sun'}) });
|
|
|
+ await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.nightColor, isNight: 'night' }) });
|
|
|
+ } else {
|
|
|
+ this.isNight = 'sun';
|
|
|
+ this.currentColor = { color: '#E6E6E6', borderColor: '#CCC', btColor: '#F2F2F2', isIcon: false };
|
|
|
+ await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.currentColor, isNight: 'sun' }) });
|
|
|
}
|
|
|
- }else{
|
|
|
- this.isNight='sun';
|
|
|
+ } else {
|
|
|
+ this.isNight = 'sun';
|
|
|
this.currentColor = {
|
|
|
- color:item.color,
|
|
|
- btColor:item.btColor,
|
|
|
- fontColor:'#1a1a1a'
|
|
|
+ color: item.color,
|
|
|
+ btColor: item.btColor,
|
|
|
+ fontColor: '#1a1a1a'
|
|
|
}
|
|
|
- await storage.set({ key: "readSetting", value: JSON.stringify({...this.currentColor,isNight:'sun'}) });
|
|
|
+ await storage.set({ key: "readSetting", value: JSON.stringify({ ...this.currentColor, isNight: 'sun' }) });
|
|
|
}
|
|
|
},
|
|
|
addShelf() {
|
|
@@ -162,14 +195,22 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
shortEnd(value) {
|
|
|
+ if (value.detail.installed) {
|
|
|
+ this.showMustTost = false;
|
|
|
+ prompt.showToast({ message: "添加桌面成功!请前往任务中心领取奖励" });
|
|
|
+ }
|
|
|
this.showShortPop = !value.detail.installed;
|
|
|
+ this.hasShort = 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.force_add_desk_type = r.force_add_desk_type;
|
|
|
this.content = r.chapter_content.trim().split(/\n/)
|
|
|
- this.bookinfo = r
|
|
|
+ this.bookinfo = r;
|
|
|
+
|
|
|
// this.$element('list').scrollTo({ index: 0 })
|
|
|
this.addShelf();
|
|
|
this.showtoast = false
|
|
@@ -238,9 +279,31 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ addDestop() {
|
|
|
+ it.mustCreateShort(res => {
|
|
|
+ if (res) this.goNext();
|
|
|
+ })
|
|
|
+ },
|
|
|
getNextChapter(evt) {
|
|
|
evt.stopPropagation();
|
|
|
- console.log("get next chapter");
|
|
|
+ let _this = this;
|
|
|
+ if (this.force_add_desk_type == 1) {
|
|
|
+ it.getShortCut(res => {
|
|
|
+
|
|
|
+ if (!res) { this.showMustTost = true; } else {
|
|
|
+ this.goNext();
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ } else if (this.force_add_desk_type == 2) {
|
|
|
+ this.$app.$def.createShortcut(res => {
|
|
|
+ this.goNext();
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.goNext();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ goNext() {
|
|
|
if (this.bookinfo.next_cid == 0) {
|
|
|
router.push({
|
|
|
uri: "/views/Raderover",
|
|
@@ -261,10 +324,18 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
onBackPress() {
|
|
|
- if (router.getLength() === 1) {
|
|
|
- router.replace({ uri: "/views/Index" });
|
|
|
- return true;
|
|
|
- }
|
|
|
+ it.backCreateShortCut(res => {
|
|
|
+ if (res == 'back') {
|
|
|
+ if (router.getLength() === 1) {
|
|
|
+ router.replace({ uri: "/views/Index" });
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ router.back()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
</script>
|