mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🌱 集录祈愿处理 #96
This commit is contained in:
@@ -70,7 +70,7 @@
|
|||||||
import { onMounted, ref, watch } from "vue";
|
import { onMounted, ref, watch } from "vue";
|
||||||
|
|
||||||
interface GachaDataViewProps {
|
interface GachaDataViewProps {
|
||||||
dataType: "new" | "avatar" | "weapon" | "normal";
|
dataType: "new" | "avatar" | "weapon" | "normal" | "mix";
|
||||||
dataVal: TGApp.Sqlite.GachaRecords.SingleTable[];
|
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 === "avatar") return "角色祈愿";
|
||||||
if (props.dataType === "weapon") return "武器祈愿";
|
if (props.dataType === "weapon") return "武器祈愿";
|
||||||
if (props.dataType === "normal") return "常驻祈愿";
|
if (props.dataType === "normal") return "常驻祈愿";
|
||||||
|
if (props.dataType === "mix") return "集录祈愿";
|
||||||
return "";
|
return "";
|
||||||
} else if (props.dataVal.length === 0) {
|
} else if (props.dataVal.length === 0) {
|
||||||
return "暂无数据";
|
return "暂无数据";
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="gro-o-container">
|
||||||
class="gro-o-container"
|
|
||||||
:style="{
|
|
||||||
gridTemplateColumns: newData.length !== 0 ? 'repeat(4, 1fr)' : 'repeat(3, 1fr)',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<gro-dataview v-if="newData.length !== 0" v-model:data-val="newData" data-type="new" />
|
<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="normalData" data-type="normal" />
|
||||||
<gro-dataview v-model:data-val="avatarData" data-type="avatar" />
|
<gro-dataview v-model:data-val="avatarData" data-type="avatar" />
|
||||||
<gro-dataview v-model:data-val="weaponData" data-type="weapon" />
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch } from "vue";
|
import { computed, watch } from "vue";
|
||||||
|
|
||||||
import GroDataview from "./gro-dataview.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 normalData = props.modelValue.filter((item) => item.uigfType === "200");
|
||||||
let avatarData = props.modelValue.filter((item) => item.uigfType === "301");
|
let avatarData = props.modelValue.filter((item) => item.uigfType === "301");
|
||||||
let weaponData = props.modelValue.filter((item) => item.uigfType === "302");
|
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(
|
watch(
|
||||||
@@ -35,6 +43,7 @@ watch(
|
|||||||
normalData = newVal.filter((item) => item.uigfType === "200");
|
normalData = newVal.filter((item) => item.uigfType === "200");
|
||||||
avatarData = newVal.filter((item) => item.uigfType === "301");
|
avatarData = newVal.filter((item) => item.uigfType === "301");
|
||||||
weaponData = newVal.filter((item) => item.uigfType === "302");
|
weaponData = newVal.filter((item) => item.uigfType === "302");
|
||||||
|
mixData = newVal.filter((item) => item.uigfType === "500");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
@@ -44,5 +53,6 @@ watch(
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
grid-gap: 10px;
|
grid-gap: 10px;
|
||||||
|
grid-template-columns: v-bind(cnCols);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -155,6 +155,8 @@ async function confirmRefresh(): Promise<void> {
|
|||||||
await getGachaLogs("400");
|
await getGachaLogs("400");
|
||||||
loadingTitle.value = "正在刷新武器祈愿数据";
|
loadingTitle.value = "正在刷新武器祈愿数据";
|
||||||
await getGachaLogs("302");
|
await getGachaLogs("302");
|
||||||
|
loadingTitle.value = "正在刷新集录祈愿数据";
|
||||||
|
await getGachaLogs("500");
|
||||||
loadingTitle.value = "数据获取完成,即将刷新页面";
|
loadingTitle.value = "数据获取完成,即将刷新页面";
|
||||||
loadingSub.value = "";
|
loadingSub.value = "";
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file utils/UIGF.ts
|
* @file utils/UIGF.ts
|
||||||
* @description UIGF工具类
|
* @description UIGF工具类
|
||||||
* @since Beta v0.4.1
|
* @since Beta v0.4.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { app, fs, path } from "@tauri-apps/api";
|
import { app, fs, path } from "@tauri-apps/api";
|
||||||
@@ -22,7 +22,7 @@ function getUigfTimeZone(uid: string): number {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取 UIGF 头部信息
|
* @description 获取 UIGF 头部信息
|
||||||
* @since Beta v0.3.8
|
* @since Beta v0.4.4
|
||||||
* @param {string} uid - UID
|
* @param {string} uid - UID
|
||||||
* @returns {Promise<TGApp.Plugins.UIGF.Export>}
|
* @returns {Promise<TGApp.Plugins.UIGF.Export>}
|
||||||
*/
|
*/
|
||||||
@@ -31,7 +31,7 @@ export async function getUigfHeader(uid: string): Promise<TGApp.Plugins.UIGF.Exp
|
|||||||
return {
|
return {
|
||||||
uid,
|
uid,
|
||||||
lang: "zh-cn",
|
lang: "zh-cn",
|
||||||
uigf_version: "v2.4",
|
uigf_version: "v3.0",
|
||||||
export_timestamp: Math.floor(stamp / 1000),
|
export_timestamp: Math.floor(stamp / 1000),
|
||||||
export_time: timestampToDate(stamp),
|
export_time: timestampToDate(stamp),
|
||||||
export_app: "TeyvatGuide",
|
export_app: "TeyvatGuide",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export async function getGachaLog(
|
|||||||
query: params,
|
query: params,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.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;
|
return res.data.data.list;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user