diff --git a/frontend/src/features/listings/api/listings.ts b/frontend/src/features/listings/api/listings.ts index 8c20f9b..05b8469 100644 --- a/frontend/src/features/listings/api/listings.ts +++ b/frontend/src/features/listings/api/listings.ts @@ -34,31 +34,8 @@ export interface Listing { updated_at: string } -// 公开商品卡片的最小字段,对应后端 PublicListingListItemDTO。 -export interface PublicListingItem { - id: number - listing_no: string - title: string - game_name: string - server_region: string - login_platform: string - rank_level: string - haf_coin_amount: number - asset_summary?: Record - screenshot_urls?: string[] - cover_url: string - price_cent: number - deposit_amount_cent: number - is_accelerated_sale?: boolean - published_at?: string - created_at: string -} - -// 公开商品详情,对应后端 PublicListingDetailDTO。 -export interface PublicListingDetail extends PublicListingItem { - description: string - screenshot_urls: string[] -} +export type PublicListingItem = Listing +export type PublicListingDetail = Listing export interface ListingPayload { title: string @@ -112,7 +89,7 @@ export interface PublicListingQuery { } export interface PublicListingPage { - items: PublicListingItem[] + items: Listing[] total: number page: number page_size: number @@ -158,7 +135,7 @@ function normalizePublicListingPage( } export async function fetchListing(id: string | number) { - const { data } = await apiClient.get>(`/listings/${id}`) + const { data } = await apiClient.get>(`/listings/${id}`) return data.data } diff --git a/frontend/src/features/listings/composables/useListingQuery.ts b/frontend/src/features/listings/composables/useListingQuery.ts index 9eb91a4..5424116 100644 --- a/frontend/src/features/listings/composables/useListingQuery.ts +++ b/frontend/src/features/listings/composables/useListingQuery.ts @@ -1,5 +1,5 @@ import { ref, onMounted, onBeforeUnmount, watch, type Ref } from 'vue' -import { fetchListingsPage, type PublicListingItem, type PublicListingQuery } from '../api/listings' +import { fetchListingsPage, type Listing, type PublicListingQuery } from '../api/listings' import type { HomeFilters } from './useHomeFilters' const homePageSize = 12 @@ -11,7 +11,7 @@ export function useListingQuery( ) { const loading = ref(false) const loadingMore = ref(false) - const listings = ref([]) + const listings = ref([]) const totalListings = ref(0) const zoneCounts = ref>({}) const currentPage = ref(1) diff --git a/frontend/src/shared/utils/listingDisplay.ts b/frontend/src/shared/utils/listingDisplay.ts index 11676c1..5474e1d 100644 --- a/frontend/src/shared/utils/listingDisplay.ts +++ b/frontend/src/shared/utils/listingDisplay.ts @@ -1,4 +1,4 @@ -import type { PublicListingItem } from '@/features/listings/api/listings' +import type { Listing, PublicListingItem } from '@/features/listings/api/listings' import { centToYuan } from '@/shared/utils/money' export interface ListingDisplayChip {