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,
"watchEffect": 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(
"../../../app/src/main/assets/web/vue",
import.meta.url
import.meta.url,
);
const VUE_DIST_DIR = new URL("../dist", import.meta.url);
@ -33,8 +33,8 @@ fs.rm(
throw error;
}
console.log("> cp success");
}
},
);
});
}
},
);

View File

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

View File

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

View File

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

View File

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

View File

@ -106,8 +106,12 @@ onUpdated(() => {
//width: 50%;
height: 40px;
cursor: pointer;
font: 16px / 40px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
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;
i {
font: 12px / 16px PingFangSC-Regular, "-apple-system", Simsun;
font:
12px / 16px PingFangSC-Regular,
"-apple-system",
Simsun;
display: inline-block;
min-width: 48px;
margin-right: 16px;
@ -410,8 +413,12 @@ const uploadConfig = (config) => {
text-align: center;
vertical-align: middle;
display: inline-block;
font: 14px / 34px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
14px / 34px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
}
.font-item-input {
width: 168px;

View File

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

View File

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

View File

@ -225,7 +225,7 @@ const checkPageWidth = (readWidth) => {
};
watch(
() => store.config.readWidth,
(width) => checkPageWidth(width)
(width) => checkPageWidth(width),
);
//
const top = ref();
@ -285,8 +285,8 @@ const getContent = (index, reloadChapter = true, chapterPos = 0) => {
chapterData.value.push({ index, content, title });
store.setShowContent(true);
throw err;
}
)
},
),
);
};
@ -498,8 +498,8 @@ onMounted(() => {
(err) => {
ElMessage({ message: "获取书籍目录失败", type: "error" });
throw err;
}
)
},
),
);
});
@ -624,7 +624,9 @@ onUnmounted(() => {
.day {
: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) {
@ -645,7 +647,9 @@ onUnmounted(() => {
.night {
: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) {

View File

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