import { Component } from '@angular/core'; import { ToastController } from '@ionic/angular'; import { UserService } from 'src/modules/user/service-user/user.service'; import * as Parse from "parse" @Component({ selector: 'app-me', templateUrl: './me.component.html', styleUrls: ['./me.component.scss'] }) export class MeComponent { isReminderExpanded = false; toggleReminder() { this.isReminderExpanded = !this.isReminderExpanded; } currentUser: Parse.User | undefined constructor( private toastCtrl: ToastController, public userServ: UserService ) { this.currentUser = Parse.User.current(); } async ngOnInit() { this.myAttentionList = await this.gteAttentionData() this.myScienceList = await this.getScienceData() this.myRecommendList = await this.getRecommendDate() } cate: string = "关注" myRecommendList: Array = [] async getRecommendDate() { let query = new Parse.Query("HrmRecommend"); query.equalTo("user", Parse.User.current()?.toPointer()) query.include("user") let list = await query.find(); return list } myAttentionList: Array = [] async gteAttentionData() { let query = new Parse.Query("HrmAttention"); query.equalTo("user", Parse.User.current()?.toPointer()) query.include("user") let list = await query.find(); return list } myScienceList: Array = [] async getScienceData() { let query = new Parse.Query("HrmScience"); query.equalTo("user", Parse.User.current()?.toPointer()) query.include("user") let list = await query.find(); return list } async logout() { await Parse.User.logOut() this.currentUser = undefined let toast = await this.toastCtrl.create({ message: "登出成功", position: "top", duration: 500 }) toast.present(); } }