💄 数据适配

close #198
This commit is contained in:
BTMuli
2026-01-02 22:49:19 +08:00
parent 27d1083181
commit fba568ead4
17 changed files with 56 additions and 37 deletions

View File

@@ -25,6 +25,7 @@
<script lang="ts" setup>
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import TMiImg from "@comp/app/t-mi-img.vue";
import { getRcStar } from "@utils/toolFunc.js";
import { AppCharacterData } from "@/data/index.js";
@@ -52,7 +53,7 @@ function getAvatarBox(avatar: TGApp.Sqlite.Abyss.CharacterInfo): TItemBoxData {
clickable: false,
height: "70px",
ltSize: "20px",
bg: `/icon/bg/${avatar.star}-Star.webp`,
bg: `/icon/bg/${getRcStar(avatar.id, avatar.star)}-Star.webp`,
icon: `/WIKI/character/${avatar.id}.webp`,
lt: `/icon/element/${res?.element ?? "风"}元素.webp`,
innerText: `Lv.${avatar.level}`,

View File

@@ -57,7 +57,7 @@
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import TSUserAvatar from "@Sqlm/userAvatar.js";
import useUserStore from "@store/user.js";
import { getZhElement } from "@utils/toolFunc.js";
import { getRcStar, getZhElement } from "@utils/toolFunc.js";
import { computed } from "vue";
import TuaRelicBox from "./tua-relic-box.vue";
@@ -79,7 +79,7 @@ const avatarIcon = computed<string>(() => {
const avatarBox = computed<TItemBoxData>(() => ({
size: "100px",
height: "100px",
bg: `/icon/bg/${props.role.avatar.rarity}-Star.webp`,
bg: `/icon/bg/${getRcStar(props.role.cid, props.role.avatar.rarity)}-Star.webp`,
icon: avatarIcon.value,
lt: `/icon/element/${getZhElement(props.role.avatar.element)}元素.webp`,
ltSize: "20px",

View File

@@ -12,13 +12,13 @@
</template>
<script lang="ts" setup>
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import { getZhElement } from "@utils/toolFunc.js";
import { getRcStar, getZhElement } from "@utils/toolFunc.js";
import { computed } from "vue";
type DucDetailOltProps =
| {
data: TGApp.Game.Avatar.Avatar;
costume: TGApp.App.Character.Costume | false;
costume?: TGApp.App.Character.Costume | false;
mode: "character";
}
| {
@@ -37,7 +37,7 @@ const title = computed<string>(() => {
return `${props.data.name}-${props.costume.name}`;
});
const boxData = computed<TItemBoxData>(() => ({
bg: `/icon/bg/${props.data.rarity}-Star.webp`,
bg: `/icon/bg/${props.mode === "weapon" ? props.data.rarity : getRcStar(props.data.id, props.data.rarity)}-Star.webp`,
icon: icon.value,
size: "100px",
height: "100px",

View File

@@ -34,7 +34,7 @@ const avatarR = computed<TGApp.App.Character.WikiBriefInfo | undefined>(() => {
});
const bg = computed<string>(() => {
if (avatarR.value) return `/icon/bg/${avatarR.value.star}-BGC.webp`;
return `/icon/bg/${props.bling.rarity > 5 ? 5 : props.bling.rarity}-BGC.webp`;
return `/icon/bg/${props.bling.rarity}-BGC.webp`;
});
const icon = computed<string>(() => {
if (avatarR.value) return `/WIKI/character/${avatarR.value.id}.webp`;

View File

@@ -14,14 +14,14 @@
<div class="left-info">
<div class="team-box">
<TItemBox
:model-value="getTeamBox(avatar)"
v-for="(avatar, idx) in props.data.teams"
:key="idx"
:model-value="getTeamBox(avatar)"
/>
</div>
<div class="best-dps">
<div class="best-dps-item" v-for="(avatar, idx) in props.data.best_avatar" :key="idx">
<TMiImg :src="avatar.side_icon" :ori="true" :alt="`${avatar.avatar_id}`" />
<div v-for="(avatar, idx) in props.data.best_avatar" :key="idx" class="best-dps-item">
<TMiImg :alt="`${avatar.avatar_id}`" :ori="true" :src="avatar.side_icon" />
<span>{{ avatar.type === 1 ? "最强一击" : "最高总伤害" }}</span>
<span>{{ avatar.dps }}</span>
</div>
@@ -29,21 +29,21 @@
</div>
<div class="right-desc">
<span
v-html="parseHtmlText(desc)"
v-for="(desc, idx) in props.data.monster.desc"
:key="idx"
v-html="parseHtmlText(desc)"
/>
</div>
</div>
<div class="monster-icon">
<TMiImg :src="props.data.monster.icon" :alt="props.data.name" :ori="true" />
<TMiImg :alt="props.data.name" :ori="true" :src="props.data.monster.icon" />
</div>
</div>
</template>
<script lang="ts" setup>
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import TMiImg from "@comp/app/t-mi-img.vue";
import { getZhElement, parseHtmlText } from "@utils/toolFunc.js";
import { getRcStar, getZhElement, parseHtmlText } from "@utils/toolFunc.js";
import TucMonsterTag from "./tuc-monster-tag.vue";
@@ -57,7 +57,7 @@ function getTeamBox(avatar: TGApp.Game.Challenge.ChallengeTeam): TItemBoxData {
const find = AppCharacterData.find((i) => i.id === avatar.avatar_id);
if (!find) {
return {
bg: `/icon/bg/${avatar.rarity}-BGC.webp`,
bg: `/icon/bg/${getRcStar(avatar.avatar_id, avatar.rarity)}-BGC.webp`,
clickable: false,
icon: avatar.image,
lt: `/icon/element/${getZhElement(avatar.element)}元素.webp`,

View File

@@ -1,14 +1,14 @@
<!-- 幽境危战赋光之人 -->
<template>
<div class="tuc-pop-item-comp" :title="props.avatar.name">
<div :title="props.avatar.name" class="tuc-pop-item-comp">
<div class="bg">
<img :src="bg" alt="Avatar" />
</div>
<div class="icon">
<TMiImg :src="icon" :alt="props.avatar.name" :ori="true" />
<TMiImg :alt="props.avatar.name" :ori="true" :src="icon" />
</div>
<div class="buff" title="赋光之人">
<img src="/icon/challenge/buff.webp" alt="Buff" />
<img alt="Buff" src="/icon/challenge/buff.webp" />
</div>
</div>
</template>
@@ -28,7 +28,7 @@ const avatarR = computed<TGApp.App.Character.WikiBriefInfo | undefined>(() => {
});
const bg = computed<string>(() => {
if (avatarR.value) return `/icon/bg/${avatarR.value.star}-BGC.webp`;
return `/icon/bg/${props.avatar.rarity > 5 ? 5 : props.avatar.rarity}-BGC.webp`;
return `/icon/bg/${props.avatar.rarity}-BGC.webp`;
});
const icon = computed<string>(() => {
if (avatarR.value) return `/WIKI/character/${avatarR.value.id}.webp`;

View File

@@ -30,7 +30,7 @@
<script lang="ts" setup>
import TItembox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import TMiImg from "@comp/app/t-mi-img.vue";
import { getWikiBrief, getZhElement } from "@utils/toolFunc.js";
import { getRcStar, getWikiBrief, getZhElement } from "@utils/toolFunc.js";
type TucAeBoxProps = {
/* 上场角色数据 */
@@ -50,7 +50,7 @@ function getAvatarBox(item: TGApp.Game.Combat.Avatar): TItemBoxData {
if (innerText === "") innerText = findAvatar.name;
}
return {
bg: `/icon/bg/${item.rarity === 105 ? 5 : item.rarity}-BGC.webp`,
bg: `/icon/bg/${getRcStar(item.avatar_id, item.rarity)}-BGC.webp`,
clickable: false,
display: "inner",
height: "80px",

View File

@@ -6,7 +6,7 @@
</template>
<script lang="ts" setup>
import TItemBox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import { getWikiBrief, getZhElement } from "@utils/toolFunc.js";
import { getRcStar, getWikiBrief, getZhElement } from "@utils/toolFunc.js";
type TucAvatarsProps = { modelValue: Array<TGApp.Game.Combat.Avatar>; detail: boolean };
@@ -21,7 +21,7 @@ function getItemBox(item: TGApp.Game.Combat.Avatar): TItemBoxData {
if (innerText === "") innerText = findAvatar.name;
}
return {
bg: `/icon/bg/${item.rarity === 105 ? 5 : item.rarity}-BGC.webp`,
bg: `/icon/bg/${getRcStar(item.avatar_id, item.rarity)}-BGC.webp`,
clickable: false,
display: "inner",
height: "80px",

View File

@@ -29,7 +29,7 @@ const props = defineProps<TucFightProps>();
function getBox(role: TGApp.Game.Combat.AvatarMini): TItemBoxData {
return {
bg: `/icon/bg/${role.rarity === 105 ? 5 : role.rarity}-BGC.webp`,
bg: `/icon/bg/${role.rarity}-BGC.webp`,
clickable: false,
display: "inner",
height: "60px",
@@ -45,7 +45,7 @@ function getBox(role: TGApp.Game.Combat.AvatarMini): TItemBoxData {
function getBox2(item: TGApp.Game.Combat.AvatarMini): TItemBoxData {
return {
bg: `/icon/bg/${item.rarity === 105 ? 5 : item.rarity}-BGC.webp`,
bg: `/icon/bg/${item.rarity}-BGC.webp`,
clickable: false,
display: "inner",
height: "60px",

View File

@@ -1,6 +1,6 @@
<template>
<TOverlay v-model="visible">
<div class="tuc-overlay-box" v-if="data">
<div v-if="data" class="tuc-overlay-box">
<div class="tuc-overlay-top">
<span class="tuc-overlay-title" @click="share()">
真境剧诗统计-第{{ data.ScheduleId }}
@@ -40,7 +40,7 @@ const raw = computed<Array<TGApp.Plugins.Hutao.Base.Rate>>(() => {
function getBoxData(item: TGApp.Plugins.Hutao.Base.Rate): TItemBoxData {
const avatar = AppCharacterData.find((i) => i.id === item.Item);
return {
bg: `/icon/bg/${avatar?.star}-Star.webp`,
bg: `/icon/bg/${avatar?.star ?? 3}-Star.webp`,
clickable: false,
display: "outer",
icon: `/WIKI/character/${item.Item}.webp`,

View File

@@ -11,6 +11,7 @@
</template>
<script lang="ts" setup>
import TItembox, { type TItemBoxData } from "@comp/app/t-itemBox.vue";
import { getRcStar } from "@utils/toolFunc.js";
type TurAvatarGridProps = { modelValue: Array<TGApp.Sqlite.Record.Avatar> };
@@ -25,7 +26,7 @@ function getBoxData(avatar: TGApp.Sqlite.Record.Avatar): TItemBoxData {
height: "80px",
ltSize: "20px",
clickable: false,
bg: `/icon/bg/${avatar.star}-Star.webp`,
bg: `/icon/bg/${getRcStar(avatar.id, avatar.star)}-Star.webp`,
icon: `/WIKI/character/${avatar.id}.webp`,
lt: `/icon/element/${avatar.element}元素.webp`,
rt: avatar.constellation.toString() || "0",

View File

@@ -52,6 +52,7 @@
class="uc-select-btn"
density="compact"
item-title="label"
width="200px"
item-value="value"
label="详情浮窗视图模式"
variant="outlined"
@@ -61,6 +62,7 @@
:hide-details="true"
:items="uidList"
class="uc-select-btn"
width="200px"
density="compact"
label="当前UID"
variant="outlined"

View File

@@ -39,7 +39,9 @@ import { AppCharacterData } from "@/data/index.js";
// 先按star降序再按元素排序再按id降序
const appCData = AppCharacterData.sort(
(a, b) =>
b.star - a.star || new Date(b.release).getTime() - new Date(a.release).getTime() || b.id - a.id,
(b.star % 100) - (a.star % 100) ||
new Date(b.release).getTime() - new Date(a.release).getTime() ||
b.id - a.id,
);
const id = useRoute().params.id.toString() ?? "0";
@@ -47,6 +49,7 @@ const showSelect = ref<boolean>(false);
const resetSelect = ref<boolean>(false);
const cardsInfo = shallowRef<Array<TGApp.App.Character.WikiBriefInfo>>(appCData);
const curItem = shallowRef<TGApp.App.Character.WikiBriefInfo>({
costumes: [],
id: 0,
contentId: 0,
name: "",
@@ -84,7 +87,7 @@ watch(
function handleSelect(val: SelectedCValue): void {
showSelect.value = false;
const filterC = AppCharacterData.filter((item) => {
if (val.star.length > 0 && !val.star.includes(item.star)) return false;
if (val.star.length > 0 && !val.star.includes(item.star % 100)) return false;
if (val.weapon.length > 0 && !val.weapon.includes(item.weapon)) return false;
if (val.elements.length > 0 && !val.elements.includes(item.element)) return false;
return !(val.area.length > 0 && !val.area.includes(item.area));

View File

@@ -1,6 +1,6 @@
/**
* 用户战绩模块
* @since Beta v0.6.0
* @since Beta v0.9.1
*/
import { timestampToDate } from "@utils/toolFunc.js";
@@ -32,15 +32,18 @@ function getInsertSql(uid: number, data: TGApp.Sqlite.Record.TableRaw): string {
/**
* 解析数据库数据
* @since Beta v0.6.0
* @since Beta v0.9.1
* @param data - 数据库数据
* @returns 渲染数据
*/
function parseRecord(data: TGApp.Sqlite.Record.TableRaw): TGApp.Sqlite.Record.TableTrans {
const avatars: Array<TGApp.Sqlite.Record.Avatar> = JSON.parse(data.avatars);
// TODO: 完善排序
avatars.sort((a, b) => Number(b.isShow) - Number(a.isShow) || b.star - a.star || b.id - a.id);
return {
uid: data.uid,
role: JSON.parse(data.role),
avatars: JSON.parse(data.avatars),
avatars: avatars,
stats: JSON.parse(data.stats),
worldExplore: JSON.parse(data.worldExplore),
homes: JSON.parse(data.homes),

View File

@@ -44,7 +44,7 @@ function transRole(data: TGApp.Game.Record.Role): TGApp.Sqlite.Record.Role {
/**
* 转换角色数据
* @since Beta v0.6.0
* @since Beta v0.9.1
* @param data - 角色数据
* @returns 转换后的角色数据
*/

View File

@@ -100,10 +100,7 @@ declare namespace TGApp.Sqlite.Record {
fetter: number;
/** 等级 */
level: number;
/**
* 稀有度
* @remarks 埃洛伊稀有度为105转换为5
*/
/** 稀有度 */
star: number;
/** 命座数 */
constellation: number;

View File

@@ -354,3 +354,15 @@ export async function isRunInAdmin(): Promise<boolean> {
}
return isAdmin;
}
/**
* 传入角色ID跟星级返回渲染星级
* @since Beta v0.9.1
* @param cid - 角色ID
* @param star - 角色星级
* @returns 渲染星级
*/
export function getRcStar(cid: number, star: number): number {
const star105List = [10000062, 10000117, 10000118];
return star105List.includes(cid) ? 105 : star;
}