Browse Source

feat: tab1 home page & new tab4

0210331 5 months ago
parent
commit
2ce881f020

+ 67 - 12
src/app/tab1/tab1.page.html

@@ -1,17 +1,72 @@
-<ion-header [translucent]="true">
+<ion-header>
   <ion-toolbar>
-    <ion-title>
-      Tab 1
-    </ion-title>
+    <ion-buttons slot="start" style="flex: 0 0 85%;">
+      <ion-searchbar placeholder="搜索"></ion-searchbar>
+    </ion-buttons>
+    <ion-buttons slot="end" style="flex: 0 0 15%;">
+      <ion-button>
+        <ion-icon slot="icon-only" name="mail"></ion-icon>
+      </ion-button>
+      <ion-button>
+        <ion-icon slot="icon-only" name="server-sharp"></ion-icon>
+      </ion-button>
+    </ion-buttons>
   </ion-toolbar>
 </ion-header>
 
-<ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">Tab 1</ion-title>
-    </ion-toolbar>
-  </ion-header>
+<ion-content>
+  <ion-segment>
+    <ion-segment-button value="follow">关注</ion-segment-button>
+    <ion-segment-button value="discover">发现</ion-segment-button>
+    <ion-segment-button value="activity">活动</ion-segment-button>
+  </ion-segment>
+  
+  <div class="filter-area">
+    <ion-row>
+      <ion-col size="4" *ngFor="let item of filterItems">
+        <ion-card>
+          <ion-card-content>{{item}}</ion-card-content>
+        </ion-card>
+      </ion-col>
+    </ion-row>
+  </div>
+  
+  <div class="friend-circles">
+    <!-- Repeat the following structure for each friend circle card -->
+    <ion-card>
+      <ion-card-header>
+        <ion-card-title>朋友圈的一句话</ion-card-title>
+      </ion-card-header>
+      <ion-card-content>
+        <p>客户id</p>
+      </ion-card-content>
+    </ion-card>
 
-  <app-explore-container name="Tab 1 page"></app-explore-container>
-</ion-content>
+    <ion-card>
+      <ion-card-header>
+        <ion-card-title>朋友圈的一句话</ion-card-title>
+      </ion-card-header>
+      <ion-card-content>
+        <p>客户id</p>
+      </ion-card-content>
+    </ion-card>
+
+    <ion-card>
+      <ion-card-header>
+        <ion-card-title>朋友圈的一句话</ion-card-title>
+      </ion-card-header>
+      <ion-card-content>
+        <p>客户id</p>
+      </ion-card-content>
+    </ion-card>
+
+    <ion-card>
+      <ion-card-header>
+        <ion-card-title>朋友圈的一句话</ion-card-title>
+      </ion-card-header>
+      <ion-card-content>
+        <p>客户id</p>
+      </ion-card-content>
+    </ion-card>
+  </div>
+</ion-content>

+ 50 - 0
src/app/tab1/tab1.page.scss

@@ -0,0 +1,50 @@
+.filter-area {
+    ion-card {
+      border-radius: 10px;
+      ion-card-content {
+        text-align: center;
+      }
+    }
+  }
+  
+  .friend-circles {
+    display: flex;
+    flex-wrap: wrap;
+    
+    ion-card {
+      width: 45%; /* 设置卡片宽度为45% */
+      margin: 5px; /* 设置卡片之间的间距 */
+      border-radius: 10px; /* 设置卡片的圆角 */
+      height: 200px; /* 设置卡片的高度 */
+      display: flex;
+      flex-direction: column;
+      
+      ion-card-content {
+        height: 80%; /* 图片占80%的高度 */
+        img {
+          width: 100%;
+          height: 100%;
+          object-fit: cover; /* 图片填充方式为覆盖 */
+          border-top-left-radius: 10px; /* 图片的左上角圆角 */
+          border-top-right-radius: 10px; /* 图片的右上角圆角 */
+        }
+      }
+      
+      ion-card-header {
+        height: 20%; /* 下方文字占20%的高度 */
+        ion-card-title {
+          font-size: 14px;
+          font-weight: bold;
+        }
+        ion-card-subtitle {
+          font-size: 12px;
+          color: gray;
+        }
+      }
+    }
+  }
+  ion-searchbar {
+    --border-radius: 30px; /* 设置搜索框的圆角大小 */
+    --background: #f4f2f2; /* 设置搜索框的背景色 */
+    --placeholder-color: #999; /* 设置搜索框的占位符颜色 */
+  }

