dachen159 commited on
Commit
89a55a3
·
verified ·
1 Parent(s): f004000

undefined - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +582 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Yigui
3
- emoji: 🐠
4
- colorFrom: yellow
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: yigui
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,582 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>我的智能衣柜</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* 自定义滚动条 */
11
+ ::-webkit-scrollbar {
12
+ width: 5px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 10px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* 动画效果 */
26
+ @keyframes fadeIn {
27
+ from { opacity: 0; transform: translateY(10px); }
28
+ to { opacity: 1; transform: translateY(0); }
29
+ }
30
+
31
+ .fade-in {
32
+ animation: fadeIn 0.3s ease-out forwards;
33
+ }
34
+
35
+ /* 卡片悬停效果 */
36
+ .clothing-card:hover {
37
+ transform: translateY(-5px);
38
+ box-shadow: 0 10px 20px rgba(0,0,0,0.1);
39
+ }
40
+
41
+ /* 响应式调整 */
42
+ @media (max-width: 640px) {
43
+ .clothing-grid {
44
+ grid-template-columns: repeat(2, 1fr);
45
+ }
46
+ }
47
+ </style>
48
+ </head>
49
+ <body class="bg-gray-50 font-sans">
50
+ <!-- 顶部导航栏 -->
51
+ <header class="sticky top-0 z-10 bg-white shadow-sm">
52
+ <div class="container mx-auto px-4 py-3 flex justify-between items-center">
53
+ <div class="flex items-center space-x-2">
54
+ <i class="fas fa-tshirt text-2xl text-indigo-600"></i>
55
+ <h1 class="text-xl font-bold text-gray-800">智能衣柜</h1>
56
+ </div>
57
+ <div class="flex space-x-4">
58
+ <button class="text-gray-600 hover:text-indigo-600">
59
+ <i class="fas fa-search"></i>
60
+ </button>
61
+ <button class="text-gray-600 hover:text-indigo-600">
62
+ <i class="fas fa-user"></i>
63
+ </button>
64
+ </div>
65
+ </div>
66
+ </header>
67
+
68
+ <!-- 主要内容区 -->
69
+ <main class="container mx-auto px-4 py-6">
70
+ <!-- 天气和推荐区域 -->
71
+ <section class="mb-8 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl p-4 text-white shadow-lg">
72
+ <div class="flex justify-between items-center mb-4">
73
+ <div>
74
+ <h2 class="text-xl font-bold">今日穿搭推荐</h2>
75
+ <p class="text-sm opacity-90">根据当前天气智能推荐</p>
76
+ </div>
77
+ <div class="flex items-center bg-white bg-opacity-20 rounded-full px-3 py-1">
78
+ <i class="fas fa-sun mr-2"></i>
79
+ <span>晴 26°C</span>
80
+ </div>
81
+ </div>
82
+
83
+ <div class="flex overflow-x-auto pb-2 space-x-3" id="outfit-recommendations">
84
+ <!-- 动态生成的推荐穿搭 -->
85
+ </div>
86
+ </section>
87
+
88
+ <!-- 快速筛选 -->
89
+ <section class="mb-6">
90
+ <div class="flex overflow-x-auto space-x-2 pb-2">
91
+ <button class="filter-btn px-4 py-2 bg-indigo-600 text-white rounded-full text-sm whitespace-nowrap" data-category="all">
92
+ <i class="fas fa-list mr-1"></i> 全部
93
+ </button>
94
+ <button class="filter-btn px-4 py-2 bg-white text-gray-700 rounded-full text-sm whitespace-nowrap shadow" data-category="top">
95
+ <i class="fas fa-tshirt mr-1"></i> 上衣
96
+ </button>
97
+ <button class="filter-btn px-4 py-2 bg-white text-gray-700 rounded-full text-sm whitespace-nowrap shadow" data-category="bottom">
98
+ <i class="fas fa-vest-patches mr-1"></i> 下装
99
+ </button>
100
+ <button class="filter-btn px-4 py-2 bg-white text-gray-700 rounded-full text-sm whitespace-nowrap shadow" data-category="shoes">
101
+ <i class="fas fa-shoe-prints mr-1"></i> 鞋子
102
+ </button>
103
+ <button class="filter-btn px-4 py-2 bg-white text-gray-700 rounded-full text-sm whitespace-nowrap shadow" data-category="accessory">
104
+ <i class="fas fa-glasses mr-1"></i> 配饰
105
+ </button>
106
+ </div>
107
+ </section>
108
+
109
+ <!-- 我的衣柜 -->
110
+ <section>
111
+ <div class="flex justify-between items-center mb-4">
112
+ <h2 class="text-xl font-bold text-gray-800">我的衣柜</h2>
113
+ <button id="add-clothing" class="bg-indigo-600 text-white px-3 py-1 rounded-full text-sm flex items-center">
114
+ <i class="fas fa-plus mr-1"></i> 添加衣物
115
+ </button>
116
+ </div>
117
+
118
+ <div class="grid clothing-grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4" id="clothing-grid">
119
+ <!-- 动态生成的衣物卡片 -->
120
+ </div>
121
+ </section>
122
+ </main>
123
+
124
+ <!-- 底部导航 -->
125
+ <nav class="fixed bottom-0 w-full bg-white shadow-lg border-t border-gray-200">
126
+ <div class="container mx-auto px-4 py-2">
127
+ <div class="flex justify-around">
128
+ <a href="#" class="flex flex-col items-center text-indigo-600">
129
+ <i class="fas fa-home text-xl"></i>
130
+ <span class="text-xs mt-1">首页</span>
131
+ </a>
132
+ <a href="#" class="flex flex-col items-center text-gray-500">
133
+ <i class="fas fa-calendar-alt text-xl"></i>
134
+ <span class="text-xs mt-1">日历</span>
135
+ </a>
136
+ <a href="#" class="flex flex-col items-center text-gray-500">
137
+ <i class="fas fa-star text-xl"></i>
138
+ <span class="text-xs mt-1">收藏</span>
139
+ </a>
140
+ <a href="#" class="flex flex-col items-center text-gray-500">
141
+ <i class="fas fa-cog text-xl"></i>
142
+ <span class="text-xs mt-1">设置</span>
143
+ </a>
144
+ </div>
145
+ </div>
146
+ </nav>
147
+
148
+ <!-- 添加衣物模态框 -->
149
+ <div id="add-modal" class="fixed inset-0 bg-black bg-opacity-50 z-20 hidden flex items-center justify-center">
150
+ <div class="bg-white rounded-xl w-full max-w-md mx-4 p-6 transform transition-all fade-in">
151
+ <div class="flex justify-between items-center mb-4">
152
+ <h3 class="text-lg font-bold text-gray-800">添加新衣物</h3>
153
+ <button id="close-modal" class="text-gray-500 hover:text-gray-700">
154
+ <i class="fas fa-times"></i>
155
+ </button>
156
+ </div>
157
+
158
+ <form id="clothing-form" class="space-y-4">
159
+ <div>
160
+ <label class="block text-sm font-medium text-gray-700 mb-1">衣物名称</label>
161
+ <input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="例如: 蓝色条纹衬衫" required>
162
+ </div>
163
+
164
+ <div>
165
+ <label class="block text-sm font-medium text-gray-700 mb-1">衣物类型</label>
166
+ <select class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500" required>
167
+ <option value="">选择类型</option>
168
+ <option value="top">上衣</option>
169
+ <option value="bottom">下装</option>
170
+ <option value="shoes">鞋子</option>
171
+ <option value="accessory">配饰</option>
172
+ </select>
173
+ </div>
174
+
175
+ <div>
176
+ <label class="block text-sm font-medium text-gray-700 mb-1">季节</label>
177
+ <div class="flex space-x-2">
178
+ <label class="inline-flex items-center">
179
+ <input type="checkbox" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" value="spring">
180
+ <span class="ml-2 text-sm">春</span>
181
+ </label>
182
+ <label class="inline-flex items-center">
183
+ <input type="checkbox" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" value="summer">
184
+ <span class="ml-2 text-sm">夏</span>
185
+ </label>
186
+ <label class="inline-flex items-center">
187
+ <input type="checkbox" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" value="autumn">
188
+ <span class="ml-2 text-sm">秋</span>
189
+ </label>
190
+ <label class="inline-flex items-center">
191
+ <input type="checkbox" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" value="winter">
192
+ <span class="ml-2 text-sm">冬</span>
193
+ </label>
194
+ </div>
195
+ </div>
196
+
197
+ <div>
198
+ <label class="block text-sm font-medium text-gray-700 mb-1">颜色</label>
199
+ <div class="flex flex-wrap gap-2">
200
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-red-500 border-2 border-transparent" data-color="red"></button>
201
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-blue-500 border-2 border-transparent" data-color="blue"></button>
202
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-green-500 border-2 border-transparent" data-color="green"></button>
203
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-yellow-500 border-2 border-transparent" data-color="yellow"></button>
204
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-purple-500 border-2 border-transparent" data-color="purple"></button>
205
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-pink-500 border-2 border-transparent" data-color="pink"></button>
206
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-gray-500 border-2 border-transparent" data-color="gray"></button>
207
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-black border-2 border-transparent" data-color="black"></button>
208
+ <button type="button" class="color-option w-8 h-8 rounded-full bg-white border-2 border-gray-300" data-color="white"></button>
209
+ </div>
210
+ <input type="hidden" id="selected-color" name="color">
211
+ </div>
212
+
213
+ <div>
214
+ <label class="block text-sm font-medium text-gray-700 mb-1">上传图片</label>
215
+ <div class="flex items-center justify-center w-full">
216
+ <label class="flex flex-col items-center justify-center w-full h-32 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100">
217
+ <div class="flex flex-col items-center justify-center pt-5 pb-6">
218
+ <i class="fas fa-cloud-upload-alt text-gray-400 text-2xl mb-2"></i>
219
+ <p class="mb-2 text-sm text-gray-500">点击上传或拖拽图片</p>
220
+ <p class="text-xs text-gray-500">PNG, JPG (最大2MB)</p>
221
+ </div>
222
+ <input type="file" class="hidden" accept="image/*">
223
+ </label>
224
+ </div>
225
+ </div>
226
+
227
+ <div class="pt-2">
228
+ <button type="submit" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition">
229
+ 添加衣物
230
+ </button>
231
+ </div>
232
+ </form>
233
+ </div>
234
+ </div>
235
+
236
+ <!-- 衣物详情模态框 -->
237
+ <div id="detail-modal" class="fixed inset-0 bg-black bg-opacity-50 z-20 hidden flex items-center justify-center">
238
+ <div class="bg-white rounded-xl w-full max-w-md mx-4 p-6 transform transition-all fade-in">
239
+ <div class="flex justify-between items-center mb-4">
240
+ <h3 class="text-lg font-bold text-gray-800" id="detail-title">衣物详情</h3>
241
+ <button id="close-detail" class="text-gray-500 hover:text-gray-700">
242
+ <i class="fas fa-times"></i>
243
+ </button>
244
+ </div>
245
+
246
+ <div class="mb-4">
247
+ <div class="w-full h-48 bg-gray-200 rounded-lg mb-3 overflow-hidden" id="detail-image">
248
+ <!-- 图片会通过JS动态添加 -->
249
+ </div>
250
+
251
+ <div class="grid grid-cols-2 gap-4">
252
+ <div>
253
+ <p class="text-sm text-gray-500">类型</p>
254
+ <p class="font-medium" id="detail-type">上衣</p>
255
+ </div>
256
+ <div>
257
+ <p class="text-sm text-gray-500">颜色</p>
258
+ <p class="font-medium" id="detail-color">蓝色</p>
259
+ </div>
260
+ <div>
261
+ <p class="text-sm text-gray-500">季节</p>
262
+ <p class="font-medium" id="detail-season">春/夏</p>
263
+ </div>
264
+ <div>
265
+ <p class="text-sm text-gray-500">添加日期</p>
266
+ <p class="font-medium" id="detail-date">2023-05-15</p>
267
+ </div>
268
+ </div>
269
+ </div>
270
+
271
+ <div class="flex space-x-2 pt-4 border-t border-gray-200">
272
+ <button class="flex-1 bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition">
273
+ <i class="fas fa-star mr-2"></i> 收藏
274
+ </button>
275
+ <button class="flex-1 bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 transition">
276
+ <i class="fas fa-trash-alt mr-2"></i> 删除
277
+ </button>
278
+ </div>
279
+ </div>
280
+ </div>
281
+
282
+ <script>
283
+ // 模拟数据
284
+ const clothingItems = [
285
+ {
286
+ id: 1,
287
+ name: "蓝色条纹衬衫",
288
+ type: "top",
289
+ color: "blue",
290
+ seasons: ["spring", "autumn"],
291
+ image: "https://images.unsplash.com/photo-1598033129183-c4f50c736e10?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
292
+ addedDate: "2023-05-10"
293
+ },
294
+ {
295
+ id: 2,
296
+ name: "黑色休闲裤",
297
+ type: "bottom",
298
+ color: "black",
299
+ seasons: ["spring", "autumn", "winter"],
300
+ image: "https://images.unsplash.com/photo-1473966968600-fa801b869a1a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
301
+ addedDate: "2023-04-15"
302
+ },
303
+ {
304
+ id: 3,
305
+ name: "白色运动鞋",
306
+ type: "shoes",
307
+ color: "white",
308
+ seasons: ["spring", "summer", "autumn"],
309
+ image: "https://images.unsplash.com/photo-1542291026-7eec264c27ff?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
310
+ addedDate: "2023-03-20"
311
+ },
312
+ {
313
+ id: 4,
314
+ name: "红色T恤",
315
+ type: "top",
316
+ color: "red",
317
+ seasons: ["summer"],
318
+ image: "https://images.unsplash.com/photo-1527719327859-c6ce80353573?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
319
+ addedDate: "2023-06-05"
320
+ },
321
+ {
322
+ id: 5,
323
+ name: "牛仔短裤",
324
+ type: "bottom",
325
+ color: "blue",
326
+ seasons: ["summer"],
327
+ image: "https://images.unsplash.com/photo-1604671801908-6f0c6a092c05?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
328
+ addedDate: "2023-07-12"
329
+ },
330
+ {
331
+ id: 6,
332
+ name: "灰色针织帽",
333
+ type: "accessory",
334
+ color: "gray",
335
+ seasons: ["autumn", "winter"],
336
+ image: "https://images.unsplash.com/photo-1534215754734-18e55d13e346?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
337
+ addedDate: "2023-01-30"
338
+ }
339
+ ];
340
+
341
+ // 模拟穿搭推荐
342
+ const outfitRecommendations = [
343
+ {
344
+ id: 1,
345
+ name: "夏日休闲",
346
+ items: [1, 5, 3],
347
+ occasion: "日常"
348
+ },
349
+ {
350
+ id: 2,
351
+ name: "春秋通勤",
352
+ items: [1, 2, 3],
353
+ occasion: "工作"
354
+ },
355
+ {
356
+ id: 3,
357
+ name: "活力夏日",
358
+ items: [4, 5, 3],
359
+ occasion: "约会"
360
+ }
361
+ ];
362
+
363
+ // DOM元素
364
+ const clothingGrid = document.getElementById('clothing-grid');
365
+ const outfitRecommendationsEl = document.getElementById('outfit-recommendations');
366
+ const filterButtons = document.querySelectorAll('.filter-btn');
367
+ const addModal = document.getElementById('add-modal');
368
+ const detailModal = document.getElementById('detail-modal');
369
+ const addButton = document.getElementById('add-clothing');
370
+ const closeModal = document.getElementById('close-modal');
371
+ const closeDetail = document.getElementById('close-detail');
372
+ const colorOptions = document.querySelectorAll('.color-option');
373
+ const selectedColor = document.getElementById('selected-color');
374
+ const clothingForm = document.getElementById('clothing-form');
375
+
376
+ // 初始化页面
377
+ document.addEventListener('DOMContentLoaded', () => {
378
+ renderClothingItems();
379
+ renderOutfitRecommendations();
380
+ setupEventListeners();
381
+ });
382
+
383
+ // 渲染衣物列表
384
+ function renderClothingItems(filter = 'all') {
385
+ clothingGrid.innerHTML = '';
386
+
387
+ const filteredItems = filter === 'all'
388
+ ? clothingItems
389
+ : clothingItems.filter(item => item.type === filter);
390
+
391
+ filteredItems.forEach(item => {
392
+ const card = document.createElement('div');
393
+ card.className = 'clothing-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 cursor-pointer';
394
+ card.dataset.id = item.id;
395
+
396
+ // 根据颜色设置卡片边框
397
+ let borderClass = '';
398
+ switch(item.color) {
399
+ case 'red': borderClass = 'border-red-500'; break;
400
+ case 'blue': borderClass = 'border-blue-500'; break;
401
+ case 'green': borderClass = 'border-green-500'; break;
402
+ case 'yellow': borderClass = 'border-yellow-500'; break;
403
+ case 'purple': borderClass = 'border-purple-500'; break;
404
+ case 'pink': borderClass = 'border-pink-500'; break;
405
+ case 'gray': borderClass = 'border-gray-500'; break;
406
+ case 'black': borderClass = 'border-black'; break;
407
+ case 'white': borderClass = 'border-gray-300'; break;
408
+ }
409
+
410
+ card.innerHTML = `
411
+ <div class="relative pb-full">
412
+ <img src="${item.image}" alt="${item.name}" class="absolute h-full w-full object-cover">
413
+ </div>
414
+ <div class="p-3 border-t-4 ${borderClass}">
415
+ <h3 class="font-medium text-gray-800 truncate">${item.name}</h3>
416
+ <div class="flex justify-between items-center mt-1">
417
+ <span class="text-xs text-gray-500 capitalize">${item.type}</span>
418
+ <button class="text-gray-400 hover:text-indigo-600">
419
+ <i class="fas fa-ellipsis-h"></i>
420
+ </button>
421
+ </div>
422
+ </div>
423
+ `;
424
+
425
+ clothingGrid.appendChild(card);
426
+ });
427
+ }
428
+
429
+ // 渲染穿搭推荐
430
+ function renderOutfitRecommendations() {
431
+ outfitRecommendationsEl.innerHTML = '';
432
+
433
+ outfitRecommendations.forEach(outfit => {
434
+ const outfitEl = document.createElement('div');
435
+ outfitEl.className = 'flex-shrink-0 w-48 bg-white bg-opacity-20 rounded-lg p-3 backdrop-blur-sm';
436
+ outfitEl.dataset.id = outfit.id;
437
+
438
+ // 获取推荐穿搭中的衣物
439
+ const outfitItems = outfit.items.map(id =>
440
+ clothingItems.find(item => item.id === id)
441
+ );
442
+
443
+ outfitEl.innerHTML = `
444
+ <h3 class="font-bold mb-2">${outfit.name}</h3>
445
+ <p class="text-xs opacity-80 mb-3">适合: ${outfit.occasion}</p>
446
+ <div class="flex space-x-2">
447
+ ${outfitItems.map(item => `
448
+ <div class="w-10 h-10 rounded-full overflow-hidden border-2 border-white">
449
+ <img src="${item.image}" alt="${item.name}" class="w-full h-full object-cover">
450
+ </div>
451
+ `).join('')}
452
+ </div>
453
+ <button class="mt-3 w-full bg-white text-indigo-600 py-1 rounded-full text-xs font-medium">
454
+ 查看搭配
455
+ </button>
456
+ `;
457
+
458
+ outfitRecommendationsEl.appendChild(outfitEl);
459
+ });
460
+ }
461
+
462
+ // 设置事件监听器
463
+ function setupEventListeners() {
464
+ // 筛选按钮
465
+ filterButtons.forEach(button => {
466
+ button.addEventListener('click', () => {
467
+ filterButtons.forEach(btn => {
468
+ btn.classList.remove('bg-indigo-600', 'text-white');
469
+ btn.classList.add('bg-white', 'text-gray-700', 'shadow');
470
+ });
471
+
472
+ button.classList.remove('bg-white', 'text-gray-700', 'shadow');
473
+ button.classList.add('bg-indigo-600', 'text-white');
474
+
475
+ const filter = button.dataset.category;
476
+ renderClothingItems(filter);
477
+ });
478
+ });
479
+
480
+ // 添加衣物按钮
481
+ addButton.addEventListener('click', () => {
482
+ addModal.classList.remove('hidden');
483
+ });
484
+
485
+ // 关闭模态框
486
+ closeModal.addEventListener('click', () => {
487
+ addModal.classList.add('hidden');
488
+ });
489
+
490
+ closeDetail.addEventListener('click', () => {
491
+ detailModal.classList.add('hidden');
492
+ });
493
+
494
+ // 颜色选择
495
+ colorOptions.forEach(option => {
496
+ option.addEventListener('click', () => {
497
+ colorOptions.forEach(opt => {
498
+ opt.classList.remove('border-indigo-600', 'border-2');
499
+ });
500
+
501
+ option.classList.add('border-indigo-600', 'border-2');
502
+ selectedColor.value = option.dataset.color;
503
+ });
504
+ });
505
+
506
+ // 衣物卡片点击
507
+ document.addEventListener('click', (e) => {
508
+ const card = e.target.closest('.clothing-card');
509
+ if (card) {
510
+ const id = parseInt(card.dataset.id);
511
+ showClothingDetail(id);
512
+ }
513
+ });
514
+
515
+ // 表单提交
516
+ clothingForm.addEventListener('submit', (e) => {
517
+ e.preventDefault();
518
+ // 这里应该是实际的表单处理逻辑
519
+ alert('衣物已添加!');
520
+ addModal.classList.add('hidden');
521
+ });
522
+ }
523
+
524
+ // 显示衣物详情
525
+ function showClothingDetail(id) {
526
+ const item = clothingItems.find(item => item.id === id);
527
+ if (!item) return;
528
+
529
+ // 更新模态框内容
530
+ document.getElementById('detail-title').textContent = item.name;
531
+ document.getElementById('detail-type').textContent = getTypeName(item.type);
532
+ document.getElementById('detail-color').textContent = getColorName(item.color);
533
+ document.getElementById('detail-season').textContent = getSeasonNames(item.seasons);
534
+ document.getElementById('detail-date').textContent = item.addedDate;
535
+
536
+ // 设置图片
537
+ const imageContainer = document.getElementById('detail-image');
538
+ imageContainer.innerHTML = `<img src="${item.image}" alt="${item.name}" class="w-full h-full object-cover">`;
539
+
540
+ // 显示模态框
541
+ detailModal.classList.remove('hidden');
542
+ }
543
+
544
+ // 辅助函数
545
+ function getTypeName(type) {
546
+ const types = {
547
+ 'top': '上衣',
548
+ 'bottom': '下装',
549
+ 'shoes': '鞋子',
550
+ 'accessory': '配饰'
551
+ };
552
+ return types[type] || type;
553
+ }
554
+
555
+ function getColorName(color) {
556
+ const colors = {
557
+ 'red': '红色',
558
+ 'blue': '蓝色',
559
+ 'green': '绿色',
560
+ 'yellow': '黄色',
561
+ 'purple': '紫色',
562
+ 'pink': '粉色',
563
+ 'gray': '灰色',
564
+ 'black': '黑色',
565
+ 'white': '白色'
566
+ };
567
+ return colors[color] || color;
568
+ }
569
+
570
+ function getSeasonNames(seasons) {
571
+ const seasonNames = {
572
+ 'spring': '春',
573
+ 'summer': '夏',
574
+ 'autumn': '秋',
575
+ 'winter': '冬'
576
+ };
577
+
578
+ return seasons.map(season => seasonNames[season]).join('/');
579
+ }
580
+ </script>
581
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=dachen159/yigui" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
582
+ </html>