🌱 集录祈愿处理 #96

This commit is contained in:
目棃
2024-03-05 20:34:15 +08:00
parent 07cef027db
commit 37de85b62c
5 changed files with 25 additions and 12 deletions

View File

@@ -70,7 +70,7 @@
import { onMounted, ref, watch } from "vue";
interface GachaDataViewProps {
dataType: "new" | "avatar" | "weapon" | "normal";
dataType: "new" | "avatar" | "weapon" | "normal" | "mix";
dataVal: TGApp.Sqlite.GachaRecords.SingleTable[];
}
@@ -148,6 +148,7 @@ function getTitle(type: "top" | "5" | "4" | "3"): string {
if (props.dataType === "avatar") return "角色祈愿";
if (props.dataType === "weapon") return "武器祈愿";
if (props.dataType === "normal") return "常驻祈愿";
if (props.dataType === "mix") return "集录祈愿";
return "";
} else if (props.dataVal.length === 0) {
return "暂无数据";

View File

@@ -1,18 +1,14 @@
<template>
<div
class="gro-o-container"
:style="{
gridTemplateColumns: newData.length !== 0 ? 'repeat(4, 1fr)' : 'repeat(3, 1fr)',
}"
>
<div class="gro-o-container">
<gro-dataview v-if="newData.length !== 0" v-model:data-val="newData" data-type="new" />
<gro-dataview v-model:data-val="normalData" data-type="normal" />
<gro-dataview v-model:data-val="avatarData" data-type="avatar" />
<gro-dataview v-model:data-val="weaponData" data-type="weapon" />
<gro-dataview v-if="mixData.length !== 0" v-model:data-val="mixData" data-type="mix" />
</div>
</template>
<script lang="ts" setup>
import { watch } from "vue";
import { computed, watch } from "vue";
import GroDataview from "./gro-dataview.vue";
@@ -26,6 +22,18 @@ let newData = props.modelValue.filter((item) => item.uigfType === "100");
let normalData = props.modelValue.filter((item) => item.uigfType === "200");
let avatarData = props.modelValue.filter((item) => item.uigfType === "301");
let weaponData = props.modelValue.filter((item) => item.uigfType === "302");
let mixData = props.modelValue.filter((item) => item.uigfType === "500");
const cnCols = computed(() => {
let total = 5;
if (newData.length === 0) {
total -= 1;
}
if (mixData.length === 0) {
total -= 1;
}
return `repeat(${total}, 1fr)`;
});
// 监听数据变化
watch(
@@ -35,6 +43,7 @@ watch(
normalData = newVal.filter((item) => item.uigfType === "200");
avatarData = newVal.filter((item) => item.uigfType === "301");
weaponData = newVal.filter((item) => item.uigfType === "302");
mixData = newVal.filter((item) => item.uigfType === "500");
},
);
</script>
@@ -44,5 +53,6 @@ watch(
width: 100%;
height: 100%;
grid-gap: 10px;
grid-template-columns: v-bind(cnCols);
}
</style>

View File

@@ -155,6 +155,8 @@ async function confirmRefresh(): Promise<void> {
await getGachaLogs("400");
loadingTitle.value = "正在刷新武器祈愿数据";
await getGachaLogs("302");
loadingTitle.value = "正在刷新集录祈愿数据";
await getGachaLogs("500");
loadingTitle.value = "数据获取完成,即将刷新页面";
loadingSub.value = "";
loading.value = false;

View File

@@ -1,7 +1,7 @@
/**
* @file utils/UIGF.ts
* @description UIGF工具类
* @since Beta v0.4.1
* @since Beta v0.4.4
*/
import { app, fs, path } from "@tauri-apps/api";
@@ -22,7 +22,7 @@ function getUigfTimeZone(uid: string): number {
/**
* @description 获取 UIGF 头部信息
* @since Beta v0.3.8
* @since Beta v0.4.4
* @param {string} uid - UID
* @returns {Promise<TGApp.Plugins.UIGF.Export>}
*/
@@ -31,7 +31,7 @@ export async function getUigfHeader(uid: string): Promise<TGApp.Plugins.UIGF.Exp
return {
uid,
lang: "zh-cn",
uigf_version: "v2.4",
uigf_version: "v3.0",
export_timestamp: Math.floor(stamp / 1000),
export_time: timestampToDate(stamp),
export_app: "TeyvatGuide",

View File

@@ -36,7 +36,7 @@ export async function getGachaLog(
query: params,
})
.then((res) => {
if (res.data.retcode !== 0) return res.data;
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
return res.data.data.list;
});
}