page-evaluate.component.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Component, OnInit } from '@angular/core';
  2. import { Router } from '@angular/router';
  3. import { IonicModule } from '@ionic/angular'; // 导入 IonicModule
  4. import { addIcons } from 'ionicons';
  5. import { chevronBack } from 'ionicons/icons';
  6. import { EditRatingStarComponent } from '../edit-rating-star/edit-rating-star.component';
  7. addIcons({chevronBack});
  8. @Component({
  9. selector: 'app-page-evaluate',
  10. templateUrl: './page-evaluate.component.html',
  11. styleUrls: ['./page-evaluate.component.scss'],
  12. standalone: true,
  13. imports: [IonicModule,EditRatingStarComponent],
  14. })
  15. export class PageEvaluateComponent implements OnInit {
  16. ngOnInit() {}
  17. constructor(private router: Router) {}
  18. // 返回按钮点击事件
  19. goBack() {
  20. this.router.navigate(['tabs/tab3']);
  21. }
  22. submitEvaluation() {
  23. // 处理评价提交逻辑
  24. console.log('发表评价');
  25. // 这里可以添加您希望执行的代码,例如将评价发送到服务器
  26. }
  27. //星星打分
  28. currentScore: number = 0; // 初始分值
  29. handleScoreChange(newScore: number) {
  30. this.currentScore = newScore;
  31. console.log('新分值:', newScore); // 处理分值变化
  32. }
  33. getScoreDescription(score: number): string {
  34. switch (score) {
  35. case 1:
  36. return '很差';
  37. case 2:
  38. return '差';
  39. case 3:
  40. return '一般';
  41. case 4:
  42. return '还不错';
  43. case 5:
  44. return '很满意';
  45. default:
  46. return ''; // 默认返回空字符串
  47. }
  48. }
  49. alertButtons = ['退出'];
  50. }