feat: 个人中心重设计 + 后台全量响应式适配
- 个人中心重设计:对齐站点黑白编辑风(极简资料区+细分隔线统计、下划线页签、 细边框卡片、克制危险区、收藏网格、评论列表),移除后台系组件与彩色渐变 - 后台响应式适配:表格页 md 以下卡片堆叠(md:hidden/hidden md:block 双模板)、 Dashboard 统计卡自适应、表单双语两列、AdminModal 移动端底部弹层、 触摸目标与间距统一,覆盖全部 9 个后台页 + 布局
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user