2 次代码提交 f545612b93 ... 5632473698

作者 SHA1 备注 提交日期
  5230240 5632473698 Merge branch 'master' of http://git.fmode.cn:3000/5230275/FilmTraceExplore 2 月之前
  5230240 8f72b17f6d 创建search页面和几个页面搜索按钮的跳转 2 月之前

+ 5 - 0
src/app/app-routing.module.ts

@@ -12,10 +12,15 @@ const routes: Routes = [
   },{
     path: 'smovies',
     loadChildren: () => import('./tab2/smovies/smovies.module').then( m => m.SMoviesPageModule)
+  },
+  {
+    path: 'search',
+    loadChildren: () => import('./search/search.module').then( m => m.SearchPageModule)
   },{
     path: 'user',
     loadChildren: () => import('../modules/user/user.module').then(m => m.UserModule)
   },
+
 ];
 @NgModule({
   imports: [

+ 2 - 5
src/app/place/place.page.ts

@@ -1,5 +1,4 @@
 import { Component, OnInit } from '@angular/core';
-
 import { Router } from '@angular/router';
 import { NavController } from '@ionic/angular';
 @Component({
@@ -9,12 +8,10 @@ import { NavController } from '@ionic/angular';
 })
 export class PlacePage implements OnInit {
 
-  constructor(private navCtrl: NavController) {}
+  constructor(private navCtrl: NavController,private router: Router) {}
 
   search() {
-    // this.router.navigate(['/blank-page']); // 替换成你的空白页面路由路径
-    // 导航到空白页面
-    console.log('Navigating to Blank page');
+    this.router.navigate(['/search']); // 替换成你的 setting 页面路由路径
   }
 
   goToBlankPage() {

+ 17 - 0
src/app/search/search-routing.module.ts

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

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

@@ -0,0 +1,20 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { SearchPageRoutingModule } from './search-routing.module';
+
+import { SearchPage } from './search.page';
+
+@NgModule({
+  imports: [
+    CommonModule,
+    FormsModule,
+    IonicModule,
+    SearchPageRoutingModule
+  ],
+  declarations: [SearchPage]
+})
+export class SearchPageModule {}

+ 40 - 0
src/app/search/search.page.html

@@ -0,0 +1,40 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-back-button></ion-back-button>
+    </ion-buttons>
+    <ion-title>搜索</ion-title>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content>
+  <ion-searchbar placeholder="请输入搜索内容">
+    <ion-button slot="end" fill="clear" (click)="search()">
+      <ion-icon name="search"></ion-icon>
+    </ion-button>
+  </ion-searchbar>
+
+  <ion-list>
+    <ion-list-header>大家都在搜</ion-list-header>
+    <ion-item *ngFor="let item of hotSearches">{{ item }}</ion-item>
+  </ion-list>
+  
+  <div class="list-container">
+    <ion-list>
+      <ion-list-header>
+        <ion-row justify-content-between align-items-center>
+          <ion-col size="auto">
+            历史记录
+          </ion-col>
+          <ion-col size="auto">
+            <ion-button color="danger" (click)="deleteAllHistory()">删除所有记录</ion-button>
+          </ion-col>
+        </ion-row>
+      </ion-list-header>
+      <ion-item *ngFor="let item of searchHistory">
+        {{ item }}
+        <ion-icon slot="end" name="trash" (click)="deleteHistoryItem(item)"></ion-icon>
+      </ion-item>
+    </ion-list>
+  </div>
+</ion-content>

+ 31 - 0
src/app/search/search.page.scss

@@ -0,0 +1,31 @@
+ion-list-header {
+    font-weight: bold;
+  }
+  
+  ion-item {
+    cursor: pointer;
+  }
+
+  ion-list-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  
+  ion-list-header ion-button {
+    margin-top: 0;
+  }
+
+  .searchbar-container {
+    margin-bottom: 20px;
+  }
+  
+  .list-container {
+    padding: 0 20px;
+  }
+  
+  ion-list-header ion-row {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }

+ 17 - 0
src/app/search/search.page.spec.ts

@@ -0,0 +1,17 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { SearchPage } from './search.page';
+
+describe('SearchPage', () => {
+  let component: SearchPage;
+  let fixture: ComponentFixture<SearchPage>;
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(SearchPage);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 29 - 0
src/app/search/search.page.ts

@@ -0,0 +1,29 @@
+import { Component, OnInit } from '@angular/core';
+import { NavController } from '@ionic/angular';
+import { Router } from '@angular/router';
+
+@Component({
+  selector: 'app-search',
+  templateUrl: './search.page.html',
+  styleUrls: ['./search.page.scss'],
+})
+
+export class SearchPage {
+  hotSearches: string[] = ['JavaScript', 'Angular', 'Ionic', 'TypeScript'];
+  searchHistory: string[] = ['React', 'Vue', 'Node.js'];
+
+  search() {
+    // 实现搜索功能的逻辑
+  }
+
+  deleteHistoryItem(item: string) {
+    const index = this.searchHistory.indexOf(item);
+    if (index > -1) {
+      this.searchHistory.splice(index, 1);
+    }
+  }
+
+  deleteAllHistory() {
+    this.searchHistory = [];
+  }
+}

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

@@ -15,9 +15,7 @@ export class Tab1Page implements OnInit {
   constructor(private router: Router) {}
 
   search() {
-    // this.router.navigate(['/blank-page']); // 替换成你的空白页面路由路径
-    // 导航到空白页面
-    console.log('Navigating to Blank page');
+    this.router.navigate(['/search']); // 替换成你的 setting 页面路由路径
   }
 
   navigateToBannerPage(banner: string) {

+ 1 - 3
src/app/tab2/tab2.page.ts

@@ -24,8 +24,6 @@ export class Tab2Page {
 
 
   search() {
-    // this.router.navigate(['/blank-page']); // 替换成你的空白页面路由路径
-    // 导航到空白页面
-    console.log('Navigating to Blank page');
+    this.router.navigate(['/search']); // 替换成你的 setting 页面路由路径
   }
 }

+ 2 - 4
src/app/tab3/tab3.page.ts

@@ -9,12 +9,10 @@ import { NavController } from '@ionic/angular';
   styleUrls: ['tab3.page.scss']
 })
 export class Tab3Page {
-  constructor(private navCtrl: NavController) {}
+  constructor(private navCtrl: NavController,private router: Router) {}
 
   search() {
-    // this.router.navigate(['/blank-page']); // 替换成你的空白页面路由路径
-    // 导航到空白页面
-    console.log('Navigating to Blank page');
+    this.router.navigate(['/search']); // 替换成你的 setting 页面路由路径
   }
 
   goToBlankPage() {