fix:补充多语言遗漏

This commit is contained in:
JiaJun
2026-04-15 09:20:02 +08:00
parent b2c7c8d362
commit e9d0d46244
5 changed files with 12 additions and 18 deletions

View File

@@ -30,8 +30,7 @@ function App() {
if (previousLanguage && previousLanguage !== normalizedLanguage) {
await queryClient.cancelQueries()
await queryClient.invalidateQueries()
await queryClient.refetchQueries({type: 'active'})
await queryClient.invalidateQueries({refetchType: 'active'})
}
previousLanguageRef.current = normalizedLanguage

View File

@@ -89,7 +89,7 @@ export function GoodsCategoryList({
className="flex h-[36px] w-[36px] items-center justify-center rounded-[12px] bg-[#FA6A00]/15 text-[#FE9F00]">
<CategoryIcon className="h-[18px] w-[18px]" aria-hidden="true"/>
</div>
<div className="truncate text-[15px] font-semibold text-white">{category.name}</div>
<div className="truncate text-[15px] font-semibold text-white">{t(HOME_CATEGORY_META_MAP[category.id].nameKey)}</div>
</div>
{showMore && onMoreClick ? (
<button
@@ -116,12 +116,12 @@ export function GoodsCategoryList({
<div className="text-[16px] font-medium text-white">{product.title}</div>
<div className="text-[13px] text-white/52">{product.subtitle}</div>
</div>
<div className="text-[16px] font-semibold text-[#FA6A00]">{product.score}</div>
<div className="text-[16px] font-semibold text-[#FA6A00]">{product.scoreValue} {t('common.points')}</div>
<Button
className="h-[36px] w-full text-[13px]"
onClick={() => onRedeem(product, category.id)}
>
{product.ctaLabel}
{t(HOME_CATEGORY_META_MAP[category.id].ctaLabelKey)}
</Button>
</div>
</div>

View File

@@ -239,7 +239,7 @@ export function GoodsRedeemModal({
</div>
<div className="flex items-center justify-between py-[14px] text-white">
<div className="text-[18px]">{t('goods.pointsRequired')}</div>
<div className="text-[18px]">{getNumericValue(selectedProductData.score)}</div>
<div className="text-[18px]">{getNumericValue(String(selectedProductData.scoreValue))}</div>
</div>
<div className="flex items-center justify-between py-[14px] text-white">
<div className="text-[18px] underline decoration-[#1E90FF] underline-offset-[3px]">
@@ -262,7 +262,7 @@ export function GoodsRedeemModal({
</div>
<div className="flex items-center justify-between py-[14px] text-white">
<div className="text-[13px] text-white/78">{t('goods.pointsRequired')}</div>
<div className="text-[14px]">{getNumericValue(selectedProductData.score)}</div>
<div className="text-[14px]">{getNumericValue(String(selectedProductData.scoreValue))}</div>
</div>
<div className="flex items-center justify-between py-[14px] text-white">
<div className="text-[13px] text-white/78">{t('goods.turnoverRequirement')}</div>
@@ -287,7 +287,7 @@ export function GoodsRedeemModal({
</div>
<div className="flex items-center justify-between py-[12px]">
<div className="text-[13px] text-white/82">{t('goods.pointsCost')}</div>
<div className="text-[15px] text-white">{getNumericValue(selectedProductData.score)}</div>
<div className="text-[15px] text-white">{getNumericValue(String(selectedProductData.scoreValue))}</div>
</div>
</div>

View File

@@ -1,7 +1,6 @@
import {useQuery} from '@tanstack/react-query'
import {goodList} from '@/api/business.ts'
import i18n from '@/lib/i18n'
import {
API_ORIGIN,
HOME_CATEGORY_META_MAP,
@@ -23,15 +22,12 @@ function getProductImageUrl(image?: string) {
return new URL(image, API_ORIGIN).toString()
}
function mapGoodItemToProductItem(item: GoodsItem, type: goodsType): ProductItem {
const categoryMeta = HOME_CATEGORY_META_MAP[type]
function mapGoodItemToProductItem(item: GoodsItem): ProductItem {
return {
id: String(item.id),
title: item.title,
subtitle: item.description,
score: `${item.score} ${i18n.t('common.points')}`,
ctaLabel: i18n.t(categoryMeta.ctaLabelKey),
scoreValue: item.score,
imageUrl: getProductImageUrl(item.image),
}
}
@@ -39,8 +35,8 @@ function mapGoodItemToProductItem(item: GoodsItem, type: goodsType): ProductItem
function buildProductCategories(groups: Record<goodsType, GoodsItem[]>): ProductCategory[] {
return HOME_GOOD_TYPE_ORDER.map((type) => ({
id: type,
name: i18n.t(HOME_CATEGORY_META_MAP[type].nameKey),
items: groups[type].map((item) => mapGoodItemToProductItem(item, type)),
name: HOME_CATEGORY_META_MAP[type].nameKey,
items: groups[type].map((item) => mapGoodItemToProductItem(item)),
}))
}

View File

@@ -51,8 +51,7 @@ export type ProductItem = {
id: string
title: string
subtitle: string
score: string
ctaLabel: string
scoreValue: number | string
imageClassName?: string
imageUrl?: string
}