Merge remote-tracking branch 'origin/master'

This commit is contained in:
kunfei
2023-05-11 10:09:20 +08:00
18 changed files with 26 additions and 30 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{u as n,A as r}from"./index-a756f3a3.js";import"./vendor-3adfd12a.js";const i=n();i.setMiniInterface(window.innerWidth<750);window.onresize=()=>{i.setMiniInterface(window.innerWidth<750)};r.getReadConfig().then(a=>{var e=a.data.data;if(e){const t=n();let o=JSON.parse(e),s=t.config;o=Object.assign(s,o),t.setConfig(o)}});
import{u as n,A as r}from"./index-4dafd329.js";import"./vendor-16414864.js";const i=n();i.setMiniInterface(window.innerWidth<750);window.onresize=()=>{i.setMiniInterface(window.innerWidth<750)};r.getReadConfig().then(a=>{var e=a.data.data;if(e){const t=n();let o=JSON.parse(e),s=t.config;o=Object.assign(s,o),t.setConfig(o)}});

View File

@@ -1 +1 @@
import{u}from"./index-a756f3a3.js";const f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function D(t,n,e,a){let s=t<12?"AM":"PM";return a&&(s=s.split("").reduce((l,i)=>l+=`${i}.`,"")),e?s.toLowerCase():s}function L(t,n,e={}){var a;const s=t.getFullYear(),l=t.getMonth(),i=t.getDate(),o=t.getHours(),r=t.getMinutes(),g=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),c=(a=e.customMeridiem)!=null?a:D,M={YY:()=>String(s).slice(-2),YYYY:()=>s,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(e.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(e.locales,{month:"long"}),D:()=>String(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(o),HH:()=>`${o}`.padStart(2,"0"),h:()=>`${o%12||12}`.padStart(1,"0"),hh:()=>`${o%12||12}`.padStart(2,"0"),m:()=>String(r),mm:()=>`${r}`.padStart(2,"0"),s:()=>String(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(e.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(e.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(e.locales,{weekday:"long"}),A:()=>c(o,r),AA:()=>c(o,r,!1,!0),a:()=>c(o,r,!0),aa:()=>c(o,r,!0,!0)};return n.replace(f,(S,h)=>h||M[S]())}const w=t=>/,\s*\{/.test(t)||!(t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:"));function Y(t){return location.origin+"/image?path="+encodeURIComponent(t)+"&url="+encodeURIComponent(sessionStorage.getItem("bookUrl"))+"&width="+u().config.readWidth}const $=t=>{let n=new Date().getTime(),e=Math.floor((n-t)/1e3),a="";return e<=30?a="":e<60?a=e+"":e<3600?a=Math.floor(e/60)+"":e<86400?a=Math.floor(e/3600)+"":e<2592e3?a=Math.floor(e/86400)+"":a=L(new Date(t),"YYYY-MM-DD"),a},v='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"/></svg>';export{$ as d,Y as g,w as i,v as l};
import{u}from"./index-4dafd329.js";const f=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function D(t,n,e,a){let s=t<12?"AM":"PM";return a&&(s=s.split("").reduce((l,i)=>l+=`${i}.`,"")),e?s.toLowerCase():s}function L(t,n,e={}){var a;const s=t.getFullYear(),l=t.getMonth(),i=t.getDate(),o=t.getHours(),r=t.getMinutes(),g=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),c=(a=e.customMeridiem)!=null?a:D,M={YY:()=>String(s).slice(-2),YYYY:()=>s,M:()=>l+1,MM:()=>`${l+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(e.locales,{month:"short"}),MMMM:()=>t.toLocaleDateString(e.locales,{month:"long"}),D:()=>String(i),DD:()=>`${i}`.padStart(2,"0"),H:()=>String(o),HH:()=>`${o}`.padStart(2,"0"),h:()=>`${o%12||12}`.padStart(1,"0"),hh:()=>`${o%12||12}`.padStart(2,"0"),m:()=>String(r),mm:()=>`${r}`.padStart(2,"0"),s:()=>String(g),ss:()=>`${g}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(e.locales,{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(e.locales,{weekday:"short"}),dddd:()=>t.toLocaleDateString(e.locales,{weekday:"long"}),A:()=>c(o,r),AA:()=>c(o,r,!1,!0),a:()=>c(o,r,!0),aa:()=>c(o,r,!0,!0)};return n.replace(f,(S,h)=>h||M[S]())}const w=t=>/,\s*\{/.test(t)||!(t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:"));function Y(t){return location.origin+"/image?path="+encodeURIComponent(t)+"&url="+encodeURIComponent(sessionStorage.getItem("bookUrl"))+"&width="+u().config.readWidth}const $=t=>{let n=new Date().getTime(),e=Math.floor((n-t)/1e3),a="";return e<=30?a="":e<60?a=e+"":e<3600?a=Math.floor(e/60)+"":e<86400?a=Math.floor(e/3600)+"":e<2592e3?a=Math.floor(e/86400)+"":a=L(new Date(t),"YYYY-MM-DD"),a},v='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"/></svg>';export{$ as d,Y as g,w as i,v as l};

View File

@@ -4,8 +4,8 @@
<meta charset="UTF-8" />
<link rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script type="module" crossorigin src="./assets/index-a756f3a3.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-3adfd12a.js">
<script type="module" crossorigin src="./assets/index-4dafd329.js"></script>
<link rel="modulepreload" crossorigin href="./assets/vendor-16414864.js">
<link rel="stylesheet" href="./assets/vendor-6f0d1692.css">
<link rel="stylesheet" href="./assets/index-a1f1b303.css">
</head>

View File

@@ -12,8 +12,6 @@ defineProps(["index", "source", "gotoChapter"]);
const store = useBookStore();
const { catalog } = storeToRefs(store);
const index = computed(() => store.readingBook.index);
const isSelected = (idx) => {

View File

@@ -5,8 +5,7 @@
style="height: 300px; overflow: auto"
:class="{ night: isNight, day: !isNight }"
ref="virtualListRef"
:data-key="'index'"
:start="index"
data-key="url"
wrap-class="data-wrapper"
item-class="cata"
:data-sources="catalog"
@@ -19,7 +18,6 @@
<script setup>
import VirtualList from "vue3-virtual-scroll-list";
import jump from "../plugins/jump";
import settings from "../plugins/config";
import "../assets/fonts/popfont.css";
import CatalogItem from "./CatalogItem.vue";
@@ -43,11 +41,10 @@ const index = computed({
set: (value) => (store.readingBook.index = value),
});
const virtualListRef = ref();
watch(popCataVisible, (visible) => {
if (!visible) return;
nextTick(() => {
virtualListRef.value.scrollToIndex(index.value);
});
if (visible) return; // 页面可见时虚拟列表内部sizes Map全为0
nextTick(() => virtualListRef.value.scrollToIndex(index.value));
});
const emit = defineEmits(["getContent"]);
@@ -57,6 +54,12 @@ const gotoChapter = (note) => {
store.setContentLoading(true);
emit("getContent", index.value);
};
onUpdated(() => {
// catalog变化触发dom更新和ResizeObserver更新虚拟列表内部的sizes Map
store.popCataVisible = false;
// 触发popCataVisible watcher
// virtualListRef.value.scrollToIndex(index.value)
});
</script>
<style lang="scss" scoped>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -22,18 +22,11 @@
```shell
pnpm install
#安装项目
pnpm serve
pnpm dev
#开发模式
pnpm build
#打包
pnpm lint
pnpm lint:fix
#格式化代码
```
- 调试的时候可以修改.env.development里面的地址连接手机端调试
## 预览
![](imgs/1.jpg)
![](imgs/2.jpg)
![](imgs/3.jpg)
![](imgs/4.jpg)

View File

@@ -1,6 +1,5 @@
# legado_web_editor
![image-20220901202413040](https://cdn.jsdelivr.net/gh/jgckM/image@main/image/202209031638325.png)
## 🚧开发注意
@@ -29,6 +28,6 @@ pnpm build
### Lints and fixes files
```
pnpm lint
pnpm lint:fix
```

View File

@@ -484,6 +484,7 @@ window.addEventListener("beforeunload", (e) => {
alert(111);
});
*/
onMounted(() => {
showLoading.value = true;
//获取书籍数据
@@ -519,6 +520,8 @@ onMounted(() => {
let data = res.data.data;
store.setCatalog(data);
store.setReadingBook(book);
// 目录使用虚拟列表显示,需要手动显示一次以便滚动到当前位置
store.popCataVisible = true;
getContent(chapterIndex, true, chapterPos);
window.addEventListener("keyup", handleKeyPress);