feat: 后台管理系统(Admin Backend + 全量 CMS)
- 内容迁入数据库:articles/works 表(中英双语 + 内容块), server/utils/seed.ts 灌入现有 6 动态 + 6 作品,站点初始内容不变 - 前台内容 API:/api/news、/api/work(列表/详情,仅已发布), 页面/首页组件改为 useFetch 拉取并按 locale 选 zh/en 字段 - 后台管理 /admin(admin 中间件守卫): - Dashboard 统计、动态/作品增删改(块编辑器、图片上传 /api/admin/upload) - 用户管理(角色切换/删除)、评论审核、联系/订阅管理(导出 CSV) - 预置管理员:NUXT_ADMIN_INITIAL_PASSWORD 首次初始化创建 admin 账号 - 图片自托管:上传存 PVC /data/uploads,/uploads/[...] 路由服务 - sitemap 改查 DB;i18n 移除内容键(305 键对齐);删除 app/data 冗余模块 - 角色以数据库为准(后台可切换);admin 中间件 + 客户端会话恢复插件
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 后台通用确认弹窗(删除等危险操作)。
|
||||
* 通过 Teleport 渲染到 body,支持危险色与加载态。
|
||||
*/
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
open: boolean
|
||||
title?: string
|
||||
message?: string
|
||||
confirmText?: string
|
||||
danger?: boolean
|
||||
loading?: boolean
|
||||
}>(),
|
||||
{
|
||||
title: '确认操作',
|
||||
message: '确定要执行该操作吗?',
|
||||
confirmText: '确认',
|
||||
danger: true,
|
||||
loading: false,
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{ confirm: []; cancel: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="confirm-fade">
|
||||
<div v-if="open" class="fixed inset-0 z-[100] flex items-center justify-center p-4">
|
||||
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="emit('cancel')"></div>
|
||||
<div class="relative w-full max-w-sm bg-white rounded-2xl shadow-2xl p-6">
|
||||
<div class="flex items-start gap-4">
|
||||
<div
|
||||
class="w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0"
|
||||
:class="danger ? 'bg-red-50 text-red-600' : 'bg-gray-100 text-gray-600'"
|
||||
>
|
||||
<Icon name="ph:warning-circle" class="w-5 h-5" />
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-lg font-bold text-black">{{ title }}</h3>
|
||||
<p class="mt-1 text-sm text-gray-600 break-words">{{ message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-6 flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
@click="emit('cancel')"
|
||||
class="px-4 py-2 rounded-lg border border-gray-200 text-sm font-semibold text-gray-700 hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="loading"
|
||||
@click="emit('confirm')"
|
||||
class="px-4 py-2 rounded-lg text-sm font-semibold text-white flex items-center gap-2 transition-colors disabled:opacity-50"
|
||||
:class="danger ? 'bg-red-600 hover:bg-red-700' : 'bg-black hover:bg-gray-800'"
|
||||
>
|
||||
<Icon v-if="loading" name="ph:circle-notch" class="w-4 h-4 animate-spin" />
|
||||
{{ confirmText }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.confirm-fade-enter-active,
|
||||
.confirm-fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
.confirm-fade-enter-active .relative,
|
||||
.confirm-fade-leave-active .relative {
|
||||
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||
}
|
||||
.confirm-fade-enter-from,
|
||||
.confirm-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
.confirm-fade-enter-from .relative,
|
||||
.confirm-fade-leave-to .relative {
|
||||
transform: translateY(8px) scale(0.98);
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user