+ 3 - 3
src/app/tab1/tab1.page.ts

@@ -3,10 +3,10 @@ import { Component } from '@angular/core';
 @Component({
   selector: 'app-tab1',
   templateUrl: 'tab1.page.html',
-  styleUrls: ['tab1.page.scss']
+  styleUrls: ['tab1.page.scss'],
 })
 export class Tab1Page {
+  filterItems: string[] = ['跟练', '同城', '晒奖牌', '运动经验', '饮食经验', '蜕变记录', '跑步打卡', '饮食打卡'];
 
   constructor() {}
-
-}
+}

+ 16 - 0
src/app/tab4/tab4-routing.module.ts

@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+import { Tab4Page } from './tab4.page';
+
+const routes: Routes = [
+  {
+    path: '',
+    component: Tab4Page,
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule]
+})
+export class Tab3PageRoutingModule {}

+ 20 - 0
src/app/tab4/tab4.module.ts

@@ -0,0 +1,20 @@
+import { IonicModule } from '@ionic/angular';
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { Tab4Page } from './tab4.page';
+import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
+
+import { Tab3PageRoutingModule } from './tab4-routing.module';
+
+@NgModule({
+  imports: [
+    IonicModule,
+    CommonModule,
+    FormsModule,
+    ExploreContainerComponentModule,
+    Tab3PageRoutingModule
+  ],
+  declarations: [Tab4Page]
+})
+export class Tab4PageModule {}

+ 17 - 0
src/app/tab4/tab4.page.html

@@ -0,0 +1,17 @@
+<ion-header [translucent]="true">
+  <ion-toolbar>
+    <ion-title>
+      Tab 4
+    </ion-title>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content [fullscreen]="true">
+  <ion-header collapse="condense">
+    <ion-toolbar>
+      <ion-title size="large">Tab 4</ion-title>
+    </ion-toolbar>
+  </ion-header>
+
+  <app-explore-container name="Tab 4 page"></app-explore-container>
+</ion-content>

+ 0 - 0
src/app/tab4/tab4.page.scss


+ 26 - 0
src/app/tab4/tab4.page.spec.ts

@@ -0,0 +1,26 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
+
+import { Tab4Page } from './tab4.page';
+
+describe('Tab3Page', () => {
+  let component: Tab4Page;
+  let fixture: ComponentFixture<Tab4Page>;
+
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [Tab4Page],
+      imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(Tab4Page);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 12 - 0
src/app/tab4/tab4.page.ts

@@ -0,0 +1,12 @@
+import { Component } from '@angular/core';
+
+@Component({
+  selector: 'app-tab4',
+  templateUrl: 'tab4.page.html',
+  styleUrls: ['tab4.page.scss']
+})
+export class Tab4Page {
+
+  constructor() {}
+
+}

+ 4 - 0
src/app/tabs/tabs-routing.module.ts

@@ -19,6 +19,10 @@ const routes: Routes = [
         path: 'tab3',
         loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule)
       },
+      {
+        path: 'tab4',
+        loadChildren: () => import('../tab4/tab4.module').then(m => m.Tab4PageModule)
+      },
       {
         path: '',
         redirectTo: '/tabs/tab1',

+ 11 - 6
src/app/tabs/tabs.page.html

@@ -2,18 +2,23 @@
 
   <ion-tab-bar slot="bottom">
     <ion-tab-button tab="tab1" href="/tabs/tab1">
-      <ion-icon aria-hidden="true" name="triangle"></ion-icon>
-      <ion-label>Tab 1</ion-label>
+      <ion-icon aria-hidden="true" name="home"></ion-icon>
+      <ion-label>首页</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab2" href="/tabs/tab2">
-      <ion-icon aria-hidden="true" name="ellipse"></ion-icon>
-      <ion-label>Tab 2</ion-label>
+      <ion-icon name="bulb-sharp"></ion-icon>
+      <ion-label>课程</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab3" href="/tabs/tab3">
-      <ion-icon aria-hidden="true" name="square"></ion-icon>
-      <ion-label>Tab 3</ion-label>
+      <ion-icon name="calendar-sharp"></ion-icon>
+      <ion-label>规划</ion-label>
+    </ion-tab-button>
+
+    <ion-tab-button tab="tab4" href="/tabs/tab4">
+      <ion-icon name="person-sharp"></ion-icon>
+      <ion-label>我的</ion-label>
     </ion-tab-button>
   </ion-tab-bar>