Преглед изворни кода

Move all inline styles to SCSS for better maintainability

Enhance responsive design with mobile-friendly layouts

Improve visual hierarchy and consistency

Add hover and click animations for better user feedback

Implement a simple notification system for user actions

Optimize performance with CSS transitions and efficient selectors
“0235959” пре 2 недеља
родитељ
комит
c011d53d69

+ 38 - 39
cloth-dit-web/src/modules/cloth/color/page/pages-community/pages-community/pages-community.html

@@ -1,8 +1,7 @@
-<p>pages-community works!</p>
 <div class="community-page">
   <div class="community-header">
     <h1>设计社区</h1>
-    <p>与全球设计师交流创意</p>
+    <p class="header-subtitle">与全球设计师交流创意</p>
     <div class="community-stats">
       <div class="stat-item">
         <div class="stat-number">12.8k</div>
@@ -20,61 +19,61 @@
   </div>
 
   <main class="main-content">
-    <div style="margin: 20px;">
+    <div class="content-container">
       <!-- 热门话题 -->
-      <div style="background: white; border-radius: 15px; padding: 20px; margin-bottom: 20px; box-shadow: 0 5px 20px rgba(0,0,0,0.1);">
-        <h4 style="margin-bottom: 15px; font-size: 16px;">🔥 热门话题</h4>
-        <div style="display: flex; flex-wrap: wrap; gap: 8px;">
-          <span style="background: #ff6b6b; color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;">#春季时尚</span>
-          <span style="background: #4ecdc4; color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;">#环保设计</span>
-          <span style="background: #45b7d1; color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;">#极简主义</span>
-          <span style="background: #96ceb4; color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;">#复古回潮</span>
+      <div class="content-card">
+        <h4 class="card-title">🔥 热门话题</h4>
+        <div class="tags-container">
+          <span class="tag tag-fashion">#春季时尚</span>
+          <span class="tag tag-eco">#环保设计</span>
+          <span class="tag tag-minimal">#极简主义</span>
+          <span class="tag tag-vintage">#复古回潮</span>
         </div>
       </div>
 
       <!-- 设计师排行榜 -->
-      <div style="background: white; border-radius: 15px; padding: 20px; margin-bottom: 20px; box-shadow: 0 5px 20px rgba(0,0,0,0.1);">
-        <h4 style="margin-bottom: 15px; font-size: 16px;">🏆 本周设计师排行</h4>
-        <div style="display: flex; flex-direction: column; gap: 12px;">
-          <div style="display: flex; align-items: center; justify-content: space-between; padding: 10px; background: #f8f9fa; border-radius: 10px;">
-            <div style="display: flex; align-items: center; gap: 12px;">
-              <div style="width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(45deg, #ff6b6b, #ffa726); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;">1</div>
-              <div>
-                <div style="font-weight: 600; font-size: 14px;">设计大师Alex</div>
-                <div style="font-size: 12px; color: #666;">点赞数: 8.9k</div>
+      <div class="content-card">
+        <h4 class="card-title">🏆 本周设计师排行</h4>
+        <div class="ranking-list">
+          <div class="ranking-item">
+            <div class="ranking-info">
+              <div class="rank-avatar rank-1">1</div>
+              <div class="ranking-details">
+                <div class="designer-name">设计大师Alex</div>
+                <div class="designer-likes">点赞数: 8.9k</div>
               </div>
             </div>
-            <div style="font-size: 20px;">👑</div>
+            <div class="rank-crown">👑</div>
           </div>
-          <div style="display: flex; align-items: center; justify-content: space-between; padding: 10px; background: #f8f9fa; border-radius: 10px;">
-            <div style="display: flex; align-items: center; gap: 12px;">
-              <div style="width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(45deg, #4ecdc4, #44a08d); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;">2</div>
-              <div>
-                <div style="font-weight: 600; font-size: 14px;">时尚达人Lisa</div>
-                <div style="font-size: 12px; color: #666;">点赞数: 7.2k</div>
+          <div class="ranking-item">
+            <div class="ranking-info">
+              <div class="rank-avatar rank-2">2</div>
+              <div class="ranking-details">
+                <div class="designer-name">时尚达人Lisa</div>
+                <div class="designer-likes">点赞数: 7.2k</div>
               </div>
             </div>
-            <div style="font-size: 20px;">🥈</div>
+            <div class="rank-medal">🥈</div>
           </div>
