fix(types): 修复合并后的 Listing 类型引用与接口类型兼容
This commit is contained in:
@@ -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<string, unknown>
|
||||
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<ApiResponse<PublicListingDetail>>(`/listings/${id}`)
|
||||
const { data } = await apiClient.get<ApiResponse<Listing>>(`/listings/${id}`)
|
||||
return data.data
|
||||
}
|
||||
|
||||
|
||||
@@ -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<PublicListingItem[]>([])
|
||||
const listings = ref<Listing[]>([])
|
||||
const totalListings = ref(0)
|
||||
const zoneCounts = ref<Record<string, number>>({})
|
||||
const currentPage = ref(1)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user