File size: 9,810 Bytes
5fc700d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - ToolHub 管理后台</title>
    
    <!-- 外部字体和图标 -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet" />
    
    <!-- 样式文件 -->
    <link rel="stylesheet" href="~/css/toolhub.css" asp-append-version="true" />
    
    <style>
        .admin-sidebar {
            width: 250px;
            background: white;
            box-shadow: var(--shadow);
            position: fixed;
            top: 0;
            left: 0;
            height: 100vh;
            z-index: 1000;
            overflow-y: auto;
        }
        
        .admin-main {
            margin-left: 250px;
            min-height: 100vh;
            background: #fafafa;
        }
        
        .admin-header {
            background: white;
            padding: 1rem 2rem;
            box-shadow: var(--shadow-sm);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .admin-content {
            padding: 2rem;
        }
        
        .sidebar-brand {
            padding: 1.5rem;
            border-bottom: 1px solid var(--light-2);
            text-align: center;
        }
        
        .sidebar-nav {
            padding: 1rem 0;
        }
        
        .sidebar-nav-item {
            display: block;
            padding: 0.75rem 1.5rem;
            color: var(--dark-2);
            text-decoration: none;
            transition: var(--transition);
            border-left: 3px solid transparent;
        }
        
        .sidebar-nav-item:hover,
        .sidebar-nav-item.active {
            background: var(--light-1);
            color: var(--primary);
            border-left-color: var(--primary);
            text-decoration: none;
        }
        
        .sidebar-nav-item i {
            width: 1.5rem;
            margin-right: 0.75rem;
        }
        
        .stats-card {
            background: white;
            padding: 1.5rem;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-sm);
            transition: var(--transition);
        }
        
        .stats-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }
        
        .stats-number {
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }
        
        .stats-label {
            color: var(--dark-2);
            font-size: 0.875rem;
        }
        
        .data-table {
            background: white;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
        }
        
        .data-table table {
            width: 100%;
            border-collapse: collapse;
        }
        
        .data-table th,
        .data-table td {
            padding: 0.75rem 1rem;
            text-align: left;
            border-bottom: 1px solid var(--light-2);
        }
        
        .data-table th {
            background: var(--light-1);
            font-weight: 600;
            color: var(--dark);
        }
        
        .data-table tbody tr:hover {
            background: var(--light-1);
        }
        
        .badge {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            font-size: 0.75rem;
            font-weight: 500;
            border-radius: 50px;
            color: white;
        }
        
        .badge-primary { background: var(--primary); }
        .badge-success { background: var(--success); }
        .badge-warning { background: var(--warning); }
        .badge-danger { background: var(--danger); }
        .badge-secondary { background: var(--dark-2); }
        
        @@media (max-width: 768px) {
            .admin-sidebar {
                transform: translateX(-100%);
                transition: transform 0.3s ease;
            }
            
            .admin-sidebar.show {
                transform: translateX(0);
            }
            
            .admin-main {
                margin-left: 0;
            }
        }
    </style>
    
    @await RenderSectionAsync("Styles", required: false)
