Skip to content

Commit

Permalink
✏️ 修复 IDE import 报错
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Jun 26, 2024
1 parent 7ea47b4 commit 8a4edd2
Show file tree
Hide file tree
Showing 77 changed files with 316 additions and 284 deletions.
43 changes: 23 additions & 20 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

<script lang="ts" setup>
import { app, event, fs, tauri, window as TauriWindow } from "@tauri-apps/api";
import { UnlistenFn } from "@tauri-apps/api/helpers/event";
import { UnlistenFn, Event } from "@tauri-apps/api/helpers/event";
import { storeToRefs } from "pinia";
import { computed, onBeforeMount, onMounted, onUnmounted, ref } from "vue";
import { useRouter } from "vue-router";
import TBackTop from "./components/app/t-backTop.vue";
import TSidebar from "./components/app/t-sidebar.vue";
import showConfirm from "./components/func/confirm";
import showSnackbar from "./components/func/snackbar";
import TGSqlite from "./plugins/Sqlite";
import { useAppStore } from "./store/modules/app";
import { useUserStore } from "./store/modules/user";
import { getBuildTime } from "./utils/TGBuild";
import TGLogger from "./utils/TGLogger";
import TGRequest from "./web/request/TGRequest";
import showConfirm from "./components/func/confirm.js";
import showSnackbar from "./components/func/snackbar.js";
import TGSqlite from "./plugins/Sqlite/index.js";
import { useAppStore } from "./store/modules/app.js";
import { useUserStore } from "./store/modules/user.js";
import { getBuildTime } from "./utils/TGBuild.js";
import TGLogger from "./utils/TGLogger.js";
import TGRequest from "./web/request/TGRequest.js";
const appStore = useAppStore();
const userStore = storeToRefs(useUserStore());
Expand Down Expand Up @@ -54,8 +54,8 @@ onBeforeMount(async () => {
onMounted(async () => {
document.documentElement.className = theme.value;
themeListener = await event.listen("readTheme", async (e) => {
const themeGet = <string>e.payload;
themeListener = await event.listen("readTheme", async (e: Event<string>) => {
const themeGet = e.payload;
if (theme.value !== themeGet) {
theme.value = themeGet;
document.documentElement.className = theme.value;
Expand Down Expand Up @@ -108,15 +108,18 @@ async function resetDB(): Promise<void> {
// 检测 deviceFp
async function checkDeviceFp(): Promise<void> {
const appData = await TGSqlite.getAppData();
const deviceInfo = appData.find((item) => item.key === "deviceInfo")?.value;
const deviceLocal = appStore.deviceInfo;
if (deviceInfo === undefined) {
if (deviceLocal.device_fp === "0000000000000")
const deviceFind = appData.find((item) => item.key === "deviceInfo");
if (typeof deviceFind === "undefined") {
if (deviceLocal.device_fp === "0000000000000") {
appStore.deviceInfo = await TGRequest.Device.getFp(appStore.deviceInfo);
}
await TGSqlite.saveAppData("deviceInfo", JSON.stringify(deviceLocal));
return;
}
if (JSON.parse(deviceInfo) !== deviceLocal) appStore.deviceInfo = JSON.parse(deviceInfo);
if (JSON.parse(deviceFind.value) !== deviceLocal) {
appStore.deviceInfo = JSON.parse(deviceFind.value);
}
}
// 检测 ck,info 数据
Expand All @@ -138,9 +141,9 @@ async function checkUserLoad(): Promise<void> {
const infoLocal = userStore.briefInfo.value;
const appData = await TGSqlite.getAppData();
const infoDB = appData.find((item) => item.key === "userInfo")?.value;
if (infoDB === undefined && JSON.stringify(infoLocal) !== "{}") {
if (typeof infoDB === "undefined" && JSON.stringify(infoLocal) !== "{}") {
await TGSqlite.saveAppData("userInfo", JSON.stringify(infoLocal));
} else if (infoDB !== undefined && infoLocal !== JSON.parse(infoDB)) {
} else if (typeof infoDB !== "undefined" && infoLocal !== JSON.parse(infoDB)) {
userStore.briefInfo.value = JSON.parse(infoDB);
console.info("briefInfo 数据已更新!");
}
Expand All @@ -158,7 +161,7 @@ async function checkUserLoad(): Promise<void> {
}
if (accountDB !== accountLocal) userStore.account.value = accountDB;
const userDir = appData.find((item) => item.key === "userDir")?.value;
if (userDir === undefined) {
if (typeof userDir === "undefined") {
await TGSqlite.saveAppData("userDir", appStore.userDir);
return;
}
Expand All @@ -167,7 +170,7 @@ async function checkUserLoad(): Promise<void> {
}
async function getDeepLink(): Promise<UnlistenFn> {
return await event.listen("active_deep_link", async (e) => {
return await event.listen("active_deep_link", async (e: Event<unknown>) => {
const windowGet = new TauriWindow.WebviewWindow("TeyvatGuide");
if (await windowGet.isMinimized()) {
await windowGet.unminimize();
Expand Down Expand Up @@ -215,7 +218,7 @@ async function getDeepLink(): Promise<UnlistenFn> {
async function toUIAF(link: string) {
const url = new URL(link);
const app = url.searchParams.get("app");
if (app === null || app === "") {
if (app == null || app === "") {
await router.push("/achievements");
} else {
await router.push("/achievements/?app=" + app);
Expand Down
20 changes: 9 additions & 11 deletions src/components/app/t-sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@

<script lang="ts" setup>
import { event, window as TauriWindow } from "@tauri-apps/api";
import { UnlistenFn } from "@tauri-apps/api/helpers/event";
import { UnlistenFn, Event } from "@tauri-apps/api/helpers/event";
import { storeToRefs } from "pinia";
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { useAppStore } from "../../store/modules/app";
import { useUserStore } from "../../store/modules/user";
import mhyClient from "../../utils/TGClient";
import TGLogger from "../../utils/TGLogger";
import showSnackbar from "../func/snackbar";
import { useAppStore } from "../../store/modules/app.js";
import { useUserStore } from "../../store/modules/user.js";
import mhyClient from "../../utils/TGClient.js";
import TGLogger from "../../utils/TGLogger.js";
import showSnackbar from "../func/snackbar.js";
const appStore = useAppStore();
const userStore = storeToRefs(useUserStore());
Expand Down Expand Up @@ -298,8 +298,8 @@ function collapse(): void {
let themeListener: UnlistenFn;
onMounted(async () => {
themeListener = await event.listen("readTheme", (e) => {
const theme = <string>e.payload;
themeListener = await event.listen("readTheme", (e: Event<string>) => {
const theme = e.payload;
themeGet.value = theme === "default" ? "default" : "dark";
});
if (TauriWindow.getCurrent().label === "TeyvatGuide") {
Expand Down Expand Up @@ -329,9 +329,7 @@ function login(): void {
});
}
onUnmounted(() => {
themeListener();
});
onUnmounted(() => themeListener());
</script>

<style lang="css" scoped>
Expand Down
12 changes: 4 additions & 8 deletions src/components/app/t-switchTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</template>
<script lang="ts" setup>
import { event } from "@tauri-apps/api";
import { UnlistenFn } from "@tauri-apps/api/helpers/event";
import { UnlistenFn, Event } from "@tauri-apps/api/helpers/event";
import { computed, onMounted, onUnmounted } from "vue";
import { useAppStore } from "../../store/modules/app";
import { useAppStore } from "../../store/modules/app.js";
const appStore = useAppStore();
const themeGet = computed({
Expand All @@ -35,17 +35,13 @@ async function switchTheme(): Promise<void> {
}
async function listenOnTheme(): Promise<UnlistenFn> {
return await event.listen<string>("readTheme", (e) => {
return await event.listen("readTheme", (e: Event<string>) => {
const theme = e.payload;
themeGet.value = theme === "default" ? "default" : "dark";
});
}
onUnmounted(() => {
if (themeListener) {
themeListener();
}
});
onUnmounted(() => themeListener());
</script>
<style lang="css" scoped>
.switch-box {
Expand Down
2 changes: 1 addition & 1 deletion src/components/config/tc-appBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import { app } from "@tauri-apps/api";
import { computed, onMounted, ref } from "vue";
import { useAppStore } from "../../store/modules/app";
import { useAppStore } from "../../store/modules/app.js";
const appStore = useAppStore();
const versionApp = ref<string>();
Expand Down
15 changes: 8 additions & 7 deletions src/components/config/tc-dataDir.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
</template>
<script lang="ts" setup>
import { dialog, fs, path } from "@tauri-apps/api";
import { FileEntry } from "@tauri-apps/api/fs";
import TGSqlite from "../../plugins/Sqlite";
import { useAppStore } from "../../store/modules/app";
import { backUpUserData } from "../../utils/dataBS";
import TGShell from "../../utils/TGShell";
import showConfirm from "../func/confirm";
import showSnackbar from "../func/snackbar";
import TGSqlite from "../../plugins/Sqlite/index.js";
import { useAppStore } from "../../store/modules/app.js";
import { backUpUserData } from "../../utils/dataBS.js";
import TGShell from "../../utils/TGShell.js";
import showConfirm from "../func/confirm.js";
import showSnackbar from "../func/snackbar.js";
const appStore = useAppStore();
Expand Down Expand Up @@ -127,7 +128,7 @@ async function confirmCLD(): Promise<void> {
}
const logDir = appStore.logDir;
const files = await fs.readDir(logDir);
const delFiles = files.filter((file) => {
const delFiles = files.filter((file: FileEntry) => {
// yyyy-mm-dd.log
const reg = /(\d{4}-\d{2}-\d{2}\.log)/;
const match = file.path.match(reg);
Expand Down
22 changes: 11 additions & 11 deletions src/components/config/tc-userBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
</template>
<script lang="ts" setup>
import { event, window as windowTauri } from "@tauri-apps/api";
import type { UnlistenFn } from "@tauri-apps/api/helpers/event";
import type { UnlistenFn, Event } from "@tauri-apps/api/helpers/event";
import { storeToRefs } from "pinia";
import { onMounted, onUnmounted, ref, watch } from "vue";
import TGSqlite from "../../plugins/Sqlite";
import { useAppStore } from "../../store/modules/app";
import { useUserStore } from "../../store/modules/user";
import TGClient from "../../utils/TGClient";
import TGLogger from "../../utils/TGLogger";
import { getDeviceFp } from "../../web/request/getDeviceFp";
import TGRequest from "../../web/request/TGRequest";
import showConfirm from "../func/confirm";
import showSnackbar from "../func/snackbar";
import TGSqlite from "../../plugins/Sqlite/index.js";
import { useAppStore } from "../../store/modules/app.js";
import { useUserStore } from "../../store/modules/user.js";
import TGClient from "../../utils/TGClient.js";
import TGLogger from "../../utils/TGLogger.js";
import { getDeviceFp } from "../../web/request/getDeviceFp.js";
import TGRequest from "../../web/request/TGRequest.js";
import showConfirm from "../func/confirm.js";
import showSnackbar from "../func/snackbar.js";
import ToGameLogin from "../overlay/to-gameLogin.vue";
interface TcUserBadgeEmits {
Expand Down Expand Up @@ -77,7 +77,7 @@ async function toWebLogin(): Promise<void> {
return;
}
await TGClient.open("config_sign_in", "https://user.mihoyo.com");
signListener = await event.listen("config_user_sign", async (e) => {
signListener = await event.listen("config_user_sign", async (e: Event<unknown>) => {
if (typeof e.payload !== "string") {
showSnackbar({
color: "error",
Expand Down
2 changes: 1 addition & 1 deletion src/components/devCharacter/duc-detail-olb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<script lang="ts" setup>
import { onMounted, onUpdated, ref } from "vue";
import { saveImgLocal } from "../../utils/TGShare";
import { saveImgLocal } from "../../utils/TGShare.js";
interface DucDetailOlbProps {
modelValue: TGApp.Sqlite.Character.RoleConstellation[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/devCharacter/duc-detail-ort.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script lang="ts" setup>
import { onMounted, onUpdated, ref } from "vue";
import { saveImgLocal } from "../../utils/TGShare";
import { saveImgLocal } from "../../utils/TGShare.js";
interface DucDetailOrtProps {
modelValue: TGApp.Sqlite.Character.RoleTalent[];
Expand Down
4 changes: 2 additions & 2 deletions src/components/devCharacter/duc-detail-overlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<script lang="ts" setup>
import { computed, onMounted, onUpdated, ref } from "vue";
import TGSqlite from "../../plugins/Sqlite";
import { generateShareImg } from "../../utils/TGShare";
import TGSqlite from "../../plugins/Sqlite/index.js";
import { generateShareImg } from "../../utils/TGShare.js";
import TOverlay from "../main/t-overlay.vue";
import DucDetailOlb from "./duc-detail-olb.vue";
Expand Down
4 changes: 2 additions & 2 deletions src/components/gachaRecord/gro-dataview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ function loadData(): void {
star4List.value.push({
...item,
gachaCount: reset4count.value,
icon: getIcon(item.itemId, item.type),
icon: getIcon(item.itemId),
});
reset4count.value = 0;
} else if (item.rank === "5") {
reset4count.value++;
star5List.value.push({
...item,
gachaCount: reset5count.value,
icon: getIcon(item.itemId, item.type),
icon: getIcon(item.itemId),
});
reset5count.value = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/gachaRecord/gro-echarts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { CanvasRenderer } from "echarts/renderers";
import { onMounted, provide } from "vue";
import VChart, { THEME_KEY } from "vue-echarts";
import showSnackbar from "../func/snackbar";
import showSnackbar from "../func/snackbar.js";
// echarts
use([
Expand Down
10 changes: 5 additions & 5 deletions src/components/gachaRecord/gro-history.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { AppGachaData, AppCharacterData, AppWeaponData } from "../../data";
import { createPost } from "../../utils/TGWindow";
import { timestampToDate } from "../../utils/toolFunc";
import showConfirm from "../func/confirm";
import showSnackbar from "../func/snackbar";
import { AppGachaData, AppCharacterData, AppWeaponData } from "../../data/index.js";
import { createPost } from "../../utils/TGWindow.js";
import { timestampToDate } from "../../utils/toolFunc.js";
import showConfirm from "../func/confirm.js";
import showSnackbar from "../func/snackbar.js";
import TItembox, { TItemBoxData } from "../main/t-itembox.vue";
interface GroHistoryMap {
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/t-calendar-birth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { onBeforeMount, ref } from "vue";
import { useRouter } from "vue-router";
import TSAvatarBirth from "../../plugins/Sqlite/modules/avatarBirth";
import TSAvatarBirth from "../../plugins/Sqlite/modules/avatarBirth.js";
const isBirthday = ref<boolean>(false);
const router = useRouter();
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/t-calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<script lang="ts" setup>
import { onMounted, ref, watch } from "vue";
import { AppCalendarData } from "../../data";
import { AppCalendarData } from "../../data/index.js";
import TibCalendarItem from "../itembox/tib-calendar-item.vue";
import ToCalendar from "../overlay/to-calendar.vue";
Expand Down
10 changes: 5 additions & 5 deletions src/components/home/t-pool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { useHomeStore } from "../../store/modules/home";
import { createPost, createTGWindow } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
import showSnackbar from "../func/snackbar";
import Mys from "../../plugins/Mys/index.js";
import { useHomeStore } from "../../store/modules/home.js";
import { createPost, createTGWindow } from "../../utils/TGWindow.js";
import { stamp2LastTime } from "../../utils/toolFunc.js";
import showSnackbar from "../func/snackbar.js";
import TItembox, { TItemBoxData } from "../main/t-itembox.vue";
import THomeCard from "./t-homecard.vue";
Expand Down
6 changes: 3 additions & 3 deletions src/components/home/t-position.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
import Mys from "../../plugins/Mys";
import { createPost } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
import Mys from "../../plugins/Mys/index.js";
import { createPost } from "../../utils/TGWindow.js";
import { stamp2LastTime } from "../../utils/toolFunc.js";
import THomeCard from "./t-homecard.vue";
Expand Down
2 changes: 1 addition & 1 deletion src/components/itembox/tib-abyss-detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import TGSqlite from "../../plugins/Sqlite";
import TGSqlite from "../../plugins/Sqlite/index.js";
import TItemBox from "../main/t-itembox.vue";
import type { TItemBoxData } from "../main/t-itembox.vue";
Expand Down
2 changes: 1 addition & 1 deletion src/components/itembox/tib-abyss-overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import TGSqlite from "../../plugins/Sqlite";
import TGSqlite from "../../plugins/Sqlite/index.js";
import TItemBox from "../main/t-itembox.vue";
import type { TItemBoxData } from "../main/t-itembox.vue";
Expand Down
Loading

0 comments on commit 8a4edd2

Please sign in to comment.