|
|
@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
<!-- 搜‘根据需要更改’,需要根据实际项目更改的已经列出来了 --> |
|
|
|
<!-- 重要事项: |
|
|
|
1.由于阅读页截取整行的需要,请确保文本格式和本插件中的text变量所示一致,即:!!!每一行的高度要一致!!! |
|
|
@ -18,8 +17,7 @@ |
|
|
|
<view id="content" class="content"> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}"> |
|
|
|
<view class="book-inner" id="preChapter" v-html="preChapter.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}" |
|
|
|
> |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -35,8 +33,7 @@ |
|
|
|
<view class="content"> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}"> |
|
|
|
<view class="book-inner" id="curChapter" v-html="curChapter.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}" |
|
|
|
> |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -52,8 +49,7 @@ |
|
|
|
<view class="content"> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}"> |
|
|
|
<view class="book-inner" id="nextChapter" v-html="nextChapter.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}" |
|
|
|
> |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -66,11 +62,9 @@ |
|
|
|
<!-- 根据需要更改(封面) --> |
|
|
|
<!-- ************************** --> |
|
|
|
<!-- 封面 --> |
|
|
|
<view class="cover container" :class="{container0: background === 1, container1: background === 2}" |
|
|
|
:style="{zIndex: 201, transform: `translate${cover.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" |
|
|
|
@touchstart="coverTouchStart" @touchend="coverTouchEnd" @touchmove="coverTouchMove" @touchcancel="coverTouchcancel" |
|
|
|
> |
|
|
|
<view class="cover container" :class="{container0: background === 1, container1: background === 2}" :style="{zIndex: 201, transform: `translate${cover.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" @touchstart="coverTouchStart" |
|
|
|
@touchend="coverTouchEnd" @touchmove="coverTouchMove" @touchcancel="coverTouchcancel"> |
|
|
|
<image> |
|
|
|
|
|
|
|
</image> |
|
|
@ -85,10 +79,8 @@ |
|
|
|
|
|
|
|
<!-- 阅读页(结构和样式请和仅用于计算元素一致) --> |
|
|
|
<!-- 上一页 --> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" |
|
|
|
:style="{zIndex: 102, transform: `translate${prePage.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" |
|
|
|
> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" :style="{zIndex: 102, transform: `translate${prePage.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}"> |
|
|
|
<!-- 章节名 --> |
|
|
|
<view class="chapter"> |
|
|
|
{{prePage.chapterName}} |
|
|
@ -99,10 +91,8 @@ |
|
|
|
<!-- 内层class="inner-box"利用innerHeight将内容截取至整行,防止文字不完整的情况出现 --> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}" v-if="prePage.canRead"> |
|
|
|
<!-- 最里层class="book-inner"的用于获取文本总高度,计算总页数,注意不可以overflow:hidden --> |
|
|
|
<view class="book-inner" v-html="prePage.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${prePage.pageNum*innerHeight}px)`}" |
|
|
|
> |
|
|
|
<view class="book-inner" v-html="prePage.text" :style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${prePage.pageNum*innerHeight}px)`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="display:flex;flex-flow: column;justify-content: center;align-items: center;height: 100%;" |
|
|
@ -130,11 +120,9 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 本页 --> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" |
|
|
|
:style="{zIndex: 101, transform: `translate${curPage.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" |
|
|
|
@touchstart="touchStart" @touchend="touchEnd" @touchmove="touchMove" @touchcancel="touchcancel" |
|
|
|
> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" :style="{zIndex: 101, transform: `translate${curPage.pageTranslate[turnType]}`, transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" @touchstart="touchStart" @touchend="touchEnd" |
|
|
|
@touchmove="touchMove" @touchcancel="touchcancel"> |
|
|
|
<!-- 章节名 --> |
|
|
|
<view class="chapter"> |
|
|
|
{{curPage.chapterName}} |
|
|
@ -142,10 +130,8 @@ |
|
|
|
<view class="content"> |
|
|
|
<!-- v-if="curPage.canRead" --> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}"> |
|
|
|
<view class="book-inner" v-html="curPage.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${curPage.pageNum*innerHeight}px)`}" |
|
|
|
> |
|
|
|
<view class="book-inner" v-html="curPage.text" :style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${curPage.pageNum*innerHeight}px)`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- <view style="display:flex;flex-flow: column;justify-content: center;align-items: center;height: 100%;" |
|
|
@ -173,20 +159,16 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 下一页 --> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" |
|
|
|
:style="{zIndex: 100, transform: `translate${nextPage.pageTranslate[turnType]}`,transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}" |
|
|
|
> |
|
|
|
<view class="container" :class="{container0: background === 1, container1: background === 2}" :style="{zIndex: 100, transform: `translate${nextPage.pageTranslate[turnType]}`,transition: `transform ${showAnimation?turnPageTime:0}s`, |
|
|
|
boxShadow:showShadow&&turnType===0?'0 0 10px 0 rgba(0,0,0,.4)':''}"> |
|
|
|
<!-- 章节名 --> |
|
|
|
<view class="chapter"> |
|
|
|
{{nextPage.chapterName}} |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
|
<view class="inner-box" :style="{height: `${innerHeight}px`}" v-if="nextPage.canRead"> |
|
|
|
<view class="book-inner" v-html="nextPage.text" |
|
|
|
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${nextPage.pageNum*innerHeight}px)`}" |
|
|
|
> |
|
|
|
<view class="book-inner" v-html="nextPage.text" :style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight*fontSize}px`,color: `${colorList[background - 1]}`, |
|
|
|
transform: `translateY(-${nextPage.pageNum*innerHeight}px)`}"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="display:flex;flex-flow: column;justify-content: center;align-items: center;height: 100%;" |
|
|
@ -214,13 +196,15 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 菜单层 --> |
|
|
|
<view class="menu" :style="{height: `100%`, width: `${windowWidth}px`}" |
|
|
|
v-if="menuShow" @touchend="closeMenu"> |
|
|
|
<view class="menu" :style="{height: `100%`, width: `${windowWidth}px`}" v-if="menuShow" @touchend="closeMenu"> |
|
|
|
<!-- 菜单层包含返回按钮的上半部分 --> |
|
|
|
<view class="menu-top" :style="{height: `${statusBarHeight + 40}px`, top: itemShow ? 0 : `-100%`}" @touchend.stop> |
|
|
|
<view class="menu-top" :style="{height: `${statusBarHeight + 40}px`, top: itemShow ? 0 : `-100%`}" |
|
|
|
@touchend.stop> |
|
|
|
<view :style="{height: `${statusBarHeight}px`}"></view> |
|
|
|
<view class="head"> |
|
|
|
<image class="back-icon" src="https://epic.js-dyyj.com/uploads/20250825/f7e4825867dbd90e2cd0721a49fad6eb.png" @click="back" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image> |
|
|
|
<image class="back-icon" |
|
|
|
src="https://epic.js-dyyj.com/uploads/20250825/f7e4825867dbd90e2cd0721a49fad6eb.png" |
|
|
|
@click="back" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image> |
|
|
|
<!-- <text class="iconfont back" @click="back"></text> --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -268,7 +252,8 @@ |
|
|
|
<view class="icon" @click="smallSize" v-if="fontSize>minFontSize">A-</view> |
|
|
|
<view class="icon" style="color: #666;border: #666 solid 1px;" v-else>A-</view> |
|
|
|
<view class="icon" @click="changeFont(2)" v-if="simplified === 1">繁體</view> |
|
|
|
<view class="icon" @click="changeFont(1)" v-else style="border: #FF9900 solid 1px;color: #FF9900">繁體</view> |
|
|
|
<view class="icon" @click="changeFont(1)" v-else style="border: #FF9900 solid 1px;color: #FF9900">繁體 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<view class="item-name">排版</view> |
|
|
@ -284,24 +269,33 @@ |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<view class="item-name">翻页</view> |
|
|
|
<view class="icon" :class="{active: turnType === 0}" style="padding: 5px 8px;" @click="changeTurnType(0)">覆盖</view> |
|
|
|
<view class="icon" :class="{active: turnType === 1}" style="padding: 5px 8px;" @click="changeTurnType(1)">左右平移</view> |
|
|
|
<view class="icon" :class="{active: turnType === 2}" style="padding: 5px 8px;" @click="changeTurnType(2)">上下平移</view> |
|
|
|
<view class="icon" :class="{active: turnType === 0}" style="padding: 5px 8px;" |
|
|
|
@click="changeTurnType(0)">覆盖</view> |
|
|
|
<view class="icon" :class="{active: turnType === 1}" style="padding: 5px 8px;" |
|
|
|
@click="changeTurnType(1)">左右平移</view> |
|
|
|
<view class="icon" :class="{active: turnType === 2}" style="padding: 5px 8px;" |
|
|
|
@click="changeTurnType(2)">上下平移</view> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<view class="item-name">背景</view> |
|
|
|
<view class="icon" style="background: url(https://epic.js-dyyj.com/uploads/20250918/fc242cdea0ebd7fd399e86b34d229a6e.jpg);" :class="{active: background === 1}" @click="changeBackground(1)"></view> |
|
|
|
<view class="icon" style="background-color: #000;" :class="{active: background === 2}" @click="changeBackground(2)"></view> |
|
|
|
<view class="icon" |
|
|
|
style="background: url(https://epic.js-dyyj.com/uploads/20250918/fc242cdea0ebd7fd399e86b34d229a6e.jpg);" |
|
|
|
:class="{active: background === 1}" @click="changeBackground(1)"></view> |
|
|
|
<view class="icon" style="background-color: #000;" :class="{active: background === 2}" |
|
|
|
@click="changeBackground(2)"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 目录层 --> |
|
|
|
<view class="directory" :class="{container0: background === 1, container1: background === 2}" v-if="directoryShowBefore" |
|
|
|
:style="{left: directoryShow ? 0 : '-100%',color: `${colorList[background - 1]}`,boxShadow:'0 0 10px 0 rgba(0,0,0,.4)'}" @touchend.stop> |
|
|
|
<view class="directory" :class="{container0: background === 1, container1: background === 2}" |
|
|
|
v-if="directoryShowBefore" |
|
|
|
:style="{left: directoryShow ? 0 : '-100%',color: `${colorList[background - 1]}`,boxShadow:'0 0 10px 0 rgba(0,0,0,.4)'}" |
|
|
|
@touchend.stop> |
|
|
|
|
|
|
|
<view class="bookname">书名</view> |
|
|
|
<!-- :size="40"——每一栏高度为40px :scrollHeight="windowHeight - 60"——书名的高度为60px --> |
|
|
|
<virtualList :items="directoryList" :size="40" :remain="16" :active="curChapter.chapterIndex" :scrollHeight="windowHeight - 60"> |
|
|
|
<virtualList :items="directoryList" :size="40" :remain="16" :active="curChapter.chapterIndex" |
|
|
|
:scrollHeight="windowHeight - 60"> |
|
|
|
<template v-slot="{item,active}"> |
|
|
|
<view class="directory-listItem" :class="{active: item.index == active}" |
|
|
|
@click="goToChapter(item.index)"> |
|
|
@ -315,17 +309,22 @@ |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script type="module"> |
|
|
|
import battery from './components/battery.vue' |
|
|
|
import virtualList from './components/virtualList.vue' |
|
|
|
import { traditionalized, simplized, dateToStr } from './components/utils.js' |
|
|
|
import { |
|
|
|
traditionalized, |
|
|
|
simplized, |
|
|
|
dateToStr |
|
|
|
} from './components/utils.js' |
|
|
|
import directoryModule from './components/directory.js' |
|
|
|
// 引入章节数据 |
|
|
|
import chapters from './components/chapters.js' |
|
|
|
|
|
|
|
// import chapterss from 'https://des.dayunyuanjian.cn/data/2025/09/22/chaptersNN.json' |
|
|
|
// 引入章节数据 |
|
|
|
// import chapters from 'https://des.dayunyuanjian.cn/data/2025/09/19/chapters.js' |
|
|
|
// 正确解构 directoryList |
|
|
|
const directoryListJs = directoryModule.chaptersList || directoryModule.default?.chaptersList || []; |
|
|
|
|
|
|
|
// const externalData = require('https://des.dayunyuanjian.cn/data/2025/09/22/chaptersNN.json') |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
battery, |
|
|
@ -340,7 +339,7 @@ |
|
|
|
progress: 0 |
|
|
|
}, |
|
|
|
directoryList: [], |
|
|
|
text: (chapters && chapters.length > 0 && chapters[0].content) ? chapters[0].content : '', |
|
|
|
text: '', |
|
|
|
currentPage: 0, //当前页 |
|
|
|
|
|
|
|
innerHeight: 0, //截取至整行的最大高度 |
|
|
@ -455,13 +454,15 @@ |
|
|
|
lineHeight: '', //行高,注意是fontSize的倍数 |
|
|
|
background: '', //背景 |
|
|
|
colorList: ['#000', '#666'], //与背景对应的字体颜色 |
|
|
|
|
|
|
|
chapters: [], |
|
|
|
chapterProgress: 0, //‘章节进度条’的参数 |
|
|
|
progressTouched: false //是否正在点击‘章节进度条’ |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
// console.log(JSON.stringify(chapters),'externalData') |
|
|
|
this.chapt() |
|
|
|
this.getSystemInfo() |
|
|
|
}, |
|
|
|
onUnload() { |
|
|
@ -477,6 +478,7 @@ |
|
|
|
this.setStorage() |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
|
|
|
|
this.initPage() |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -489,6 +491,23 @@ |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
chapt() { |
|
|
|
uni.request({ |
|
|
|
url: 'https://des.dayunyuanjian.cn/data/2025/09/22/chaptersN1.json', |
|
|
|
method: 'GET', |
|
|
|
success: (res) => { |
|
|
|
console.log(res.data); |
|
|
|
this.chapters = res.data; // 转为数组 |
|
|
|
console.log("小程序端解析成功:", this.chapters); |
|
|
|
this.text = this.chapters[0].content |
|
|
|
|
|
|
|
// 进一步处理数据... |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
console.error('请求失败:', err); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
setStorage() { |
|
|
|
let history = uni.getStorageSync('history') |
|
|
|
if (typeof history !== 'object') { |
|
|
@ -524,7 +543,13 @@ |
|
|
|
**/ |
|
|
|
getSystemInfo() { |
|
|
|
|
|
|
|
const { windowWidth, windowHeight, statusBarHeight, platform, pixelRatio } = uni.getSystemInfoSync() |
|
|
|
const { |
|
|
|
windowWidth, |
|
|
|
windowHeight, |
|
|
|
statusBarHeight, |
|
|
|
platform, |
|
|
|
pixelRatio |
|
|
|
} = uni.getSystemInfoSync() |
|
|
|
//获取一些必要的设备参数 |
|
|
|
this.statusBarHeight = statusBarHeight |
|
|
|
this.windowWidth = windowWidth |
|
|
@ -536,7 +561,9 @@ |
|
|
|
plus.navigator.setFullscreen(true) |
|
|
|
// 取消ios左滑返回 |
|
|
|
let page = this.$mp.page.$getAppWebview() |
|
|
|
page.setStyle({ popGesture: 'none' }) |
|
|
|
page.setStyle({ |
|
|
|
popGesture: 'none' |
|
|
|
}) |
|
|
|
|
|
|
|
if (this.platform === 'ios') { |
|
|
|
// 获取ios电量 |
|
|
@ -550,8 +577,7 @@ |
|
|
|
this.batteryLevel = dev.batteryLevel() * 100 |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 获取安卓电量 |
|
|
|
let main = plus.android.runtimeMainActivity(); |
|
|
|
let Intent = plus.android.importClass('android.content.Intent'); |
|
|
@ -658,10 +684,10 @@ |
|
|
|
// #ifdef APP-PLUS || MP-WEIXIN |
|
|
|
lineHeight = Math.floor(lineHeight * this.pixelRatio) / this.pixelRatio |
|
|
|
// #endif |
|
|
|
let lineNum = Math.floor((this.contentHeight + Math.floor((lineHeight - this.fontSize)/2)) / lineHeight) |
|
|
|
let lineNum = Math.floor((this.contentHeight + Math.floor((lineHeight - this.fontSize) / 2)) / |
|
|
|
lineHeight) |
|
|
|
this.innerHeight = lineNum * lineHeight |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.$nextTick(() => { |
|
|
|
const query = uni.createSelectorQuery().in(this); |
|
|
@ -671,9 +697,11 @@ |
|
|
|
let lineHeight = this.fontSize * this.lineHeight; |
|
|
|
|
|
|
|
// #ifdef APP-PLUS || MP-WEIXIN |
|
|
|
lineHeight = Math.floor(lineHeight*this.pixelRatio)/this.pixelRatio |
|
|
|
lineHeight = Math.floor(lineHeight * this.pixelRatio) / this |
|
|
|
.pixelRatio |
|
|
|
// #endif |
|
|
|
let lineNum = Math.floor((height + Math.floor((lineHeight - this.fontSize)/2)) / lineHeight) |
|
|
|
let lineNum = Math.floor((height + Math.floor((lineHeight - this |
|
|
|
.fontSize) / 2)) / lineHeight) |
|
|
|
this.innerHeight = lineNum * lineHeight |
|
|
|
resolve() |
|
|
|
}).exec(); |
|
|
@ -806,8 +834,7 @@ |
|
|
|
|
|
|
|
this.delta = e.touches[0].clientX - this.touchX; |
|
|
|
this.touchX = e.touches[0].clientX; |
|
|
|
} |
|
|
|
else { //翻页方式为‘上下平移’ |
|
|
|
} else { //翻页方式为‘上下平移’ |
|
|
|
delta = e.touches[0].clientY - this.touchStartY; |
|
|
|
|
|
|
|
// 限制边界 |
|
|
@ -876,8 +903,7 @@ |
|
|
|
let delta = 0 |
|
|
|
if (this.turnType === 0 || this.turnType === 1) { //翻页方式为‘覆盖’或者‘左右平移’ |
|
|
|
delta = e.changedTouches[0].clientX - this.touchStartX; |
|
|
|
} |
|
|
|
else { //翻页方式为‘上下平移’ |
|
|
|
} else { //翻页方式为‘上下平移’ |
|
|
|
delta = e.changedTouches[0].clientY - this.touchStartY; |
|
|
|
} |
|
|
|
if (delta === 0) { |
|
|
@ -886,8 +912,7 @@ |
|
|
|
title: '已经是第一页了', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
else if (e.changedTouches[0].clientX>this.windowWidth/3*2) { //点击屏幕右1/3为下一页 |
|
|
|
} else if (e.changedTouches[0].clientX > this.windowWidth / 3 * 2) { //点击屏幕右1/3为下一页 |
|
|
|
this.cover.pageTranslate = [ |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
@ -898,12 +923,11 @@ |
|
|
|
`(0,0)`, |
|
|
|
`(0,0)` |
|
|
|
] |
|
|
|
} |
|
|
|
else if (e.changedTouches[0].clientX<=this.windowWidth/3*2 && e.changedTouches[0].clientX>=this.windowWidth/3) { //点击屏幕中间1/3为呼出菜单 |
|
|
|
} else if (e.changedTouches[0].clientX <= this.windowWidth / 3 * 2 && e.changedTouches[0].clientX >= |
|
|
|
this.windowWidth / 3) { //点击屏幕中间1/3为呼出菜单 |
|
|
|
this.showMenu() |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
if (this.next && this.delta <= 0) { //下一页 |
|
|
|
this.cover.pageTranslate = [ |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
@ -915,8 +939,7 @@ |
|
|
|
`(0,0)`, |
|
|
|
`(0,0)` |
|
|
|
] |
|
|
|
} |
|
|
|
else if (this.next && this.delta > 0) { //取消翻页 |
|
|
|
} else if (this.next && this.delta > 0) { //取消翻页 |
|
|
|
this.cover.pageTranslate = [ |
|
|
|
`(0,0)`, |
|
|
|
`(0,0)`, |
|
|
@ -986,8 +1009,7 @@ |
|
|
|
|
|
|
|
this.delta = e.touches[0].clientX - this.touchX; |
|
|
|
this.touchX = e.touches[0].clientX; |
|
|
|
} |
|
|
|
else { //翻页方式为‘上下平移’ |
|
|
|
} else { //翻页方式为‘上下平移’ |
|
|
|
delta = e.touches[0].clientY - this.touchStartY; |
|
|
|
|
|
|
|
// 限制边界 |
|
|
@ -1046,8 +1068,7 @@ |
|
|
|
/*****************************************/ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.prePage.pageTranslate = [ |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
|
`(${-this.windowWidth+delta}px,0)`, |
|
|
@ -1064,8 +1085,7 @@ |
|
|
|
`(0,${this.windowHeight+delta}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
else if (this.nextChapter.ready) { //下一章已经准备好了 |
|
|
|
} else if (this.nextChapter.ready) { //下一章已经准备好了 |
|
|
|
this.nextPage = { |
|
|
|
ready: this.nextChapter.ready, |
|
|
|
chapterName: this.nextChapter.chapterName, |
|
|
@ -1114,8 +1134,7 @@ |
|
|
|
`(${delta}px,0)`, |
|
|
|
`(0,${delta}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.prePage.pageTranslate = [ |
|
|
|
`(${-this.windowWidth+delta}px,0)`, |
|
|
|
`(${-this.windowWidth+delta}px,0)`, |
|
|
@ -1147,8 +1166,7 @@ |
|
|
|
`(${delta}px,0)`, |
|
|
|
`(0,${delta}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.prePage.pageTranslate = [ |
|
|
|
`(${-this.windowWidth+delta}px,0)`, |
|
|
|
`(${-this.windowWidth+delta}px,0)`, |
|
|
@ -1165,8 +1183,7 @@ |
|
|
|
`(0,${this.windowHeight+delta}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
else if (this.preChapter.ready) { //上一章已经准备好了 |
|
|
|
} else if (this.preChapter.ready) { //上一章已经准备好了 |
|
|
|
this.prePage = { |
|
|
|
ready: this.preChapter.ready, |
|
|
|
chapterName: this.preChapter.chapterName, |
|
|
@ -1209,26 +1226,22 @@ |
|
|
|
let delta = 0 |
|
|
|
if (this.turnType === 0 || this.turnType === 1) { |
|
|
|
delta = e.changedTouches[0].clientX - this.touchStartX; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
delta = e.changedTouches[0].clientY - this.touchStartY; |
|
|
|
} |
|
|
|
if (delta < 0.8 && delta > -0.8) { //部分手机点击屏幕时无法做到delta===0 |
|
|
|
if (e.changedTouches[0].clientX < this.windowWidth / 3) { //点击屏幕左1/3为上一页 |
|
|
|
this.goPrePage() |
|
|
|
} |
|
|
|
else if (e.changedTouches[0].clientX>this.windowWidth/3*2) { //点击屏幕右1/3为下一页 |
|
|
|
} else if (e.changedTouches[0].clientX > this.windowWidth / 3 * 2) { //点击屏幕右1/3为下一页 |
|
|
|
this.goNextPage() |
|
|
|
} |
|
|
|
else if (e.changedTouches[0].clientX<=this.windowWidth/3*2 && e.changedTouches[0].clientX>=this.windowWidth/3) { //点击屏幕中间1/3为呼出菜单 |
|
|
|
} else if (e.changedTouches[0].clientX <= this.windowWidth / 3 * 2 && e.changedTouches[0].clientX >= |
|
|
|
this.windowWidth / 3) { //点击屏幕中间1/3为呼出菜单 |
|
|
|
this.showMenu() |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
if (this.next && this.delta <= 0) { //下一页 |
|
|
|
this.goNextPage() |
|
|
|
} |
|
|
|
else if (this.next && this.delta > 0) { //取消翻页 |
|
|
|
} else if (this.next && this.delta > 0) { //取消翻页 |
|
|
|
this.prePage.pageTranslate = [ |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
@ -1244,11 +1257,9 @@ |
|
|
|
`(${this.windowWidth}px,0)`, |
|
|
|
`(0,${this.windowHeight}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
else if (this.pre && this.delta >= 0) { //上一页 |
|
|
|
} else if (this.pre && this.delta >= 0) { //上一页 |
|
|
|
this.goPrePage() |
|
|
|
} |
|
|
|
else if (this.pre && this.delta < 0) { //取消翻页 |
|
|
|
} else if (this.pre && this.delta < 0) { //取消翻页 |
|
|
|
this.prePage.pageTranslate = [ |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
|
`(${-this.windowWidth}px,0)`, |
|
|
@ -1544,9 +1555,11 @@ |
|
|
|
this.$set(this.nextChapter, 'text', this.tmpChapter.text) |
|
|
|
this.$set(this.nextChapter, 'canRead', this.tmpChapter.canRead) |
|
|
|
this.calcNextChapter() |
|
|
|
} else { |
|
|
|
this.nextChapter = { |
|
|
|
ready: true, |
|
|
|
isEnd: true |
|
|
|
} |
|
|
|
else { |
|
|
|
this.nextChapter = {ready: true,isEnd: true} |
|
|
|
} |
|
|
|
} |
|
|
|
if (type === 'pre') { |
|
|
@ -1562,9 +1575,11 @@ |
|
|
|
this.$set(this.preChapter, 'text', this.tmpChapter.text) |
|
|
|
this.$set(this.preChapter, 'canRead', this.tmpChapter.canRead) |
|
|
|
this.calcPreChapter() |
|
|
|
} else { |
|
|
|
this.preChapter = { |
|
|
|
ready: true, |
|
|
|
isCover: true |
|
|
|
} |
|
|
|
else { |
|
|
|
this.preChapter = {ready: true,isCover: true} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
@ -1587,8 +1602,7 @@ |
|
|
|
if (this.nextChapter.ready) { |
|
|
|
this.chapterRotate('next') |
|
|
|
this.goToPage(0) |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在准备下一章' |
|
|
|
}) |
|
|
@ -1614,8 +1628,7 @@ |
|
|
|
if (this.preChapter.ready) { |
|
|
|
this.chapterRotate('pre') |
|
|
|
this.goToPage(0) |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
uni.showLoading({ |
|
|
|
title: '正在准备上一章' |
|
|
|
}) |
|
|
@ -1655,8 +1668,7 @@ |
|
|
|
`(0,${-this.windowHeight}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.prePage = { |
|
|
|
ready: this.preChapter.ready, |
|
|
|
chapterName: this.preChapter.chapterName, |
|
|
@ -1671,8 +1683,7 @@ |
|
|
|
canRead: this.preChapter.canRead |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.prePage = { |
|
|
|
ready: true, |
|
|
|
chapterName: this.curChapter.chapterName, |
|
|
@ -1698,8 +1709,7 @@ |
|
|
|
`(0,${this.windowHeight}px)` |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.nextPage = { |
|
|
|
ready: this.nextChapter.ready, |
|
|
|
chapterName: this.nextChapter.chapterName, |
|
|
@ -1714,8 +1724,7 @@ |
|
|
|
canRead: this.nextChapter.canRead |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.nextPage = { |
|
|
|
ready: true, |
|
|
|
chapterName: this.curChapter.chapterName, |
|
|
@ -1805,8 +1814,7 @@ |
|
|
|
this.nextPage.text = traditionalized(this.nextPage.text) |
|
|
|
this.simplified = 2 |
|
|
|
uni.setStorageSync('simplified', 2) |
|
|
|
} |
|
|
|
else { //切换为简体 |
|
|
|
} else { //切换为简体 |
|
|
|
this.preChapter.text = simplized(this.preChapter.text) |
|
|
|
this.curChapter.text = simplized(this.curChapter.text) |
|
|
|
this.nextChapter.text = simplized(this.nextChapter.text) |
|
|
@ -1825,8 +1833,7 @@ |
|
|
|
let progress = this.progress |
|
|
|
if (lineHeight === this.lineHeight) { |
|
|
|
return |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.lineHeight = lineHeight; |
|
|
|
uni.setStorageSync('lineHeight', this.lineHeight) |
|
|
|
this.calcHeight() |
|
|
@ -1852,8 +1859,7 @@ |
|
|
|
changeTurnType(turnType) { |
|
|
|
if (turnType === this.turnType) { |
|
|
|
return |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.showAnimation = false |
|
|
|
this.turnType = turnType; |
|
|
|
uni.setStorageSync('turnType', this.turnType) |
|
|
@ -1866,8 +1872,7 @@ |
|
|
|
changeBackground(background) { |
|
|
|
if (background === this.background) { |
|
|
|
return |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
this.background = background; |
|
|
|
uni.setStorageSync('background', this.background) |
|
|
|
} |
|
|
@ -1980,8 +1985,8 @@ |
|
|
|
// } |
|
|
|
|
|
|
|
// 从章节数据中获取对应章节内容 |
|
|
|
console.log(chapters,'chapterschapters',chapterId); |
|
|
|
const chapter = chapters.find(ch => ch.id == chapterId) |
|
|
|
console.log(this.chapters, 'chapterschapters', chapterId); |
|
|
|
const chapter = this.chapters.find(ch => ch.id == chapterId) |
|
|
|
console.log(chapter, 'chapterchapter'); |
|
|
|
if (chapter) { |
|
|
|
this.tmpChapter.text = chapter.content |
|
|
@ -2048,9 +2053,11 @@ |
|
|
|
text: this.tmpChapter.text, |
|
|
|
canRead: this.tmpChapter.canRead |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.preChapter = { |
|
|
|
ready: true, |
|
|
|
isCover: true |
|
|
|
} |
|
|
|
else { |
|
|
|
this.preChapter = {ready: true,isCover: true} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.curChapter.chapterIndex !== this.directoryList.length - 1) { |
|
|
@ -2061,9 +2068,11 @@ |
|
|
|
text: this.tmpChapter.text, |
|
|
|
canRead: this.tmpChapter.canRead |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.nextChapter = { |
|
|
|
ready: true, |
|
|
|
isEnd: true |
|
|
|
} |
|
|
|
else { |
|
|
|
this.nextChapter = {ready: true,isEnd: true} |
|
|
|
} |
|
|
|
await this.calcCurChapter() |
|
|
|
await this.calcPreChapter() |
|
|
@ -2092,9 +2101,11 @@ |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.hidden { |
|
|
|
opacity: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.action { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
@ -2103,11 +2114,13 @@ |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
.item { |
|
|
|
flex: 1; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.container { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
@ -2121,6 +2134,7 @@ |
|
|
|
width: 100%; |
|
|
|
background-color: #fff; |
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
.chapter { |
|
|
|
font-size: 14px; |
|
|
|
color: $minor-text-color; |
|
|
@ -2128,6 +2142,7 @@ |
|
|
|
width: 100%; |
|
|
|
line-height: 30px; |
|
|
|
} |
|
|
|
|
|
|
|
.bottom-bar { |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
@ -2137,11 +2152,14 @@ |
|
|
|
height: 30px; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
flex: 1 1 auto; |
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
.inner-box { |
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
.book-inner { |
|
|
|
text-indent: 2em; |
|
|
|
text-align: justify; |
|
|
@ -2150,19 +2168,23 @@ |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.container0 { |
|
|
|
background: url(https://epic.js-dyyj.com/uploads/20250918/fc242cdea0ebd7fd399e86b34d229a6e.jpg); |
|
|
|
background-color: #fff; |
|
|
|
background-size: 100% 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.container1 { |
|
|
|
background-color: #000; |
|
|
|
} |
|
|
|
|
|
|
|
.menu { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
z-index: 300; |
|
|
|
|
|
|
|
// transition: all .3s; |
|
|
|
.menu-top { |
|
|
|
position: absolute; |
|
|
@ -2170,6 +2192,7 @@ |
|
|
|
width: 100%; |
|
|
|
background-color: #333; |
|
|
|
transition: top .3s; |
|
|
|
|
|
|
|
.head { |
|
|
|
position: relative; |
|
|
|
// display: flex; |
|
|
@ -2181,12 +2204,14 @@ |
|
|
|
line-height: 40px; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.back { |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 10px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.directory { |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
@ -2195,11 +2220,13 @@ |
|
|
|
width: 600rpx; |
|
|
|
height: 100%; |
|
|
|
transition: left .1s; |
|
|
|
|
|
|
|
.bookname { |
|
|
|
padding: 20px 0 20px 10px; |
|
|
|
height: 60px; |
|
|
|
font-size: 18px; |
|
|
|
} |
|
|
|
|
|
|
|
.directory-listItem { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
@ -2208,10 +2235,12 @@ |
|
|
|
font-size: 14px; |
|
|
|
border-bottom: #eee solid 1px; |
|
|
|
} |
|
|
|
|
|
|
|
.active { |
|
|
|
color: red |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.menu-bottom { |
|
|
|
position: absolute; |
|
|
|
left: 0; |
|
|
@ -2219,6 +2248,7 @@ |
|
|
|
background-color: #333; |
|
|
|
transition: bottom .3s; |
|
|
|
color: #fff; |
|
|
|
|
|
|
|
.show-chapter { |
|
|
|
position: absolute; |
|
|
|
left: 50%; |
|
|
@ -2230,6 +2260,7 @@ |
|
|
|
font-size: 13px; |
|
|
|
background-color: #333; |
|
|
|
} |
|
|
|
|
|
|
|
.progress-box { |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
@ -2239,12 +2270,14 @@ |
|
|
|
width: 100%; |
|
|
|
font-size: 15px; |
|
|
|
} |
|
|
|
|
|
|
|
.items-box { |
|
|
|
display: flex; |
|
|
|
justify-content: space-around; |
|
|
|
align-items: center; |
|
|
|
height: 80px; |
|
|
|
width: 100%; |
|
|
|
|
|
|
|
.item-box { |
|
|
|
display: flex; |
|
|
|
flex-flow: column; |
|
|
@ -2254,6 +2287,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.setting { |
|
|
|
position: absolute; |
|
|
|
left: 0; |
|
|
@ -2265,15 +2299,18 @@ |
|
|
|
color: #fff; |
|
|
|
background-color: #333; |
|
|
|
transition: bottom .3s; |
|
|
|
|
|
|
|
.item { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
height: 70px; |
|
|
|
|
|
|
|
.item-name { |
|
|
|
padding: 10px; |
|
|
|
color: #fff; |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
|
|
|
|
.icon { |
|
|
|
margin-right: 10px; |
|
|
|
padding: 5px 20px; |
|
|
@ -2285,6 +2322,7 @@ |
|
|
|
border-radius: 20px; |
|
|
|
border: #fff solid 1px; |
|
|
|
} |
|
|
|
|
|
|
|
.type-setting { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@ -2296,15 +2334,18 @@ |
|
|
|
width: 30px; |
|
|
|
border-radius: 5px; |
|
|
|
border: #fff solid 1px; |
|
|
|
|
|
|
|
.line { |
|
|
|
width: 100%; |
|
|
|
border-bottom: #fff solid 1px; |
|
|
|
} |
|
|
|
|
|
|
|
.lineActive { |
|
|
|
width: 100%; |
|
|
|
border-bottom: #FF9900 solid 1px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.active { |
|
|
|
color: #FF9900; |
|
|
|
border: #FF9900 solid 1px; |
|
|
@ -2312,6 +2353,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.cover { |
|
|
|
image { |
|
|
|
height: 400rpx; |
|
|
|