project-bottom-card.component.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { Component, Input, Output, EventEmitter } from '@angular/core';
  2. import { CommonModule } from '@angular/common';
  3. import { FmodeObject } from 'fmode-ng/parse';
  4. @Component({
  5. selector: 'app-project-bottom-card',
  6. standalone: true,
  7. imports: [CommonModule],
  8. templateUrl: './project-bottom-card.component.html',
  9. styleUrls: ['./project-bottom-card.component.scss']
  10. })
  11. export class ProjectBottomCardComponent {
  12. @Input() project: FmodeObject | null = null;
  13. @Input() groupChat: FmodeObject | null = null;
  14. @Input() currentUser: FmodeObject | null = null;
  15. @Input() cid: string = '';
  16. @Input() loading: boolean = false;
  17. @Input() fileCount: number = 0;
  18. @Input() memberCount: number = 0;
  19. @Input() issueCount: number = 0;
  20. @Output() showFiles = new EventEmitter<void>();
  21. @Output() showMembers = new EventEmitter<void>();
  22. @Output() showIssues = new EventEmitter<void>();
  23. constructor() {}
  24. onShowFiles() {
  25. this.showFiles.emit();
  26. }
  27. onShowMembers() {
  28. this.showMembers.emit();
  29. }
  30. onShowIssues() {
  31. this.showIssues.emit();
  32. }
  33. getProjectTitle(): string {
  34. return this.project?.get('title') || '项目详情';
  35. }
  36. getProjectStatus(): string {
  37. return this.project?.get('status') || '未知';
  38. }
  39. getStatusClass(): string {
  40. const status = this.getProjectStatus();
  41. switch (status) {
  42. case '进行中':
  43. return 'status-active';
  44. case '已完成':
  45. return 'status-completed';
  46. case '已暂停':
  47. return 'status-paused';
  48. default:
  49. return 'status-default';
  50. }
  51. }
  52. }