优化发布等各种状态

This commit is contained in:
yml2213
2026-05-23 15:52:44 +08:00
parent f2492d5e40
commit b101415e9d
25 changed files with 368 additions and 70 deletions
@@ -7,6 +7,7 @@ import {
startRealname,
type RealnameStatus,
} from "@/api/realname";
import { realnameStatusLabel } from "@/utils/statusLabels";
import { useSessionStore } from "@/stores/session";
import { formatDateTime } from "@/utils/time";
@@ -106,7 +107,7 @@ async function handleSubmit() {
size="medium"
round
>
{{ status.status === "verified" ? "已认证" : status.status }}
{{ realnameStatusLabel(status.status) }}
</van-tag>
</div>
<p v-if="status.masked_name" class="status-detail">
@@ -1,7 +1,10 @@
.mobile-publish {
width: 100%;
min-width: 0;
min-height: 100dvh;
background: #f4f6f8;
padding-bottom: 56px;
overflow-x: hidden;
}
.page-header {
@@ -528,18 +531,22 @@
bottom: 0;
z-index: 100;
display: flex;
width: 100%;
height: 50px;
box-sizing: border-box;
background: #fff;
border-top: 1px solid #eee;
}
.nav-item {
flex: 1;
flex: 0 0 20%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
min-width: 0;
height: 50px;
color: #999;
font-size: 10px;
text-decoration: none;
@@ -356,7 +356,7 @@ async function handleSubmit() {
const dailyPrice = calculatedFinalPrice.value;
const hourlyPrice = Math.max(roundMoney(dailyPrice / 24), 0.01);
await createListing({
const listing = await createListing({
title,
description: form.remark,
server_region: form.server_region,
@@ -371,7 +371,13 @@ async function handleSubmit() {
deposit_amount: Number(form.deposit_amount),
});
localStorage.removeItem(draftKey);
showToast({ message: "发布成功", icon: "passed" });
showToast({
message:
listing.status === "published" && listing.review_status === "approved"
? "发布成功,已上架"
: "发布成功,等待后台审核",
icon: "passed",
});
await router.push("/m/profile");
} catch (error) {
showToast({
@@ -396,9 +402,15 @@ function validateForm() {
if (form.deposit_amount === "" || Number(form.deposit_amount) < 0) {
return "请填写押金";
}
if (!Number.isFinite(Number(form.deposit_amount))) {
return "押金格式不正确";
}
if (!calculatedFinalPrice.value) {
return "请完善币数、保险、体力和负重后再发布";
}
if (!Number.isFinite(calculatedFinalPrice.value)) {
return "发布价格计算异常,请检查填写内容";
}
for (const item of screenshotSlots.value) {
if (isScreenshotRequired(item) && !screenshotFiles[item.key]) {
return `请上传${item.label}`;
@@ -705,7 +717,7 @@ function readError(error: unknown, fallback: string) {
type="number"
inputmode="numeric"
min="0"
:placeholder="item.placeholder || '0'"
placeholder="0"
class="quantity-input"
/>
</div>