-          <div style="display: flex; align-items: center; justify-content: space-between; padding: 10px; background: #f8f9fa; border-radius: 10px;">
-            <div style="display: flex; align-items: center; gap: 12px;">
-              <div style="width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(45deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;">3</div>
-              <div>
-                <div style="font-weight: 600; font-size: 14px;">创意师Mike</div>
-                <div style="font-size: 12px; color: #666;">点赞数: 5.8k</div>
+          <div class="ranking-item">
+            <div class="ranking-info">
+              <div class="rank-avatar rank-3">3</div>
+              <div class="ranking-details">
+                <div class="designer-name">创意师Mike</div>
+                <div class="designer-likes">点赞数: 5.8k</div>
               </div>
             </div>
-            <div style="font-size: 20px;">🥉</div>
+            <div class="rank-medal">🥉</div>
           </div>
         </div>
       </div>
 
       <!-- 最新作品 -->
-      <div style="background: white; border-radius: 15px; padding: 20px; box-shadow: 0 5px 20px rgba(0,0,0,0.1);">
-        <h4 style="margin-bottom: 15px; font-size: 16px;">✨ 最新作品</h4>
-        <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;">
-          <div style="background: linear-gradient(45deg, #a8edea 0%, #fed6e3 100%); border-radius: 12px; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 36px; cursor: pointer; transition: all 0.3s ease;" (click)="likeWork($event)">🌸</div>
-          <div style="background: linear-gradient(45deg, #667eea 0%, #764ba2 100%); border-radius: 12px; height: 120px; display: flex; align-items: center; justify-content: center; font-size: 36px; cursor: pointer; transition: all 0.3s ease;" (click)="likeWork($event)">⚡</div>
+      <div class="content-card">
+        <h4 class="card-title">✨ 最新作品</h4>
+        <div class="works-grid">
+          <div class="work-item work-1" (click)="likeWork($event)">🌸</div>
+          <div class="work-item work-2" (click)="likeWork($event)">⚡</div>
         </div>
       </div>
     </div>

+ 221 - 8
cloth-dit-web/src/modules/cloth/color/page/pages-community/pages-community/pages-community.scss

