ranking.component.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Component, OnInit } from '@angular/core';
  2. import { IonicModule } from '@ionic/angular';
  3. import * as Parse from 'parse';
  4. import { NavComponent } from '../../../app/components/nav/nav.component';
  5. import { AiChatService } from '../../../services/aichart.service';
  6. @Component({
  7. selector: 'app-ranking',
  8. templateUrl: './ranking.component.html',
  9. styleUrls: ['./ranking.component.scss'],
  10. standalone: true,
  11. imports: [IonicModule,NavComponent],
  12. })
  13. export class RankingComponent implements OnInit {
  14. user?: Parse.Object = Parse.User.current();
  15. orderList: Array<any> = [];
  16. active: string = 'anchor';
  17. disbable:boolean = true
  18. constructor(
  19. public aiServ: AiChatService
  20. ) {}
  21. async ngOnInit() {
  22. this.orderList = await this.aiServ.getOrderAnchor(null,null,'day')
  23. // console.log(this.orderList);
  24. }
  25. async segmentChanged(e: any) {
  26. let { value } = e.detail;
  27. this.active = value;
  28. console.log(this.active);
  29. // console.log(this.active);
  30. // this.orderList = []
  31. this.orderList = await this.aiServ.getOrderAnchor(this.active,null,'day')
  32. }
  33. async changeTop(e:any, type?:string){
  34. e.cancelBubble = true;
  35. this.orderList = await this.aiServ.getOrderAnchor(this.active,null,type);
  36. }
  37. formatNumber(num1:number,num2:number){
  38. let n = num1 - num2;
  39. return Math.round(n * 100) / 100;
  40. }
  41. }