</head>
<body class="admin-page">
    <!-- 侧边栏 -->
    <div class="admin-sidebar">
        <div class="sidebar-brand">
            <div class="brand-icon" style="margin-bottom: 0.5rem;">
                <i class="fas fa-wrench"></i>
            </div>
            <h5 style="margin: 0; font-weight: 700;">
                <span class="text-gradient">ToolHub</span>
            </h5>
            <p style="font-size: 0.75rem; color: var(--dark-2); margin: 0.25rem 0 0;">管理后台</p>
        </div>
        
        <nav class="sidebar-nav">
            <a href="@Url.Action("Index", "Admin")" class="sidebar-nav-item @(ViewContext.RouteData.Values["action"]?.ToString() == "Index" ? "active" : "")">
                <i class="fas fa-chart-line"></i>
                仪表板
            </a>
            <a href="@Url.Action("Index", "Category")" class="sidebar-nav-item @(ViewContext.RouteData.Values["controller"]?.ToString() == "Category" ? "active" : "")">
                <i class="fas fa-tags"></i>
                工具分类
            </a>
            <a href="@Url.Action("Index", "Tag")" class="sidebar-nav-item @(ViewContext.RouteData.Values["controller"]?.ToString() == "Tag" ? "active" : "")">
                <i class="fas fa-tags"></i>
                标签管理
            </a>
            <a href="@Url.Action("Index", "Tool")" class="sidebar-nav-item @(ViewContext.RouteData.Values["controller"]?.ToString() == "Tool" ? "active" : "")">
                <i class="fas fa-tools"></i>
                工具管理
            </a>
            <a href="@Url.Action("Index", "ToolStatistics")" class="sidebar-nav-item @(ViewContext.RouteData.Values["controller"]?.ToString() == "ToolStatistics" ? "active" : "")">
                <i class="fas fa-chart-bar"></i>
                工具统计
            </a>
            <a href="@Url.Action("Users", "Admin")" class="sidebar-nav-item @(ViewContext.RouteData.Values["action"]?.ToString() == "Users" ? "active" : "")">
                <i class="fas fa-users"></i>
                用户管理
            </a>
            <a href="@Url.Action("Index", "Home")" class="sidebar-nav-item" target="_blank">
                <i class="fas fa-external-link-alt"></i>
                查看网站
            </a>
        </nav>
    </div>

    <!-- 主内容区 -->
    <div class="admin-main">
        <!-- 顶部导航 -->
        <header class="admin-header">
            <div style="display: flex; align-items: center;">
                <button class="btn btn-outline btn-sm mobile-sidebar-toggle" style="display: none; margin-right: 1rem;">
                    <i class="fas fa-bars"></i>
                </button>
                <h1 style="font-size: 1.25rem; font-weight: 600; margin: 0; color: var(--dark);">
                    @ViewData["Title"]
                </h1>
            </div>
            
            <div style="display: flex; align-items: center; gap: 1rem;">
                <span style="font-size: 0.875rem; color: var(--dark-2);">
                    欢迎,<strong>@User.Identity?.Name</strong>
                </span>
                <form method="post" action="@Url.Action("Logout", "Admin")" style="margin: 0;">
                    <button type="submit" class="btn btn-outline btn-sm">
                        <i class="fas fa-sign-out-alt"></i>
                        退出
                    </button>
                </form>
            </div>
        </header>

        <!-- 内容区 -->
        <main class="admin-content">
            @RenderBody()
        </main>
    </div>

    <!-- JavaScript -->
    <script src="~/js/toolhub.js" asp-append-version="true"></script>
    
    <script>
        // 移动端侧边栏切换
        document.addEventListener('DOMContentLoaded', function() {
            const toggleBtn = document.querySelector('.mobile-sidebar-toggle');
            const sidebar = document.querySelector('.admin-sidebar');
            
            if (toggleBtn && sidebar) {
                // 显示移动端按钮
                if (window.innerWidth <= 768) {
                    toggleBtn.style.display = 'inline-flex';
                }
                
                // 切换侧边栏
                toggleBtn.addEventListener('click', function() {
                    sidebar.classList.toggle('show');
                });
                
                // 点击外部关闭
                document.addEventListener('click', function(e) {
                    if (window.innerWidth <= 768 && 
                        !sidebar.contains(e.target) && 
                        !toggleBtn.contains(e.target)) {
                        sidebar.classList.remove('show');
                    }
                });
                
                // 响应式处理
                window.addEventListener('resize', function() {
                    if (window.innerWidth <= 768) {
                        toggleBtn.style.display = 'inline-flex';
                    } else {
                        toggleBtn.style.display = 'none';
                        sidebar.classList.remove('show');
                    }
                });
            }
        });
    </script>
    
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>