feat: 个人中心重设计 + 后台全量响应式适配
- 个人中心重设计:对齐站点黑白编辑风(极简资料区+细分隔线统计、下划线页签、 细边框卡片、克制危险区、收藏网格、评论列表),移除后台系组件与彩色渐变 - 后台响应式适配:表格页 md 以下卡片堆叠(md:hidden/hidden md:block 双模板)、 Dashboard 统计卡自适应、表单双语两列、AdminModal 移动端底部弹层、 触摸目标与间距统一,覆盖全部 9 个后台页 + 布局
This commit is contained in:
@@ -145,8 +145,8 @@ const formatDate = (raw?: string) => {
|
||||
<span v-if="keyword" class="text-sm text-gray-400">· 当前页匹配 {{ filteredLogs.length }} 条</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 flex flex-col sm:flex-row gap-3">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="mb-5 flex flex-col gap-3 md:flex-row">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -163,7 +163,7 @@ const formatDate = (raw?: string) => {
|
||||
<Icon name="ph:x" class="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
<AdminSelect v-model="actionFilter" :options="ACTION_OPTIONS" class="w-full sm:w-40" />
|
||||
<AdminSelect v-model="actionFilter" :options="ACTION_OPTIONS" class="w-full md:w-40" />
|
||||
</div>
|
||||
|
||||
<!-- 加载态 -->
|
||||
@@ -192,12 +192,13 @@ const formatDate = (raw?: string) => {
|
||||
|
||||
<!-- 日志表格 -->
|
||||
<template v-else>
|
||||
<div class="rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<!-- 桌面表格(md+) -->
|
||||
<div class="hidden md:block rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-100 bg-gray-50">
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap">时间</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap sticky left-0 bg-gray-50 z-10 border-r border-gray-100">时间</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap">操作人</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap">操作</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider">对象</th>
|
||||
@@ -206,7 +207,7 @@ const formatDate = (raw?: string) => {
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
<tr v-for="log in filteredLogs" :key="log.id" class="hover:bg-gray-50/60 transition-colors">
|
||||
<td class="px-5 py-4 text-gray-500 text-xs whitespace-nowrap">{{ formatDate(log.createdAt) }}</td>
|
||||
<td class="px-5 py-4 text-gray-500 text-xs whitespace-nowrap sticky left-0 bg-white z-10 border-r border-gray-100">{{ formatDate(log.createdAt) }}</td>
|
||||
<td class="px-5 py-4 text-gray-700 whitespace-nowrap">{{ log.actor_name || 'system' }}</td>
|
||||
<td class="px-5 py-4 whitespace-nowrap">
|
||||
<AdminBadge :tone="actionMeta(log.action).tone">{{ actionMeta(log.action).label }}</AdminBadge>
|
||||
@@ -223,6 +224,24 @@ const formatDate = (raw?: string) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 移动端卡片(<md) -->
|
||||
<div class="md:hidden space-y-3">
|
||||
<div v-for="log in filteredLogs" :key="log.id" class="bg-white rounded-2xl border border-gray-100 shadow-sm p-4">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<AdminBadge :tone="actionMeta(log.action).tone">{{ actionMeta(log.action).label }}</AdminBadge>
|
||||
<span class="text-xs text-gray-400 flex-shrink-0">{{ formatDate(log.createdAt) }}</span>
|
||||
</div>
|
||||
<div class="mt-2 flex items-center gap-2 text-sm">
|
||||
<span class="text-gray-400 flex-shrink-0">操作人</span>
|
||||
<span class="text-gray-700 truncate">{{ log.actor_name || 'system' }}</span>
|
||||
</div>
|
||||
<div class="mt-1.5">
|
||||
<code class="inline-block max-w-full text-xs text-gray-600 bg-gray-50 border border-gray-100 rounded px-2 py-1 break-all">{{ log.target }}</code>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-gray-600 break-words">{{ log.detail || '—' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<AdminPagination :total="total" :page="page" :page-size="pageSize" @page="changePage" />
|
||||
</div>
|
||||
|
||||
@@ -178,8 +178,8 @@ const formatDate = (raw?: string) => {
|
||||
<span v-if="selected.size" class="text-sm text-gray-400">· 已选 {{ selected.size }} 项</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 flex flex-wrap items-center gap-3">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="mb-5 flex flex-col gap-3 md:flex-row md:items-center">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -196,7 +196,7 @@ const formatDate = (raw?: string) => {
|
||||
<Icon name="ph:x" class="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
<AdminButton variant="danger" size="sm" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<AdminButton variant="danger" size="sm" class="w-full md:w-auto" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<Icon name="ph:trash" class="w-4 h-4" /> 批量删除
|
||||
</AdminButton>
|
||||
</div>
|
||||
@@ -227,12 +227,13 @@ const formatDate = (raw?: string) => {
|
||||
|
||||
<!-- 评论表格 -->
|
||||
<template v-else>
|
||||
<div class="rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<!-- 桌面表格(md+) -->
|
||||
<div class="hidden md:block rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-100 bg-gray-50">
|
||||
<th class="px-5 py-4 w-10">
|
||||
<th class="px-5 py-4 w-10 sticky left-0 bg-gray-50 z-10 border-r border-gray-100">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allChecked"
|
||||
@@ -254,7 +255,7 @@ const formatDate = (raw?: string) => {
|
||||
class="hover:bg-gray-50/60 transition-colors"
|
||||
:class="selected.has(c.id) ? 'bg-gray-50/70' : ''"
|
||||
>
|
||||
<td class="px-5 py-4">
|
||||
<td class="px-5 py-4 sticky left-0 bg-white z-10 border-r border-gray-100">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(c.id)"
|
||||
@@ -289,6 +290,41 @@ const formatDate = (raw?: string) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 移动端卡片(<md) -->
|
||||
<div class="md:hidden space-y-3">
|
||||
<div
|
||||
v-for="c in filteredComments"
|
||||
:key="c.id"
|
||||
class="bg-white rounded-2xl border border-gray-100 shadow-sm p-4"
|
||||
:class="selected.has(c.id) ? 'ring-2 ring-black/5 border-black/10' : ''"
|
||||
>
|
||||
<div class="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(c.id)"
|
||||
class="w-5 h-5 mt-0.5 rounded border-gray-300 accent-black cursor-pointer flex-shrink-0"
|
||||
@change="toggleOne(c.id)"
|
||||
/>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<NuxtLink
|
||||
:to="`/news/${c.newsSlug}`"
|
||||
class="inline-flex items-center gap-1.5 font-semibold text-black min-w-0"
|
||||
>
|
||||
<Icon name="ph:article" class="w-4 h-4 text-gray-400 flex-shrink-0" />
|
||||
<span class="truncate">#{{ c.newsSlug }}</span>
|
||||
</NuxtLink>
|
||||
<AdminButton size="sm" variant="ghost" class="min-h-10 shrink-0 -my-1" @click="askDelete(c)">
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</AdminButton>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-gray-400">作者:{{ c.username }} · {{ formatDate(c.createdAt) }}</p>
|
||||
<p class="mt-2 text-sm text-gray-700 break-words line-clamp-3">{{ c.content }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<AdminPagination :total="total" :page="page" :page-size="pageSize" @page="changePage" />
|
||||
</div>
|
||||
|
||||
@@ -208,8 +208,8 @@ const formatDate = (raw?: string) => {
|
||||
<span v-if="selected.size" class="text-sm text-gray-400">· 已选 {{ selected.size }} 项</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 flex flex-wrap items-center gap-3">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="mb-5 flex flex-col gap-3 md:flex-row md:items-center">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -233,9 +233,9 @@ const formatDate = (raw?: string) => {
|
||||
{ value: 'unread', label: '未读' },
|
||||
{ value: 'read', label: '已读' },
|
||||
]"
|
||||
class="w-full sm:w-36"
|
||||
class="w-full md:w-36"
|
||||
/>
|
||||
<AdminButton variant="danger" size="sm" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<AdminButton variant="danger" size="sm" class="w-full md:w-auto" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<Icon name="ph:trash" class="w-4 h-4" /> 批量删除
|
||||
</AdminButton>
|
||||
</div>
|
||||
@@ -270,58 +270,68 @@ const formatDate = (raw?: string) => {
|
||||
/>
|
||||
|
||||
<!-- 消息卡片列表 -->
|
||||
<div v-else class="space-y-4">
|
||||
<div v-else class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
<div
|
||||
v-for="c in pagedContacts"
|
||||
:key="c.id"
|
||||
class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 md:p-6 transition-shadow"
|
||||
class="bg-white rounded-2xl border border-gray-100 shadow-sm p-5 flex flex-col gap-3 transition-shadow"
|
||||
:class="[selected.has(c.id) ? 'ring-2 ring-black/5 border-black/10' : 'hover:shadow-md']"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div class="flex items-center gap-3 min-w-0">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(c.id)"
|
||||
class="w-4 h-4 rounded border-gray-300 accent-black cursor-pointer flex-shrink-0 mt-1"
|
||||
@change="toggleOne(c.id)"
|
||||
/>
|
||||
<div class="w-10 h-10 rounded-full bg-black text-white flex items-center justify-center font-bold flex-shrink-0">
|
||||
{{ (c.name || '?').charAt(0) }}
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<h3 class="font-bold text-black">{{ c.name }}</h3>
|
||||
<a :href="`mailto:${c.email}`" class="text-sm text-gray-500 hover:text-black transition-colors truncate">
|
||||
{{ c.email }}
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-xs text-gray-400 mt-1">{{ formatDate(c.createdAt) }}</p>
|
||||
</div>
|
||||
<div class="flex items-start gap-3 min-w-0">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(c.id)"
|
||||
class="w-5 h-5 rounded border-gray-300 accent-black cursor-pointer flex-shrink-0 mt-0.5"
|
||||
@change="toggleOne(c.id)"
|
||||
/>
|
||||
<div class="w-10 h-10 rounded-full bg-black text-white flex items-center justify-center font-bold flex-shrink-0">
|
||||
{{ (c.name || '?').charAt(0) }}
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-shrink-0">
|
||||
<AdminBadge :tone="Number(c.delivered) === 1 ? 'green' : 'amber'">
|
||||
<Icon :name="Number(c.delivered) === 1 ? 'ph:check' : 'ph:clock'" class="w-3.5 h-3.5" />
|
||||
{{ Number(c.delivered) === 1 ? '已送达' : '未送达' }}
|
||||
</AdminBadge>
|
||||
<AdminBadge :tone="Number(c.read) === 1 ? 'gray' : 'black'">
|
||||
<Icon :name="Number(c.read) === 1 ? 'ph:envelope-open' : 'ph:envelope-simple'" class="w-3.5 h-3.5" />
|
||||
{{ Number(c.read) === 1 ? '已读' : '未读' }}
|
||||
</AdminBadge>
|
||||
<AdminButton size="sm" variant="secondary" :loading="togglingId === c.id" @click="toggleRead(c)">
|
||||
{{ Number(c.read) === 1 ? '标为未读' : '标为已读' }}
|
||||
</AdminButton>
|
||||
<AdminButton size="sm" variant="ghost" @click="askDelete(c)">
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</AdminButton>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex flex-wrap items-center gap-x-2">
|
||||
<h3 class="font-bold text-black">{{ c.name }}</h3>
|
||||
<a :href="`mailto:${c.email}`" class="text-sm text-gray-500 hover:text-black transition-colors break-all">
|
||||
{{ c.email }}
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-xs text-gray-400 mt-1">{{ formatDate(c.createdAt) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 border-t border-gray-100 pt-4">
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<AdminBadge :tone="Number(c.delivered) === 1 ? 'green' : 'amber'">
|
||||
<Icon :name="Number(c.delivered) === 1 ? 'ph:check' : 'ph:clock'" class="w-3.5 h-3.5" />
|
||||
{{ Number(c.delivered) === 1 ? '已送达' : '未送达' }}
|
||||
</AdminBadge>
|
||||
<AdminBadge :tone="Number(c.read) === 1 ? 'gray' : 'black'">
|
||||
<Icon :name="Number(c.read) === 1 ? 'ph:envelope-open' : 'ph:envelope-simple'" class="w-3.5 h-3.5" />
|
||||
{{ Number(c.read) === 1 ? '已读' : '未读' }}
|
||||
</AdminBadge>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 border-t border-gray-100 pt-3">
|
||||
<p class="text-sm font-semibold text-gray-800">{{ c.subject }}</p>
|
||||
<p class="mt-1.5 text-sm text-gray-600 whitespace-pre-line break-words">{{ c.message }}</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-auto pt-3 border-t border-gray-100 flex flex-wrap items-center gap-2">
|
||||
<AdminButton
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
class="flex-1 min-w-0 min-h-10"
|
||||
:loading="togglingId === c.id"
|
||||
@click="toggleRead(c)"
|
||||
>
|
||||
<Icon :name="Number(c.read) === 1 ? 'ph:envelope-open' : 'ph:envelope-simple'" class="w-3.5 h-3.5" />
|
||||
{{ Number(c.read) === 1 ? '标为未读' : '标为已读' }}
|
||||
</AdminButton>
|
||||
<AdminButton size="sm" variant="ghost" class="min-h-10 shrink-0" @click="askDelete(c)">
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</AdminButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<div class="md:col-span-2 lg:col-span-3">
|
||||
<AdminPagination :total="filteredContacts.length" :page="page" :page-size="pageSize" @page="changePage" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -196,7 +196,7 @@ const initial = (name?: string) => (name || '?').charAt(0).toUpperCase()
|
||||
<AdminCard class="h-full transition-all duration-300 hover:-translate-y-0.5 hover:shadow-md">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-3xl font-bold text-black leading-none">{{ card.value }}</p>
|
||||
<p class="text-2xl sm:text-3xl font-bold text-black leading-none tabular-nums">{{ card.value }}</p>
|
||||
<p class="mt-2 text-sm font-semibold text-gray-800">{{ card.label }}</p>
|
||||
<p class="mt-1 text-xs text-gray-400">{{ card.sub }}</p>
|
||||
</div>
|
||||
@@ -300,11 +300,11 @@ const initial = (name?: string) => (name || '?').charAt(0).toUpperCase()
|
||||
</div>
|
||||
<div v-else class="flex items-center gap-4">
|
||||
<div class="flex-1">
|
||||
<p class="text-2xl font-bold text-black leading-none">{{ files.length }}</p>
|
||||
<p class="text-2xl font-bold text-black leading-none tabular-nums">{{ files.length }}</p>
|
||||
<p class="mt-1 text-xs text-gray-500">图片文件</p>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<p class="text-2xl font-bold text-black leading-none">{{ formatSize(storageTotalBytes) }}</p>
|
||||
<p class="text-2xl font-bold text-black leading-none tabular-nums">{{ formatSize(storageTotalBytes) }}</p>
|
||||
<p class="mt-1 text-xs text-gray-500">总大小</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+13
-11
@@ -271,7 +271,7 @@ const doDelete = async () => {
|
||||
<button
|
||||
v-if="keyword"
|
||||
@click="keyword = ''"
|
||||
class="absolute right-2.5 top-1/2 -translate-y-1/2 w-5 h-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 flex items-center justify-center"
|
||||
class="absolute right-2.5 top-1/2 -translate-y-1/2 w-6 h-6 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 flex items-center justify-center"
|
||||
aria-label="清空筛选"
|
||||
>
|
||||
<Icon name="ph:x" class="w-3.5 h-3.5" />
|
||||
@@ -366,10 +366,10 @@ const doDelete = async () => {
|
||||
</td>
|
||||
<td class="px-5 py-4">
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<AdminButton size="sm" variant="secondary" @click="openEdit(a)">
|
||||
<AdminButton size="sm" variant="secondary" class="min-h-10" @click="openEdit(a)">
|
||||
<Icon name="ph:pencil-simple" class="w-3.5 h-3.5" /> 编辑
|
||||
</AdminButton>
|
||||
<AdminButton size="sm" variant="danger" @click="askDelete(a)">
|
||||
<AdminButton size="sm" variant="danger" class="min-h-10" @click="askDelete(a)">
|
||||
<Icon name="ph:trash" class="w-3.5 h-3.5" /> 删除
|
||||
</AdminButton>
|
||||
</div>
|
||||
@@ -408,7 +408,7 @@ const doDelete = async () => {
|
||||
:options="CATEGORIES"
|
||||
/>
|
||||
<AdminInput v-model="form.date" type="date" label="发布日期" />
|
||||
<div class="grid grid-cols-2 gap-5">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-5">
|
||||
<AdminInput
|
||||
:model-value="String(form.readTime)"
|
||||
type="number"
|
||||
@@ -431,7 +431,7 @@ const doDelete = async () => {
|
||||
|
||||
<!-- 标题与摘要 -->
|
||||
<AdminCard title="标题与摘要">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div class="space-y-4">
|
||||
<AdminInput v-model="form.titleZh" label="中文标题" required />
|
||||
<AdminTextarea v-model="form.excerptZh" label="中文摘要" :rows="3" />
|
||||
@@ -457,12 +457,14 @@ const doDelete = async () => {
|
||||
</AdminCard>
|
||||
|
||||
<!-- 提交 -->
|
||||
<div class="flex items-center justify-end gap-3">
|
||||
<p v-if="formError" class="mr-auto text-sm text-red-600">{{ formError }}</p>
|
||||
<AdminButton variant="secondary" @click="backToList">取消</AdminButton>
|
||||
<AdminButton :loading="saving" @click="save">
|
||||
{{ saving ? '保存中…' : editingId != null ? '保存修改' : '创建动态' }}
|
||||
</AdminButton>
|
||||
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-end gap-3">
|
||||
<p v-if="formError" class="text-sm text-red-600 sm:mr-auto">{{ formError }}</p>
|
||||
<div class="flex items-center gap-3 w-full sm:w-auto sm:justify-end">
|
||||
<AdminButton class="flex-1 sm:flex-none" variant="secondary" @click="backToList">取消</AdminButton>
|
||||
<AdminButton class="flex-1 sm:flex-none" :loading="saving" @click="save">
|
||||
{{ saving ? '保存中…' : editingId != null ? '保存修改' : '创建动态' }}
|
||||
</AdminButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -175,8 +175,8 @@ const formatDate = (raw?: string) => {
|
||||
<span v-if="selected.size" class="text-sm text-gray-400">· 已选 {{ selected.size }} 项</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 flex flex-wrap items-center gap-3">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="mb-5 flex flex-col gap-3 md:flex-row md:items-center">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -193,7 +193,7 @@ const formatDate = (raw?: string) => {
|
||||
<Icon name="ph:x" class="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
<AdminButton variant="danger" size="sm" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<AdminButton variant="danger" size="sm" class="w-full md:w-auto" :disabled="!selected.size" @click="batchConfirmOpen = true">
|
||||
<Icon name="ph:trash" class="w-4 h-4" /> 批量删除
|
||||
</AdminButton>
|
||||
</div>
|
||||
@@ -224,12 +224,13 @@ const formatDate = (raw?: string) => {
|
||||
|
||||
<!-- 订阅表格 -->
|
||||
<template v-else>
|
||||
<div class="rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<!-- 桌面表格(md+) -->
|
||||
<div class="hidden md:block rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-100 bg-gray-50">
|
||||
<th class="px-5 py-4 w-10">
|
||||
<th class="px-5 py-4 w-10 sticky left-0 bg-gray-50 z-10 border-r border-gray-100">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allChecked"
|
||||
@@ -249,7 +250,7 @@ const formatDate = (raw?: string) => {
|
||||
class="hover:bg-gray-50/60 transition-colors"
|
||||
:class="selected.has(s.id) ? 'bg-gray-50/70' : ''"
|
||||
>
|
||||
<td class="px-5 py-4">
|
||||
<td class="px-5 py-4 sticky left-0 bg-white z-10 border-r border-gray-100">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(s.id)"
|
||||
@@ -280,6 +281,35 @@ const formatDate = (raw?: string) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 移动端卡片(<md) -->
|
||||
<div class="md:hidden space-y-3">
|
||||
<div
|
||||
v-for="s in pagedSubscribers"
|
||||
:key="s.id"
|
||||
class="bg-white rounded-2xl border border-gray-100 shadow-sm p-4"
|
||||
:class="selected.has(s.id) ? 'ring-2 ring-black/5 border-black/10' : ''"
|
||||
>
|
||||
<div class="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selected.has(s.id)"
|
||||
class="w-5 h-5 mt-0.5 rounded border-gray-300 accent-black cursor-pointer flex-shrink-0"
|
||||
@change="toggleOne(s.id)"
|
||||
/>
|
||||
<div class="min-w-0 flex-1">
|
||||
<a :href="`mailto:${s.email}`" class="inline-flex items-center gap-2 font-semibold text-black break-all">
|
||||
<Icon name="ph:envelope-simple" class="w-4 h-4 text-gray-400 flex-shrink-0" />
|
||||
{{ s.email }}
|
||||
</a>
|
||||
<p class="mt-1 text-xs text-gray-400">{{ formatDate(s.createdAt) }}</p>
|
||||
</div>
|
||||
<AdminButton size="sm" variant="ghost" class="min-h-10 shrink-0 -my-1" @click="askDelete(s)">
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</AdminButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<AdminPagination :total="filteredSubscribers.length" :page="page" :page-size="pageSize" @page="changePage" />
|
||||
</div>
|
||||
|
||||
@@ -136,7 +136,7 @@ const formatDate = (raw?: string) => {
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -181,7 +181,7 @@ const formatDate = (raw?: string) => {
|
||||
|
||||
<!-- 图片网格 -->
|
||||
<template v-else>
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4">
|
||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4">
|
||||
<div
|
||||
v-for="f in pagedFiles"
|
||||
:key="f.name"
|
||||
@@ -191,7 +191,7 @@ const formatDate = (raw?: string) => {
|
||||
<img :src="f.url" :alt="f.name" loading="lazy" class="w-full h-full object-cover" />
|
||||
<button
|
||||
@click="askDelete(f)"
|
||||
class="absolute top-2 right-2 w-8 h-8 rounded-full bg-black/60 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-600"
|
||||
class="absolute top-2 right-2 w-10 h-10 lg:w-8 lg:h-8 rounded-full bg-black/60 text-white flex items-center justify-center opacity-100 lg:opacity-0 lg:group-hover:opacity-100 transition-opacity hover:bg-red-600"
|
||||
title="删除图片"
|
||||
>
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
|
||||
@@ -152,8 +152,8 @@ const formatDate = (raw?: string) => {
|
||||
<span class="text-sm text-gray-400">· 管理员 {{ adminCount }} · 普通用户 {{ users.length - adminCount }}</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 flex flex-col sm:flex-row gap-3">
|
||||
<div class="relative flex-1 sm:max-w-xs">
|
||||
<div class="mb-5 flex flex-col gap-3 md:flex-row">
|
||||
<div class="relative flex-1 md:max-w-xs">
|
||||
<Icon name="ph:magnifying-glass" class="w-4 h-4 text-gray-400 absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
@@ -177,7 +177,7 @@ const formatDate = (raw?: string) => {
|
||||
{ value: 'admin', label: '管理员' },
|
||||
{ value: 'user', label: '普通用户' },
|
||||
]"
|
||||
class="w-full sm:w-40"
|
||||
class="w-full md:w-40"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -207,12 +207,13 @@ const formatDate = (raw?: string) => {
|
||||
|
||||
<!-- 用户表格 -->
|
||||
<template v-else>
|
||||
<div class="rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<!-- 桌面表格(md+) -->
|
||||
<div class="hidden md:block rounded-2xl border border-gray-100 bg-white shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead>
|
||||
<tr class="text-left text-gray-400 border-b border-gray-100 bg-gray-50">
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap">ID</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider whitespace-nowrap sticky left-0 bg-gray-50 z-10 border-r border-gray-100">ID</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider">用户名</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider">邮箱</th>
|
||||
<th class="px-5 py-4 font-semibold text-xs uppercase tracking-wider">手机号</th>
|
||||
@@ -223,7 +224,7 @@ const formatDate = (raw?: string) => {
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
<tr v-for="u in pagedUsers" :key="u.id" class="hover:bg-gray-50/60 transition-colors">
|
||||
<td class="px-5 py-4 text-gray-400 font-mono text-xs whitespace-nowrap">#{{ u.id }}</td>
|
||||
<td class="px-5 py-4 text-gray-400 font-mono text-xs whitespace-nowrap sticky left-0 bg-white z-10 border-r border-gray-100">#{{ u.id }}</td>
|
||||
<td class="px-5 py-4 font-semibold text-black whitespace-nowrap">{{ u.username }}</td>
|
||||
<td class="px-5 py-4 text-gray-600">{{ u.email || '—' }}</td>
|
||||
<td class="px-5 py-4 text-gray-600 whitespace-nowrap">{{ u.phone || '—' }}</td>
|
||||
@@ -258,6 +259,64 @@ const formatDate = (raw?: string) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 移动端卡片(<md) -->
|
||||
<div class="md:hidden space-y-3">
|
||||
<div
|
||||
v-for="u in pagedUsers"
|
||||
:key="u.id"
|
||||
class="bg-white rounded-2xl border border-gray-100 shadow-sm p-4"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-3 min-w-0">
|
||||
<div
|
||||
class="w-10 h-10 rounded-full bg-black text-white flex items-center justify-center font-bold flex-shrink-0"
|
||||
>
|
||||
{{ (u.username || '?').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<p class="font-semibold text-black truncate">{{ u.username }}</p>
|
||||
<p class="text-xs text-gray-400 font-mono">#{{ u.id }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<AdminBadge :tone="u.role === 'admin' ? 'black' : 'gray'" class="flex-shrink-0">
|
||||
<Icon v-if="u.role === 'admin'" name="ph:crown-simple" class="w-3 h-3" />
|
||||
{{ u.role === 'admin' ? '管理员' : '用户' }}
|
||||
</AdminBadge>
|
||||
</div>
|
||||
<dl class="mt-3 space-y-1.5 text-sm">
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt class="text-gray-400 flex-shrink-0">邮箱</dt>
|
||||
<dd class="text-gray-700 text-right break-all">{{ u.email || '—' }}</dd>
|
||||
</div>
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt class="text-gray-400 flex-shrink-0">手机号</dt>
|
||||
<dd class="text-gray-700 text-right">{{ u.phone || '—' }}</dd>
|
||||
</div>
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt class="text-gray-400 flex-shrink-0">注册时间</dt>
|
||||
<dd class="text-gray-700 text-right">{{ formatDate(u.createdAt) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div class="mt-4 flex flex-wrap items-center gap-2">
|
||||
<template v-if="u.id !== meId">
|
||||
<AdminButton
|
||||
size="sm"
|
||||
class="flex-1 min-h-10"
|
||||
:variant="u.role === 'admin' ? 'secondary' : 'primary'"
|
||||
:loading="togglingId === u.id"
|
||||
@click="toggleRole(u)"
|
||||
>
|
||||
{{ u.role === 'admin' ? '设为用户' : '设为管理员' }}
|
||||
</AdminButton>
|
||||
<AdminButton size="sm" variant="danger" class="min-h-10" @click="askDelete(u)">
|
||||
<Icon name="ph:trash" class="w-3.5 h-3.5" /> 删除
|
||||
</AdminButton>
|
||||
</template>
|
||||
<AdminBadge v-else tone="gray">当前账号</AdminBadge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<AdminPagination :total="filteredUsers.length" :page="page" :page-size="pageSize" @page="changePage" />
|
||||
</div>
|
||||
|
||||
+38
-34
@@ -339,7 +339,7 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
<button
|
||||
v-if="keyword"
|
||||
@click="keyword = ''"
|
||||
class="absolute right-2.5 top-1/2 -translate-y-1/2 w-5 h-5 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 flex items-center justify-center"
|
||||
class="absolute right-2.5 top-1/2 -translate-y-1/2 w-6 h-6 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 flex items-center justify-center"
|
||||
aria-label="清空筛选"
|
||||
>
|
||||
<Icon name="ph:x" class="w-3.5 h-3.5" />
|
||||
@@ -458,10 +458,10 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
</td>
|
||||
<td class="px-5 py-4">
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<AdminButton size="sm" variant="secondary" @click="openEdit(w)">
|
||||
<AdminButton size="sm" variant="secondary" class="min-h-10" @click="openEdit(w)">
|
||||
<Icon name="ph:pencil-simple" class="w-3.5 h-3.5" /> 编辑
|
||||
</AdminButton>
|
||||
<AdminButton size="sm" variant="danger" @click="askDelete(w)">
|
||||
<AdminButton size="sm" variant="danger" class="min-h-10" @click="askDelete(w)">
|
||||
<Icon name="ph:trash" class="w-3.5 h-3.5" /> 删除
|
||||
</AdminButton>
|
||||
</div>
|
||||
@@ -518,7 +518,7 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
|
||||
<!-- 标题与简介 -->
|
||||
<AdminCard title="标题与简介">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div class="space-y-4">
|
||||
<AdminInput v-model="form.titleZh" label="中文标题" required />
|
||||
<AdminTextarea v-model="form.descriptionZh" label="中文简介" :rows="3" />
|
||||
@@ -533,7 +533,7 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
<!-- 项目详情(中英) -->
|
||||
<AdminCard title="项目详情(中英各一组)">
|
||||
<div class="space-y-6">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div class="space-y-4">
|
||||
<AdminTextarea v-model="form.overviewZh" label="中文概述(Overview)" :rows="4" />
|
||||
<AdminTextarea v-model="form.challengeZh" label="中文挑战(Challenge)" :rows="3" />
|
||||
@@ -546,7 +546,7 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<AdminInput v-model="form.clientZh" label="中文客户(Client)" />
|
||||
<AdminInput v-model="form.clientEn" label="English Client" />
|
||||
<AdminInput v-model="form.durationZh" label="中文周期(Duration)" placeholder="如 3 个月" />
|
||||
@@ -572,39 +572,41 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
<div
|
||||
v-for="(url, i) in form.gallery"
|
||||
:key="i"
|
||||
class="flex items-center gap-3 border border-gray-200 rounded-xl bg-white p-3"
|
||||
class="flex flex-col sm:flex-row sm:items-center gap-3 border border-gray-200 rounded-xl bg-white p-3"
|
||||
>
|
||||
<div class="flex-1 min-w-0">
|
||||
<input
|
||||
v-model="form.gallery[i]"
|
||||
type="text"
|
||||
placeholder="图片 URL(本地 /uploads/... 或 https://...)"
|
||||
class="w-full px-3 py-2 rounded-lg border border-gray-200 bg-gray-50 text-sm outline-none transition-all focus:border-black focus:bg-white"
|
||||
class="w-full px-3 py-2.5 rounded-lg border border-gray-200 bg-gray-50 text-sm outline-none transition-all focus:border-black focus:bg-white"
|
||||
/>
|
||||
<div v-if="url" class="mt-2">
|
||||
<img :src="url" alt="图集预览" class="h-24 w-auto max-w-full rounded-lg border border-gray-100 object-cover" />
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="galleryUploading && uploadingIndex === i"
|
||||
@click="pickGalleryFile(i)"
|
||||
class="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-black text-white text-xs font-semibold hover:bg-gray-800 transition-colors disabled:opacity-60 flex-shrink-0"
|
||||
>
|
||||
<Icon
|
||||
:name="galleryUploading && uploadingIndex === i ? 'ph:circle-notch' : 'ph:upload-simple'"
|
||||
:class="galleryUploading && uploadingIndex === i ? 'w-3.5 h-3.5 animate-spin' : 'w-3.5 h-3.5'"
|
||||
/>
|
||||
{{ galleryUploading && uploadingIndex === i ? '上传中…' : '上传' }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="removeGalleryRow(i)"
|
||||
class="w-8 h-8 rounded-lg hover:bg-red-50 text-gray-400 hover:text-red-600 flex items-center justify-center transition-colors flex-shrink-0"
|
||||
aria-label="删除该图"
|
||||
>
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</button>
|
||||
<div class="flex items-center gap-2 sm:flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="galleryUploading && uploadingIndex === i"
|
||||
@click="pickGalleryFile(i)"
|
||||
class="flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2.5 min-h-10 rounded-lg bg-black text-white text-xs font-semibold hover:bg-gray-800 transition-colors disabled:opacity-60"
|
||||
>
|
||||
<Icon
|
||||
:name="galleryUploading && uploadingIndex === i ? 'ph:circle-notch' : 'ph:upload-simple'"
|
||||
:class="galleryUploading && uploadingIndex === i ? 'w-3.5 h-3.5 animate-spin' : 'w-3.5 h-3.5'"
|
||||
/>
|
||||
{{ galleryUploading && uploadingIndex === i ? '上传中…' : '上传' }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="removeGalleryRow(i)"
|
||||
class="w-10 h-10 rounded-lg hover:bg-red-50 text-gray-400 hover:text-red-600 flex items-center justify-center transition-colors flex-shrink-0"
|
||||
aria-label="删除该图"
|
||||
>
|
||||
<Icon name="ph:trash" class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="galleryError" class="text-xs text-red-600">{{ galleryError }}</p>
|
||||
</div>
|
||||
@@ -613,12 +615,14 @@ const removeGalleryRow = (i: number) => form.gallery.splice(i, 1)
|
||||
</AdminCard>
|
||||
|
||||
<!-- 提交 -->
|
||||
<div class="flex items-center justify-end gap-3">
|
||||
<p v-if="formError" class="mr-auto text-sm text-red-600">{{ formError }}</p>
|
||||
<AdminButton variant="secondary" @click="backToList">取消</AdminButton>
|
||||
<AdminButton :loading="saving" @click="save">
|
||||
{{ saving ? '保存中…' : editingId != null ? '保存修改' : '创建作品' }}
|
||||
</AdminButton>
|
||||
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-end gap-3">
|
||||
<p v-if="formError" class="text-sm text-red-600 sm:mr-auto">{{ formError }}</p>
|
||||
<div class="flex items-center gap-3 w-full sm:w-auto sm:justify-end">
|
||||
<AdminButton class="flex-1 sm:flex-none" variant="secondary" @click="backToList">取消</AdminButton>
|
||||
<AdminButton class="flex-1 sm:flex-none" :loading="saving" @click="save">
|
||||
{{ saving ? '保存中…' : editingId != null ? '保存修改' : '创建作品' }}
|
||||
</AdminButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user