新增首页 AW炫彩回收入口,支持后台配置展示图

首页第三入口点击查看回收说明图;配置项 mobile.aw_recycle 可配标题/图片;aw-recycle 走公开文件链路,首页鉴权预览兼容旧私有地址。
This commit is contained in:
yml2213
2026-07-19 22:50:16 +08:00
parent dabcec45cb
commit 9b1ee445b7
14 changed files with 533 additions and 18 deletions
@@ -27,6 +27,11 @@ import PublishOptionsDialog from '../components/PublishOptionsDialog.vue'
import SalePriceDialog from '../components/SalePriceDialog.vue'
import HomeAnnouncementsDialog from '../components/HomeAnnouncementsDialog.vue'
import HomeBannersDialog from '../components/HomeBannersDialog.vue'
import AwRecycleDialog from '../components/AwRecycleDialog.vue'
import {
defaultAWRecycleConfig,
type AWRecycleConfig,
} from '@/features/listings/api/homeConfig'
import ListingPublishAgreementsDialog from '../components/ListingPublishAgreementsDialog.vue'
import OrderAgreementsDialog from '../components/OrderAgreementsDialog.vue'
import PostRentalNoticeDialog from '../components/PostRentalNoticeDialog.vue'
@@ -70,6 +75,7 @@ const publishVisible = ref(false)
const salePriceVisible = ref(false)
const announcementsVisible = ref(false)
const bannersVisible = ref(false)
const awRecycleVisible = ref(false)
const listingPublishAgreementsVisible = ref(false)
const agreementsVisible = ref(false)
const postRentalNoticeVisible = ref(false)
@@ -90,6 +96,9 @@ const homeAnnouncementsConfig = computed(
const homeBannersConfig = computed(
() => configs.value.find(item => item.key === 'mobile.home_banners') || null
)
const awRecycleConfig = computed(
() => configs.value.find(item => item.key === 'mobile.aw_recycle') || null
)
const listingPublishAgreementsConfig = computed(
() => configs.value.find(item => item.key === 'listing.publish_agreements') || null
)
@@ -135,6 +144,7 @@ const regularConfigs = computed(() =>
item.key !== 'listing.publish_cooldown_minutes' &&
item.key !== 'mobile.home_announcements' &&
item.key !== 'mobile.home_banners' &&
item.key !== 'mobile.aw_recycle' &&
item.key !== 'listing.publish_agreements' &&
item.key !== 'order.agreements' &&
item.key !== 'profile.post_rental_notice' &&
@@ -180,6 +190,13 @@ const homeStats = computed(() => {
}
})
const awRecycleStats = computed(() => {
const item = parseAWRecycle(awRecycleConfig.value?.value || '')
return {
enabledLabel: item.enabled ? (item.image_url ? '已配置图' : '已开启') : '已隐藏',
}
})
const agreementStats = computed(() => {
const agreements = parseOrderAgreements(orderAgreementsConfig.value?.value || '')
return {
@@ -236,6 +253,8 @@ function openEdit(row: SystemConfig) {
announcementsVisible.value = true
} else if (row.key === 'mobile.home_banners') {
bannersVisible.value = true
} else if (row.key === 'mobile.aw_recycle') {
awRecycleVisible.value = true
} else if (row.key === 'listing.publish_agreements') {
listingPublishAgreementsVisible.value = true
} else if (row.key === 'order.agreements') {
@@ -269,6 +288,22 @@ function parseHomeBanners(raw: string) {
return cloneHomeBanners(mergeHomeConfig({ banners: Array.isArray(parsed) ? parsed : [] }).banners)
}
function parseAWRecycle(raw: string): AWRecycleConfig {
const parsed = safeParseJSON(raw, defaultAWRecycleConfig)
return {
title:
typeof parsed.title === 'string' && parsed.title.trim()
? parsed.title.trim()
: defaultAWRecycleConfig.title,
subtitle:
typeof parsed.subtitle === 'string' && parsed.subtitle.trim()
? parsed.subtitle.trim()
: defaultAWRecycleConfig.subtitle,
image_url: typeof parsed.image_url === 'string' ? parsed.image_url.trim() : '',
enabled: typeof parsed.enabled === 'boolean' ? parsed.enabled : true,
}
}
function parseOrderAgreements(raw: string) {
const parsed = safeParseJSON(raw, defaultOrderAgreements)
return {
@@ -479,20 +514,26 @@ function formatConfigValue(row: SystemConfig) {
</div>
</section>
<section v-if="homeAnnouncementsConfig || homeBannersConfig" class="publish-config-panel">
<section
v-if="homeAnnouncementsConfig || homeBannersConfig || awRecycleConfig"
class="publish-config-panel"
>
<div class="publish-config-main">
<div>
<p class="eyebrow">Home Content</p>
<h2>移动端首页运营配置</h2>
<span>管理首页公告滚动内容和顶部轮播图,保存后移动端会从接口读取最新配置。</span>
<h2>首页运营配置</h2>
<span>管理首页公告、轮播图与 AW炫彩回收入口展示图,保存后 PC/移动端从接口读取。</span>
</div>
<div class="panel-actions">
<el-button v-if="homeAnnouncementsConfig" @click="openEdit(homeAnnouncementsConfig)"
>编辑公告</el-button
>
<el-button v-if="homeBannersConfig" type="primary" @click="openEdit(homeBannersConfig)"
<el-button v-if="homeBannersConfig" @click="openEdit(homeBannersConfig)"
>编辑轮播图</el-button
>
<el-button v-if="awRecycleConfig" type="primary" @click="openEdit(awRecycleConfig)"
>编辑 AW炫彩回收</el-button
>
</div>
</div>
<div class="publish-stat-grid home-stat-grid">
@@ -504,17 +545,17 @@ function formatConfigValue(row: SystemConfig) {
<strong>{{ homeStats.bannerCount }}</strong>
<span>轮播图</span>
</div>
<div class="publish-stat">
<strong>{{ awRecycleStats.enabledLabel }}</strong>
<span>AW炫彩回收</span>
</div>
<div class="publish-stat">
<strong>接口</strong>
<span>/api/mobile-home-config</span>
</div>
<div class="publish-stat">
<strong>公告</strong>
<span>{{ formatHomeConfigStatus(homeAnnouncementsConfig, '未初始化') }}</span>
</div>
<div class="publish-stat">
<strong>轮播</strong>
<span>{{ formatHomeConfigStatus(homeBannersConfig, '未初始化') }}</span>
<strong>更新</strong>
<span>{{ formatHomeConfigStatus(awRecycleConfig || homeBannersConfig, '未初始化') }}</span>
</div>
</div>
</section>
@@ -767,6 +808,13 @@ function formatConfigValue(row: SystemConfig) {
@saved="loadConfigs"
/>
<AwRecycleDialog
v-if="awRecycleConfig"
v-model="awRecycleVisible"
:config="awRecycleConfig"
@saved="loadConfigs"
/>
<ListingPublishAgreementsDialog
v-if="listingPublishAgreementsConfig"
v-model="listingPublishAgreementsVisible"