🚨 解决Qodana报错

This commit is contained in:
目棃
2024-09-06 09:24:36 +08:00
parent 6b4b1c0b25
commit 8acdebebf2
14 changed files with 699 additions and 829 deletions

View File

@@ -79,6 +79,7 @@ import { onMounted, ref } from "vue";
import TGSqlite from "../../plugins/Sqlite/index.js";
import { useAchievementsStore } from "../../store/modules/achievements.js";
import TGLogger from "../../utils/TGLogger.js";
import showSnackbar from "../func/snackbar.js";
const achievementsStore = useAchievementsStore();
@@ -119,6 +120,7 @@ onMounted(async () => {
text: "加载数据库错误,请重置数据库!",
color: "error",
});
await TGLogger.Error(`加载数据库错误: ${e}`);
}
});

View File

@@ -53,6 +53,7 @@
</THomeCard>
</template>
<script lang="ts" setup>
import { storeToRefs } from "pinia";
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
@@ -66,7 +67,7 @@ import TItembox, { TItemBoxData } from "../main/t-itembox.vue";
import THomeCard from "./t-homecard.vue";
// store
const homeStore = useHomeStore();
const homeStore = storeToRefs(useHomeStore());
const router = useRouter();
const hasNew = ref<boolean>(false);
@@ -122,9 +123,9 @@ onMounted(async () => {
coverData[pool.id] = pool.cover;
return pool;
});
homeStore.poolCover = coverData;
homeStore.poolCover.value = coverData;
} else {
poolCards.value = await Mys.Gacha.card(gachaData, homeStore.poolCover);
poolCards.value = await Mys.Gacha.card(gachaData, homeStore.poolCover.value);
}
poolCards.value.map((pool) => {
poolTimeGet.value[pool.postId] = stamp2LastTime(pool.time.endStamp - Date.now());

View File

@@ -7,8 +7,6 @@
<script lang="ts" setup>
import { computed } from "vue";
import showSnackbar from "../func/snackbar.js";
import TurWorldSub from "./tur-world-sub.vue";
interface TurWorldGridProps {
@@ -26,19 +24,8 @@ const theme = computed(() => {
});
function getData(): TGApp.Sqlite.Record.WorldExplore[] {
let res: TGApp.Sqlite.Record.WorldExplore[] = JSON.parse(<string>props.modelValue);
try {
if (res[0].children) {
console.log("检测到children字段");
}
} catch (e) {
showSnackbar({
text: "数据解析错误,建议刷新页面",
color: "error",
});
res = [];
}
return res;
if (!props.modelValue) return [];
return JSON.parse(props.modelValue);
}
</script>
<style lang="css" scoped>

View File

@@ -102,7 +102,8 @@ function switchMaterial(isNext: boolean) {
text: `材料 ${curItem.name} 暂无详细信息`,
color: "warn",
});
isNext ? curIndex.value-- : curIndex.value++;
if (isNext) curIndex.value--;
else curIndex.value++;
}
</script>
<style lang="css" scoped>

View File

@@ -1,7 +1,6 @@
/**
* @file src plugins Hutao types Abyss.d.ts
* @file src/plugins/Hutao/types/Abyss.d.ts
* @description Hutao 插件深渊类型定义文件
* @author BTMuli <bt-muli@outlook.com>
* @since Beta v0.3.0
*/
@@ -24,7 +23,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {string} ReservedUserName - 保留用户名
* @return RecordUpload
*/
export interface RecordUpload {
interface RecordUpload {
Uid: string;
Identity: string;
SpiralAbyss: RecordData;
@@ -52,7 +51,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {Floor[]} Floors - 楼层信息
* @return RecordData
*/
export interface RecordData {
interface RecordData {
ScheduleId: number;
TotalBattleTimes: number;
TotalWinTimes: number;
@@ -88,7 +87,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {Level[]} Levels - 楼层关卡信息
* @return Floor
*/
export interface Floor {
interface Floor {
Index: number;
Star: number;
Levels: Level[];
@@ -104,7 +103,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number[]} Battles[].Avatars - 战斗角色ID
* @return Level
*/
export interface Level {
interface Level {
Index: number;
Star: number;
Battles: Array<{
@@ -123,7 +122,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} ActivedConstellationNumber - 已激活命座数量
* @return Avatar
*/
export interface Avatar {
interface Avatar {
AvatarId: number;
WeaponId: number;
ReliquarySetIds: number[];
@@ -138,7 +137,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @extends TGApp.Plugins.Hutao.Base.Response
* @return UploadResponse
*/
export interface UploadResponse extends TGApp.Plugins.Hutao.Base.Response {}
type UploadResponse = TGApp.Plugins.Hutao.Base.Response;
/**
* @description 获取深渊总览数据返回
@@ -149,7 +148,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {OverviewData} data - 深渊总览数据
* @return OverviewResponse
*/
export interface OverviewResponse extends TGApp.Plugins.Hutao.Base.Response {
interface OverviewResponse extends TGApp.Plugins.Hutao.Base.Response {
data: OverviewData;
}
@@ -169,7 +168,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} TimeAverage - 平均耗时
* @return OverviewData
*/
export interface OverviewData {
interface OverviewData {
ScheduleId: number;
RecordTotal: number;
SpiralAbyssTotal: number;
@@ -191,7 +190,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {AvatarUp[]} data - 角色深渊上场率
* @return AvatarUpResponse
*/
export interface AvatarUpResponse extends TGApp.Plugins.Hutao.Base.Response {
interface AvatarUpResponse extends TGApp.Plugins.Hutao.Base.Response {
data: AvatarUp[];
}
@@ -204,7 +203,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} Ranks[].Rate - 上场率
* @return AvatarUp
*/
export interface AvatarUp {
interface AvatarUp {
Floor: number;
Ranks: Array<{
Item: number;
@@ -221,7 +220,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {AvatarUse[]} data - 角色深渊使用率
* @return AvatarUseResponse
*/
export interface AvatarUseResponse extends TGApp.Plugins.Hutao.Base.Response {
interface AvatarUseResponse extends TGApp.Plugins.Hutao.Base.Response {
data: AvatarUse[];
}
@@ -234,7 +233,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} Ranks[].Rate - 使用率
* @return AvatarUse
*/
export interface AvatarUse {
interface AvatarUse {
Floor: number;
Ranks: Array<{
Item: number;
@@ -251,7 +250,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {AvatarHold[]} data - 角色深渊持有率
* @return AvatarHoldResponse
*/
export interface AvatarHoldResponse extends TGApp.Plugins.Hutao.Base.Response {
interface AvatarHoldResponse extends TGApp.Plugins.Hutao.Base.Response {
data: AvatarHold[];
}
@@ -265,7 +264,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} AvatarId - 角色ID
* @return AvatarHold
*/
export interface AvatarHold {
interface AvatarHold {
HoldingRate: number;
Constellations: Array<{
Item: number;
@@ -283,7 +282,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {AvatarCollocation[]} data - 角色搭配
* @return AvatarCollocationResponse
*/
export interface AvatarCollocationResponse extends TGApp.Plugins.Hutao.Base.Response {
interface AvatarCollocationResponse extends TGApp.Plugins.Hutao.Base.Response {
data: AvatarCollocation[];
}
@@ -300,7 +299,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} Weapons[].Rate - 武器搭配率
* @return AvatarCollocation
*/
export interface AvatarCollocation {
interface AvatarCollocation {
AvatarId: number;
Avatars: Array<{
Item: number;
@@ -324,7 +323,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @extends TGApp.Plugins.Hutao.Base.Response
* @property {WeaponCollocation[]} data - 武器搭配角色
*/
export interface WeaponCollocationResponse extends TGApp.Plugins.Hutao.Base.Response {
interface WeaponCollocationResponse extends TGApp.Plugins.Hutao.Base.Response {
data: WeaponCollocation[];
}
@@ -337,7 +336,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} Avatars[].Rate - 角色搭配率
* @return WeaponCollocation
*/
export interface WeaponCollocation {
interface WeaponCollocation {
WeaponId: number;
Avatars: Array<{
Item: number;
@@ -354,7 +353,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {TeamCombination[]} data - 队伍搭配
* @return TeamCombinationResponse
*/
export interface TeamCombinationResponse extends TGApp.Plugins.Hutao.Base.Response {
interface TeamCombinationResponse extends TGApp.Plugins.Hutao.Base.Response {
data: TeamCombination[];
}
@@ -369,7 +368,7 @@ declare namespace TGApp.Plugins.Hutao.Abyss {
* @property {number} Down[].Rate - 统计次数
* @return TeamCombination
*/
export interface TeamCombination {
interface TeamCombination {
Floor: number;
Up: Array<{
Item: string;

View File

@@ -24,7 +24,7 @@ declare namespace TGApp.Plugins.UIGF {
* @since Beta v0.5.0
* @interface Schema4
* @property {Info4} info - UIGF 头部信息
* @property {GachaItem4[]} hk4e - UIGF 祈愿列表,原神数据
* @property {GachaHk4e[]} hk4e - UIGF 祈愿列表,原神数据
* @return Schema4
*/
interface Schema4 {

View File

@@ -1,7 +1,7 @@
/**
* @file utils/TGShare.ts
* @description 生成分享截图并保存到本地
* @since Beta v0.5.0
* @since Beta v0.5.5
*/
import { path } from "@tauri-apps/api";
@@ -86,7 +86,7 @@ function getShareImgBgColor(): string {
/**
* @description 生成分享截图
* @since Beta v0.4.2
* @since Beta v0.5.5
* @param {string} fileName - 文件名
* @param {HTMLElement} element - 元素
* @param {number} scale - 缩放比例
@@ -153,6 +153,7 @@ export async function generateShareImg(
});
await TGLogger.Info(`[generateShareImg][${fileName}] 已将图像复制到剪贴板`);
} catch (e) {
await TGLogger.Error(`[generateShareImg][${fileName}] 复制到剪贴板失败 ${e}`);
await saveCanvasImg(buffer, fileName);
}
}

View File

@@ -1,7 +1,7 @@
/**
* @file utils/dataBS.ts
* @description 用户数据的备份、恢复、迁移
* @since Beta v0.5.0
* @since Beta v0.5.5
*/
import { path } from "@tauri-apps/api";
@@ -45,7 +45,7 @@ export async function backUpUserData(dir: string): Promise<void> {
/**
* @description 恢复用户数据
* @since Beta v0.5.0
* @since Beta v0.5.5
* @param {string} dir 备份目录路径
* @returns {Promise<void>}
*/
@@ -118,6 +118,7 @@ export async function restoreUserData(dir: string): Promise<void> {
);
await TGSqlite.restoreAbyss(dataAbyss);
} catch (e) {
await TGLogger.Error(`[DataBS][restoreUserData] 深渊数据恢复失败 ${e}`);
showSnackbar({
text: "深渊数据恢复失败",
color: "error",

View File

@@ -1,16 +1,17 @@
/**
* @file src/web/request/getDeviceFp.ts
* @description 获取设备指纹
* @since Beta v0.5.0
* @since Beta v0.5.5
*/
import TGHttp from "../../utils/TGHttp.js";
import TGLogger from "../../utils/TGLogger.js";
import { getInitDeviceInfo } from "../../utils/toolFunc.js";
import TGConstant from "../constant/TGConstant.js";
/**
* @description 获取设备指纹
* @since Beta v0.5.0
* @since Beta v0.5.5
* @param {TGApp.App.Device.DeviceInfo} Info - 设备信息
* @returns {Promise<TGApp.App.Device.DeviceInfo>} 设备指纹
*/
@@ -104,6 +105,7 @@ export async function getDeviceFp(
}
} catch (error) {
info.device_fp = "0000000000000";
await TGLogger.Error(`获取设备指纹失败: ${error}`);
}
return info;
}