diff --git a/src/views/miniapp/CarouselManage.vue b/src/views/miniapp/CarouselManage.vue index ad1797c..4bd22a9 100644 --- a/src/views/miniapp/CarouselManage.vue +++ b/src/views/miniapp/CarouselManage.vue @@ -12,10 +12,14 @@

轮播图与公告管理

- +
+

+ UFO 点单端:主轮播选「点单页主轮播」;公告下第二横幅选「点单页第二横幅(可多图)」; + 「我的」顶区背景选「点单个人中心背景(可多图)」。改图前请切到具体俱乐部(如 ufo),勿在集团视图下上传。 +

@@ -104,17 +108,43 @@ import request from '@/utils/request' import { JITUAN_API } from '@/utils/club-context' import ClubScopeHint from '@/components/ClubScopeHint.vue' +/** 本地兜底:即使接口 page_options 仍是旧列表,也要保证 UFO 两项可选 */ +const DEFAULT_PAGE_OPTIONS = [ + { key: 'order_pool', label: '抢单池' }, + { key: 'accept_order', label: '点单页主轮播' }, + { key: 'accept_order_banner2', label: '点单页第二横幅(可多图)' }, + { key: 'merchant_home', label: '商家首页' }, + { key: 'dashou_center', label: '打手个人中心背景' }, + { key: 'boss_center', label: '点单个人中心背景(可多图)' }, +] + +function mergePageOptions(fromServer) { + const map = new Map() + DEFAULT_PAGE_OPTIONS.forEach((o) => map.set(o.key, { ...o })) + ;(fromServer || []).forEach((o) => { + if (!o || !o.key) return + const prev = map.get(o.key) + map.set(o.key, { + key: o.key, + label: (prev && prev.label) || o.label || o.key, + }) + }) + // 固定顺序:默认项在前,其余追加 + const ordered = [] + DEFAULT_PAGE_OPTIONS.forEach((o) => { + if (map.has(o.key)) { + ordered.push(map.get(o.key)) + map.delete(o.key) + } + }) + map.forEach((v) => ordered.push(v)) + return ordered +} + const username = ref(localStorage.getItem('username') || '') const hasPermission = ref(true) const pageKey = ref('order_pool') -const pageOptions = ref([ - { key: 'order_pool', label: '抢单池' }, - { key: 'accept_order', label: '点单页主轮播' }, - { key: 'accept_order_banner2', label: '点单页横幅轮播' }, - { key: 'merchant_home', label: '商家首页' }, - { key: 'dashou_center', label: '打手个人中心背景' }, - { key: 'boss_center', label: '点单个人中心背景' }, -]) +const pageOptions = ref(mergePageOptions([])) const gonggaoTitle = computed(() => { const opt = pageOptions.value.find((o) => o.key === pageKey.value) const label = opt ? opt.label : pageKey.value @@ -167,17 +197,7 @@ const fetchLunbo = async () => { }) if (res.code === 0) { lunboList.value = res.data?.list || [] - pageOptions.value = res.data?.page_options || [] - if (!pageOptions.value.length) { - pageOptions.value = [ - { key: 'order_pool', label: '抢单池' }, - { key: 'accept_order', label: '点单页主轮播' }, - { key: 'accept_order_banner2', label: '点单页横幅轮播' }, - { key: 'merchant_home', label: '商家首页' }, - { key: 'dashou_center', label: '打手个人中心背景' }, - { key: 'boss_center', label: '点单个人中心背景' }, - ] - } + pageOptions.value = mergePageOptions(res.data?.page_options) } else if (res.code === 403) { hasPermission.value = false } else { @@ -354,6 +374,16 @@ onMounted(async () => { color: #909399; font-size: 13px; } +.page-hint { + margin: -8px 0 16px; + padding: 10px 14px; + background: #ecf5ff; + border: 1px solid #d9ecff; + border-radius: 6px; + color: #409eff; + font-size: 13px; + line-height: 1.55; +} .header-bar { display: flex; justify-content: space-between;