This commit is contained in:
kunfei 2023-07-25 21:35:32 +08:00
parent 021e6bf400
commit 1eb6f96153
12 changed files with 59 additions and 38 deletions

View File

@ -78,6 +78,7 @@
"watch": true, "watch": true,
"watchEffect": true, "watchEffect": true,
"watchPostEffect": true, "watchPostEffect": true,
"watchSyncEffect": true "watchSyncEffect": true,
"toValue": true
} }
} }

View File

@ -3,7 +3,7 @@ import fs from "node:fs";
const LEGADO_ASSETS_WEB_VUE_DIR = new URL( const LEGADO_ASSETS_WEB_VUE_DIR = new URL(
"../../../app/src/main/assets/web/vue", "../../../app/src/main/assets/web/vue",
import.meta.url import.meta.url,
); );
const VUE_DIST_DIR = new URL("../dist", import.meta.url); const VUE_DIST_DIR = new URL("../dist", import.meta.url);
@ -33,8 +33,8 @@ fs.rm(
throw error; throw error;
} }
console.log("> cp success"); console.log("> cp success");
} },
); );
}); });
} },
); );

View File

@ -30,7 +30,7 @@ const saveBookProgressWithBeacon = (bookProgress) => {
// 常规请求可能会被取消 使用Fetch keep-alive 或者 navigator.sendBeacon // 常规请求可能会被取消 使用Fetch keep-alive 或者 navigator.sendBeacon
navigator.sendBeacon( navigator.sendBeacon(
`${import.meta.env.VITE_API || location.origin}/saveBookProgress`, `${import.meta.env.VITE_API || location.origin}/saveBookProgress`,
JSON.stringify(bookProgress) JSON.stringify(bookProgress),
); );
}; };
@ -41,19 +41,19 @@ const getChapterList = (/** @type {string} */ bookUrl) =>
const getBookContent = ( const getBookContent = (
/** @type {string} */ bookUrl, /** @type {string} */ bookUrl,
/** @type {number} */ chapterIndex /** @type {number} */ chapterIndex,
) => ) =>
ajax.get( ajax.get(
"/getBookContent?url=" + "/getBookContent?url=" +
encodeURIComponent(bookUrl) + encodeURIComponent(bookUrl) +
"&index=" + "&index=" +
chapterIndex chapterIndex,
); );
const search = ( const search = (
/** @type {string} */ searchKey, /** @type {string} */ searchKey,
/** @type {(data: string) => void} */ onReceive, /** @type {(data: string) => void} */ onReceive,
/** @type {() => void} */ onFinish /** @type {() => void} */ onFinish,
) => { ) => {
// webSocket // webSocket
const url = `ws://${hostname}:${Number(port) + 1}/searchBook`; const url = `ws://${hostname}:${Number(port) + 1}/searchBook`;
@ -97,7 +97,7 @@ const debug = (
/** @type {string} */ sourceUrl, /** @type {string} */ sourceUrl,
/** @type {string} */ searchKey, /** @type {string} */ searchKey,
/** @type {(data: string) => void} */ onReceive, /** @type {(data: string) => void} */ onReceive,
/** @type {() => void} */ onFinish /** @type {() => void} */ onFinish,
) => { ) => {
// webSocket // webSocket
const url = `ws://${hostname}:${Number(port) + 1}/${ const url = `ws://${hostname}:${Number(port) + 1}/${

View File

@ -61,6 +61,7 @@ declare global {
const toRaw: typeof import('vue')['toRaw'] const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef'] const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs'] const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef'] const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref'] const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs'] const useAttrs: typeof import('vue')['useAttrs']

View File

@ -62,7 +62,7 @@ const getCover = (coverUrl) => {
}; };
const subJustify = computed(() => const subJustify = computed(() =>
props.isSearch ? "space-between" : "flex-start" props.isSearch ? "space-between" : "flex-start",
); );
</script> </script>

View File

@ -59,7 +59,7 @@ const paragraphRef = ref();
const scrollToReadedLength = (length) => { const scrollToReadedLength = (length) => {
if (length === 0) return; if (length === 0) return;
let paragraphIndex = chapterPos.value.findIndex( let paragraphIndex = chapterPos.value.findIndex(
(wordCount) => wordCount >= length (wordCount) => wordCount >= length,
); );
if (paragraphIndex === -1) return; if (paragraphIndex === -1) return;
nextTick(() => { nextTick(() => {
@ -81,14 +81,14 @@ onMounted(() => {
emit( emit(
"readedLengthChange", "readedLengthChange",
props.chapterIndex, props.chapterIndex,
parseInt(target.dataset.chapterpos) parseInt(target.dataset.chapterpos),
); );
} }
} }
}, },
{ {
rootMargin: `0px 0px -${window.innerHeight - 24}px 0px`, rootMargin: `0px 0px -${window.innerHeight - 24}px 0px`,
} },
); );
intersectionObserver.observe(titleRef.value); intersectionObserver.observe(titleRef.value);
paragraphRef.value.forEach((element) => { paragraphRef.value.forEach((element) => {
@ -105,8 +105,12 @@ onUnmounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.title { .title {
margin-bottom: 57px; margin-bottom: 57px;
font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light, font:
"Helvetica Neue Light", "Microsoft YaHei", sans-serif; 24px / 32px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
} }
p { p {

View File

@ -106,8 +106,12 @@ onUpdated(() => {
//width: 50%; //width: 50%;
height: 40px; height: 40px;
cursor: pointer; cursor: pointer;
font: 16px / 40px PingFangSC-Regular, HelveticaNeue-Light, font:
"Helvetica Neue Light", "Microsoft YaHei", sans-serif; 16px / 40px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
} }
} }

View File

@ -362,7 +362,10 @@ const uploadConfig = (config) => {
list-style: none outside none; list-style: none outside none;
i { i {
font: 12px / 16px PingFangSC-Regular, "-apple-system", Simsun; font:
12px / 16px PingFangSC-Regular,
"-apple-system",
Simsun;
display: inline-block; display: inline-block;
min-width: 48px; min-width: 48px;
margin-right: 16px; margin-right: 16px;
@ -410,8 +413,12 @@ const uploadConfig = (config) => {
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
font: 14px / 34px PingFangSC-Regular, HelveticaNeue-Light, font:
"Helvetica Neue Light", "Microsoft YaHei", sans-serif; 14px / 34px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
} }
.font-item-input { .font-item-input {
width: 168px; width: 168px;

View File

@ -31,7 +31,7 @@ watch(
() => store.isDebuging, () => store.isDebuging,
() => { () => {
if (store.isDebuging) startDebug(); if (store.isDebuging) startDebug();
} },
); );
const appendDebugMsg = (msg) => { const appendDebugMsg = (msg) => {
@ -46,7 +46,7 @@ const startDebug = async () => {
store.currentSourceUrl, store.currentSourceUrl,
searchKey.value || store.searchKey, searchKey.value || store.searchKey,
appendDebugMsg, appendDebugMsg,
store.debugFinish store.debugFinish,
); );
}; };

View File

@ -211,8 +211,8 @@ const buttons = ref(
{ name: "↶撤销操作", hotKeys: [], action: undo }, { name: "↶撤销操作", hotKeys: [], action: undo },
{ name: "↷重做操作", hotKeys: [], action: redo }, { name: "↷重做操作", hotKeys: [], action: redo },
{ name: "⇏调试源", hotKeys: [], action: debug }, { name: "⇏调试源", hotKeys: [], action: debug },
{ name: "✓保存源", hotKeys: [], action: saveSource } { name: "✓保存源", hotKeys: [], action: saveSource },
) ),
); );
const hotkeysDialogVisible = ref(true); const hotkeysDialogVisible = ref(true);
@ -250,7 +250,7 @@ watch(
buttons.value[recordKeyDownIndex.value].hotKeys = pressedKeys; buttons.value[recordKeyDownIndex.value].hotKeys = pressedKeys;
}); });
}, },
{ immediate: true } { immediate: true },
); );
const recordKeyDown = (index) => { const recordKeyDown = (index) => {

View File

@ -225,7 +225,7 @@ const checkPageWidth = (readWidth) => {
}; };
watch( watch(
() => store.config.readWidth, () => store.config.readWidth,
(width) => checkPageWidth(width) (width) => checkPageWidth(width),
); );
// //
const top = ref(); const top = ref();
@ -285,8 +285,8 @@ const getContent = (index, reloadChapter = true, chapterPos = 0) => {
chapterData.value.push({ index, content, title }); chapterData.value.push({ index, content, title });
store.setShowContent(true); store.setShowContent(true);
throw err; throw err;
} },
) ),
); );
}; };
@ -498,8 +498,8 @@ onMounted(() => {
(err) => { (err) => {
ElMessage({ message: "获取书籍目录失败", type: "error" }); ElMessage({ message: "获取书籍目录失败", type: "error" });
throw err; throw err;
} },
) ),
); );
}); });
@ -624,7 +624,9 @@ onUnmounted(() => {
.day { .day {
:deep(.popup) { :deep(.popup) {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04); box-shadow:
0 2px 4px rgba(0, 0, 0, 0.12),
0 0 6px rgba(0, 0, 0, 0.04);
} }
:deep(.tool-icon) { :deep(.tool-icon) {
@ -645,7 +647,9 @@ onUnmounted(() => {
.night { .night {
:deep(.popup) { :deep(.popup) {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.48), 0 0 6px rgba(0, 0, 0, 0.16); box-shadow:
0 2px 4px rgba(0, 0, 0, 0.48),
0 0 6px rgba(0, 0, 0, 0.16);
} }
:deep(.tool-icon) { :deep(.tool-icon) {

View File

@ -29,7 +29,7 @@
readingRecent.name, readingRecent.name,
readingRecent.author, readingRecent.author,
readingRecent.chapterIndex, readingRecent.chapterIndex,
readingRecent.chapterPos readingRecent.chapterPos,
) )
" "
:class="{ 'no-point': readingRecent.url == '' }" :class="{ 'no-point': readingRecent.url == '' }"
@ -100,7 +100,7 @@ const readingRecent = ref({
const shelfWrapper = ref(null); const shelfWrapper = ref(null);
const { showLoading, closeLoading, loadingWrapper } = useLoading( const { showLoading, closeLoading, loadingWrapper } = useLoading(
shelfWrapper, shelfWrapper,
"正在获取书籍信息" "正在获取书籍信息",
); );
const books = ref([]); const books = ref([]);
@ -144,7 +144,7 @@ const searchBook = () => {
if (books.value.length == 0) { if (books.value.length == 0) {
ElMessage.info("搜索结果为空"); ElMessage.info("搜索结果为空");
} }
} },
); );
}; };
@ -195,7 +195,7 @@ onMounted(() => {
store store
.saveBookProgress() .saveBookProgress()
// //
.finally(fetchBookShelfData) .finally(fetchBookShelfData),
); );
}); });
const fetchBookShelfData = () => { const fetchBookShelfData = () => {
@ -209,7 +209,7 @@ const fetchBookShelfData = () => {
var x = a["durChapterTime"] || 0; var x = a["durChapterTime"] || 0;
var y = b["durChapterTime"] || 0; var y = b["durChapterTime"] || 0;
return y - x; return y - x;
}) }),
); );
} else { } else {
ElMessage.error(response.data.errorMsg); ElMessage.error(response.data.errorMsg);