tt0101 hace 4 días
padre
commit
7a074b10cd
Se han modificado 1 ficheros con 186 adiciones y 78 borrados
  1. 186 78
      src/components/TabBar.vue

+ 186 - 78
src/components/TabBar.vue

@@ -9,11 +9,9 @@
         :class="{ active: currentPath === tab.path }"
       >
         <div class="tab-icon-wrapper">
-          <img
-            :src="getIcon(tab)"
-            class="tab-icon"
-            alt=""
-          />
+          <div class="tab-icon" :class="getIconClass(tab)">
+            <i :class="tab.iconClass"></i>
+          </div>
           <div class="active-indicator" v-if="currentPath === tab.path"></div>
         </div>
         <span class="tab-title">{{ tab.title }}</span>
@@ -35,28 +33,26 @@ export default {
         {
           path: '/home',
           title: '首页',
-          icon: 'index0.png',
-          iconActive: 'index1.png'
+          iconClass: 'icon-home',
+          color: '#667eea'
         },
         {
           path: '/mall',
           title: '退休计划',
-          icon: 'hang0.png',
-          iconActive: 'hang1.png'
+          iconClass: 'icon-plan',
+          color: '#51cf66'
         },
         {
-          // path: '/dynamic', //邀请百姓
-          // path: '/China', // 红旗医疗
-          path: '/Medical', // 红旗原始股
+          path: '/Medical',
           title: '红旗基金',
-          icon: 'gang0.png',
-          iconActive: 'gang1.png'
+          iconClass: 'icon-fund',
+          color: '#ff6b6b'
         },
         {
           path: '/profile',
           title: '我的',
-          icon: 'mine0.png',
-          iconActive: 'mine1.png'
+          iconClass: 'icon-profile',
+          color: '#ffd43b'
         }
       ]
     }
@@ -66,8 +62,11 @@ export default {
       this.currentPath = path
       this.$router.push(path)
     },
