From 5030af2366ac253e8aff1223302d065319f3d928 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Wed, 31 Dec 2025 01:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=88=91=E7=9A=84=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E9=A1=B5=E9=9D=A2=E6=B8=B2=E6=9F=93=E8=A1=A3=E8=A3=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #190 --- src/components/userAvatar/tua-avatar-box.vue | 63 ++++++++++----- src/components/userAvatar/tua-detail-card.vue | 80 ++++++++++++------- .../userAvatar/tua-detail-overlay.vue | 4 +- .../userAvatarCard/duc-detail-olt.vue | 14 +++- .../userAvatarCard/tuc-detail-card.vue | 52 +++++++----- src/pages/User/Characters.vue | 2 +- 6 files changed, 140 insertions(+), 75 deletions(-) diff --git a/src/components/userAvatar/tua-avatar-box.vue b/src/components/userAvatar/tua-avatar-box.vue index 26674c1e..26da61e1 100644 --- a/src/components/userAvatar/tua-avatar-box.vue +++ b/src/components/userAvatar/tua-avatar-box.vue @@ -34,20 +34,20 @@
-
+
fetter - {{ props.modelValue.avatar.fetter }} + {{ props.role.avatar.fetter }}
mdi-tshirt-crew
- Lv.{{ props.modelValue.avatar.level }} + Lv.{{ props.role.avatar.level }}
@@ -62,23 +62,30 @@ import { computed } from "vue"; import TuaRelicBox from "./tua-relic-box.vue"; +import { AppCharacterData } from "@/data/index.js"; + type fixedLenArr = [T, ...Array] & { length: N }; type AvatarRelics = fixedLenArr; -type TuaAvatarBoxProps = { modelValue: TGApp.Sqlite.Character.TableTrans }; +type TuaAvatarBoxProps = { role: TGApp.Sqlite.Character.TableTrans }; const props = defineProps(); const userStore = useUserStore(); +const avatarIcon = computed(() => { + const costume = getCostume(); + if (costume) return `/WIKI/costume/${costume.id}.webp`; + return `/WIKI/character/${props.role.avatar.id}.webp`; +}); const avatarBox = computed(() => ({ size: "100px", height: "100px", - bg: `/icon/bg/${props.modelValue.avatar.rarity}-Star.webp`, - icon: `/WIKI/character/${props.modelValue.avatar.id}.webp`, - lt: `/icon/element/${getZhElement(props.modelValue.avatar.element)}元素.webp`, + bg: `/icon/bg/${props.role.avatar.rarity}-Star.webp`, + icon: avatarIcon.value, + lt: `/icon/element/${getZhElement(props.role.avatar.element)}元素.webp`, ltSize: "20px", - rt: props.modelValue.avatar.actived_constellation_num.toString() || "0", + rt: props.role.avatar.actived_constellation_num.toString() || "0", rtSize: "20px", - innerText: props.modelValue.avatar.name, + innerText: props.role.avatar.name, innerHeight: 30, display: "inner", clickable: true, @@ -86,19 +93,19 @@ const avatarBox = computed(() => ({ const weaponBox = computed(() => ({ size: "65px", height: "65px", - bg: `/icon/bg/${props.modelValue.weapon.rarity}-Star.webp`, - icon: `/WIKI/weapon/${props.modelValue.weapon.id}.webp`, - lt: `/icon/weapon/${props.modelValue.weapon.type_name}.webp`, + bg: `/icon/bg/${props.role.weapon.rarity}-Star.webp`, + icon: `/WIKI/weapon/${props.role.weapon.id}.webp`, + lt: `/icon/weapon/${props.role.weapon.type_name}.webp`, ltSize: "20px", - rt: props.modelValue.weapon.affix_level.toString(), + rt: props.role.weapon.affix_level.toString(), rtSize: "20px", - innerText: props.modelValue.weapon.name, + innerText: props.role.weapon.name, innerHeight: 20, display: "inner", clickable: true, })); const relicsBox = computed(() => { - const relics = props.modelValue.relics; + const relics = props.role.relics; return [ relics.find((i) => i.pos === 1) || false, relics.find((i) => i.pos === 2) || false, @@ -109,19 +116,31 @@ const relicsBox = computed(() => { }); const isFetterMax = computed(() => { const skipList = [10000005, 10000007, 10000117, 10000118]; - if (skipList.includes(props.modelValue.avatar.id)) return true; - return props.modelValue.avatar.fetter === 10; + if (skipList.includes(props.role.avatar.id)) return true; + return props.role.avatar.fetter === 10; }); const skills = computed>(() => - props.modelValue.skills.filter((skill) => skill.skill_type === 1), + props.role.skills.filter((skill) => skill.skill_type === 1), ); const nameCard = computed(() => { - const cardFind = TSUserAvatar.getAvatarCard(props.modelValue.avatar.id); + const cardFind = TSUserAvatar.getAvatarCard(props.role.avatar.id); return `/WIKI/nameCard/profile/${cardFind}.webp`; }); +function getCostume(): TGApp.App.Character.Costume | false { + if (props.role.costumes.length === 0) return false; + const findC = AppCharacterData.find((i) => i.id === props.role.cid); + if (!findC) return false; + let res: TGApp.App.Character.Costume | false = false; + for (const costume of props.role.costumes) { + const findCostume = findC.costumes.find((i) => i.id === costume.id); + if (findCostume !== undefined && !findCostume.isDefault) return findCostume; + } + return res; +} + function getWeaponTitle(): string { - const weapon = props.modelValue.weapon; + const weapon = props.role.weapon; const title: Array = []; title.push(`${weapon.type_name} - ${weapon.name}`); title.push(`${weapon.rarity}星 精炼${weapon.affix_level} Lv.${weapon.level}`); diff --git a/src/components/userAvatar/tua-detail-card.vue b/src/components/userAvatar/tua-detail-card.vue index 06f25877..17d1a4ab 100644 --- a/src/components/userAvatar/tua-detail-card.vue +++ b/src/components/userAvatar/tua-detail-card.vue @@ -1,34 +1,35 @@ + @@ -88,28 +89,35 @@ import TuaDcRelic from "./tua-dc-relic.vue"; import TuaDcTalents from "./tua-dc-talents.vue"; import TuaDcWeapon from "./tua-dc-weapon.vue"; +import { AppCharacterData } from "@/data/index.js"; + type fixedLenArr = [T, ...Array] & { length: N }; type RelicList = fixedLenArr; -type TuaDetailCardProps = { modelValue: TGApp.Sqlite.Character.TableTrans }; +type TuaDetailCardProps = { avatar: TGApp.Sqlite.Character.TableTrans }; const props = defineProps(); const userStore = useUserStore(); +const fullIcon = computed(() => { + const costume = getCostume(); + if (costume) return `/WIKI/costume/${costume.id}_full.webp`; + return props.avatar.avatar.image; +}); const relicList = computed(() => { return [ - props.modelValue.relics.find((item) => item.pos === 1) || false, - props.modelValue.relics.find((item) => item.pos === 2) || false, - props.modelValue.relics.find((item) => item.pos === 3) || false, - props.modelValue.relics.find((item) => item.pos === 4) || false, - props.modelValue.relics.find((item) => item.pos === 5) || false, + props.avatar.relics.find((item) => item.pos === 1) || false, + props.avatar.relics.find((item) => item.pos === 2) || false, + props.avatar.relics.find((item) => item.pos === 3) || false, + props.avatar.relics.find((item) => item.pos === 4) || false, + props.avatar.relics.find((item) => item.pos === 5) || false, ]; }); const propMain = computed>(() => - props.modelValue.propSelected.map((item) => userStore.getProp(item.property_type)), + props.avatar.propSelected.map((item) => userStore.getProp(item.property_type)), ); const bg = computed(() => { - const card = TSUserAvatar.getAvatarCard(props.modelValue.cid); + const card = TSUserAvatar.getAvatarCard(props.avatar.cid); return `url("/WIKI/nameCard/profile/${card}.webp")`; }); const loading = ref(false); @@ -120,11 +128,23 @@ async function share(): Promise { showSnackbar.error("分享失败,未找到分享内容"); return; } - const fileName = `【角色详情】${props.modelValue.avatar.name}`; + const fileName = `【角色详情】${props.avatar.avatar.name}`; loading.value = true; await generateShareImg(fileName, shareBox); loading.value = false; } + +function getCostume(): TGApp.App.Character.Costume | false { + if (props.avatar.costumes.length === 0) return false; + const findC = AppCharacterData.find((i) => i.id === props.avatar.cid); + if (!findC) return false; + let res: TGApp.App.Character.Costume | false = false; + for (const costume of props.avatar.costumes) { + const findCostume = findC.costumes.find((i) => i.id === costume.id); + if (findCostume !== undefined && !findCostume.isDefault) return findCostume; + } + return res; +}