优化历史包袱,修复发布页面默认0 恢哈伏笔
This commit is contained in:
@@ -4,15 +4,14 @@ import { useRoute, useRouter } from "vue-router";
|
||||
import { showToast, showDialog } from "vant";
|
||||
|
||||
import { fetchListing, type Listing } from "@/api/listings";
|
||||
import { defaultListingPublishOptions } from "@/api/listingOptions";
|
||||
import { createOrder } from "@/api/orders";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
import { buildFallbackListings } from "./mobileHomeFallback";
|
||||
import {
|
||||
assetRegions,
|
||||
formatHafCoinM,
|
||||
formatRatio,
|
||||
getCoinWan,
|
||||
getDailyLoss,
|
||||
getListingChips,
|
||||
getListingDisplayPrice,
|
||||
getListingResources,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
getListingTitle,
|
||||
getLoginMethod,
|
||||
getRentDays,
|
||||
getScreenshotMap,
|
||||
getServerRegion,
|
||||
readAssetNumber,
|
||||
readAssetString,
|
||||
@@ -40,15 +38,7 @@ onMounted(async () => {
|
||||
listing.value = await fetchListing(String(route.params.id));
|
||||
rentHours.value = Math.max(listing.value.min_rent_hours || 1, 1);
|
||||
} catch {
|
||||
const fallback = buildFallbackListings(defaultListingPublishOptions).find(
|
||||
(item) => String(item.id) === String(route.params.id)
|
||||
);
|
||||
if (fallback) {
|
||||
listing.value = fallback;
|
||||
rentHours.value = Math.max(fallback.min_rent_hours || 1, 1);
|
||||
} else {
|
||||
showToast({ message: "加载失败", icon: "warning-o" });
|
||||
}
|
||||
showToast({ message: "加载失败", icon: "warning-o" });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -77,20 +67,9 @@ const detailMetrics = computed(() => {
|
||||
|
||||
const detailScreenshots = computed(() => {
|
||||
if (!listing.value) return [];
|
||||
const screenshotMap = getScreenshotMap(listing.value);
|
||||
const labels: Record<string, string> = {
|
||||
coin: "纯币截图",
|
||||
gameId: "游戏ID",
|
||||
totalAsset: "总资产",
|
||||
tencentSecurity: "腾讯安全中心",
|
||||
skin: "皮肤截图",
|
||||
};
|
||||
const mapped = Object.entries(screenshotMap)
|
||||
.filter(([, url]) => typeof url === "string" && url)
|
||||
.map(([key, url]) => ({ label: labels[key] || "账号截图", url: String(url) }));
|
||||
if (mapped.length) return mapped;
|
||||
const labels = ["纯币截图", "游戏ID截图", "总资产截图", "腾讯安全中心截图", "皮肤截图"];
|
||||
return (listing.value.screenshot_urls || []).map((url, index) => ({
|
||||
label: `账号截图${index + 1}`,
|
||||
label: labels[index] || `账号截图${index + 1}`,
|
||||
url,
|
||||
}));
|
||||
});
|
||||
@@ -239,12 +218,12 @@ function isNavActive(path: string) {
|
||||
listing.rank_level
|
||||
}}</van-tag>
|
||||
<van-tag
|
||||
v-if="readAssetString(listing, 'daily_loss')"
|
||||
v-if="getDailyLoss(listing)"
|
||||
color="#fff7ed"
|
||||
text-color="#ea580c"
|
||||
size="medium"
|
||||
>
|
||||
损耗 {{ readAssetString(listing, "daily_loss") }}
|
||||
损耗 {{ getDailyLoss(listing) }}
|
||||
</van-tag>
|
||||
</div>
|
||||
<h2 class="detail-title">{{ getListingTitle(listing) }}</h2>
|
||||
|
||||
Reference in New Issue
Block a user