From cf9e4ae00825bdee61b82968c4b7eb56a53ec379 Mon Sep 17 00:00:00 2001 From: Yanstory <862415702@qq.com> Date: Fri, 22 May 2026 16:20:34 +0800 Subject: [PATCH 1/6] fix(ItemList): data fetch & functional optimize --- src/utils/utils.ts | 21 +++++++ src/widgets/ItemList/ItemCard.vue | 93 ++++++++++++++++++++++++++----- src/widgets/ItemList/consts.ts | 23 ++++---- src/widgets/ItemList/index.vue | 27 ++++++++- src/widgets/ItemList/itemData.ts | 9 +-- src/widgets/ItemList/types.ts | 1 + 6 files changed, 144 insertions(+), 30 deletions(-) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 6978fe88..ea3fe00e 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -30,6 +30,27 @@ export function getImagePath(filename: string) { return `${MEDIA_ENDPOINT}/${md5.slice(0, 1)}/${md5.slice(0, 2)}/${filename}`; } +export async function getImagePathWithRedirect(filename: string) { + const resp = await fetch( + `/api.php?${new URLSearchParams({ + action: "query", + titles: `File:${filename}`, + redirects: "1", + format: "json", + })}`, + ); + const data = await resp.json(); + + if (data.query?.redirects) { + filename = (data.query.redirects[0].to || filename) + .replaceAll(" ", "_") + .replace("文件:", ""); + } + + const md5 = MD5(filename); + return `${MEDIA_ENDPOINT}/${md5.slice(0, 1)}/${md5.slice(0, 2)}/${filename}`; +} + export const professionMap = { PIONEER: "先锋", WARRIOR: "近卫", diff --git a/src/widgets/ItemList/ItemCard.vue b/src/widgets/ItemList/ItemCard.vue index 94cd1ed9..240ce7f2 100644 --- a/src/widgets/ItemList/ItemCard.vue +++ b/src/widgets/ItemList/ItemCard.vue @@ -1,10 +1,10 @@
{{ item.name }}
-
- {{ item.usage }} -
-
- {{ item.description }} -
+
+
@@ -68,4 +132,7 @@ const imgSrc = computed(() => { transform: scale(1.1); z-index: 1; } +:deep(a) { + color: orange !important; +} diff --git a/src/widgets/ItemList/consts.ts b/src/widgets/ItemList/consts.ts index 98412eb9..5e92e2b7 100644 --- a/src/widgets/ItemList/consts.ts +++ b/src/widgets/ItemList/consts.ts @@ -12,12 +12,9 @@ export const defaultFilterConfig: FilterConfig = { "材料", "消耗道具", "作战记录", - "建材", - "建材原材料", + "精英化芯片", "技巧概要", - "芯片", - "双芯片", - "芯片组", + "基建材料", "理智药剂", "食物", "物资补给", @@ -29,15 +26,11 @@ export const defaultFilterConfig: FilterConfig = { "私人信件", "文件夹", "活动道具", - "其它道具组合", + "道具组合", "干员赠礼", "纪念物", "可露希尔票券", - "其他道具", - "其他干员道具", - "养成材料组合", - "家具收藏包", - "形艺特辑组件包", + "其他", ], }, obtainApproach: { @@ -88,6 +81,14 @@ export const rarityColorMap: Record = { 5: "#e06c00", }; +//only needed aliases +export const categoryAliases: Record = { + 精英化芯片: ["芯片", "芯片组", "双芯片"], + 基建材料: ["建材", "建材原材料"], + 道具组合: ["养成材料组合", "家具收藏包", "其它道具组合", "形艺特辑组件包"], + 其他: ["其他道具", "其他干员道具"], +}; + export const obtainApproachAliases: Record = { 采购中心: ["采购中心"], 任务奖励: ["任务奖励", "日常任务", "周常任务"], diff --git a/src/widgets/ItemList/index.vue b/src/widgets/ItemList/index.vue index 4b3e2a93..d21f37cd 100644 --- a/src/widgets/ItemList/index.vue +++ b/src/widgets/ItemList/index.vue @@ -1,5 +1,5 @@