feat: 后台管理系统完整重构 + 前后台数据联通
- 后台全面引入 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>
这个提交包含在:
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div style="min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f0f2f5;">
|
||||
<n-config-provider :theme-overrides="themeOverrides">
|
||||
<n-card style="width: 380px" :bordered="false" size="large">
|
||||
<h1 style="text-align: center; margin: 0 0 30px; font-size: 22px; color: #111827">呼籁后台管理</h1>
|
||||
<n-form @submit.prevent="handleLogin">
|
||||
<n-form-item label="用户名">
|
||||
<n-input v-model:value="username" placeholder="请输入用户名" autofocus />
|
||||
</n-form-item>
|
||||
<n-form-item label="密码">
|
||||
<n-input v-model:value="password" type="password" show-password-on="click" placeholder="请输入密码" @keyup.enter="handleLogin" />
|
||||
</n-form-item>
|
||||
<n-alert v-if="error" type="error" style="margin-bottom: 16px">{{ error }}</n-alert>
|
||||
<n-button type="primary" block :loading="loading" @click="handleLogin">登录</n-button>
|
||||
</n-form>
|
||||
</n-card>
|
||||
</n-config-provider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { NConfigProvider, NCard, NForm, NFormItem, NInput, NButton, NAlert } from 'naive-ui'
|
||||
|
||||
definePageMeta({ layout: false })
|
||||
|
||||
const { login, isLoggedIn } = useAdmin()
|
||||
|
||||
if (isLoggedIn.value) {
|
||||
navigateTo('/admin')
|
||||
}
|
||||
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
const error = ref('')
|
||||
const loading = ref(false)
|
||||
|
||||
const themeOverrides = {
|
||||
common: {
|
||||
primaryColor: '#3a7d44',
|
||||
primaryColorHover: '#2d6235',
|
||||
primaryColorPressed: '#245c2b',
|
||||
primaryColorSuppl: '#3a7d44',
|
||||
},
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
error.value = ''
|
||||
loading.value = true
|
||||
try {
|
||||
await login(username.value, password.value)
|
||||
navigateTo('/admin')
|
||||
} catch (e) {
|
||||
error.value = e.data?.message || '登录失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户