新增合作与反馈入口配置
This commit is contained in:
@@ -29,7 +29,12 @@ 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 {
|
||||
defaultAWRecycleConfig,
|
||||
defaultCooperationFeedbackConfig,
|
||||
type AWRecycleConfig,
|
||||
type CooperationFeedbackConfig,
|
||||
} from '@/features/listings/api/homeConfig'
|
||||
import ListingPublishAgreementsDialog from '../components/ListingPublishAgreementsDialog.vue'
|
||||
import OrderAgreementsDialog from '../components/OrderAgreementsDialog.vue'
|
||||
import PostRentalNoticeDialog from '../components/PostRentalNoticeDialog.vue'
|
||||
@@ -75,6 +80,7 @@ const salePriceVisible = ref(false)
|
||||
const announcementsVisible = ref(false)
|
||||
const bannersVisible = ref(false)
|
||||
const awRecycleVisible = ref(false)
|
||||
const cooperationFeedbackVisible = ref(false)
|
||||
const listingPublishAgreementsVisible = ref(false)
|
||||
const agreementsVisible = ref(false)
|
||||
const postRentalNoticeVisible = ref(false)
|
||||
@@ -102,6 +108,9 @@ const homeBannersConfig = computed(
|
||||
const awRecycleConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'mobile.aw_recycle') || null
|
||||
)
|
||||
const cooperationFeedbackConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'mobile.cooperation_feedback') || null
|
||||
)
|
||||
const listingPublishAgreementsConfig = computed(
|
||||
() => configs.value.find(item => item.key === 'listing.publish_agreements') || null
|
||||
)
|
||||
@@ -148,6 +157,7 @@ const regularConfigs = computed(() =>
|
||||
item.key !== 'mobile.home_announcements' &&
|
||||
item.key !== 'mobile.home_banners' &&
|
||||
item.key !== 'mobile.aw_recycle' &&
|
||||
item.key !== 'mobile.cooperation_feedback' &&
|
||||
item.key !== 'listing.publish_agreements' &&
|
||||
item.key !== 'order.agreements' &&
|
||||
item.key !== 'profile.post_rental_notice' &&
|
||||
@@ -201,6 +211,13 @@ const awRecycleStats = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const cooperationFeedbackStats = computed(() => {
|
||||
const item = parseCooperationFeedback(cooperationFeedbackConfig.value?.value || '')
|
||||
return {
|
||||
enabledLabel: item.enabled ? (item.image_url ? '已配置图' : '已开启') : '已隐藏',
|
||||
}
|
||||
})
|
||||
|
||||
const renterGrowthStats = computed(() => {
|
||||
const config = parseRenterGrowthConfig(renterGrowthConfig.value?.value || '')
|
||||
return {
|
||||
@@ -268,6 +285,8 @@ function openEdit(row: SystemConfig) {
|
||||
bannersVisible.value = true
|
||||
} else if (row.key === 'mobile.aw_recycle') {
|
||||
awRecycleVisible.value = true
|
||||
} else if (row.key === 'mobile.cooperation_feedback') {
|
||||
cooperationFeedbackVisible.value = true
|
||||
} else if (row.key === 'listing.publish_agreements') {
|
||||
listingPublishAgreementsVisible.value = true
|
||||
} else if (row.key === 'order.agreements') {
|
||||
@@ -319,6 +338,25 @@ function parseAWRecycle(raw: string): AWRecycleConfig {
|
||||
}
|
||||
}
|
||||
|
||||
function parseCooperationFeedback(raw: string): CooperationFeedbackConfig {
|
||||
const parsed = safeParseJSON(raw, defaultCooperationFeedbackConfig)
|
||||
return {
|
||||
title:
|
||||
typeof parsed.title === 'string' && parsed.title.trim()
|
||||
? parsed.title.trim()
|
||||
: defaultCooperationFeedbackConfig.title,
|
||||
subtitle:
|
||||
typeof parsed.subtitle === 'string' && parsed.subtitle.trim()
|
||||
? parsed.subtitle.trim()
|
||||
: defaultCooperationFeedbackConfig.subtitle,
|
||||
image_url: typeof parsed.image_url === 'string' ? parsed.image_url.trim() : '',
|
||||
enabled:
|
||||
typeof parsed.enabled === 'boolean'
|
||||
? parsed.enabled
|
||||
: defaultCooperationFeedbackConfig.enabled,
|
||||
}
|
||||
}
|
||||
|
||||
function parseOrderAgreements(raw: string) {
|
||||
const parsed = safeParseJSON(raw, defaultOrderAgreements)
|
||||
return {
|
||||
@@ -555,14 +593,19 @@ function formatConfigValue(row: SystemConfig) {
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="homeAnnouncementsConfig || homeBannersConfig || awRecycleConfig"
|
||||
v-if="
|
||||
homeAnnouncementsConfig || homeBannersConfig || awRecycleConfig || cooperationFeedbackConfig
|
||||
"
|
||||
class="publish-config-panel"
|
||||
>
|
||||
<div class="publish-config-main">
|
||||
<div>
|
||||
<p class="eyebrow">Home Content</p>
|
||||
<h2>首页运营配置</h2>
|
||||
<span>管理首页公告、轮播图与 AW炫彩回收入口展示图,保存后 PC/移动端从接口读取。</span>
|
||||
<span
|
||||
>管理首页公告、轮播图、AW炫彩回收与合作反馈入口展示图,保存后
|
||||
PC/移动端从接口读取。</span
|
||||
>
|
||||
</div>
|
||||
<div class="panel-actions">
|
||||
<el-button v-if="homeAnnouncementsConfig" @click="openEdit(homeAnnouncementsConfig)"
|
||||
@@ -574,6 +617,12 @@ function formatConfigValue(row: SystemConfig) {
|
||||
<el-button v-if="awRecycleConfig" type="primary" @click="openEdit(awRecycleConfig)"
|
||||
>编辑 AW炫彩回收</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="cooperationFeedbackConfig"
|
||||
type="primary"
|
||||
@click="openEdit(cooperationFeedbackConfig)"
|
||||
>编辑 合作与反馈</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="publish-stat-grid home-stat-grid">
|
||||
@@ -589,6 +638,10 @@ function formatConfigValue(row: SystemConfig) {
|
||||
<strong>{{ awRecycleStats.enabledLabel }}</strong>
|
||||
<span>AW炫彩回收</span>
|
||||
</div>
|
||||
<div class="publish-stat">
|
||||
<strong>{{ cooperationFeedbackStats.enabledLabel }}</strong>
|
||||
<span>合作与反馈</span>
|
||||
</div>
|
||||
<div class="publish-stat">
|
||||
<strong>接口</strong>
|
||||
<span>/api/mobile-home-config</span>
|
||||
@@ -596,7 +649,10 @@ function formatConfigValue(row: SystemConfig) {
|
||||
<div class="publish-stat">
|
||||
<strong>更新</strong>
|
||||
<span>{{
|
||||
formatHomeConfigStatus(awRecycleConfig || homeBannersConfig, '未初始化')
|
||||
formatHomeConfigStatus(
|
||||
cooperationFeedbackConfig || awRecycleConfig || homeBannersConfig,
|
||||
'未初始化'
|
||||
)
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -854,6 +910,21 @@ function formatConfigValue(row: SystemConfig) {
|
||||
v-if="awRecycleConfig"
|
||||
v-model="awRecycleVisible"
|
||||
:config="awRecycleConfig"
|
||||
:defaults="defaultAWRecycleConfig"
|
||||
dialog-title="编辑 AW炫彩回收"
|
||||
upload-scene="aw-recycle"
|
||||
image-hint="走后台通用上传(scene=aw-recycle,公开可访问)。首页点击入口后展示此图,建议竖图或说明海报。"
|
||||
@saved="loadConfigs"
|
||||
/>
|
||||
|
||||
<AwRecycleDialog
|
||||
v-if="cooperationFeedbackConfig"
|
||||
v-model="cooperationFeedbackVisible"
|
||||
:config="cooperationFeedbackConfig"
|
||||
:defaults="defaultCooperationFeedbackConfig"
|
||||
dialog-title="编辑 合作与反馈"
|
||||
upload-scene="cooperation-feedback"
|
||||
image-hint="走后台通用上传(scene=cooperation-feedback,公开可访问)。首页点击入口后展示此图,建议上传合作或反馈联系方式海报。"
|
||||
@saved="loadConfigs"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user