0210329 8 сар өмнө
parent
commit
285cdda73c
5 өөрчлөгдсөн 295 нэмэгдсэн , 0 устгасан
  1. 20 0
      tab1.module.ts
  2. 102 0
      tab1.page.html
  3. 121 0
      tab1.page.scss
  4. 27 0
      tab1.page.spec.ts
  5. 25 0
      tab1.page.ts

+ 20 - 0
tab1.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 { Tab1Page } from './tab1.page';
+import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
+
+import { Tab1PageRoutingModule } from './tab1-routing.module';
+
+@NgModule({
+  imports: [
+    IonicModule,
+    CommonModule,
+    FormsModule,
+    ExploreContainerComponentModule,
+    Tab1PageRoutingModule
+  ],
+  declarations: [Tab1Page]
+})
+export class Tab1PageModule {}

+ 102 - 0
tab1.page.html

@@ -0,0 +1,102 @@
+<ion-header [translucent]="true">
+</ion-header>
+
+<ion-content [fullscreen]="true">
+  <ion-header collapse="condense">
+    <ion-toolbar>
+      <ion-searchbar placeholder="搜索"></ion-searchbar>
+    </ion-toolbar>
+  </ion-header>
+    
+  <!-- 方框 -->
+  <ion-card (click)="openModal()">
+    <ion-card-content>
+      <ion-grid>
+        <ion-row>
+          <ion-col size="3">
+            <div class="info-box">初始</div>
+            <div class="info-value">--KG</div>
+          </ion-col>
+          <ion-col size="3">
+            <div class="info-box">当前</div>
+            <div class="info-value">--KG</div>
+          </ion-col>
+          <ion-col size="3">
+            <div class="info-box">目标</div>
+            <div class="info-value">--KG</div>
+          </ion-col>
+          <ion-col size="3">
+            <div class="info-box">赏金</div>
+            <div class="info-value">--元</div>
+          </ion-col>
+        </ion-row>
+      </ion-grid>
+    </ion-card-content>
+  </ion-card>
+
+  <!-- 3D效果的圆 -->
+  <div class="wave-container">
+    <div class="wave-circle">
+      <div class="wave">
+        <div class="wave-inner"></div>
+      </div>
+    </div>
+  </div>
+
+  <!-- 每日小习惯 -->
+  <div class="daily-habit">
+    <div class="daily-habit-line"></div>
+    <div class="daily-habit-text">每日小习惯</div>
+  </div>
+
+  
+   <!-- 大方框 -->
+  <ion-card>
+    <ion-card-content>
+      <ion-grid>
+        <ion-row>
+          <ion-col size="3">
+            <button class="habit-button" (click)="toggleButtonColor('运动')">
+              <ion-icon name="dumbbell"></ion-icon>
+              <div class="habit-label">运动</div>
+            </button>
+          </ion-col>
+          <ion-col size="3">
+            <ion-button shape="round" class="habit-button" (click)="toggleButtonColor('少吃')">
+              <ion-icon name="nutrition"></ion-icon>
+              <div>少吃</div>
+            </ion-button>
+          </ion-col>
+          <ion-col size="3">
+            <ion-button shape="round" class="habit-button" (click)="toggleButtonColor('喝水')">
+              <ion-icon name="water"></ion-icon>
+              <div>喝水</div>
+            </ion-button>
+          </ion-col>
+          <ion-col size="3">
+            <ion-button shape="round" class="habit-button" (click)="toggleButtonColor('吃蔬菜')">
+              <ion-icon name="leaf"></ion-icon>
+              <div>吃蔬菜</div>
+            </ion-button>
+          </ion-col>
+        </ion-row>
+        <ion-row>
+          <ion-col size="3">
+            <ion-button shape="round" class="habit-button" (click)="toggleButtonColor('水果')">
+              <ion-icon name="apple"></ion-icon>
+              <div>水果</div>
+            </ion-button>
+          </ion-col>
+          <ion-col size="3">
+            <ion-button shape="round" class="habit-button" (click)="toggleButtonColor('经常站立')">
+              <ion-icon name="walk"></ion-icon>
+              <div>经常站立</div>
+            </ion-button>
+          </ion-col>
+        </ion-row>
+      </ion-grid>
+    </ion-card-content>
+  </ion-card>
+</ion-content>
+  
+

+ 121 - 0
tab1.page.scss

@@ -0,0 +1,121 @@
+ion-searchbar {
+  --background: #f4f4f4;
+  margin: 10px;
+  border-radius: 10px;
+}
+
+.info-box {
+  text-align: center;
+  font-weight: bold;
+}
+
+.info-value {
+  text-align: center;
+  margin-top: 10px;
+  font-size: 1.2em;
+  color: #888;
+}
+
+.wave-container {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  height: 200px;
+  position: relative;
+  margin: 20px 0;
+}
+
+.wave-circle {
+  width: 150px;
+  height: 150px;
+  background: radial-gradient(circle at 50% 50%, #6ec1e4, #378ab7);
+  border-radius: 50%;
+  position: relative;
+  overflow: hidden;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
+}
+
+.wave {
+  position: absolute;
+  width: 200%;
+  height: 200%;
+  top: -75%;
+  left: -50%;
+  background: rgba(255, 255, 255, 0.4);
+  border-radius: 45%;
+  animation: wave 4s infinite linear;
+}
+
+@keyframes wave {
+  0% {
+    transform: rotate(0deg);
+  }
+  100% {
+    transform: rotate(360deg);
+  }
+}
+
+// 每日小习惯
+.daily-habit {
+  display: flex;
+  align-items: center;
+  margin: 20px 0;
+}
+
+.daily-habit-line {
+  width: 5px;
+  height: 20px;
+  background-color: green;
+  margin-right: 10px;
+}
+
+.daily-habit-text {
+  font-size: 1.2em;
+  color: #666;
+}
+
+.habit-button {
+  width: 60px;
+  height: 60px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 0.8em;
+  margin: 10px 0;
+  background-color: #fff;
+  border: 2px solid #000;
+  border-radius: 50%;
+  transition: background-color 0.3s;
+}
+
+.habit-button ion-icon {
+  font-size: 1.5em;
+}
+
+.habit-label {
+  text-align: center;
+  font-size: 0.8em;
+  color: #666;
+  margin-top: 5px;
+}
+
+.habit-button.blue {
+  background-color: #007bff; /* 蓝色背景 */
+}
+
+.habit-button.white {
+  background-color: #fff; /* 白色背景 */
+}
+
+// .habit-button div {
+//   font-size: 0.8em;
+//   margin-top: 5px;
+// }
+
+.habit-button:active {
+  transform: scale(0.9);
+  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+}

+ 27 - 0
tab1.page.spec.ts

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

+ 25 - 0
tab1.page.ts

@@ -0,0 +1,25 @@
+import { Component } from '@angular/core';
+import { AlertController } from '@ionic/angular';
+@Component({
+  selector: 'app-tab1',
+  templateUrl: 'tab1.page.html',
+  styleUrls: ['tab1.page.scss']
+})
+export class Tab1Page {
+
+  constructor(private alertController: AlertController) {}
+
+  async openModal() {
+    const alert = await this.alertController.create({
+      header: '提示',
+      message: '弹窗了',
+      buttons: ['确定']
+    });
+    await alert.present();
+  }
+  blueColor:boolean=false;
+  toggleButtonColor(habit:string){
+    this.blueColor=!this.blueColor;
+  }
+}
+