me.component.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { Component } from '@angular/core';
  2. import { ToastController } from '@ionic/angular';
  3. import { UserService } from 'src/modules/user/service-user/user.service';
  4. import * as Parse from "parse"
  5. @Component({
  6. selector: 'app-me',
  7. templateUrl: './me.component.html',
  8. styleUrls: ['./me.component.scss']
  9. })
  10. export class MeComponent {
  11. isReminderExpanded = false;
  12. toggleReminder() {
  13. this.isReminderExpanded = !this.isReminderExpanded;
  14. }
  15. currentUser: Parse.User | undefined
  16. constructor(
  17. private toastCtrl: ToastController,
  18. public userServ: UserService
  19. ) {
  20. this.currentUser = Parse.User.current();
  21. }
  22. async ngOnInit() {
  23. this.myAttentionList = await this.gteAttentionData()
  24. this.myScienceList = await this.getScienceData()
  25. this.myRecommendList = await this.getRecommendDate()
  26. }
  27. cate: string = "关注"
  28. myRecommendList: Array<Parse.Object> = []
  29. async getRecommendDate() {
  30. let query = new Parse.Query("HrmRecommend");
  31. query.equalTo("user", Parse.User.current()?.toPointer())
  32. query.include("user")
  33. let list = await query.find();
  34. return list
  35. }
  36. myAttentionList: Array<Parse.Object> = []
  37. async gteAttentionData() {
  38. let query = new Parse.Query("HrmAttention");
  39. query.equalTo("user", Parse.User.current()?.toPointer())
  40. query.include("user")
  41. let list = await query.find();
  42. return list
  43. }
  44. myScienceList: Array<Parse.Object> = []
  45. async getScienceData() {
  46. let query = new Parse.Query("HrmScience");
  47. query.equalTo("user", Parse.User.current()?.toPointer())
  48. query.include("user")
  49. let list = await query.find();
  50. return list
  51. }
  52. async logout() {
  53. await Parse.User.logOut()
  54. this.currentUser = undefined
  55. let toast = await this.toastCtrl.create({
  56. message: "登出成功",
  57. position: "top",
  58. duration: 500
  59. })
  60. toast.present();
  61. }
  62. }