-    getIcon(tab) {
-      return require(`@/assets/${this.currentPath === tab.path ? tab.iconActive : tab.icon}`)
+    getIconClass(tab) {
+      return {
+        'active': this.currentPath === tab.path,
+        [tab.iconClass]: true
+      }
     }
   },
   created() {
@@ -87,9 +86,9 @@ export default {
   bottom: 0;
   left: 0;
   right: 0;
-  height: 70px;
+  height: 75px;
   z-index: 999;
-  padding: 0 10px 10px;
+  padding: 0 15px 15px;
   box-sizing: border-box;
 }
 
@@ -100,12 +99,12 @@ export default {
   right: 0;
   bottom: 0;
   background: linear-gradient(145deg, #ffffff, #f8f9fa);
-  border-radius: 20px 20px 0 0;
+  border-radius: 25px 25px 0 0;
   box-shadow: 
-    0 -10px 30px rgba(0, 0, 0, 0.15),
-    0 -5px 15px rgba(0, 0, 0, 0.1),
+    0 -12px 35px rgba(0, 0, 0, 0.15),
+    0 -6px 18px rgba(0, 0, 0, 0.1),
     inset 0 1px 0 rgba(255, 255, 255, 0.8);
-  backdrop-filter: blur(10px);
+  backdrop-filter: blur(15px);
   
   // 顶部高光效果
   &::before {
@@ -114,10 +113,10 @@ export default {
     top: 0;
     left: 50%;
     transform: translateX(-50%);
-    width: 60%;
-    height: 2px;
-    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
-    border-radius: 0 0 20px 20px;
+    width: 80px;
+    height: 4px;
+    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.4), transparent);
+    border-radius: 0 0 25px 25px;
   }
 }
 
@@ -128,7 +127,7 @@ export default {
   display: flex;
   align-items: center;
   justify-content: space-around;
-  padding: 8px 0;
+  padding: 12px 0;
 }
 
 .tab-item {
@@ -138,67 +137,90 @@ export default {
   align-items: center;
   justify-content: center;
   cursor: pointer;
-  transition: all 0.3s ease;
-  padding: 8px 4px;
-  border-radius: 12px;
+  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+  padding: 10px 8px;
+  border-radius: 16px;
   position: relative;
   
   &:hover {
-    background: rgba(102, 126, 234, 0.05);
-    transform: translateY(-2px);
+    background: rgba(102, 126, 234, 0.06);
+    transform: translateY(-3px);
   }
   
   &.active {
-    .tab-icon-wrapper {
-      .tab-icon {
-        transform: scale(1.1);
-        filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
-      }
-    }
-    
     .tab-title {
       color: #667eea;
-      font-weight: 600;
+      font-weight: 700;
       text-shadow: 0 1px 3px rgba(102, 126, 234, 0.2);
+      transform: scale(1.05);
     }
   }
 }
 
 .tab-icon-wrapper {
   position: relative;
-  margin-bottom: 4px;
+  margin-bottom: 6px;
   transition: all 0.3s ease;
 }
 
 .tab-icon {
-  width: 28px;
-  height: 28px;
+  width: 32px;
+  height: 32px;
+  border-radius: 12px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
   transition: all 0.3s ease;
-  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
+  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
+  box-shadow: 
+    0 4px 8px rgba(0, 0, 0, 0.1),
+    inset 0 1px 0 rgba(255, 255, 255, 0.5);
+  
+  i {
+    font-style: normal;
+    font-size: 18px;
+    font-weight: bold;
+    color: #666;
+    transition: all 0.3s ease;
+  }
+  
+  &.active {
+    background: linear-gradient(145deg, #667eea, #764ba2);
+    box-shadow: 
+      0 6px 16px rgba(102, 126, 234, 0.3),
+      inset 0 1px 0 rgba(255, 255, 255, 0.2);
+    transform: scale(1.1);
+    
+    i {
+      color: white;
+      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
+    }
+  }
 }
 
 .active-indicator {
   position: absolute;
-  top: -3px;
+  top: -4px;
   left: 50%;
   transform: translateX(-50%);
-  width: 6px;
-  height: 6px;
+  width: 8px;
+  height: 8px;
   background: linear-gradient(145deg, #667eea, #764ba2);
   border-radius: 50%;
   box-shadow: 
-    0 2px 6px rgba(102, 126, 234, 0.4),
-    0 0 0 2px rgba(255, 255, 255, 0.8);
+    0 3px 8px rgba(102, 126, 234, 0.4),
+    0 0 0 3px rgba(255, 255, 255, 0.9);
   animation: pulse 2s infinite;
 }
 
 .tab-title {
   font-size: 12px;
   color: #666;
-  transition: all 0.3s ease;
-  font-weight: 500;
+  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+  font-weight: 600;
   line-height: 1.2;
   text-align: center;
+  letter-spacing: 0.5px;
 }
 
 // 脉搏动画
@@ -208,8 +230,8 @@ export default {
     opacity: 1;
   }
   50% {
-    transform: translateX(-50%) scale(1.2);
-    opacity: 0.8;
+    transform: translateX(-50%) scale(1.3);
+    opacity: 0.7;
   }
   100% {
     transform: translateX(-50%) scale(1);
@@ -217,49 +239,60 @@ export default {
   }
 }
 
-// 响应式设计
-@media (max-width: 375px) {
-  .tab-bar {
-    height: 65px;
-    padding: 0 8px 8px;
+// 首页图标
+.icon-home {
+  i::before {
+    content: '🏠';
   }
   
-  .tab-icon {
-    width: 24px;
-    height: 24px;
+  &.active {
+    background: linear-gradient(145deg, #667eea, #764ba2);
+  }
+}
+
+// 退休计划图标
+.icon-plan {
+  i::before {
+    content: '📊';
   }
   
-  .tab-title {
-    font-size: 11px;
+  &.active {
+    background: linear-gradient(145deg, #51cf66, #40c057);
   }
 }
 
-@media (min-width: 414px) {
-  .tab-bar {
-    height: 75px;
-    padding: 0 15px 15px;
+// 红旗基金图标
+.icon-fund {
+  i::before {
+    content: '💰';
   }
   
-  .tab-icon {
-    width: 32px;
-    height: 32px;
+  &.active {
+    background: linear-gradient(145deg, #ff6b6b, #e74c3c);
+  }
+}
+
+// 我的图标
+.icon-profile {
+  i::before {
+    content: '👤';
   }
   
-  .tab-title {
-    font-size: 13px;
+  &.active {
+    background: linear-gradient(145deg, #ffd43b, #fab005);
   }
 }
 
-// 增加点击反馈
+// 点击反馈动画
 .tab-item:active {
-  transform: translateY(0);
+  transform: translateY(-1px) scale(0.98);
   
-  .tab-icon-wrapper {
+  .tab-icon {
     transform: scale(0.95);
   }
 }
 
-// 为不同标签页添加特殊效果
+// 为不同标签页的激活指示器添加特殊颜色
 .tab-item:nth-child(1).active {
   .active-indicator {
     background: linear-gradient(145deg, #667eea, #764ba2);
@@ -283,4 +316,79 @@ export default {
     background: linear-gradient(145deg, #ffd43b, #fab005);
   }
 }
+
+// 响应式设计
+@media (max-width: 375px) {
+  .tab-bar {
+    height: 68px;
+    padding: 0 10px 10px;
+  }
+  
+  .tab-icon {
+    width: 28px;
+    height: 28px;
+    border-radius: 10px;
+    
+    i {
+      font-size: 16px;
+    }
+  }
+  
+  .tab-title {
+    font-size: 11px;
+  }
+  
+  .active-indicator {
+    width: 6px;
+    height: 6px;
+  }
+}
+
+@media (min-width: 414px) {
+  .tab-bar {
+    height: 80px;
+    padding: 0 20px 20px;
+  }
+  
+  .tab-icon {
+    width: 36px;
+    height: 36px;
+    border-radius: 14px;
+    
+    i {
+      font-size: 20px;
+    }
+  }
+  
+  .tab-title {
+    font-size: 13px;
+  }
+  
+  .active-indicator {
+    width: 10px;
+    height: 10px;
+  }
+}
+
+// 添加微妙的进入动画
+.tab-item {
+  animation: slideUp 0.5s ease-out;
+}
+
+@keyframes slideUp {
+  from {
+    opacity: 0;
+    transform: translateY(20px);
+  }
+  to {
+    opacity: 1;
+    transform: translateY(0);
+  }
+}
+
+// 为每个标签项添加延迟动画
+.tab-item:nth-child(1) { animation-delay: 0.1s; }
+.tab-item:nth-child(2) { animation-delay: 0.2s; }
+.tab-item:nth-child(3) { animation-delay: 0.3s; }
+.tab-item:nth-child(4) { animation-delay: 0.4s; }
 </style>