查看代码
 <!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理后台 - QSZ</title>
    <style>
        :root {
            --primary-color: #1a56db;
            --secondary-color: #e5e7eb;
            --text-color: #1f2937;
            --bg-color: #f3f4f6;
            --white: #ffffff;
            --border-color: #d1d5db;
            --success-color: #059669;
            --danger-color: #dc2626;
            --warning-color: #d97706;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.6;
        }

        .admin-container {
            display: flex;
            min-height: 100vh;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 250px;
            background: var(--white);
            border-right: 1px solid var(--border-color);
            padding: 1rem;
        }

        .sidebar-header {
            padding: 1rem;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 1rem;
        }

        .nav-menu {
            list-style: none;
        }

        .nav-item {
            margin-bottom: 0.5rem;
        }

        .nav-link {
            display: block;
            padding: 0.75rem 1rem;
            color: var(--text-color);
            text-decoration: none;
            border-radius: 0.375rem;
            transition: background-color 0.3s;
        }

        .nav-link:hover,
        .nav-link.active {
            background-color: var(--bg-color);
            color: var(--primary-color);
        }

        /* 主内容区域样式 */
        .main-content {
            flex: 1;
            padding: 2rem;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .stat-card {
            background: var(--white);
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        .stat-title {
            font-size: 0.875rem;
            color: #6b7280;
            margin-bottom: 0.5rem;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 600;
            color: var(--text-color);
        }

        /* 表格样式 */
        .table-container {
            background: var(--white);
            border-radius: 0.5rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            overflow: hidden;
        }

        .admin-table {
            width: 100%;
            border-collapse: collapse;
        }

        .admin-table th,
        .admin-table td {
            padding: 1rem;
            text-align: left;
            border-bottom: 1px solid var(--border-color);
        }

        .admin-table th {
            background: var(--bg-color);
            font-weight: 500;
        }

        /* 按钮样式 */
        .btn {
            padding: 0.5rem 1rem;
            border: none;
            border-radius: 0.375rem;
            font-size: 0.875rem;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .btn-primary {
            background: var(--primary-color);
            color: var(--white);
        }

        .btn-danger {
            background: var(--danger-color);
            color: var(--white);
        }

        .btn-warning {
            background: var(--warning-color);
            color: var(--white);
        }

        /* 搜索框样式 */
        .search-box {
            padding: 0.5rem;
            border: 1px solid var(--border-color);
            border-radius: 0.375rem;
            width: 300px;
            margin-bottom: 1rem;
        }

        /* 分页样式 */
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 2rem;
            gap: 0.5rem;
        }

        .page-link {
            padding: 0.5rem 1rem;
            border: 1px solid var(--border-color);
            border-radius: 0.375rem;
            color: var(--text-color);
            text-decoration: none;
        }

        .page-link.active {
            background: var(--primary-color);
            color: var(--white);
            border-color: var(--primary-color);
        }

        @media (max-width: 768px) {
            .admin-container {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                border-right: none;
                border-bottom: 1px solid var(--border-color);
            }

            .stats-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="admin-container">
        <aside class="sidebar">
            <div class="sidebar-header">
                <h2>管理后台</h2>
            </div>
            <nav>
                <ul class="nav-menu">
                    <li class="nav-item">
                        <a href="#" class="nav-link active">控制台</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">用户管理</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">文章管理</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">评论管理</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">系统设置</a>
                    </li>
                </ul>
            </nav>
        </aside>

        <main class="main-content">
            <div class="page-header">
                <h1>控制台</h1>
                <button class="btn btn-primary">新建</button>
            </div>

            <div class="stats-grid">
                <div class="stat-card">
                    <div class="stat-title">总用户数</div>
                    <div class="stat-value">1,234</div>
                </div>
                <div class="stat-card">
                    <div class="stat-title">文章数</div>
                    <div class="stat-value">567</div>
                </div>
                <div class="stat-card">
                    <div class="stat-title">评论数</div>
                    <div class="stat-value">8,901</div>
                </div>
                <div class="stat-card">
                    <div class="stat-title">今日访问</div>
                    <div class="stat-value">2,345</div>
                </div>
            </div>

            <input type="text" class="search-box" placeholder="搜索...">

            <div class="table-container">
                <table class="admin-table">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>邮箱</th>
                            <th>注册时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>1</td>
                            <td>admin</td>
                            <td>admin@example.com</td>
                            <td>2024-02-20</td>
                            <td>正常</td>
                            <td>
                                <button class="btn btn-warning">编辑</button>
                                <button class="btn btn-danger">删除</button>
                            </td>
                        </tr>
                        <tr>
                            <td>2</td>
                            <td>user1</td>
                            <td>user1@example.com</td>
                            <td>2024-02-19</td>
                            <td>正常</td>
                            <td>
                                <button class="btn btn-warning">编辑</button>
                                <button class="btn btn-danger">删除</button>
                            </td>
                        </tr>
                        <!-- 更多数据行 -->
                    </tbody>
                </table>
            </div>

            <div class="pagination">
                <a href="#" class="page-link">上一页</a>
                <a href="#" class="page-link active">1</a>
                <a href="#" class="page-link">2</a>
                <a href="#" class="page-link">3</a>
                <a href="#" class="page-link">下一页</a>
            </div>
        </main>
    </div>
</body>
</html>

 

Posted on 2024-11-18 14:27  北边村的富少  阅读(7)  评论(0编辑  收藏  举报