mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🐛 完善数据库完整性检测,修复视频加载失败
This commit is contained in:
@@ -48,7 +48,6 @@ onBeforeMount(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 获取当前主题
|
|
||||||
document.documentElement.className = theme.value;
|
document.documentElement.className = theme.value;
|
||||||
await listenOnTheme();
|
await listenOnTheme();
|
||||||
});
|
});
|
||||||
@@ -82,12 +81,9 @@ async function listenOnInit(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkAppLoad(): Promise<void> {
|
async function checkAppLoad(): Promise<void> {
|
||||||
if (appStore.loading) {
|
|
||||||
console.info("数据已加载!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const checkDB = await TGSqlite.check();
|
const checkDB = await TGSqlite.check();
|
||||||
if (!checkDB) {
|
if (!checkDB) {
|
||||||
|
appStore.loading = false;
|
||||||
await TGSqlite.reset();
|
await TGSqlite.reset();
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
text: "检测到数据库不完整!已重置数据库!",
|
text: "检测到数据库不完整!已重置数据库!",
|
||||||
@@ -95,6 +91,7 @@ async function checkAppLoad(): Promise<void> {
|
|||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
});
|
||||||
await createDataDir();
|
await createDataDir();
|
||||||
|
router.go(0);
|
||||||
} else {
|
} else {
|
||||||
appStore.loading = true;
|
appStore.loading = true;
|
||||||
console.info("数据库已加载!");
|
console.info("数据库已加载!");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
:src="props.data.insert.video"
|
:src="props.data.insert.video"
|
||||||
:allowfullscreen="false"
|
:allowfullscreen="false"
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
sandbox="allow-forms allow-same-origin allow-popups allow-presentation"
|
sandbox="allow-forms allow-same-origin allow-popups allow-presentation allow-scripts"
|
||||||
>
|
>
|
||||||
</iframe>
|
</iframe>
|
||||||
<!-- todo 优化 -->
|
<!-- todo 优化 -->
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ const timer = ref<any>(null);
|
|||||||
|
|
||||||
function readLoading(): void {
|
function readLoading(): void {
|
||||||
if (!loading.value) return;
|
if (!loading.value) return;
|
||||||
const loadingMap = itemRefs.value.map((item) => {
|
let loadingMap = itemRefs.value.map((item) => {
|
||||||
return item.loading ? item.name : null;
|
return item.loading ? item.name : null;
|
||||||
});
|
});
|
||||||
|
if (!appStore.loading) loadingMap.push("数据库");
|
||||||
loadingSubtitle.value = "正在加载 " + loadingMap.filter((item) => item)?.join("、");
|
loadingSubtitle.value = "正在加载 " + loadingMap.filter((item) => item)?.join("、");
|
||||||
if (loadingMap.every((item) => !item)) {
|
if (loadingMap.every((item) => !item)) {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user