BookChapter.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. <template>
  2. <div
  3. class="chapter-wrapper"
  4. :style="bodyTheme"
  5. :class="{ night: isNight, day: !isNight }"
  6. @click="showToolBar = !showToolBar"
  7. >
  8. <div class="tool-bar" :style="leftBarTheme">
  9. <div class="tools">
  10. <el-popover
  11. placement="right"
  12. :width="popupWidth"
  13. trigger="click"
  14. :show-arrow="false"
  15. v-model:visible="popCataVisible"
  16. popper-class="pop-cata"
  17. >
  18. <PopCatalog @getContent="getContent" class="popup" />
  19. <template #reference>
  20. <div class="tool-icon" :class="{ 'no-point': noPoint }">
  21. <div class="iconfont">&#58905;</div>
  22. <div class="icon-text">目录</div>
  23. </div>
  24. </template>
  25. </el-popover>
  26. <el-popover
  27. placement="right"
  28. :width="popupWidth"
  29. trigger="click"
  30. :show-arrow="false"
  31. v-model:visible="readSettingsVisible"
  32. popper-class="pop-setting"
  33. >
  34. <read-settings class="popup" />
  35. <template #reference>
  36. <div class="tool-icon" :class="{ 'no-point': noPoint }">
  37. <div class="iconfont">&#58971;</div>
  38. <div class="icon-text">设置</div>
  39. </div>
  40. </template>
  41. </el-popover>
  42. <div class="tool-icon" @click="toShelf">
  43. <div class="iconfont">&#58892;</div>
  44. <div class="icon-text">书架</div>
  45. </div>
  46. <div class="tool-icon" :class="{ 'no-point': noPoint }" @click="toTop">
  47. <div class="iconfont">&#58914;</div>
  48. <div class="icon-text">顶部</div>
  49. </div>
  50. <div
  51. class="tool-icon"
  52. :class="{ 'no-point': noPoint }"
  53. @click="toBottom"
  54. >
  55. <div class="iconfont">&#58915;</div>
  56. <div class="icon-text">底部</div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="read-bar" :style="rightBarTheme">
  61. <div class="tools">
  62. <div
  63. class="tool-icon"
  64. :class="{ 'no-point': noPoint }"
  65. @click="toPreChapter"
  66. >
  67. <div class="iconfont">&#58920;</div>
  68. <span v-if="miniInterface">上一章</span>
  69. </div>
  70. <div
  71. class="tool-icon"
  72. :class="{ 'no-point': noPoint }"
  73. @click="toNextChapter"
  74. >
  75. <span v-if="miniInterface">下一章</span>
  76. <div class="iconfont">&#58913;</div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="chapter-bar"></div>
  81. <div class="chapter" ref="content" :style="chapterTheme">
  82. <div class="content">
  83. <div class="top-bar" ref="top"></div>
  84. <div
  85. v-for="data in chapterData"
  86. :key="data.index"
  87. :chapterIndex="data.index"
  88. ref="chapter"
  89. >
  90. <chapter-content
  91. ref="chapterRef"
  92. :chapterIndex="data.index"
  93. :contents="data.content"
  94. :title="data.title"
  95. :spacing="store.config.spacing"
  96. :fontSize="fontSize"
  97. :fontFamily="fontFamily"
  98. @readedLengthChange="onReadedLengthChange"
  99. v-if="showContent"
  100. />
  101. </div>
  102. <div class="loading" ref="loading"></div>
  103. <div class="bottom-bar" ref="bottom"></div>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <script setup>
  109. import jump from "@/plugins/jump";
  110. import settings from "@/config/themeConfig";
  111. import API from "@api";
  112. import { useLoading } from "@/hooks/loading";
  113. import { useThrottleFn } from "@vueuse/shared";
  114. const content = ref();
  115. // loading spinner
  116. const { isLoading, loadingWrapper } = useLoading(content, "正在获取信息");
  117. const store = useBookStore();
  118. // 读取阅读配置
  119. try {
  120. const browerConfig = JSON.parse(localStorage.getItem("config"));
  121. if (browerConfig != null) store.setConfig(browerConfig);
  122. } catch {
  123. localStorage.removeItem("config");
  124. }
  125. const {
  126. catalog,
  127. popCataVisible,
  128. readSettingsVisible,
  129. miniInterface,
  130. showContent,
  131. bookProgress,
  132. theme,
  133. isNight,
  134. } = storeToRefs(store);
  135. const chapterPos = computed({
  136. get: () => store.readingBook.chapterPos,
  137. set: (value) => (store.readingBook.chapterPos = value),
  138. });
  139. const chapterIndex = computed({
  140. get: () => store.readingBook.index,
  141. set: (value) => (store.readingBook.index = value),
  142. });
  143. // 无限滚动
  144. const infiniteLoading = computed(() => store.config.infiniteLoading);
  145. let scrollObserver;
  146. const loading = ref();
  147. watchEffect(() => {
  148. if (!infiniteLoading.value) {
  149. scrollObserver?.disconnect();
  150. } else {
  151. scrollObserver?.observe(loading.value);
  152. }
  153. });
  154. const loadMore = () => {
  155. let index = chapterData.value.slice(-1)[0].index;
  156. if (catalog.value.length - 1 > index) {
  157. getContent(index + 1, false);
  158. store.saveBookProgress(); // 保存的是上一章的进度,不是预载的本章进度
  159. }
  160. };
  161. // IntersectionObserver回调 底部加载
  162. const onReachBottom = (entries) => {
  163. if (isLoading.value) return;
  164. for (let { isIntersecting } of entries) {
  165. if (!isIntersecting) return;
  166. loadMore();
  167. }
  168. };
  169. // 字体
  170. const fontFamily = computed(() => {
  171. if (store.config.font >= 0) {
  172. return settings.fonts[store.config.font];
  173. }
  174. return store.config.customFontName;
  175. });
  176. const fontSize = computed(() => {
  177. return store.config.fontSize + "px";
  178. });
  179. // 主题部分
  180. const bodyColor = computed(() => settings.themes[theme.value].body);
  181. const chapterColor = computed(() => settings.themes[theme.value].content);
  182. const popupColor = computed(() => settings.themes[theme.value].popup);
  183. const readWidth = computed(() => {
  184. if (!miniInterface.value) {
  185. return store.config.readWidth - 130 + "px";
  186. } else {
  187. return window.innerWidth + "px";
  188. }
  189. });
  190. const popupWidth = computed(() => {
  191. if (!miniInterface.value) {
  192. return store.config.readWidth - 33;
  193. } else {
  194. return window.innerWidth - 33;
  195. }
  196. });
  197. const bodyTheme = computed(() => {
  198. return {
  199. background: bodyColor.value,
  200. };
  201. });
  202. const chapterTheme = computed(() => {
  203. return {
  204. background: chapterColor.value,
  205. width: readWidth.value,
  206. };
  207. });
  208. const showToolBar = ref(false);
  209. const leftBarTheme = computed(() => {
  210. return {
  211. background: popupColor.value,
  212. marginLeft: miniInterface.value
  213. ? 0
  214. : -(store.config.readWidth / 2 + 68) + "px",
  215. display: miniInterface.value && !showToolBar.value ? "none" : "block",
  216. };
  217. });
  218. const rightBarTheme = computed(() => {
  219. return {
  220. background: popupColor.value,
  221. marginRight: miniInterface.value
  222. ? 0
  223. : -(store.config.readWidth / 2 + 52) + "px",
  224. display: miniInterface.value && !showToolBar.value ? "none" : "block",
  225. };
  226. });
  227. /**
  228. * pc移动端判断 最大阅读宽度修正
  229. * 阅读宽度最小为640px 加上工具栏 68px 52px 取较大值 为 776px
  230. */
  231. const onResize = () => {
  232. store.setMiniInterface(window.innerWidth < 776);
  233. const width = store.config.readWidth; /**包含padding */
  234. checkPageWidth(width);
  235. };
  236. /** 判断阅读宽度是否超出页面 */
  237. const checkPageWidth = (readWidth) => {
  238. if (store.miniInterface) return;
  239. if (readWidth + 2 * 68 > window.innerWidth) store.config.readWidth -= 160;
  240. };
  241. watch(
  242. () => store.config.readWidth,
  243. (width) => checkPageWidth(width),
  244. );
  245. // 顶部底部跳转
  246. const top = ref();
  247. const bottom = ref();
  248. const toTop = () => {
  249. jump(top.value);
  250. };
  251. const toBottom = () => {
  252. jump(bottom.value);
  253. };
  254. // 书架路由切换
  255. const router = useRouter();
  256. const toShelf = () => {
  257. router.push("/");
  258. };
  259. // 获取章节内容
  260. const chapterData = ref([]);
  261. const noPoint = ref(true);
  262. const getContent = (index, reloadChapter = true, chapterPos = 0) => {
  263. if (reloadChapter) {
  264. //展示进度条
  265. store.setShowContent(false);
  266. //强制滚回顶层
  267. jump(top.value, { duration: 0 });
  268. //从目录,按钮切换章节时保存进度 预加载时不保存
  269. saveReadingBookProgressToBrowser(index, chapterPos);
  270. chapterData.value = [];
  271. }
  272. let bookUrl = sessionStorage.getItem("bookUrl");
  273. let { title, index: chapterIndex } = catalog.value[index];
  274. loadingWrapper(
  275. API.getBookContent(bookUrl, chapterIndex).then(
  276. (res) => {
  277. if (res.data.isSuccess) {
  278. let data = res.data.data;
  279. let content = data.split(/\n+/);
  280. chapterData.value.push({ index, content, title });
  281. if (reloadChapter) toChapterPos(chapterPos);
  282. } else {
  283. ElMessage({ message: res.data.errorMsg, type: "error" });
  284. let content = [res.data.errorMsg];
  285. chapterData.value.push({ index, content, title });
  286. }
  287. store.setContentLoading(true);
  288. noPoint.value = false;
  289. store.setShowContent(true);
  290. if (!res.data.isSuccess) {
  291. throw res.data;
  292. }
  293. },
  294. (err) => {
  295. ElMessage({ message: "获取章节内容失败", type: "error" });
  296. let content = ["获取章节内容失败!"];
  297. chapterData.value.push({ index, content, title });
  298. store.setShowContent(true);
  299. throw err;
  300. },
  301. ),
  302. );
  303. };
  304. // 章节进度跳转和计算
  305. const chapter = ref();
  306. const chapterRef = ref();
  307. const toChapterPos = (pos) => {
  308. nextTick(() => {
  309. if (chapterRef.value.length === 1)
  310. chapterRef.value[0].scrollToReadedLength(pos);
  311. });
  312. };
  313. // 60秒保存一次进度
  314. const saveBookProgressThrottle = useThrottleFn(
  315. () => store.saveBookProgress(),
  316. 60000,
  317. );
  318. const onReadedLengthChange = (index, pos) => {
  319. saveReadingBookProgressToBrowser(index, pos);
  320. saveBookProgressThrottle();
  321. };
  322. // 文档标题
  323. watchEffect(() => {
  324. document.title = catalog.value[chapterIndex.value]?.title || document.title;
  325. });
  326. // 阅读记录保存浏览器
  327. const saveReadingBookProgressToBrowser = (index, pos) => {
  328. //保存localStorage
  329. let bookUrl = sessionStorage.getItem("bookUrl");
  330. var book = JSON.parse(localStorage.getItem(bookUrl));
  331. book.index = index;
  332. book.chapterPos = pos;
  333. localStorage.setItem(bookUrl, JSON.stringify(book));
  334. //最近阅读
  335. book = JSON.parse(localStorage.getItem("readingRecent"));
  336. book.chapterIndex = index;
  337. book.chapterPos = pos;
  338. localStorage.setItem("readingRecent", JSON.stringify(book));
  339. //保存vuex
  340. chapterIndex.value = index;
  341. chapterPos.value = pos;
  342. //保存sessionStorage
  343. sessionStorage.setItem("chapterIndex", index);
  344. sessionStorage.setItem("chapterPos", String(pos));
  345. };
  346. // 进度同步
  347. // 返回导航变化 同步请求会在获取书架前完成
  348. /**
  349. * VisibilityChange https://developer.mozilla.org/zh-CN/docs/Web/API/Document/visibilitychange_event
  350. * 监听关闭页面 切换tab 返回桌面 等操作
  351. * 注意不用监听点击链接导航变化 不对Safari<14.5兼容处理
  352. **/
  353. const onVisibilityChange = () => {
  354. if (document.visibilityState == "hidden") {
  355. API.saveBookProgressWithBeacon(bookProgress.value);
  356. }
  357. };
  358. // 定时同步
  359. // 章节切换
  360. const toNextChapter = () => {
  361. store.setContentLoading(true);
  362. let index = chapterIndex.value + 1;
  363. if (typeof catalog.value[index] !== "undefined") {
  364. ElMessage({
  365. message: "下一章",
  366. type: "info",
  367. });
  368. getContent(index);
  369. store.saveBookProgress();
  370. } else {
  371. ElMessage({
  372. message: "本章是最后一章",
  373. type: "error",
  374. });
  375. }
  376. };
  377. const toPreChapter = () => {
  378. store.setContentLoading(true);
  379. let index = chapterIndex.value - 1;
  380. if (typeof catalog.value[index] !== "undefined") {
  381. ElMessage({
  382. message: "上一章",
  383. type: "info",
  384. });
  385. getContent(index);
  386. store.saveBookProgress();
  387. } else {
  388. ElMessage({
  389. message: "本章是第一章",
  390. type: "error",
  391. });
  392. }
  393. };
  394. let canJump = true;
  395. // 监听方向键
  396. const handleKeyPress = (event) => {
  397. if (!canJump) return;
  398. switch (event.key) {
  399. case "ArrowLeft":
  400. event.stopPropagation();
  401. event.preventDefault();
  402. toPreChapter();
  403. break;
  404. case "ArrowRight":
  405. event.stopPropagation();
  406. event.preventDefault();
  407. toNextChapter();
  408. break;
  409. case "ArrowUp":
  410. event.stopPropagation();
  411. event.preventDefault();
  412. if (document.documentElement.scrollTop === 0) {
  413. ElMessage.warning("已到达页面顶部");
  414. } else {
  415. canJump = false;
  416. jump(0 - document.documentElement.clientHeight + 100, {
  417. duration: store.config.jumpDuration,
  418. callback: () => (canJump = true),
  419. });
  420. }
  421. break;
  422. case "ArrowDown":
  423. event.stopPropagation();
  424. event.preventDefault();
  425. if (
  426. document.documentElement.clientHeight +
  427. document.documentElement.scrollTop ===
  428. document.documentElement.scrollHeight
  429. ) {
  430. ElMessage.warning("已到达页面底部");
  431. } else {
  432. canJump = false;
  433. jump(document.documentElement.clientHeight - 100, {
  434. duration: store.config.jumpDuration,
  435. callback: () => (canJump = true),
  436. });
  437. }
  438. break;
  439. }
  440. };
  441. // 阻止默认滚动事件
  442. const ignoreKeyPress = (event) => {
  443. if (event.key === "ArrowUp" || event.key === "ArrowDown") {
  444. event.preventDefault();
  445. event.stopPropagation();
  446. }
  447. };
  448. onMounted(() => {
  449. //获取书籍数据
  450. let bookUrl = sessionStorage.getItem("bookUrl");
  451. let bookName = sessionStorage.getItem("bookName");
  452. let bookAuthor = sessionStorage.getItem("bookAuthor");
  453. let chapterIndex = Number(sessionStorage.getItem("chapterIndex") || 0);
  454. let chapterPos = Number(sessionStorage.getItem("chapterPos") || 0);
  455. var book = JSON.parse(localStorage.getItem(bookUrl));
  456. if (
  457. book == null ||
  458. chapterIndex != book.index ||
  459. chapterPos != book.chapterPos
  460. ) {
  461. book = {
  462. bookName: bookName,
  463. bookAuthor: bookAuthor,
  464. bookUrl: bookUrl,
  465. index: chapterIndex,
  466. chapterPos: chapterPos,
  467. };
  468. localStorage.setItem(bookUrl, JSON.stringify(book));
  469. }
  470. onResize();
  471. window.addEventListener("resize", onResize);
  472. loadingWrapper(
  473. API.getChapterList(bookUrl).then(
  474. (res) => {
  475. if (!res.data.isSuccess) {
  476. ElMessage({ message: res.data.errorMsg, type: "error" });
  477. setTimeout(toShelf, 500);
  478. return;
  479. }
  480. let data = res.data.data;
  481. store.setCatalog(data);
  482. store.setReadingBook(book);
  483. getContent(chapterIndex, true, chapterPos);
  484. window.addEventListener("keyup", handleKeyPress);
  485. window.addEventListener("keydown", ignoreKeyPress);
  486. // 兼容Safari < 14
  487. document.addEventListener("visibilitychange", onVisibilityChange);
  488. //监听底部加载
  489. scrollObserver = new IntersectionObserver(onReachBottom, {
  490. rootMargin: "-100% 0% 20% 0%",
  491. });
  492. infiniteLoading.value && scrollObserver.observe(loading.value);
  493. //第二次点击同一本书 页面标题不会变化
  494. document.title = null;
  495. document.title = bookName + " | " + catalog.value[chapterIndex].title;
  496. },
  497. (err) => {
  498. ElMessage({ message: "获取书籍目录失败", type: "error" });
  499. throw err;
  500. },
  501. ),
  502. );
  503. });
  504. onUnmounted(() => {
  505. window.removeEventListener("keyup", handleKeyPress);
  506. window.removeEventListener("keydown", ignoreKeyPress);
  507. window.removeEventListener("resize", onResize);
  508. // 兼容Safari < 14
  509. document.removeEventListener("visibilitychange", onVisibilityChange);
  510. readSettingsVisible.value = false;
  511. popCataVisible.value = false;
  512. scrollObserver?.disconnect();
  513. scrollObserver = null;
  514. });
  515. const addToBookShelfConfirm = async () => {
  516. const bookUrl = sessionStorage.getItem("bookUrl");
  517. const bookName = sessionStorage.getItem("bookName");
  518. const isSeachBook = sessionStorage.getItem("isSeachBook");
  519. const book = JSON.parse(localStorage.getItem(bookUrl));
  520. sessionStorage.removeItem("isSeachBook");
  521. // 阅读的是搜索的书籍 并未在书架
  522. if (isSeachBook === "true") {
  523. await ElMessageBox.confirm(`是否将《${bookName}》放入书架?`, "放入书架", {
  524. confirmButtonText: "确认",
  525. cancelButtonText: "否",
  526. type: "info",
  527. /*
  528. ElMessageBox.confirm默认在触发hashChange事件时自动关闭
  529. 按下物理返回键时触发hashChange事件
  530. 使用router.push("/")则不会触发hashChange事件
  531. */
  532. closeOnHashChange: false,
  533. })
  534. .then(() => {
  535. //选择是,无动作
  536. })
  537. .catch(async () => {
  538. //选择否,删除书籍
  539. await API.deleteBook(book);
  540. });
  541. }
  542. };
  543. onBeforeRouteLeave(async (to, from, next) => {
  544. await addToBookShelfConfirm();
  545. next();
  546. });
  547. </script>
  548. <style lang="scss" scoped>
  549. :deep(.pop-setting) {
  550. margin-left: 68px;
  551. top: 0;
  552. }
  553. :deep(.pop-cata) {
  554. margin-left: 10px;
  555. }
  556. .chapter-wrapper {
  557. padding: 0 4%;
  558. overflow-x: hidden;
  559. :deep(.no-point) {
  560. pointer-events: none;
  561. }
  562. .tool-bar {
  563. position: fixed;
  564. top: 0;
  565. left: 50%;
  566. z-index: 100;
  567. .tools {
  568. display: flex;
  569. flex-direction: column;
  570. .tool-icon {
  571. font-size: 18px;
  572. width: 58px;
  573. height: 48px;
  574. text-align: center;
  575. padding-top: 12px;
  576. cursor: pointer;
  577. outline: none;
  578. .iconfont {
  579. font-family: iconfont;
  580. width: 16px;
  581. height: 16px;
  582. font-size: 16px;
  583. margin: 0 auto 6px;
  584. }
  585. .icon-text {
  586. font-size: 12px;
  587. }
  588. }
  589. }
  590. }
  591. .read-bar {
  592. position: fixed;
  593. bottom: 0;
  594. right: 50%;
  595. z-index: 100;
  596. .tools {
  597. display: flex;
  598. flex-direction: column;
  599. .tool-icon {
  600. font-size: 18px;
  601. width: 42px;
  602. height: 31px;
  603. padding-top: 12px;
  604. text-align: center;
  605. align-items: center;
  606. cursor: pointer;
  607. outline: none;
  608. margin-top: -1px;
  609. .iconfont {
  610. font-family: iconfont;
  611. width: 16px;
  612. height: 16px;
  613. font-size: 16px;
  614. margin: 0 auto 6px;
  615. }
  616. }
  617. }
  618. }
  619. .chapter {
  620. font-family: "Microsoft YaHei", PingFangSC-Regular, HelveticaNeue-Light,
  621. "Helvetica Neue Light", sans-serif;
  622. text-align: left;
  623. padding: 0 65px;
  624. min-height: 100vh;
  625. width: 670px;
  626. margin: 0 auto;
  627. .content {
  628. font-size: 18px;
  629. line-height: 1.8;
  630. font-family: "Microsoft YaHei", PingFangSC-Regular, HelveticaNeue-Light,
  631. "Helvetica Neue Light", sans-serif;
  632. .bottom-bar,
  633. .top-bar {
  634. height: 64px;
  635. }
  636. }
  637. }
  638. }
  639. .day {
  640. :deep(.popup) {
  641. box-shadow:
  642. 0 2px 4px rgba(0, 0, 0, 0.12),
  643. 0 0 6px rgba(0, 0, 0, 0.04);
  644. }
  645. :deep(.tool-icon) {
  646. border: 1px solid rgba(0, 0, 0, 0.1);
  647. margin-top: -1px;
  648. color: #000;
  649. .icon-text {
  650. color: rgba(0, 0, 0, 0.4);
  651. }
  652. }
  653. :deep(.chapter) {
  654. border: 1px solid #d8d8d8;
  655. color: #262626;
  656. }
  657. }
  658. .night {
  659. :deep(.popup) {
  660. box-shadow:
  661. 0 2px 4px rgba(0, 0, 0, 0.48),
  662. 0 0 6px rgba(0, 0, 0, 0.16);
  663. }
  664. :deep(.tool-icon) {
  665. border: 1px solid #444;
  666. margin-top: -1px;
  667. color: #666;
  668. .icon-text {
  669. color: #666;
  670. }
  671. }
  672. :deep(.chapter) {
  673. border: 1px solid #444;
  674. color: #666;
  675. }
  676. :deep(.popper__arrow) {
  677. background: #666;
  678. }
  679. }
  680. @media screen and (max-width: 776px) {
  681. .chapter-wrapper {
  682. padding: 0;
  683. .tool-bar {
  684. left: 0;
  685. width: 100vw;
  686. margin-left: 0 !important;
  687. .tools {
  688. flex-direction: row;
  689. justify-content: space-between;
  690. .tool-icon {
  691. border: none;
  692. }
  693. }
  694. }
  695. .read-bar {
  696. right: 0;
  697. width: 100vw;
  698. margin-right: 0 !important;
  699. .tools {
  700. flex-direction: row;
  701. justify-content: space-between;
  702. padding: 0 15px;
  703. .tool-icon {
  704. border: none;
  705. width: auto;
  706. .iconfont {
  707. display: inline-block;
  708. }
  709. }
  710. }
  711. }
  712. .chapter {
  713. width: 100vw !important;
  714. padding: 0 20px;
  715. box-sizing: border-box;
  716. }
  717. }
  718. }
  719. </style>