chat.component.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <ion-header [translucent]="true" class="header">
  2. <ion-toolbar class="toolbar">
  3. <ion-buttons slot="start" (click)="onBack()">
  4. <ion-icon
  5. name="chevron-back-outline"
  6. style="width: 6.4vw; height: 6.4vw; color: #000000"
  7. ></ion-icon>
  8. </ion-buttons>
  9. <ion-title class="title">{{ targetUser?.get('nickname') }}</ion-title>
  10. <ion-buttons slot="end" id="option-trigger">
  11. <ion-icon name="ellipsis-horizontal-outline"></ion-icon>
  12. </ion-buttons>
  13. </ion-toolbar>
  14. </ion-header>
  15. <ion-content
  16. [scrollEvents]="true"
  17. [fullscreen]="true"
  18. (ionScrollStart)="handleScrollStart()"
  19. (ionScroll)="handleScroll($any($event))"
  20. (ionScrollEnd)="handleScrollEnd()"
  21. class="content"
  22. (click)="changeShowEmoji(true)"
  23. >
  24. <ion-popover
  25. trigger="option-trigger"
  26. [dismissOnSelect]="true"
  27. triggerAction="click"
  28. >
  29. <ng-template>
  30. <ion-list>
  31. <ion-item class="clear" [button]="true" [detail]="false">
  32. <ion-icon name="person-remove-outline"></ion-icon>加入黑名单</ion-item
  33. >
  34. <ion-item class="clear" [button]="true" [detail]="false"
  35. ><ion-icon name="star-outline"></ion-icon>添加关注</ion-item
  36. >
  37. <ion-item class="clear" [button]="true" [detail]="false"
  38. ><ion-icon name="trash-outline"></ion-icon>删除聊天记录</ion-item
  39. >
  40. </ion-list>
  41. </ng-template>
  42. </ion-popover>
  43. <div id="container" style="overflow: hidden">
  44. @for (item of list.data; track $index) {
  45. <div class="clearfix message-box">
  46. @if ($index == 0 || item.create_time - list.data[$index-1].create_time >
  47. 60) {
  48. <div class="time-box">
  49. @if (item.istoday) {
  50. <div class="time">{{ item.timeStamp | date : "HH:mm" }}</div>
  51. }@else {
  52. <div class="time">
  53. {{ item.timeStamp | date : "yyyy年MM月dd日 HH:mm" }}
  54. </div>
  55. }
  56. </div>
  57. }
  58. <!-- 他人信息 -->
  59. @if (!item.is_self) {
  60. <div class="msg-bloak no_self">
  61. <img class="avatar fl" mode="widthFix" src="{{ item.avatar }}" />
  62. <!-- 文字消息 msg_type == 1 || text -->
  63. @if (item.msg_type == 1 || item.msg_type == 'text') {
  64. <div class="text-item fl text-item_left">
  65. <p>{{ item.content }}</p>
  66. </div>
  67. }
  68. <!-- 图片消息 msg_type == 2 || img -->
  69. @else if(item.msg_type == 2 || item.msg_type == 'img' || item.msg_type
  70. == 'image') {
  71. <img
  72. class="img-item fl"
  73. [src]="item.content"
  74. (click)="predivimg(item.content)"
  75. />
  76. } @else if (item.msg_type == 3) {
  77. <div class="text-item fl text-item_left">
  78. <p>{{ item.content }}</p>
  79. </div>
  80. }
  81. </div>
  82. } @else {
  83. <div class="msg-bloak self">
  84. <!-- 自己信息 -->
  85. @if (item.msg_type == 1 || item.msg_type == 'text') {
  86. <div class="text-item fr text-item_right">
  87. <p>{{ item.content }}</p>
  88. </div>
  89. } @if (item.msg_type == 2 || item.msg_type == 'img' || item.msg_type ==
  90. 'image') {
  91. <img
  92. class="img-item fr"
  93. src="{{ item.content }}"
  94. (click)="predivimg(item.content)"
  95. bindtap="predivimg"
  96. data-src="{{ item.content }}"
  97. />
  98. } @if (item.msg_type == 3) {
  99. <div class="text-item fr text-item_right">
  100. <p>{{ item.content }}</p>
  101. </div>
  102. }
  103. <img class="avatar fr" [src]="item.avatar" />
  104. </div>
  105. }
  106. </div>
  107. }
  108. </div>
  109. </ion-content>
  110. <ion-footer>
  111. <ion-toolbar class="footer-tool">
  112. <ion-input
  113. slot="start"
  114. labelPlacement="stacked"
  115. [clearInput]="true"
  116. placeholder="和ta说点什么"
  117. [(ngModel)]="text"
  118. (keydown)="comfirmText($event)"
  119. >
  120. </ion-input>
  121. <div class="tools" slot="end">
  122. <ion-icon name="happy-outline" (click)="changeShowEmoji()"></ion-icon>
  123. <ion-icon name="videocam-outline"></ion-icon>
  124. <ion-icon name="gift-outline" (click)="isOpen = true"></ion-icon>
  125. <span class="splice">|</span>
  126. <!-- <div class="send">发送</div> -->
  127. <ion-button
  128. class="send"
  129. fill="outline"
  130. size="small"
  131. [disabled]="text.length == 0"
  132. (click)="comfirmText()"
  133. >发送</ion-button
  134. >
  135. </div>
  136. </ion-toolbar>
  137. <div [style.height]="height + 'px'"></div>
  138. @if (showEmoji) {
  139. <div class="b-1px-b"></div>
  140. } @if (showEmoji) {
  141. <div class="emoji-content">
  142. <div class="emoji-box">
  143. @for (item of emojis; track $index) {
  144. <div class="emoji-item">
  145. <div class="emoji-img" (click)="emojiChoose(item.char)">
  146. {{ item.char }}
  147. </div>
  148. </div>
  149. }
  150. <div class="emoji-item__del" (click)="delEmoji()">
  151. <img
  152. class="emoji-img"
  153. src="https://common.file.futurestack.cn/images/wxapp/card_multi/images//chat/del.svg"
  154. />
  155. </div>
  156. </div>
  157. </div>
  158. }
  159. </ion-footer>
  160. <ion-modal
  161. (click)="isOpen = false"
  162. (didDismiss)="dismiss($event)"
  163. [isOpen]="isOpen"
  164. [initialBreakpoint]="0.5"
  165. [breakpoints]="[0, 0.5, 1]"
  166. >
  167. <ng-template>
  168. <div class="block">敬请期待</div>
  169. </ng-template>
  170. </ion-modal>