BookChapter.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  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 v-for="data in chapterData" :key="data.index" ref="chapter">
  85. <div class="title" :index="data.index" v-if="showContent">
  86. {{ data.title }}
  87. </div>
  88. <chapter-content :carray="data.content" v-if="showContent" />
  89. </div>
  90. <div class="loading" ref="loading"></div>
  91. <div class="bottom-bar" ref="bottom"></div>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script setup>
  97. import jump from "@/plugins/jump";
  98. import settings from "@/plugins/config";
  99. import API from "@api";
  100. import loadingSvg from "@element-plus/icons-svg/loading.svg?raw";
  101. const showLoading = ref(false);
  102. const loadingSerive = ref(null);
  103. const content = ref();
  104. watch(showLoading, (loading) => {
  105. if (!loading) return loadingSerive.value?.close();
  106. loadingSerive.value = ElLoading.service({
  107. target: content.value,
  108. spinner: loadingSvg,
  109. text: "正在获取信息",
  110. lock: true,
  111. });
  112. });
  113. const store = useBookStore();
  114. // 读取阅读配置
  115. try {
  116. const browerConfig = JSON.parse(localStorage.getItem("config"));
  117. if (browerConfig != null) store.setConfig(browerConfig);
  118. } catch {
  119. localStorage.removeItem("config");
  120. }
  121. const loading = ref();
  122. const noPoint = ref(true);
  123. const showToolBar = ref(false);
  124. const chapterData = ref([]);
  125. const scrollObserve = ref(null);
  126. const readingObserve = ref(null);
  127. const {
  128. catalog,
  129. popCataVisible,
  130. readSettingsVisible,
  131. miniInterface,
  132. showContent,
  133. } = storeToRefs(store);
  134. const { chapterPos, index: chapterIndex } = toRefs(store.readingBook);
  135. const { theme, infiniteLoading } = toRefs(store.config);
  136. // 主题部分
  137. const bodyColor = computed(() => settings.themes[theme.value].body);
  138. const chapterColor = computed(() => settings.themes[theme.value].content);
  139. const popupColor = computed(() => settings.themes[theme.value].popup);
  140. const readWidth = computed(() => {
  141. if (!miniInterface.value) {
  142. return store.config.readWidth - 130 + "px";
  143. } else {
  144. return window.innerWidth + "px";
  145. }
  146. });
  147. const popupWidth = computed(() => {
  148. if (!miniInterface.value) {
  149. return store.config.readWidth - 33;
  150. } else {
  151. return window.innerWidth - 33;
  152. }
  153. });
  154. const bodyTheme = computed(() => {
  155. return {
  156. background: settings.themes[theme.value].body,
  157. };
  158. });
  159. const chapterTheme = computed(() => {
  160. return {
  161. background: settings.themes[theme.value].content,
  162. width: readWidth.value,
  163. };
  164. });
  165. const leftBarTheme = computed(() => {
  166. return {
  167. background: settings.themes[theme.value].popup,
  168. marginLeft: miniInterface.value
  169. ? 0
  170. : -(store.config.readWidth / 2 + 68) + "px",
  171. display: miniInterface.value && !showToolBar.value ? "none" : "block",
  172. };
  173. });
  174. const rightBarTheme = computed(() => {
  175. return {
  176. background: settings.themes[theme.value].popup,
  177. marginRight: miniInterface.value
  178. ? 0
  179. : -(store.config.readWidth / 2 + 52) + "px",
  180. display: miniInterface.value && !showToolBar.value ? "none" : "block",
  181. };
  182. });
  183. const isNight = ref(false);
  184. watchEffect(() => {
  185. isNight.value = theme.value == 6;
  186. });
  187. watch(bodyColor, (color) => {
  188. bodyTheme.value.background = color;
  189. });
  190. watch(chapterColor, (color) => {
  191. chapterTheme.value.background = color;
  192. });
  193. watch(readWidth, (width) => {
  194. chapterTheme.value.width = width;
  195. let leftToolMargin = -((parseInt(width) + 130) / 2 + 68) + "px";
  196. let rightToolMargin = -((parseInt(width) + 130) / 2 + 52) + "px";
  197. leftBarTheme.value.marginLeft = leftToolMargin;
  198. rightBarTheme.value.marginRight = rightToolMargin;
  199. });
  200. watch(popupColor, (color) => {
  201. leftBarTheme.value.background = color;
  202. rightBarTheme.value.background = color;
  203. });
  204. watchEffect(() => {
  205. if (chapterData.value.length > 0) {
  206. store.setContentLoading(false);
  207. //添加章节内容到observe
  208. addReadingObserve();
  209. }
  210. });
  211. watchEffect(() => {
  212. document.title = catalog.value[chapterIndex.value]?.title || document.title;
  213. store.saveBookProcess();
  214. });
  215. watchEffect(() => {
  216. if (!infiniteLoading.value) {
  217. scrollObserve.value?.disconnect();
  218. } else {
  219. scrollObserve.value?.observe(loading.value);
  220. }
  221. });
  222. const top = ref();
  223. const getContent = (index, reloadChapter = true, chapterPos = 0) => {
  224. if (reloadChapter) {
  225. //展示进度条
  226. store.setShowContent(false);
  227. showLoading.value = true;
  228. //强制滚回顶层
  229. jump(top.value, { duration: 0 });
  230. //从目录,按钮切换章节时保存进度 预加载时不保存
  231. saveReadingBookProgressToBrowser(index, chapterPos);
  232. }
  233. let bookUrl = sessionStorage.getItem("bookUrl");
  234. let { title, index: chapterIndex } = catalog.value[index];
  235. API.getBookContent(bookUrl, chapterIndex).then(
  236. (res) => {
  237. if (res.data.isSuccess) {
  238. let data = res.data.data;
  239. let content = data.split(/\n+/);
  240. updateChapterData({ index, content, title }, reloadChapter);
  241. } else {
  242. ElMessage({ message: res.data.errorMsg, type: "error" });
  243. let content = [res.data.errorMsg];
  244. updateChapterData({ index, content, title }, reloadChapter);
  245. }
  246. store.setContentLoading(true);
  247. showLoading.value = false;
  248. noPoint.value = false;
  249. store.setShowContent(true);
  250. if (!res.data.isSuccess) {
  251. throw res.data;
  252. }
  253. },
  254. (err) => {
  255. ElMessage({ message: "获取章节内容失败", type: "error" });
  256. let content = ["获取章节内容失败!"];
  257. updateChapterData({ index, content, title }, reloadChapter);
  258. showLoading.value = false;
  259. store.setShowContent(true);
  260. throw err;
  261. }
  262. );
  263. };
  264. const chapter = ref();
  265. const toChapterPos = (chapterPos) => {
  266. if (!chapterPos) return;
  267. nextTick(() => {
  268. //计算chapterPos对应的段落行数
  269. let wordCount = 0;
  270. let index = chapterData.value[0].content.findIndex((paragraph) => {
  271. wordCount += paragraph.length;
  272. return wordCount >= chapterPos.value;
  273. });
  274. if (index == -1) index = chapterData.value[0].content.length - 1;
  275. if (index == 0) return; //第一行不跳转
  276. //跳转
  277. jump(chapter.value[0].children[1].children[index], {
  278. duration: 0,
  279. callback: () => (chapterPos.value = 0),
  280. });
  281. });
  282. };
  283. //计算当前章节阅读的字数
  284. const computeChapterPos = () => {
  285. //dom没渲染时 返回0
  286. if (!chapter.value[0]) return;
  287. //计算当前阅读进度对应的element
  288. let index = chapterData.value.findIndex(
  289. (chapter) => chapter.index == chapterIndex.value
  290. );
  291. if (index == -1) return;
  292. let element = chapter.value[index].children[1].children;
  293. //计算已读字数
  294. let mChapterPos = 0;
  295. for (let paragraph of element) {
  296. let text = paragraph.innerText;
  297. mChapterPos += text.length;
  298. if (paragraph.getBoundingClientRect().top >= 0) {
  299. chapterPos.value = mChapterPos;
  300. break;
  301. }
  302. }
  303. };
  304. const bottom = ref();
  305. const toTop = () => {
  306. jump(top.value);
  307. };
  308. const toBottom = () => {
  309. jump(bottom.value);
  310. };
  311. const toNextChapter = () => {
  312. store.setContentLoading(true);
  313. let index = chapterIndex.value + 1;
  314. if (typeof catalog.value[index] !== "undefined") {
  315. ElMessage({
  316. message: "下一章",
  317. type: "info",
  318. });
  319. getContent(index);
  320. } else {
  321. ElMessage({
  322. message: "本章是最后一章",
  323. type: "error",
  324. });
  325. }
  326. };
  327. const toPreChapter = () => {
  328. store.setContentLoading(true);
  329. let index = chapterIndex.value - 1;
  330. if (typeof catalog.value[index] !== "undefined") {
  331. ElMessage({
  332. message: "上一章",
  333. type: "info",
  334. });
  335. getContent(index);
  336. } else {
  337. ElMessage({
  338. message: "本章是第一章",
  339. type: "error",
  340. });
  341. }
  342. };
  343. const saveReadingBookProgressToBrowser = (index, pos = chapterPos.value) => {
  344. //保存localStorage
  345. let bookUrl = sessionStorage.getItem("bookUrl");
  346. var book = JSON.parse(localStorage.getItem(bookUrl));
  347. book.index = index;
  348. book.chapterPos = pos;
  349. localStorage.setItem(bookUrl, JSON.stringify(book));
  350. //最近阅读
  351. book = JSON.parse(localStorage.getItem("readingRecent"));
  352. book.chapterIndex = index;
  353. book.chapterPos = pos;
  354. localStorage.setItem("readingRecent", JSON.stringify(book));
  355. //保存vuex
  356. chapterIndex.value = index;
  357. chapterPos.value = pos;
  358. //保存sessionStorage
  359. sessionStorage.setItem("chapterIndex", index);
  360. sessionStorage.setItem("chapterPos", String(pos));
  361. };
  362. const updateChapterData = async (data, reloadChapter) => {
  363. if (reloadChapter) {
  364. chapterData.value.splice(0);
  365. }
  366. chapterData.value.push(data);
  367. };
  368. const loadMore = () => {
  369. let index = chapterData.value.slice(-1)[0].index;
  370. if (catalog.value.length - 1 > index) {
  371. getContent(index + 1, false);
  372. }
  373. };
  374. const router = useRouter();
  375. const toShelf = () => {
  376. router.push("/");
  377. };
  378. //监听方向键
  379. const handleKeyPress = (event) => {
  380. switch (event.key) {
  381. case "ArrowLeft":
  382. event.stopPropagation();
  383. event.preventDefault();
  384. toPreChapter();
  385. break;
  386. case "ArrowRight":
  387. event.stopPropagation();
  388. event.preventDefault();
  389. toNextChapter();
  390. break;
  391. case "ArrowUp":
  392. event.stopPropagation();
  393. event.preventDefault();
  394. if (document.documentElement.scrollTop === 0) {
  395. ElMessage({
  396. message: "已到达页面顶部",
  397. type: "warn",
  398. });
  399. } else {
  400. jump(0 - document.documentElement.clientHeight + 100);
  401. }
  402. break;
  403. case "ArrowDown":
  404. event.stopPropagation();
  405. event.preventDefault();
  406. if (
  407. document.documentElement.clientHeight +
  408. document.documentElement.scrollTop ===
  409. document.documentElement.scrollHeight
  410. ) {
  411. ElMessage({
  412. message: "已到达页面底部",
  413. type: "warn",
  414. });
  415. } else {
  416. jump(document.documentElement.clientHeight - 100);
  417. }
  418. break;
  419. }
  420. };
  421. //IntersectionObserver回调 底部加载
  422. const handleIScrollObserve = (entries) => {
  423. if (showLoading.value) return;
  424. for (let { isIntersecting } of entries) {
  425. if (!isIntersecting) return;
  426. loadMore();
  427. }
  428. };
  429. //IntersectionObserver回调 当前阅读章节序号
  430. const handleIReadingObserve = (entries) => {
  431. nextTick(() => {
  432. for (let { isIntersecting, target, boundingClientRect } of entries) {
  433. let titleElement = target.querySelector(".title");
  434. if (!titleElement) return;
  435. let chapterTitleIndex = parseInt(titleElement.getAttribute("index"));
  436. if (isIntersecting) {
  437. chapterIndex.value = chapterTitleIndex;
  438. } else {
  439. if (boundingClientRect.top < 0) {
  440. chapterIndex.value = chapterTitleIndex + 1;
  441. } else {
  442. chapterIndex.value = chapterTitleIndex - 1;
  443. }
  444. }
  445. }
  446. });
  447. };
  448. //添加所有章节到observe
  449. const addReadingObserve = () => {
  450. nextTick(() => {
  451. let chapterElements = chapter.value;
  452. if (!chapterElements) return;
  453. chapterElements.forEach((el) => readingObserve.value.observe(el));
  454. });
  455. };
  456. /*
  457. onBeforeRouteLeave((to, from, next) => {
  458. if (
  459. store.searchBooks.every((book) => book.bookUrl != store.readingBook.bookUrl)
  460. ) {
  461. next();
  462. } else {
  463. alert(111);
  464. next(false);
  465. }
  466. });
  467. window.addEventListener("beforeunload", (e) => {
  468. e.preventDefault();
  469. e.returnValue = "";
  470. alert(111);
  471. });
  472. */
  473. onMounted(() => {
  474. showLoading.value = true;
  475. //获取书籍数据
  476. let bookUrl = sessionStorage.getItem("bookUrl");
  477. let bookName = sessionStorage.getItem("bookName");
  478. let bookAuthor = sessionStorage.getItem("bookAuthor");
  479. let chapterIndex = Number(sessionStorage.getItem("chapterIndex") || 0);
  480. let chapterPos = Number(sessionStorage.getItem("chapterPos") || 0);
  481. var book = JSON.parse(localStorage.getItem(bookUrl));
  482. if (
  483. book == null ||
  484. chapterIndex != book.index ||
  485. chapterPos != book.chapterPos
  486. ) {
  487. book = {
  488. bookName: bookName,
  489. bookAuthor: bookAuthor,
  490. bookUrl: bookUrl,
  491. index: chapterIndex,
  492. chapterPos: chapterPos,
  493. };
  494. localStorage.setItem(bookUrl, JSON.stringify(book));
  495. }
  496. API.getChapterList(bookUrl).then(
  497. (res) => {
  498. showLoading.value = false;
  499. if (!res.data.isSuccess) {
  500. ElMessage({ message: res.data.errorMsg, type: "error" });
  501. setTimeout(toShelf, 500);
  502. return;
  503. }
  504. let data = res.data.data;
  505. store.setCatalog(data);
  506. store.setReadingBook(book);
  507. getContent(chapterIndex, true, chapterPos);
  508. window.addEventListener("keyup", handleKeyPress);
  509. //监听底部加载
  510. scrollObserve.value = new IntersectionObserver(handleIScrollObserve, {
  511. rootMargin: "-100% 0% 20% 0%",
  512. });
  513. infiniteLoading.value && scrollObserve.value.observe(loading.value);
  514. //监听当前阅读章节
  515. readingObserve.value = new IntersectionObserver(handleIReadingObserve);
  516. //第二次点击同一本书 页面标题不会变化
  517. document.title = null;
  518. document.title = bookName + " | " + catalog.value[chapterIndex].title;
  519. },
  520. (err) => {
  521. showLoading.value = false;
  522. ElMessage({ message: "获取书籍目录失败", type: "error" });
  523. throw err;
  524. }
  525. );
  526. });
  527. onUnmounted(() => {
  528. window.removeEventListener("keyup", handleKeyPress);
  529. readSettingsVisible.value = false;
  530. popCataVisible.value = false;
  531. scrollObserve.value?.disconnect();
  532. readingObserve.value?.disconnect();
  533. });
  534. </script>
  535. <style lang="scss" scoped>
  536. :deep(.pop-setting) {
  537. margin-left: 68px;
  538. top: 0;
  539. }
  540. :deep(.pop-cata) {
  541. margin-left: 10px;
  542. }
  543. .chapter-wrapper {
  544. padding: 0 4%;
  545. flex-direction: column;
  546. align-items: center;
  547. :deep(.no-point) {
  548. pointer-events: none;
  549. }
  550. .tool-bar {
  551. position: fixed;
  552. top: 0;
  553. left: 50%;
  554. z-index: 100;
  555. .tools {
  556. display: flex;
  557. flex-direction: column;
  558. .tool-icon {
  559. font-size: 18px;
  560. width: 58px;
  561. height: 48px;
  562. text-align: center;
  563. padding-top: 12px;
  564. cursor: pointer;
  565. outline: none;
  566. .iconfont {
  567. font-family: iconfont;
  568. width: 16px;
  569. height: 16px;
  570. font-size: 16px;
  571. margin: 0 auto 6px;
  572. }
  573. .icon-text {
  574. font-size: 12px;
  575. }
  576. }
  577. }
  578. }
  579. .read-bar {
  580. position: fixed;
  581. bottom: 0;
  582. right: 50%;
  583. z-index: 100;
  584. .tools {
  585. display: flex;
  586. flex-direction: column;
  587. .tool-icon {
  588. font-size: 18px;
  589. width: 42px;
  590. height: 31px;
  591. padding-top: 12px;
  592. text-align: center;
  593. align-items: center;
  594. cursor: pointer;
  595. outline: none;
  596. margin-top: -1px;
  597. .iconfont {
  598. font-family: iconfont;
  599. width: 16px;
  600. height: 16px;
  601. font-size: 16px;
  602. margin: 0 auto 6px;
  603. }
  604. }
  605. }
  606. }
  607. .chapter {
  608. font-family: "Microsoft YaHei", PingFangSC-Regular, HelveticaNeue-Light,
  609. "Helvetica Neue Light", sans-serif;
  610. text-align: left;
  611. padding: 0 65px;
  612. min-height: 100vh;
  613. width: 670px;
  614. margin: 0 auto;
  615. :deep(.el-loading-mask) {
  616. background-color: rgba(0, 0, 0, 0);
  617. }
  618. :deep(.el-loading-spinner) {
  619. font-size: 36px;
  620. color: #b5b5b5;
  621. }
  622. :deep(.el-loading-text) {
  623. font-weight: 500;
  624. color: #b5b5b5;
  625. }
  626. .content {
  627. overflow: hidden;
  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. .title {
  633. margin-bottom: 57px;
  634. font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light,
  635. "Helvetica Neue Light", "Microsoft YaHei", sans-serif;
  636. }
  637. .bottom-bar,
  638. .top-bar {
  639. height: 64px;
  640. }
  641. }
  642. }
  643. }
  644. .day {
  645. :deep(.popup) {
  646. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  647. }
  648. :deep(.tool-icon) {
  649. border: 1px solid rgba(0, 0, 0, 0.1);
  650. margin-top: -1px;
  651. color: #000;
  652. .icon-text {
  653. color: rgba(0, 0, 0, 0.4);
  654. }
  655. }
  656. :deep(.chapter) {
  657. border: 1px solid #d8d8d8;
  658. color: #262626;
  659. }
  660. }
  661. .night {
  662. :deep(.popup) {
  663. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.48), 0 0 6px rgba(0, 0, 0, 0.16);
  664. }
  665. :deep(.tool-icon) {
  666. border: 1px solid #444;
  667. margin-top: -1px;
  668. color: #666;
  669. .icon-text {
  670. color: #666;
  671. }
  672. }
  673. :deep(.chapter) {
  674. border: 1px solid #444;
  675. color: #666;
  676. }
  677. :deep(.popper__arrow) {
  678. background: #666;
  679. }
  680. }
  681. @media screen and (max-width: 750px) {
  682. .chapter-wrapper {
  683. padding: 0;
  684. .tool-bar {
  685. left: 0;
  686. width: 100vw;
  687. margin-left: 0 !important;
  688. .tools {
  689. flex-direction: row;
  690. justify-content: space-between;
  691. .tool-icon {
  692. border: none;
  693. }
  694. }
  695. }
  696. .read-bar {
  697. right: 0;
  698. width: 100vw;
  699. margin-right: 0 !important;
  700. .tools {
  701. flex-direction: row;
  702. justify-content: space-between;
  703. padding: 0 15px;
  704. .tool-icon {
  705. border: none;
  706. width: auto;
  707. .iconfont {
  708. display: inline-block;
  709. }
  710. }
  711. }
  712. }
  713. .chapter {
  714. width: 100vw !important;
  715. padding: 0 20px;
  716. box-sizing: border-box;
  717. }
  718. }
  719. }
  720. </style>