@@ -1,36 +1,249 @@
 .community-page {
-  display: block;
+  display: flex;
+  flex-direction: column;
+  min-height: 100vh;
+  background-color: #f5f7fa;
 }
 
 .community-header {
   background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
-  padding: 20px;
+  padding: 30px 20px;
   color: white;
   text-align: center;
+  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+
+  h1 {
+    margin: 0;
+    font-size: 2.2rem;
+    font-weight: 700;
+  }
+
+  .header-subtitle {
+    margin: 8px 0 0;
+    font-size: 1rem;
+    opacity: 0.9;
+  }
 }
 
 .community-stats {
   display: flex;
   justify-content: space-around;
-  margin: 20px 0;
+  max-width: 600px;
+  margin: 30px auto 0;
+  padding: 15px 0;
+  background-color: rgba(255, 255, 255, 0.15);
+  border-radius: 12px;
 }
 
 .stat-item {
   text-align: center;
+  padding: 0 15px;
 }
 
 .stat-number {
-  font-size: 24px;
+  font-size: 1.8rem;
   font-weight: 700;
+  line-height: 1.2;
 }
 
 .stat-label {
-  font-size: 12px;
-  opacity: 0.8;
+  font-size: 0.75rem;
+  opacity: 0.85;
+  margin-top: 4px;
 }
 
 .main-content {
   flex: 1;
-  overflow-y: auto;
-  padding-bottom: 80px;
+  padding: 20px 0 40px;
+}
+
+.content-container {
+  max-width: 800px;
+  margin: 0 auto;
+  padding: 0 20px;
+}
+
+.content-card {
+  background: white;
+  border-radius: 16px;
+  padding: 20px;
+  margin-bottom: 20px;
+  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
+  transition: transform 0.2s ease, box-shadow 0.2s ease;
+
+  &:hover {
+    transform: translateY(-2px);
+    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
+  }
+}
+
+.card-title {
+  margin: 0 0 15px;
+  font-size: 1.1rem;
+  font-weight: 600;
+  color: #333;
+}
+
+.tags-container {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 8px;
+}
+
+.tag {
+  padding: 6px 12px;
+  border-radius: 20px;
+  font-size: 0.75rem;
+  cursor: pointer;
+  transition: all 0.2s ease;
+  color: white;
+  font-weight: 500;
+
+  &:hover {
+    transform: scale(1.05);
+    opacity: 0.9;
+  }
+
+  &.tag-fashion {
+    background: #ff6b6b;
+  }
+
+  &.tag-eco {
+    background: #4ecdc4;
+  }
+
+  &.tag-minimal {
+    background: #45b7d1;
+  }
+
+  &.tag-vintage {
+    background: #96ceb4;
+  }
+}
+
+.ranking-list {
+  display: flex;
+  flex-direction: column;
+  gap: 12px;
+}
+
+.ranking-item {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 12px;
+  background: #f8f9fa;
+  border-radius: 12px;
+  transition: background 0.2s ease;
+
+  &:hover {
+    background: #e9ecef;
+  }
+}
+
+.ranking-info {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+}
+
+.rank-avatar {
+  width: 40px;
+  height: 40px;
+  border-radius: 50%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  color: white;
+  font-weight: bold;
+  font-size: 1rem;
+
+  &.rank-1 {
+    background: linear-gradient(45deg, #ff6b6b, #ffa726);
+  }
+
+  &.rank-2 {
+    background: linear-gradient(45deg, #4ecdc4, #44a08d);
+  }
+
+  &.rank-3 {
+    background: linear-gradient(45deg, #667eea, #764ba2);
+  }
+}
+
+.ranking-details {
+  .designer-name {
+    font-weight: 600;
+    font-size: 0.875rem;
+    margin-bottom: 2px;
+  color: #333;
+  }
+
+  .designer-likes {
+    font-size: 0.75rem;
+    color: #666;
+  }
+}
+
+.rank-crown, .rank-medal {
+  font-size: 1.25rem;
+}
+
+.works-grid {
+  display: grid;
+  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
+  gap: 12px;
+}
+
+.work-item {
+  border-radius: 12px;
+  height: 120px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 2.5rem;
+  cursor: pointer;
+  transition: all 0.3s ease;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+
+  &:hover {
+    transform: translateY(-3px);
+    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
+  }
+
+  &.work-1 {
+    background: linear-gradient(45deg, #a8edea 0%, #fed6e3 100%);
+  }
+
+  &.work-2 {
+    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
+  }
+}
+
+/* 响应式设计 */
+@media (max-width: 600px) {
+  .community-header {
+    padding: 20px 15px;
+
+    h1 {
+      font-size: 1.8rem;
+    }
+  }
+
+  .community-stats {
+    margin: 20px auto 0;
+    padding: 10px 0;
+  }
+
+  .stat-number {
+    font-size: 1.5rem;
+  }
+
+  .content-container {
+    padding: 0 15px;
+  }
+
+  .works-grid {
+    grid-template-columns: 1fr;
+  }
 }

+ 27 - 2
cloth-dit-web/src/modules/cloth/color/page/pages-community/pages-community/pages-community.ts

@@ -9,17 +9,42 @@ import { Component } from '@angular/core';
 export class PagesCommunity {
   likeWork(event: Event) {
     const element = event.target as HTMLElement;
+    
+    // 添加点击动画
     element.style.transform = 'scale(0.95)';
+    element.style.opacity = '0.8';
+    
     setTimeout(() => {
       element.style.transform = 'scale(1)';
+      element.style.opacity = '1';
     }, 150);
     
     this.showNotification('点赞成功', '感谢你的支持!');
   }
 
   private showNotification(title: string, message: string) {
-    // 在这里实现通知逻辑
+    // 在实际应用中,这里可以调用通知服务
     console.log(`${title}: ${message}`);
-    // 在实际应用中,你会使用通知服务或组件
+    
+    // 简单实现一个临时提示
+    const notification = document.createElement('div');
+    notification.style.position = 'fixed';
+    notification.style.bottom = '20px';
+    notification.style.left = '50%';
+    notification.style.transform = 'translateX(-50%)';
+    notification.style.backgroundColor = '#4CAF50';
+    notification.style.color = 'white';
+    notification.style.padding = '12px 24px';
+    notification.style.borderRadius = '4px';
+    notification.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
+    notification.style.zIndex = '1000';
+    notification.style.animation = 'fadeIn 0.3s, fadeOut 0.3s 2.7s';
+    notification.textContent = `${title}: ${message}`;
+    
+    document.body.appendChild(notification);
+    
+    setTimeout(() => {
+      document.body.removeChild(notification);
+    }, 3000);
   }
 }