users.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>用户管理 - TG Admin</title>
  7. <script src="https://cdn.tailwindcss.com"></script>
  8. <script>
  9. tailwind.config = {
  10. theme: {
  11. extend: {
  12. fontFamily: { sans: ['Inter', 'system-ui', 'sans-serif'] },
  13. colors: { brand: { DEFAULT: '#000000', hover: '#1a1a1a' } }
  14. }
  15. }
  16. }
  17. </script>
  18. <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
  19. <style>
  20. body { font-family: 'Inter', system-ui, sans-serif; }
  21. .nav-item { @apply flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white hover:bg-white/5 transition-colors cursor-pointer; }
  22. .nav-item.active { @apply text-white bg-white/10; }
  23. .card { @apply bg-white border border-gray-200 p-6; }
  24. .btn-primary { @apply py-3.5 bg-black hover:bg-gray-900 text-white font-semibold rounded-none transition-colors cursor-pointer; }
  25. .btn-secondary { @apply py-3 border border-gray-200 hover:border-black hover:bg-gray-50 text-black font-medium rounded-none transition-colors cursor-pointer; }
  26. .input-box { @apply w-full px-4 py-3 bg-gray-50 border border-gray-200 text-black placeholder-gray-400 focus:outline-none focus:border-black focus:bg-white transition-colors; }
  27. .badge { @apply inline-flex items-center px-2.5 py-0.5 text-xs font-medium; }
  28. .badge-success { @apply bg-green-100 text-green-800; }
  29. .badge-danger { @apply bg-red-100 text-red-800; }
  30. .table-header { @apply text-left text-xs font-semibold text-gray-500 uppercase tracking-wider; }
  31. .table-cell { @apply py-4 text-sm text-gray-900; }
  32. .table-row { @apply border-b border-gray-100 hover:bg-gray-50 transition-colors; }
  33. </style>
  34. </head>
  35. <body class="min-h-screen bg-gray-50">
  36. <div class="flex min-h-screen">
  37. <!-- Sidebar Overlay (Mobile) -->
  38. <div id="sidebar-overlay" class="fixed inset-0 bg-black/50 z-40 lg:hidden hidden"></div>
  39. <!-- Sidebar -->
  40. <aside id="sidebar" class="fixed lg:static inset-y-0 left-0 z-50 w-64 bg-gradient-to-b from-gray-900 via-gray-900 to-black transform -translate-x-full lg:translate-x-0 transition-transform duration-200">
  41. <div class="flex flex-col h-full">
  42. <!-- Logo -->
  43. <div class="flex items-center justify-between h-16 px-6 border-b border-white/10">
  44. <div class="flex items-center gap-3">
  45. <div class="w-8 h-8 bg-white rounded-lg flex items-center justify-center">
  46. <svg class="w-4 h-4 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  47. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
  48. </svg>
  49. </div>
  50. <span class="text-white font-semibold">TG Admin</span>
  51. </div>
  52. <button id="sidebar-close" class="lg:hidden text-gray-400 hover:text-white">
  53. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  54. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
  55. </svg>
  56. </button>
  57. </div>
  58. <!-- Navigation -->
  59. <nav class="flex-1 px-4 py-6 space-y-1 overflow-y-auto">
  60. <a href="dashboard.html" class="nav-item">
  61. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  62. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/>
  63. </svg>
  64. <span>Dashboard</span>
  65. </a>
  66. <a href="users.html" class="nav-item active">
  67. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  68. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"/>
  69. </svg>
  70. <span>用户管理</span>
  71. </a>
  72. <a href="settings.html" class="nav-item">
  73. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  74. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
  75. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
  76. </svg>
  77. <span>设置</span>
  78. </a>
  79. </nav>
  80. <!-- Footer -->
  81. <div class="px-6 py-4 border-t border-white/10">
  82. <a href="auth/login.html" class="flex items-center gap-3 text-gray-400 hover:text-white transition-colors">
  83. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  84. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
  85. </svg>
  86. <span>退出登录</span>
  87. </a>
  88. </div>
  89. </div>
  90. </aside>
  91. <!-- Main Content -->
  92. <div class="flex-1 flex flex-col min-w-0">
  93. <!-- Header -->
  94. <header class="h-16 bg-white border-b border-gray-200 flex items-center justify-between px-4 lg:px-8">
  95. <button id="sidebar-toggle" class="lg:hidden p-2 -ml-2 text-gray-600 hover:text-black">
  96. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  97. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
  98. </svg>
  99. </button>
  100. <h1 class="text-lg font-semibold text-black hidden lg:block">用户管理</h1>
  101. <div class="relative">
  102. <button data-dropdown-toggle="user-dropdown" class="flex items-center gap-3 cursor-pointer">
  103. <div class="w-8 h-8 bg-gray-900 rounded-full flex items-center justify-center">
  104. <span class="text-white text-sm font-medium">A</span>
  105. </div>
  106. <span class="hidden sm:block text-sm font-medium text-gray-700">Admin</span>
  107. </button>
  108. <div id="user-dropdown" data-dropdown class="hidden absolute right-0 mt-2 w-48 bg-white border border-gray-200 shadow-lg z-50">
  109. <a href="settings.html" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50">设置</a>
  110. <a href="auth/login.html" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50">退出登录</a>
  111. </div>
  112. </div>
  113. </header>
  114. <!-- Page Content -->
  115. <main class="flex-1 p-4 lg:p-8 overflow-auto">
  116. <!-- Page Header -->
  117. <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8">
  118. <div>
  119. <h2 class="text-2xl lg:text-3xl font-bold text-black">用户管理</h2>
  120. <p class="text-gray-400 mt-1">管理系统用户和权限</p>
  121. </div>
  122. <button class="btn-primary w-auto px-6 flex items-center gap-2">
  123. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  124. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
  125. </svg>
  126. 添加用户
  127. </button>
  128. </div>
  129. <!-- Search and Filters -->
  130. <div class="card mb-6">
  131. <div class="flex flex-col sm:flex-row gap-4">
  132. <div class="flex-1">
  133. <div class="relative">
  134. <svg class="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  135. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
  136. </svg>
  137. <input type="text" placeholder="搜索用户..." class="input-box pl-10">
  138. </div>
  139. </div>
  140. <select class="input-box w-full sm:w-40">
  141. <option>全部状态</option>
  142. <option>活跃</option>
  143. <option>禁用</option>
  144. </select>
  145. <select class="input-box w-full sm:w-40">
  146. <option>全部角色</option>
  147. <option>管理员</option>
  148. <option>主播</option>
  149. <option>观众</option>
  150. </select>
  151. </div>
  152. </div>
  153. <!-- Users Table -->
  154. <div class="card overflow-hidden">
  155. <div class="overflow-x-auto">
  156. <table class="w-full">
  157. <thead>
  158. <tr class="border-b border-gray-200">
  159. <th class="table-header px-4 py-3">用户</th>
  160. <th class="table-header px-4 py-3 hidden sm:table-cell">邮箱</th>
  161. <th class="table-header px-4 py-3 hidden md:table-cell">角色</th>
  162. <th class="table-header px-4 py-3">状态</th>
  163. <th class="table-header px-4 py-3 hidden lg:table-cell">注册时间</th>
  164. <th class="table-header px-4 py-3 text-right">操作</th>
  165. </tr>
  166. </thead>
  167. <tbody>
  168. <tr class="table-row">
  169. <td class="table-cell px-4">
  170. <div class="flex items-center gap-3">
  171. <div class="w-10 h-10 bg-gray-900 rounded-full flex items-center justify-center flex-shrink-0">
  172. <span class="text-white text-sm font-medium">张</span>
  173. </div>
  174. <div>
  175. <div class="font-medium">张明</div>
  176. <div class="text-xs text-gray-400 sm:hidden">zhang@example.com</div>
  177. </div>
  178. </div>
  179. </td>
  180. <td class="table-cell px-4 hidden sm:table-cell text-gray-600">zhang@example.com</td>
  181. <td class="table-cell px-4 hidden md:table-cell">
  182. <span class="badge bg-purple-100 text-purple-800">主播</span>
  183. </td>
  184. <td class="table-cell px-4">
  185. <span class="badge badge-success">活跃</span>
  186. </td>
  187. <td class="table-cell px-4 hidden lg:table-cell text-gray-500">2024-01-15</td>
  188. <td class="table-cell px-4 text-right">
  189. <div class="flex items-center justify-end gap-2">
  190. <button class="p-2 text-gray-400 hover:text-black transition-colors" title="编辑">
  191. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  192. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
  193. </svg>
  194. </button>
  195. <button onclick="confirmDelete('确定要删除用户 张明 吗?')" class="p-2 text-gray-400 hover:text-red-600 transition-colors" title="删除">
  196. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  197. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
  198. </svg>
  199. </button>
  200. </div>
  201. </td>
  202. </tr>
  203. <tr class="table-row">
  204. <td class="table-cell px-4">
  205. <div class="flex items-center gap-3">
  206. <div class="w-10 h-10 bg-gray-900 rounded-full flex items-center justify-center flex-shrink-0">
  207. <span class="text-white text-sm font-medium">李</span>
  208. </div>
  209. <div>
  210. <div class="font-medium">李华</div>
  211. <div class="text-xs text-gray-400 sm:hidden">lihua@example.com</div>
  212. </div>
  213. </div>
  214. </td>
  215. <td class="table-cell px-4 hidden sm:table-cell text-gray-600">lihua@example.com</td>
  216. <td class="table-cell px-4 hidden md:table-cell">
  217. <span class="badge bg-blue-100 text-blue-800">管理员</span>
  218. </td>
  219. <td class="table-cell px-4">
  220. <span class="badge badge-success">活跃</span>
  221. </td>
  222. <td class="table-cell px-4 hidden lg:table-cell text-gray-500">2024-01-10</td>
  223. <td class="table-cell px-4 text-right">
  224. <div class="flex items-center justify-end gap-2">
  225. <button class="p-2 text-gray-400 hover:text-black transition-colors" title="编辑">
  226. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  227. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
  228. </svg>
  229. </button>
  230. <button onclick="confirmDelete('确定要删除用户 李华 吗?')" class="p-2 text-gray-400 hover:text-red-600 transition-colors" title="删除">
  231. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  232. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
  233. </svg>
  234. </button>
  235. </div>
  236. </td>
  237. </tr>
  238. <tr class="table-row">
  239. <td class="table-cell px-4">
  240. <div class="flex items-center gap-3">
  241. <div class="w-10 h-10 bg-gray-900 rounded-full flex items-center justify-center flex-shrink-0">
  242. <span class="text-white text-sm font-medium">王</span>
  243. </div>
  244. <div>
  245. <div class="font-medium">王芳</div>
  246. <div class="text-xs text-gray-400 sm:hidden">wangfang@example.com</div>
  247. </div>
  248. </div>
  249. </td>
  250. <td class="table-cell px-4 hidden sm:table-cell text-gray-600">wangfang@example.com</td>
  251. <td class="table-cell px-4 hidden md:table-cell">
  252. <span class="badge bg-gray-100 text-gray-800">观众</span>
  253. </td>
  254. <td class="table-cell px-4">
  255. <span class="badge badge-danger">禁用</span>
  256. </td>
  257. <td class="table-cell px-4 hidden lg:table-cell text-gray-500">2024-01-05</td>
  258. <td class="table-cell px-4 text-right">
  259. <div class="flex items-center justify-end gap-2">
  260. <button class="p-2 text-gray-400 hover:text-black transition-colors" title="编辑">
  261. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  262. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
  263. </svg>
  264. </button>
  265. <button onclick="confirmDelete('确定要删除用户 王芳 吗?')" class="p-2 text-gray-400 hover:text-red-600 transition-colors" title="删除">
  266. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  267. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
  268. </svg>
  269. </button>
  270. </div>
  271. </td>
  272. </tr>
  273. </tbody>
  274. </table>
  275. </div>
  276. <!-- Pagination -->
  277. <div class="flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-4 border-t border-gray-200">
  278. <p class="text-sm text-gray-500">显示 1-3 共 3 条</p>
  279. <div class="flex items-center gap-2">
  280. <button class="px-3 py-1.5 border border-gray-200 text-sm text-gray-400 cursor-not-allowed">上一页</button>
  281. <button class="px-3 py-1.5 bg-black text-white text-sm">1</button>
  282. <button class="px-3 py-1.5 border border-gray-200 text-sm text-gray-400 cursor-not-allowed">下一页</button>
  283. </div>
  284. </div>
  285. </div>
  286. </main>
  287. </div>
  288. </div>
  289. <script type="module" src="../src/js/main.js"></script>
  290. </body>
  291. </html>