完成听书 不带图片

This commit is contained in:
@fawn-nine
2023-03-10 17:56:57 +08:00
parent 45cb5d66f7
commit 53d4af542a
3 changed files with 556 additions and 40 deletions

349
package-lock.json generated
View File

@@ -1,8 +1,355 @@
{
"name": "e-peanut",
"version": "1.0.0",
"lockfileVersion": 1,
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "e-peanut",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"animate.css": "^4.1.1",
"epubjs": "^0.3.93",
"qs": "^6.11.0",
"uview-ui": "^2.0.35"
}
},
"node_modules/@types/localforage": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.34.tgz",
"integrity": "sha512-tJxahnjm9dEI1X+hQSC5f2BSd/coZaqbIl1m3TCl0q9SVuC52XcXfV0XmoCU1+PmjyucuVITwoTnN8OlTbEXXA==",
"deprecated": "This is a stub types definition for localforage (https://github.com/localForage/localForage). localforage provides its own type definitions, so you don't need @types/localforage installed!",
"dependencies": {
"localforage": "*"
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.5.tgz",
"integrity": "sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/animate.css": {
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/animate.css/-/animate.css-4.1.1.tgz",
"integrity": "sha512-+mRmCTv6SbCmtYJCN4faJMNFVNN5EuCTTprDTAo7YzIGji2KADmakjVA3+8mVDkZ2Bf09vayB35lSQIex2+QaQ=="
},
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/core-js": {
"version": "3.24.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.24.1.tgz",
"integrity": "sha512-0QTBSYSUZ6Gq21utGzkfITDylE8jWC9Ne1D2MrhvlsZBI1x39OdDIVbzSqtgMndIy6BlHxBXpMGqzZmnztg2rg==",
"hasInstallScript": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/d": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
"integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
"dependencies": {
"es5-ext": "^0.10.50",
"type": "^1.0.1"
}
},
"node_modules/epubjs": {
"version": "0.3.93",
"resolved": "https://registry.npmjs.org/epubjs/-/epubjs-0.3.93.tgz",
"integrity": "sha512-c06pNSdBxcXv3dZSbXAVLE1/pmleRhOT6mXNZo6INKmvuKpYB65MwU/lO7830czCtjIiK9i+KR+3S+p0wtljrw==",
"dependencies": {
"@types/localforage": "0.0.34",
"@xmldom/xmldom": "^0.7.5",
"core-js": "^3.18.3",
"event-emitter": "^0.3.5",
"jszip": "^3.7.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"marks-pane": "^1.0.9",
"path-webpack": "0.0.3"
}
},
"node_modules/es5-ext": {
"version": "0.10.62",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz",
"integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==",
"hasInstallScript": true,
"dependencies": {
"es6-iterator": "^2.0.3",
"es6-symbol": "^3.1.3",
"next-tick": "^1.1.0"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/es6-iterator": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
"integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
"dependencies": {
"d": "1",
"es5-ext": "^0.10.35",
"es6-symbol": "^3.1.1"
}
},
"node_modules/es6-symbol": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
"integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
"dependencies": {
"d": "^1.0.1",
"ext": "^1.1.2"
}
},
"node_modules/event-emitter": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
"integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
"dependencies": {
"d": "1",
"es5-ext": "~0.10.14"
}
},
"node_modules/ext": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/ext/-/ext-1.6.0.tgz",
"integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==",
"dependencies": {
"type": "^2.5.0"
}
},
"node_modules/ext/node_modules/type": {
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
"integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"node_modules/get-intrinsic": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
"integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dependencies": {
"function-bind": "^1.1.1"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
"node_modules/lie": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/localforage": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
"integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
"dependencies": {
"lie": "3.1.1"
}
},
"node_modules/localforage/node_modules/lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
"integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/marks-pane": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/marks-pane/-/marks-pane-1.0.9.tgz",
"integrity": "sha512-Ahs4oeG90tbdPWwAJkAAoHg2lRR8lAs9mZXETNPO9hYg3AkjUJBKi1NQ4aaIQZVGrig7c/3NUV1jANl8rFTeMg=="
},
"node_modules/next-tick": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
},
"node_modules/object-inspect": {
"version": "1.12.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
"integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"node_modules/path-webpack": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/path-webpack/-/path-webpack-0.0.3.tgz",
"integrity": "sha512-AmeDxedoo5svf7aB3FYqSAKqMxys014lVKBzy1o/5vv9CtU7U4wgGWL1dA2o6MOzcD53ScN4Jmiq6VbtLz1vIQ=="
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/type": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
"integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/uview-ui": {
"version": "2.0.35",
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.35.tgz",
"integrity": "sha512-OfMttN3XkHvQosXfd8bjz8ASTvypPoGzBWmQZBJ871bYMCA7t2bDFPlzjbxUj/5ykAjKnZ8zMUapSwSisVt99g==",
"engines": {
"HBuilderX": "^3.1.0"
}
}
},
"dependencies": {
"@types/localforage": {
"version": "0.0.34",

View File

@@ -258,7 +258,8 @@
.then(res => {
this.bookMessage = res.book
this.bokMesDet.bookId = res.book.id
this.bokMesDet.bookName = res.book.name
this.bokMesDet.bookName = res.book.name,
this.bokMesDet.images = res.book.images
if (this.bookMessage.isSale == 1) {
this.buysignContent = '您确定要花费' + this.bookMessage.salePrice + '疯币购买' + this.bokMesDet
.bookName + '吗?'

View File

@@ -14,7 +14,7 @@
<view class="inner-box" :style="{ height: `${innerHeight}px` }">
<view class="book-inner" id="preChapter"
:style="{ fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px` }">
<p v-for="(item, index) in preChapter.text" :key="index" v-html="item.picAndWord"></p>
<p v-for="(item, index) in preChapter.text" :key="index" v-html="item.picAndWord"></p>
</view>
</view>
</view>
@@ -109,10 +109,8 @@
<view class="content">
<!-- 内层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" >
<!-- 最里层class="book-inner"的用于获取文本总高度计算总页数注意不可以overflow:hidden -->
<view class="book-inner" >
<p v-for="(item, index) in curPage.text" v-html="item.list" :key="index"
:class="highlight === item.paragraph ? 'highlight' : ''"
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }"></p>
@@ -154,9 +152,9 @@
<view class="book-inner" >
<!-- <pre>
{{curPage.text}}
</pre> -->
</pre> -->
<p v-for="(item, index) in curPage.text" v-html="item.list" :key="index"
:class="highlight === item.paragraph ? 'highlight' : ''"
:class="{'highlight': highlight == item.paragraph ? true : false, 'jushou': item.class == 'jushou' ? true : false}"
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }"></p>
</view>
@@ -194,9 +192,11 @@
<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-for="(item, index) in nextPage.text" :key="index"
:style="{ fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0)` }">
{{ item }}
<view class="book-inner" >
<p v-for="(item, index) in nextPage.text" v-html="item.list" :key="index"
:class="{'highlight': highlight == item.paragraph ? true : false, 'jushou': item.class == 'jushou' ? true : false}"
:style="{fontSize: `${fontSize}px`, lineHeight: `${lineHeight * fontSize}px`, color: `${colorList[background - 1]}`, transform: `translateY(0px)` }"></p>
</view>
</view>
<view
@@ -359,7 +359,9 @@
mapState
} from 'vuex';
import $http from '../../config/requestConfig';
let copyBookText = []
let copyBookText = []
let preText = []
let nextText = []
// var music = uni.createInnerAudioContext();
export default {
components: {
@@ -368,6 +370,9 @@
},
data() {
return {
preChapterTotal : null,
nextChapterTotal :null,
// preBookText = []
oldReadSpeed: { // 本地初始阅读进度
precent: null,
updateReadId: null
@@ -508,6 +513,7 @@
directoryShowBefore: false, // 目录渲染
turnPageTime: .5, //翻页动画时间
biaodian : ['',':','、',';','。','.'], //匹配的标点
maxFontSize: 30, //最大字体大小px
minFontSize: 14, //最小字体大小px
turnType: 0, //翻页方式
@@ -632,46 +638,179 @@
}
})
},
mpcounlSystemInfo() {
let that = this;
uni.getSystemInfo({
success: async function(res) {
let screenHeight = res.screenHeight - res.statusBarHeight; //屏幕高度-状态栏高度
let screenWidth = res.screenWidth;
that.NumCol = Math.floor((screenHeight - 50) / (that.fontSize * that
.lineHeight)) - 1 //一屏总行 30为panding值
console.log('一屏总行', that.NumCol)
that.colSize = Math.floor((screenWidth - 20) / that.fontSize) //一行最多排多少个字
await that.mpforGet(that.colSize - 1, that.NumCol)
}
})
},
nextmpcounlSystemInfo() {
let that = this;
uni.getSystemInfo({
success: async function(res) {
let screenHeight = res.screenHeight - res.statusBarHeight; //屏幕高度-状态栏高度
let screenWidth = res.screenWidth;
that.NumCol = Math.floor((screenHeight - 50) / (that.fontSize * that
.lineHeight)) - 1 //一屏总行 30为panding值
console.log('一屏总行', that.NumCol)
that.colSize = Math.floor((screenWidth - 20) / that.fontSize) //一行最多排多少个字
await that.nextmpforGet(that.colSize - 1, that.NumCol)
}
})
},
// 拆分数据
forGet(colSize, NumCol) {
let that = this
let arr = [] //数组每一项代表一行
// console.log(copyBookText,'拆分前')
// console.log(copyBookText,'拆分前')
let isbiaodian = false
copyBookText.map((res, index) => {
res.picAndWord = ' ' + res.picAndWord
if (res.picAndWord.length > colSize) {
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize), 'level':0})
let text = res.picAndWord.substr(colSize)
res.picAndWord = '' + res.picAndWord
if (res.picAndWord.length > colSize - 2) {
// 判断是否下一行以标点开始
let nextString = res.picAndWord.substr(colSize-2, 1)
let haveBiao = 0
for (var i=0; i < this.biaodian.length; i++) {
if(nextString == this.biaodian[i]) {
haveBiao = 1
}
}
//console.log(haveBiao, nextString, 'isbiaodian')
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize - 2 - haveBiao), 'level':0, class:'jushou'})
let text = res.picAndWord.substr(colSize - 2 - haveBiao )
that.aginForget(text, arr, colSize, index)
} else {
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize), 'level':0})
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize - 2), 'level':0, class:'jushou'})
}
})
copyBookText = arr
// console.log(copyBookText,'copyBookText')
this.getSizePage(NumCol)
},
mpforGet(colSize, NumCol) {
let that = this
let arr = [] //数组每一项代表一行
// console.log(copyBookText,'拆分前')
let isbiaodian = false
preText.map((res, index) => {
res.picAndWord = '' + res.picAndWord
if (res.picAndWord.length > colSize - 2) {
// 判断是否下一行以标点开始
let nextString = res.picAndWord.substr(colSize-2, 1)
let haveBiao = 0
for (var i=0; i < this.biaodian.length; i++) {
if(nextString == this.biaodian[i]) {
haveBiao = 1
}
}
//console.log(haveBiao, nextString, 'isbiaodian')
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize - 2 - haveBiao), 'level':0, class:'jushou'})
let text = res.picAndWord.substr(colSize - 2 - haveBiao )
that.aginForget(text, arr, colSize, index)
} else {
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize - 2), 'level':0, class:'jushou'})
}
})
preText = arr
// console.log(copyBookText,'copyBookText')
// this.getSizePage(NumCol)
},
nextmpforGet(colSize, NumCol) {
let that = this
let arr = [] //数组每一项代表一行
// console.log(copyBookText,'拆分前')
let isbiaodian = false
nextText.map((res, index) => {
res.picAndWord = '' + res.picAndWord
if (res.picAndWord.length > colSize - 2) {
// 判断是否下一行以标点开始
let nextString = res.picAndWord.substr(colSize-2, 1)
let haveBiao = 0
for (var i=0; i < this.biaodian.length; i++) {
if(nextString == this.biaodian[i]) {
haveBiao = 1
}
}
//console.log(haveBiao, nextString, 'isbiaodian')
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize - 2 - haveBiao), 'level':0, class:'jushou'})
let text = res.picAndWord.substr(colSize - 2 - haveBiao )
that.aginForget(text, arr, colSize, index)
} else {
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize - 2), 'level':0, class:'jushou'})
}
})
nextText = arr
// console.log(copyBookText,'copyBookText')
// this.getSizePage(NumCol)
},
//获取后面的字符,再去计算能放几行
aginForget(text, arr, colSize, index) {
let that = this;
let strBR = "</br>"
if (text.length > colSize) {
arr.push({'paragraph':index,'list':text.substr(0, colSize), 'level':0})
let newText = text.substr(colSize)
let nextString = text.substr(colSize, 1)
let haveBiao = 0
for (var i=0; i < this.biaodian.length; i++) {
if(nextString == this.biaodian[i]) {
haveBiao = 1
}
}
arr.push({'paragraph':index,'list':text.substr(0, colSize - haveBiao), 'level':0, class:''})
let newText = text.substr(colSize - haveBiao)
that.aginForget(newText, arr, colSize, index)
} else {
arr.push({'paragraph':index,'list':text.substr(0, colSize),'level':0})
arr.push({'paragraph':index,'list':text.substr(0, colSize),'level':0, class:''})
// arr.push(strBR)
}
},
tmpforGet(colSize, NumCol) {
let that = this
let arr = [] //数组每一项代表一行
// console.log(copyBookText,'拆分前')
let isbiaodian = false
this.tmpChapter.text.map((res, index) => {
res.picAndWord = '' + res.picAndWord
if (res.picAndWord.length > colSize - 2) {
// 判断是否下一行以标点开始
let nextString = res.picAndWord.substr(colSize-2, 1)
let haveBiao = 0
for (var i=0; i < this.biaodian.length; i++) {
if(nextString == this.biaodian[i]) {
haveBiao = 1
}
}
//console.log(haveBiao, nextString, 'isbiaodian')
arr.push({'paragraph':index,'list':res.picAndWord.substr(0, colSize - 2 - haveBiao), 'level':0, class:'jushou'})
let text = res.picAndWord.substr(colSize - 2 - haveBiao )
that.aginForget(text, arr, colSize, index)
} else {
arr.push({'paragraph':index,list:res.picAndWord.substr(0, colSize - 2), 'level':0, class:'jushou'})
}
})
this.tmpChapter.text = arr
// console.log(copyBookText,'copyBookText')
this.getSizePage(NumCol)
},
// 计算章节页数
getSizePage(NumCol) {
let that = this;
let arr = [],
newArr = []
copyBookText = copyBookText.filter((item, index) => {
if (item == '' || item == ' ' || item == ' ') {
} else {
@@ -714,7 +853,7 @@
progress: this.progress
})
// 将进度存到数据库
//this.saveReadRateUl()
this.saveReadRateUl()
//this.updateReadRateUl() // 更新进度
}
// oldReadSpeed:{ // 本地初始阅读进度
@@ -1099,16 +1238,26 @@
});
},
// 加载下一条音频
addDomIndex(page) {
addDomIndex() {
this.domIndex += 1
//console.log(this.domIndex, '下一条domIndex')
//console.log(this.curPage.text, '最大值')
setTimeout(()=>{
this.createAudio()
if(this.domIndex > this.curPage.text[this.curPage.length -1].paragraph){
console.log(this.curPage.text[this.curPage.length -1].paragraph)
let paragraphindex = 0
//if(this.domIndex > this.curPage.text[this.curPage.length -1].paragraph){
this.curPage.text.map((item, index) => {
if(index == this.curPage.text.length - 1 ){
paragraphindex = item.paragraph
return
}
})
console.log(paragraphindex, this.domIndex)
//return
if(this.domIndex > paragraphindex){
this.goNextPage()
}
}
},2000)
},
@@ -1142,10 +1291,12 @@
const query = uni.createSelectorQuery().in(this);
query.select('#preChapter').boundingClientRect(data => {
let height = data.height;
// let height = copyBookText.height;
// #ifdef APP-PLUS || MP-WEIXIN
height = Math.round(height * this.pixelRatio) / this.pixelRatio
// #endif
this.preChapter.totalPage = Math.ceil(height / this.innerHeight) || 1
// #endif
// this.preChapter.totalPage = Math.floor(height / this.innerHeight) || 1
this.preChapter.totalPage = this.preChapterTotal
this.preChapter.ready = true //章节准备完毕
if (this.waitForPre) { //发生在用户翻至上一章,但是上一章数据未准备完毕时
uni.hideLoading() //把loading关掉
@@ -1180,7 +1331,8 @@
// #ifdef APP-PLUS || MP-WEIXIN
height = Math.round(height * this.pixelRatio) / this.pixelRatio
// #endif
this.nextChapter.totalPage = Math.ceil(height / this.innerHeight) || 1
//this.nextChapter.totalPage = Math.ceil(height / this.innerHeight) || 1
this.nextChapter.totalPage = this.nextChapterTotal
this.nextChapter.ready = true //章节准备完毕
if (this.waitForNext) { //发生在用户翻至下一章,但是下一章数据未准备完毕时
uni.hideLoading() //把loading关掉
@@ -1435,7 +1587,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,
@@ -1717,10 +1869,10 @@
this.currentPage -= 1
if (this.currentPage === -1) { //翻至上一章了
showChapter = true
this.currentPage = this.preChapter.totalPage - 1
this.currentPage = this.preChapter.totalPage - 1
this.chapterRotate('pre')
}
console.log(copyBookText,'goPrePage////////////////////////////////')
let cur = [].concat(this.curPage.pageTranslate)
let pre = [].concat(this.prePage.pageTranslate)
this.goToPage(this.currentPage)
@@ -1780,6 +1932,7 @@
**/
goNextPage() {
if (this.nextPage.isEnd) { //如果翻至本书末尾
alery('到头了')
uni.showToast({
title: '跳转推荐页',
icon: 'none'
@@ -1907,7 +2060,9 @@
this.nextChapter = Object.assign({}, this.curChapter)
this.curChapter = Object.assign({}, this.preChapter)
copyBookText = this.curChapter.text;
this.counlSystemInfo()
this.counlSystemInfo()
console.log(copyBookText, '跳转到上一章')
// this.preChapter.text =
if (this.curChapter.chapterIndex !== 0) {
this.preChapter = {
ready: false,
@@ -1996,7 +2151,7 @@
setTimeout(() => {
this.getThreeChapter(this.curChapter.chapterIndex - 1)
// this.counlSystemInfo()
console.log(copyBookText,'翻页后')
console.log(copyBookText,'翻页后//////////////')
uni.hideLoading()
}, 300)
} else {
@@ -2155,7 +2310,7 @@
title: '加载中'
})
await this.getThreeChapter(index.id)
this.counlSystemInfo()
//this.counlSystemInfo()
this.goToPage(0)
this.scrollTop = 0
// this.domIndex = 1
@@ -2396,17 +2551,25 @@
text: this.tmpChapter.text,
canRead: this.tmpChapter.canRead
}
copyBookText = this.curChapter.text;
copyBookText = this.curChapter.text;
this.counlSystemInfo()
this.domIndex = 0;
if (this.curChapter.chapterIndex !== 0) {
if (this.curChapter.chapterIndex !== 0) {
await this.getOneChapter(this.directoryList[Number(index) - 1].chapterId)
//this.mpcounlSystemInfo
this.preChapter = {
chapterIndex: Number(index) - 1,
chapterName: this.directoryList[Number(index) - 1].name,
text: this.tmpChapter.text,
canRead: this.tmpChapter.canRead
}
preText = this.tmpChapter.text
this.mpcounlSystemInfo()
this.preChapterTotal = Math.floor(preText.length / this.NumCol) + 1
console.log(this.preChapterTotal,'上一章内容页数')
// 处理数据
//
} else {
this.preChapter = {
ready: true,
@@ -2423,6 +2586,10 @@
text: this.tmpChapter.text,
canRead: this.tmpChapter.canRead
}
nextText = this.tmpChapter.text
this.nextmpcounlSystemInfo()
this.nextChapterTotal = Math.floor(nextText.length / this.NumCol) + 1
console.log(this.nextChapterTotal,'下一章内容页数')
} else {
this.nextChapter = {
ready: true,
@@ -2946,4 +3113,5 @@
width: 100%;
height: 300rpx;
}
.jushou{text-indent: 2em;}
</style>