- 后台全面引入 Naive UI 组件库,统一 UI 规范 - 前台 usePublicApi 切换到 API 调用(GET /api/content/[key]) - 前后台数据源统一(site_content 表) - 产品线统一管理(tour/camp/course 三套编辑器) - 产品数据归一化(itinerary/faq/pricing 格式统一) - 表单提交 API 改写入 submissions 表 - 新增 submissions 标记已读 API - site-content PUT 支持 upsert - 修复前台 bug(stories 路由冲突、占位符警告、selector breadcrumb) - 消除 PageHero 类型警告(useSEO reactive 修复) - 25 个前台页面全部 HTTP 200,展示效果不变 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 行
3.9 KiB
Vue
90 行
3.9 KiB
Vue
<template>
|
||
<div style="max-width: 900px;">
|
||
<NSpace justify="space-between" align="start" style="margin-bottom: 20px;">
|
||
<div>
|
||
<div style="font-size: 20px; font-weight: 600; color: #111827; margin-bottom: 4px;">产品选择器</div>
|
||
<div style="font-size: 13px; color: #9ca3af;">管理产品推荐问答和评分逻辑 · 对应官网「帮你选」功能</div>
|
||
</div>
|
||
<a href="/selector" target="_blank">
|
||
<NButton>查看前台</NButton>
|
||
</a>
|
||
</NSpace>
|
||
|
||
<NSpin :show="!loaded">
|
||
<template v-if="loaded">
|
||
<!-- 问题列表 -->
|
||
<div style="font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px;">
|
||
问题列表 ({{ data.questions?.length || 0 }})
|
||
</div>
|
||
<NSpace vertical :size="8" style="margin-bottom: 24px;">
|
||
<NuxtLink
|
||
v-for="(q, i) in data.questions"
|
||
:key="i"
|
||
:to="`/admin/content/selector/${i}`"
|
||
style="text-decoration: none; color: inherit; display: block;"
|
||
>
|
||
<NCard
|
||
size="small"
|
||
hoverable
|
||
style="cursor: pointer;"
|
||
:content-style="{ padding: '14px 20px' }"
|
||
>
|
||
<NSpace justify="space-between" align="center">
|
||
<NSpace align="center" :size="14">
|
||
<div style="width: 36px; height: 36px; background: #3a7d44; color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;">
|
||
Q{{ i + 1 }}
|
||
</div>
|
||
<div>
|
||
<div style="font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 2px;">{{ q.text }}</div>
|
||
<div style="font-size: 12px; color: #9ca3af;">{{ q.hint }}</div>
|
||
</div>
|
||
</NSpace>
|
||
<NSpace align="center" :size="8">
|
||
<NTag type="success" size="small">{{ q.options?.length || 0 }} 个选项</NTag>
|
||
<NTag v-if="q.condition" type="warning" size="small">条件显示</NTag>
|
||
<span style="font-size: 20px; color: #d1d5db;">›</span>
|
||
</NSpace>
|
||
</NSpace>
|
||
</NCard>
|
||
</NuxtLink>
|
||
</NSpace>
|
||
|
||
<!-- 评分矩阵 -->
|
||
<div style="font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px;">评分矩阵</div>
|
||
<NCard style="margin-bottom: 24px;" :content-style="{ padding: '20px' }">
|
||
<div style="font-size: 13px; color: #6b7280; margin-bottom: 12px;">每个问题的每个选项对应各产品的评分权重,用于计算最终推荐排名。</div>
|
||
<NuxtLink to="/admin/content/selector/scoring" style="color: #3a7d44; font-size: 14px; font-weight: 500; text-decoration: none;">
|
||
编辑评分矩阵 ›
|
||
</NuxtLink>
|
||
</NCard>
|
||
|
||
<!-- 推荐理由 -->
|
||
<div style="font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px;">推荐理由</div>
|
||
<NCard :content-style="{ padding: '20px' }">
|
||
<div style="font-size: 13px; color: #6b7280; margin-bottom: 12px;">每个产品在不同匹配情况下的推荐文案。</div>
|
||
<NuxtLink to="/admin/content/selector/reasons" style="color: #3a7d44; font-size: 14px; font-weight: 500; text-decoration: none;">
|
||
编辑推荐理由 ›
|
||
</NuxtLink>
|
||
</NCard>
|
||
</template>
|
||
</NSpin>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { NButton, NCard, NSpace, NTag, NSpin } from 'naive-ui'
|
||
|
||
definePageMeta({ layout: 'admin', middleware: 'admin' })
|
||
const { adminFetch } = useAdmin()
|
||
const data = ref({ questions: [] })
|
||
const loaded = ref(false)
|
||
|
||
onMounted(async () => {
|
||
try {
|
||
const r = await adminFetch('/api/admin/site-content?key=selector')
|
||
data.value = r.data
|
||
} catch {}
|
||
loaded.value = true
|
||
})
|
||
</script>
|