attention-detail.component.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Component } from '@angular/core';
  2. // 引入服务
  3. import { ActivatedRoute } from '@angular/router';
  4. // 引入Parse第三方库
  5. import * as Parse from "parse"
  6. (Parse as any).serverURL = "http://web2023.fmode.cn:9999/parse"
  7. Parse.initialize("dev")
  8. @Component({
  9. selector: 'app-attention-detail',
  10. templateUrl: './attention-detail.component.html',
  11. styleUrls: ['./attention-detail.component.scss']
  12. })
  13. export class AttentionDetailComponent {
  14. //添加评论
  15. comments: string[] = [];
  16. comment: string = '';
  17. currentDate = new Date();
  18. addComment() {
  19. console.log(this.comment)
  20. if (this.comment.trim() !== '') {
  21. this.comments.push(this.comment);
  22. this.comment = '';
  23. }
  24. }
  25. attention: Parse.Object | undefined;
  26. constructor(private router: ActivatedRoute) {
  27. this.router.queryParams.subscribe(param => {
  28. this.getRoleInfoById(param["id"])
  29. })
  30. }
  31. async getRoleInfoById(id: string) {
  32. let query = new Parse.Query("PetAttention")
  33. this.attention = await query.get(id)
  34. }
  35. }