mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
style(sth): 代码微改
This commit is contained in:
24
src/App.vue
24
src/App.vue
@@ -12,25 +12,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import TSidebar from "./components/t-sidebar.vue";
|
// vue
|
||||||
import useAppStore from "./store/modules/app";
|
|
||||||
import { TGAppDataList, TGGetDataList } from "./data";
|
|
||||||
import { fs } from "@tauri-apps/api";
|
|
||||||
import { BaseDirectory } from "@tauri-apps/api/fs";
|
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
|
import TSidebar from "./components/t-sidebar.vue";
|
||||||
|
// tauri
|
||||||
|
import { fs } from "@tauri-apps/api";
|
||||||
|
// store
|
||||||
|
import useAppStore from "./store/modules/app";
|
||||||
|
// utils
|
||||||
import { InitTGData, DeleteTGData, WriteTGData } from "./utils/TGIndex";
|
import { InitTGData, DeleteTGData, WriteTGData } from "./utils/TGIndex";
|
||||||
|
// data
|
||||||
|
import { TGAppDataList, TGGetDataList } from "./data";
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await checkLoad();
|
await checkLoad();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function checkLoad() {
|
async function checkLoad() {
|
||||||
|
await appStore.check();
|
||||||
if (appStore.loading) {
|
if (appStore.loading) {
|
||||||
console.log("数据已加载!");
|
console.log("数据已加载!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await DeleteTGData();
|
DeleteTGData();
|
||||||
await createDataDir();
|
await createDataDir();
|
||||||
await writeData();
|
await writeData();
|
||||||
await writeIndex();
|
await writeIndex();
|
||||||
@@ -40,9 +46,9 @@ async function checkLoad() {
|
|||||||
// 创建数据文件夹
|
// 创建数据文件夹
|
||||||
async function createDataDir() {
|
async function createDataDir() {
|
||||||
console.log("开始创建数据文件夹...");
|
console.log("开始创建数据文件夹...");
|
||||||
await fs.createDir("appData", { dir: BaseDirectory.AppLocalData, recursive: true });
|
await fs.createDir("appData", { dir: fs.BaseDirectory.AppLocalData, recursive: true });
|
||||||
await fs.createDir("userData", { dir: BaseDirectory.AppLocalData, recursive: true });
|
await fs.createDir("userData", { dir: fs.BaseDirectory.AppLocalData, recursive: true });
|
||||||
await fs.createDir("tempData", { dir: BaseDirectory.AppLocalData, recursive: true });
|
await fs.createDir("tempData", { dir: fs.BaseDirectory.AppLocalData, recursive: true });
|
||||||
console.log("数据文件夹创建完成!");
|
console.log("数据文件夹创建完成!");
|
||||||
}
|
}
|
||||||
// 将数据写入文件夹
|
// 将数据写入文件夹
|
||||||
|
|||||||
@@ -65,12 +65,6 @@ const props = defineProps({
|
|||||||
color: #f4d8a8;
|
color: #f4d8a8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-subtitle {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #38393a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-img {
|
.loading-img {
|
||||||
width: 256px;
|
width: 256px;
|
||||||
height: 256px;
|
height: 256px;
|
||||||
@@ -78,10 +72,4 @@ const props = defineProps({
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-text {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #38393a;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -26,11 +26,7 @@
|
|||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<img
|
<img src="../assets/icons/arrow-right.svg" alt="right" onload="SVGInject(this)" />
|
||||||
src="../assets/icons/arrow-right.svg"
|
|
||||||
alt="right"
|
|
||||||
onload="SVGInject(this)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
查看
|
查看
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -57,11 +53,7 @@
|
|||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<img
|
<img src="../assets/icons/arrow-right.svg" alt="right" onload="SVGInject(this)" />
|
||||||
src="../assets/icons/arrow-right.svg"
|
|
||||||
alt="right"
|
|
||||||
onload="SVGInject(this)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
查看
|
查看
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -90,11 +82,7 @@
|
|||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
<v-btn @click="toPost(item.post_id)" class="ms-2 card-btn">
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<img
|
<img src="../assets/icons/arrow-right.svg" alt="right" onload="SVGInject(this)" />
|
||||||
src="../assets/icons/arrow-right.svg"
|
|
||||||
alt="right"
|
|
||||||
onload="SVGInject(this)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
查看
|
查看
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ export async function InitTGData() {
|
|||||||
/**
|
/**
|
||||||
* @description 删除数据库
|
* @description 删除数据库
|
||||||
* @since Alpha
|
* @since Alpha
|
||||||
* @return {Promise<void>}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
export async function DeleteTGData() {
|
export function DeleteTGData() {
|
||||||
await window.indexedDB.deleteDatabase(DB_NAME);
|
window.indexedDB.deleteDatabase(DB_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user