新增合作与反馈入口配置

This commit is contained in:
yml2213
2026-08-15 16:37:30 +08:00
parent 134d6fa05e
commit d9f552577a
14 changed files with 332 additions and 36 deletions
@@ -15,10 +15,12 @@ import {
} from '@/features/listings/api/listings'
import {
defaultAWRecycleConfig,
defaultCooperationFeedbackConfig,
defaultHomeAnnouncements,
defaultHomeBanners,
fetchMobileHomeConfig,
type AWRecycleConfig,
type CooperationFeedbackConfig,
type HomeBannerSlide,
} from '@/features/listings/api/homeConfig'
import { showImagePreview, showToast } from 'vant'
@@ -81,6 +83,8 @@ const announcements = ref<string[]>(defaultHomeAnnouncements)
const bannerSlides = ref<HomeBannerSlide[]>(defaultHomeBanners)
const awRecycle = ref<AWRecycleConfig>({ ...defaultAWRecycleConfig })
const awRecyclePreviewVisible = ref(false)
const cooperationFeedback = ref<CooperationFeedbackConfig>({ ...defaultCooperationFeedbackConfig })
const cooperationFeedbackPreviewVisible = ref(false)
const supportLoading = ref(false)
const showBackTop = ref(false)
const mobilePageSize = 10
@@ -463,6 +467,7 @@ async function loadHomeConfig() {
announcements.value = config.announcements
bannerSlides.value = config.banners
awRecycle.value = config.aw_recycle
cooperationFeedback.value = config.cooperation_feedback
publishOptions.value = config.publish_options
homeCache.saveHomeConfig({
announcements: config.announcements,
@@ -473,6 +478,7 @@ async function loadHomeConfig() {
announcements.value = defaultHomeAnnouncements
bannerSlides.value = defaultHomeBanners
awRecycle.value = { ...defaultAWRecycleConfig }
cooperationFeedback.value = { ...defaultCooperationFeedbackConfig }
publishOptions.value = emptyListingPublishOptions
}
}
@@ -485,6 +491,14 @@ function openAWRecycle() {
awRecyclePreviewVisible.value = true
}
function openCooperationFeedback() {
if (!cooperationFeedback.value.image_url) {
showToast({ message: '合作与反馈图片尚未配置', icon: 'warning-o' })
return
}
cooperationFeedbackPreviewVisible.value = true
}
function openBannerPreview(slide: HomeBannerSlide) {
const url = slide.image_url?.trim()
if (!url) return
@@ -512,6 +526,7 @@ async function onRefresh() {
announcements.value = nextHomeConfig.announcements
bannerSlides.value = nextHomeConfig.banners
awRecycle.value = nextHomeConfig.aw_recycle
cooperationFeedback.value = nextHomeConfig.cooperation_feedback
publishOptions.value = nextHomeConfig.publish_options
homeCache.saveHomeConfig({
announcements: nextHomeConfig.announcements,
@@ -894,6 +909,15 @@ syncMobileHomeQuery()
<strong>{{ awRecycle.title }}</strong>
<small>{{ awRecycle.subtitle }}</small>
</button>
<button
v-if="cooperationFeedback.enabled"
type="button"
class="biz-entry cooperation-feedback"
@click="openCooperationFeedback"
>
<strong>{{ cooperationFeedback.title }}</strong>
<small>{{ cooperationFeedback.subtitle }}</small>
</button>
</div>
<div class="zone-strip" aria-label="账号专区">
@@ -1111,6 +1135,32 @@ syncMobileHomeQuery()
</div>
</van-popup>
<van-popup
v-model:show="cooperationFeedbackPreviewVisible"
position="center"
round
closeable
teleport="body"
class="aw-recycle-popup"
:style="{ width: 'min(92vw, 420px)', maxHeight: '86vh' }"
>
<div class="aw-recycle-preview">
<header class="aw-recycle-preview-head">
<h3>{{ cooperationFeedback.title }}</h3>
</header>
<div class="aw-recycle-preview-body">
<AuthImage
v-if="cooperationFeedback.image_url"
:source="cooperationFeedback.image_url"
:alt="cooperationFeedback.title"
fit="contain"
image-class="aw-recycle-preview-img"
/>
<van-empty v-else description="暂无展示图片" />
</div>
</div>
</van-popup>
<MobileBottomNav />
</main>
</template>