topic-detail.component.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <app-page-header
  2. *ngIf="!isEmbedded"
  3. [title]="headerTitle"
  4. [description]="topic?.description || ''"
  5. backLabel="返回主题探索"
  6. [backRoute]="backRoute"
  7. [crumbs]="crumbs">
  8. </app-page-header>
  9. <section class="topic-detail" *ngIf="topic as item; else detailState">
  10. <div class="entity-layout" [class.is-embedded]="isEmbedded">
  11. <div class="entity-main">
  12. <header class="detail-header" *ngIf="isEmbedded">
  13. <div>
  14. <div class="detail-title-row">
  15. <h2>{{ item.label }}</h2>
  16. <span class="availability-status" [class.limited]="item.availability === 'limited'">{{ item.availabilityLabel }}</span>
  17. </div>
  18. <p>{{ item.description }}</p>
  19. </div>
  20. <button class="icon-button" type="button" title="关闭详情" aria-label="关闭详情" (click)="closeDetail()">
  21. <lucide-icon name="x" [size]="16"></lucide-icon>
  22. </button>
  23. </header>
  24. <div class="detail-metrics">
  25. <div><span>证据</span><strong>{{ item.evidenceCount }}</strong><small>条原始评价</small></div>
  26. <div><span>影响商品</span><strong>{{ item.productCount }}</strong><small>去重商品</small></div>
  27. <div><span>有效正文占比</span><strong>{{ item.share | percent:'1.0-1' }}</strong><small>当前来源范围</small></div>
  28. <div><span>置信等级</span><strong class="text-value">{{ item.confidenceLabel }}</strong><small>{{ item.availabilityReason }}</small></div>
  29. </div>
  30. <section class="detail-section trend-section">
  31. <div class="section-heading">
  32. <div><h3>主题趋势</h3><p>{{ trendSummary(item) }}</p></div>
  33. <span>{{ item.datedEvidenceCount }} / {{ item.evidenceCount }} 条有日期</span>
  34. </div>
  35. <div class="trend-chart" *ngIf="item.trend.length; else noTrend">
  36. <div class="trend-column" *ngFor="let point of item.trend; trackBy: trackTrend" [title]="point.date + ' · ' + point.count + ' 条'">
  37. <span>{{ point.count }}</span>
  38. <div class="bar-track"><i [style.height.%]="trendBarHeight(point)"></i></div>
  39. <small>{{ point.label }}</small>
  40. </div>
  41. </div>
  42. <ng-template #noTrend>
  43. <div class="inline-empty">原始评价没有有效日期,趋势保持不可用。</div>
  44. </ng-template>
  45. </section>
  46. <section class="detail-section">
  47. <div class="section-heading">
  48. <div><h3>影响商品</h3><p>按同主题证据数量排序</p></div>
  49. <span>{{ item.productCount }} 个</span>
  50. </div>
  51. <div class="product-list" *ngIf="item.products.length; else noProducts">
  52. <div class="product-row" *ngFor="let product of item.products | slice:0:6">
  53. <span class="product-image">
  54. <img *ngIf="product.imageUrl" [src]="product.imageUrl" [alt]="product.title">
  55. <lucide-icon *ngIf="!product.imageUrl" name="package" [size]="17"></lucide-icon>
  56. </span>
  57. <div><strong>{{ product.title }}</strong><span>{{ product.brand || product.productId }} · {{ productRoleLabel(product.role) }}</span></div>
  58. <b>{{ product.evidenceCount }} 条</b>
  59. </div>
  60. </div>
  61. <ng-template #noProducts><div class="inline-empty">当前证据尚未匹配到商品主数据。</div></ng-template>
  62. </section>
  63. <section class="detail-section evidence-section">
  64. <div class="section-heading">
  65. <div><h3>原始证据</h3><p>点击评价进入反馈收件箱继续审阅</p></div>
  66. <button type="button" class="text-button" [disabled]="!item.evidence.length" (click)="openAllEvidence()">
  67. 全部证据 <lucide-icon name="arrow-up-right" [size]="14"></lucide-icon>
  68. </button>
  69. </div>
  70. <div class="evidence-list" *ngIf="item.evidence.length; else noEvidence">
  71. <button class="evidence-row" type="button" *ngFor="let evidence of item.evidence | slice:0:8; trackBy: trackEvidence"
  72. (click)="openEvidence(evidence)">
  73. <div class="evidence-meta">
  74. <span [class]="'sentiment-' + evidence.sentiment">{{ sentimentLabel(evidence) }}</span>
  75. <span>{{ evidence.rating > 0 ? evidence.rating + ' 星' : '无星级' }}</span>
  76. <span>{{ evidence.sourceLabel }}</span>
  77. <time>{{ evidence.dateLabel }}</time>
  78. </div>
  79. <p>{{ evidence.content }}</p>
  80. <div class="evidence-footer"><span>{{ evidence.productTitle }}</span><lucide-icon name="chevron-right" [size]="15"></lucide-icon></div>
  81. </button>
  82. </div>
  83. <ng-template #noEvidence><div class="inline-empty">当前主题没有可跳转的原始评价证据。</div></ng-template>
  84. </section>
  85. </div>
  86. <aside class="topic-properties">
  87. <h3>属性</h3>
  88. <app-entity-property-list [items]="propertyItems"></app-entity-property-list>
  89. </aside>
  90. </div>
  91. </section>
  92. <ng-template #detailState>
  93. <section class="detail-state">
  94. <span class="spinner" *ngIf="loading"></span>
  95. <strong>{{ loading ? '正在加载主题详情' : errorMessage ? '详情加载失败' : '未找到主题' }}</strong>
  96. <p>{{ errorMessage || (!loading ? '该主题不在当前真实数据范围内。' : '') }}</p>
  97. </section>
  98. </ng-template>