chat.component.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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">{{
  10. uid
  11. ? targetUser?.get("nickname") ||
  12. targetUser?.get("name") ||
  13. "用户" + targetUser?.id
  14. : "世界频道"
  15. }}</ion-title>
  16. <ion-buttons slot="end" id="option-trigger">
  17. <ion-icon name="ellipsis-horizontal-outline"></ion-icon>
  18. </ion-buttons>
  19. </ion-toolbar>
  20. </ion-header>
  21. <ion-content
  22. [scrollEvents]="true"
  23. [fullscreen]="true"
  24. (ionScrollStart)="handleScrollStart()"
  25. (ionScroll)="handleScroll($any($event))"
  26. (ionScrollEnd)="handleScrollEnd()"
  27. class="content"
  28. (click)="changeShowEmoji(true)"
  29. >
  30. <ion-popover
  31. trigger="option-trigger"
  32. [dismissOnSelect]="true"
  33. triggerAction="click"
  34. >
  35. <ng-template>
  36. <ion-list>
  37. @if (uid) {
  38. <ion-item (click)="onRjects()" class="clear" [button]="true" [detail]="false">
  39. <ion-icon name="person-remove-outline"></ion-icon
  40. >{{ this.isRet?.get('isAward') ? "移除黑名单" : "加入黑名单" }}</ion-item
  41. >
  42. <ion-item class="clear" [button]="true" [detail]="false"
  43. ><ion-icon name="star-outline"></ion-icon>添加关注</ion-item
  44. >
  45. }
  46. <ion-item
  47. class="clear"
  48. [button]="true"
  49. [detail]="false"
  50. (click)="deleteChatLog()"
  51. ><ion-icon name="trash-outline"></ion-icon>删除聊天记录</ion-item
  52. >
  53. </ion-list>
  54. </ng-template>
  55. </ion-popover>
  56. <div #scrollMsg id="scrollMsg" class="scroll">
  57. @for (item of msgServe.messageMapList[channel]; track $index) {
  58. <div class="clearfix message-box">
  59. @if ($index == 0 || item.timestamp -
  60. msgServe.messageMapList[channel][$index-1].timestamp > 600) {
  61. <div class="time-box">
  62. @if (item.istoday) {
  63. <div class="time">{{ item.timestamp | showDate }}</div>
  64. }@else {
  65. <div class="time">
  66. {{ item.timestamp | showDate }}
  67. </div>
  68. }
  69. </div>
  70. }
  71. <!-- 他人信息 -->
  72. @if (!item.is_self) {
  73. <div class="msg-bloak no_self">
  74. <img
  75. class="avatar fl"
  76. (click)="toUrl('user/profile/' + item.publisher)"
  77. mode="widthFix"
  78. src="{{ item.avatar }}"
  79. />
  80. <!-- 文字消息 msg_type == 1 || text -->
  81. @if (item.msg_type == 1 || item.msg_type == 'text') {
  82. <div class="msg-card">
  83. @if(channel == 'global_room'){
  84. <span class="text-item_status">{{
  85. item.name || "用户" + item.publisher
  86. }}</span>
  87. }
  88. <div class="text-item fl text-item_left">
  89. <p>{{ item.content }}</p>
  90. </div>
  91. </div>
  92. }
  93. <!-- 图片消息 msg_type == 2 || img -->
  94. @else if(item.msg_type == 2 || item.msg_type == 'img' || item.msg_type
  95. == 'image') {
  96. <img
  97. class="img-item fl"
  98. [src]="item.content"
  99. (click)="predivimg(item.content)"
  100. />
  101. <div class="text-item fl text-item_left">
  102. <p>{{ item.content }}</p>
  103. </div>
  104. }
  105. </div>
  106. } @else {
  107. <div class="msg-bloak self">
  108. <!-- 自己信息 -->
  109. @if (item.msg_type == 1 || item.msg_type == 'text') {
  110. <div class="text-item fr text-item_right">
  111. <p>{{ item.content }}</p>
  112. </div>
  113. } @if (item.msg_type == 2 || item.msg_type == 'img' || item.msg_type ==
  114. 'image') {
  115. <img
  116. class="img-item fr"
  117. src="{{ item.content }}"
  118. (click)="predivimg(item.content)"
  119. bindtap="predivimg"
  120. data-src="{{ item.content }}"
  121. />
  122. } @if (item.msg_type == 3) {
  123. <div class="text-item fr text-item_right">
  124. <p>{{ item.content }}</p>
  125. </div>
  126. }
  127. <img class="avatar fr" [src]="item.avatar" />
  128. </div>
  129. }
  130. </div>
  131. }
  132. </div>
  133. </ion-content>
  134. <ion-footer>
  135. <ion-toolbar class="footer-tool">
  136. <ion-input
  137. slot="start"
  138. labelPlacement="stacked"
  139. [clearInput]="true"
  140. [placeholder]="!uid && !accServ.userVip?.rights?.['all-chat'] ? '请开通会员享受世界频道畅聊' : '文明发言'"
  141. [(ngModel)]="text"
  142. (keydown)="comfirmText($event)"
  143. [disabled]="!uid && !accServ.userVip?.rights?.['all-chat']"
  144. >
  145. </ion-input>
  146. <div
  147. [ngClass]="{
  148. 'tools-maxwid': uid && profile?.get('identyType') === 'anchor',
  149. tools: true
  150. }"
  151. slot="end"
  152. >
  153. <ion-icon name="happy-outline" (click)="changeShowEmoji()"></ion-icon>
  154. @if (uid && profile?.get("identyType") === 'anchor') {
  155. <ion-icon
  156. name="videocam-outline"
  157. (click)="call.toLiveContact()"
  158. ></ion-icon>
  159. } @if (uid && profile?.get("identyType") === 'anchor') {
  160. <ion-icon name="gift-outline" (click)="gift.openModal()"></ion-icon>
  161. }
  162. <span class="splice">|</span>
  163. <!-- <div class="send">发送</div> -->
  164. <ion-button
  165. class="send"
  166. fill="outline"
  167. size="small"
  168. [disabled]="text.length == 0 || disabled"
  169. (click)="comfirmText()"
  170. >发送</ion-button
  171. >
  172. </div>
  173. </ion-toolbar>
  174. <div [style.height]="height + 'px'"></div>
  175. @if (showEmoji) {
  176. <div class="b-1px-b"></div>
  177. } @if (showEmoji) {
  178. <div class="emoji-content">
  179. <div class="emoji-box">
  180. @for (item of aiServ.emojis; track $index) {
  181. <div class="emoji-item">
  182. <div class="emoji-img" (click)="emojiChoose(item.char)">
  183. {{ item.char }}
  184. </div>
  185. </div>
  186. }
  187. <div class="emoji-item__del" (click)="delEmoji()">
  188. <img
  189. class="emoji-img"
  190. src="https://common.file.futurestack.cn/images/wxapp/card_multi/images//chat/del.svg"
  191. />
  192. </div>
  193. </div>
  194. </div>
  195. }
  196. </ion-footer>
  197. <app-gift-modal
  198. #gift
  199. (sendEmit)="onSendGift()"
  200. [toUid]="this.uid"
  201. ></app-gift-modal>
  202. @if(profile?.id){
  203. <app-call-modal #call [profile]="profile"></app-call-modal>
  204. }