123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import { Router } from '@angular/router';
- import { Component, ElementRef, OnInit, ViewChild,ChangeDetectorRef } from '@angular/core';
- import Swiper from 'swiper';
- import Parse from 'parse';
- import { FilmService } from 'src/modules/server/firm.serve';
- import { BookService } from 'src/modules/server/book.serve';
- import { MusicService } from 'src/modules/server/music.serve';
- import { GameService } from 'src/modules/server/game.serve';
- import { OutdoorService } from 'src/modules/server/outdoor.serve';
- @Component({
- selector: 'app-tab1',
- templateUrl: 'tab1.page.html',
- styleUrls: ['tab1.page.scss']
- })
- export class Tab1Page implements OnInit {
-
-
- @ViewChild("slide1Comp") slide1Comp:ElementRef |undefined
- constructor(private cdr: ChangeDetectorRef,
- private filmService: FilmService,
- private router: Router,
- private bookService: BookService,
- private musicService: MusicService,
- private gameService: GameService,
- private outdoorService: OutdoorService,
- ) { }
-
- ngOnInit() {
-
- setTimeout(() => {
- this.initSwiper();
- }, 500);
- }
-
- slide1:Swiper|undefined
- initSwiper(){
- console.log(this.slide1Comp)
- this.slide1 = new Swiper(this.slide1Comp?.nativeElement, {
- loop:true,
- autoplay:{
- delay:200,
- },
- mousewheel: {
- forceToAxis: true,
- },
- pagination:{
- el:".swiper-pagination",
- clickable:true
- }
- });
- setInterval(()=>{
- this.slide1?.slideNext();
- },1000)
- }
-
- filmsearchResults: any[] = [];
- booksearchResults: any[] = [];
- gamesearchResults: any[] = [];
- musicsearchResults: any[] = [];
- outdoorsearchResults: any[] = [];
- searchTerm: string = '';
- searchName: string = '';
- async search(){
- const queryParams = {
- name: this.searchTerm
-
- };
-
- this.filmsearchResults=await this.filmService.searchFilm(queryParams);
- this.booksearchResults=await this.bookService.getBooks(queryParams);
- this.musicsearchResults=await this.musicService.getMusics(queryParams);
- this.gamesearchResults=await this.gameService.getGames(queryParams);
- this.outdoorsearchResults=await this.outdoorService.getOutdoors(queryParams);
-
- const keywords = ['影', '视', '影片'];
- if (keywords.some(keyword => this.searchTerm.toLowerCase().includes(keyword))) {
- this.router.navigate(['/feiwu/fiml']);
- }
- const keywords2 = ['书', '小说'];
- if (keywords2.some(keyword2 => this.searchTerm.toLowerCase().includes(keyword2))) {
- this.router.navigate(['/feiwu/book']);
- }
- const keywords3 = ['音乐', '歌', '曲','听'];
- if (keywords3.some(keyword3 => this.searchTerm.toLowerCase().includes(keyword3))) {
- this.router.navigate(['/feiwu/music']);
- }
- const keywords4 = ['游戏', '玩'];
- if (keywords4.some(keyword4 => this.searchTerm.toLowerCase().includes(keyword4))) {
- this.router.navigate(['/feiwu/game']);
- }
- const keywords5 = ['运动', '户外', '锻炼','健'];
- if (keywords5.some(keyword5=> this.searchTerm.toLowerCase().includes(keyword5))) {
- this.router.navigate(['/feiwu/outdoor']);
- }
-
- if(!this.searchTerm)
- {
- this.filmsearchResults = []
- this.booksearchResults = []
- this.gamesearchResults = []
- this.musicsearchResults = []
- this.outdoorsearchResults =[]
- }
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- function searchContent(event: Event | undefined, CustomEvent: { new <T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>; prototype: CustomEvent; }) {
- throw new Error('Function not implemented.');
- }
-
|