feat: 添加租后须知功能并优化发布默认设置

新增功能:
- 添加租后须知查看功能(PC端+移动端)
- 管理后台支持配置租后须知内容
- 默认提供完整的租后须知模板

功能实现:
- 后端:新增 PostRentalNotice API 接口和配置管理
- PC端:在用户下拉菜单添加租后须知入口,独立页面展示
- 移动端:在个人中心实名认证下方添加入口,弹窗展示
- 管理端:新增租后须知配置弹窗,支持编辑和恢复默认

优化改进:
- 修复发布页面默认选中"参考比例"而非"自定比例"
- 移除错误的迁移测试脚本(与 MySQL 8.0 不兼容)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yml
2026-06-05 09:55:11 +08:00
co-authored by Claude Opus 4.7
parent 0b9b0b5ea7
commit 5d5bd5af77
15 changed files with 563 additions and 201 deletions
@@ -6,6 +6,7 @@ import { showDialog, showToast } from "vant";
import MobileBottomNav from "@/components/MobileBottomNav.vue";
import { fetchWalletBalance, fetchWalletLedger, type WalletLedger } from "@/features/wallet/api/wallet";
import { fetchPostRentalNotice, type PostRentalNotice } from "@/features/orders/api/orders";
import { formatDateMinute } from "@/utils/time";
import { uploadFile } from "@/shared/api/files";
@@ -60,6 +61,11 @@ const showLedgers = ref(false);
const loadingLedgers = ref(false);
const ledgers = ref<WalletLedger[]>([]);
// 租后须知
const showPostRentalNotice = ref(false);
const loadingPostRentalNotice = ref(false);
const postRentalNotice = ref<PostRentalNotice | null>(null);
const settingsGroups = [
{
title: "账号与安全",
@@ -108,6 +114,20 @@ async function openLedgers() {
}
}
async function openPostRentalNotice() {
showPostRentalNotice.value = true;
if (!postRentalNotice.value) {
loadingPostRentalNotice.value = true;
try {
postRentalNotice.value = await fetchPostRentalNotice();
} catch {
showToast({ message: "无法获取租后须知", icon: "cross" });
} finally {
loadingPostRentalNotice.value = false;
}
}
}
function handleWithdraw() {
showDialog({
title: "提现提示",
@@ -348,6 +368,7 @@ function resolveAvatarURL(url: string | undefined | null) {
</span>
</template>
</van-cell>
<van-cell title="租后须知" icon="info-o" is-link @click="openPostRentalNotice" />
<van-cell title="系统设置" icon="setting-o" is-link @click="showSettings = true" />
</van-cell-group>
</div>
@@ -382,6 +403,27 @@ function resolveAvatarURL(url: string | undefined | null) {
</div>
</van-popup>
<!-- 租后须知 Popup -->
<van-popup
v-model:show="showPostRentalNotice"
position="bottom"
round
class="notice-popup"
:style="{ height: '75%' }"
>
<header class="popup-header">
<h3>{{ postRentalNotice?.title || '租后须知' }}</h3>
<button class="popup-close" @click="showPostRentalNotice = false"></button>
</header>
<div class="popup-body">
<van-loading v-if="loadingPostRentalNotice" class="center-loading" vertical>加载中...</van-loading>
<div v-else-if="postRentalNotice" class="notice-content">
{{ postRentalNotice.content }}
</div>
<van-empty v-else description="暂无租后须知" />
</div>
</van-popup>
<!-- 设置面板 - Popup -->
<van-popup
v-model:show="showSettings"
@@ -858,6 +900,26 @@ function resolveAvatarURL(url: string | undefined | null) {
color: #ef4444;
}
/* 租后须知 Popup */
.notice-popup {
display: flex;
flex-direction: column;
}
.notice-content {
padding: 16px 0;
color: #374151;
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
word-wrap: break-word;
}
.center-loading {
display: flex;
align-items: center;
justify-content: center;
padding: 40px 0;
}
/* ========== 设置面板 ========== */
.settings-panel {
display: flex;