ConversationDetail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <script setup lang="ts">
  2. import type { Conversation } from '@tencentcloud/lite-chat'
  3. import type { UserInfoItemVO } from '~/types/api'
  4. import CloseListIcon from '~/assets/icons/im/close-list.svg'
  5. import ArrowSvg from '~/assets/icons/mine/arrow-temp.svg'
  6. type Props = {
  7. conversation: Conversation | null
  8. name: string
  9. avatar: string
  10. bizUserInfo?: UserInfoItemVO
  11. }
  12. const props = withDefaults(defineProps<Props>(), {
  13. bizUserInfo: undefined,
  14. })
  15. const emit = defineEmits<{
  16. (e: 'back' | 'close'): void
  17. }>()
  18. </script>
  19. <template>
  20. <div class="im-detail">
  21. <header class="im-detail__header">
  22. <div class="im-detail__header-left">
  23. <button
  24. class="im-detail__back"
  25. type="button"
  26. aria-label="back"
  27. @click="emit('back')"
  28. >
  29. <ArrowSvg class="im-detail__back-icon" />
  30. </button>
  31. <div class="im-detail__avatar">
  32. <img
  33. class="im-detail__avatar-img"
  34. :src="props.avatar"
  35. alt=""
  36. loading="lazy"
  37. >
  38. </div>
  39. <div class="im-detail__title">
  40. <p class="im-detail__name">
  41. {{ props.name || 'Conversation' }}
  42. </p>
  43. <p class="im-detail__status">
  44. online
  45. </p>
  46. </div>
  47. </div>
  48. <div class="im-detail__header-right">
  49. <!-- Icon can be empty (placeholder) -->
  50. <button
  51. class="im-detail__close"
  52. type="button"
  53. aria-label="close"
  54. @click="emit('close')"
  55. >
  56. <CloseListIcon />
  57. </button>
  58. </div>
  59. </header>
  60. <main class="im-detail__content">
  61. <div class="im-detail__placeholder">
  62. 消息内容待接入
  63. </div>
  64. </main>
  65. <footer class="im-detail__composer">
  66. <div class="im-detail__input">
  67. <input
  68. class="im-detail__input-el"
  69. type="text"
  70. inputmode="text"
  71. autocomplete="off"
  72. placeholder="发送消息"
  73. >
  74. </div>
  75. <button
  76. class="im-detail__send"
  77. type="button"
  78. aria-label="send"
  79. />
  80. </footer>
  81. </div>
  82. </template>
  83. <style scoped lang="scss">
  84. .im-detail {
  85. height: 100vh;
  86. display: flex;
  87. flex-direction: column;
  88. background: #F1F2F5;
  89. }
  90. .im-detail__header {
  91. background: #fff;
  92. padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  93. display: flex;
  94. align-items: center;
  95. justify-content: space-between;
  96. }
  97. .im-detail__header-left {
  98. display: flex;
  99. align-items: center;
  100. gap: 12px;
  101. min-width: 0;
  102. }
  103. .im-detail__back {
  104. border: none;
  105. background: transparent;
  106. padding: 0;
  107. display: inline-flex;
  108. align-items: center;
  109. justify-content: center;
  110. cursor: pointer;
  111. -webkit-tap-highlight-color: transparent;
  112. opacity: 0.9;
  113. flex: 0 0 auto;
  114. }
  115. .im-detail__back-icon {
  116. @include size(24px);
  117. transform: rotate(180deg);
  118. }
  119. .im-detail__avatar {
  120. @include size(34px);
  121. border-radius: 999px;
  122. overflow: hidden;
  123. background: #eee;
  124. flex: 0 0 auto;
  125. }
  126. .im-detail__avatar-img {
  127. @include size(100%);
  128. object-fit: cover;
  129. object-position: 50% 50%;
  130. display: block;
  131. }
  132. .im-detail__title {
  133. min-width: 0;
  134. display: flex;
  135. flex-direction: column;
  136. justify-content: center;
  137. gap: 2px;
  138. }
  139. .im-detail__name {
  140. margin: 0;
  141. font-family: var(--font-title, 'Poppins', sans-serif);
  142. font-weight: 600;
  143. font-size: 16px;
  144. line-height: 17px;
  145. color: #1D2129;
  146. max-width: 60vw;
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. white-space: nowrap;
  150. }
  151. .im-detail__status {
  152. margin: 0;
  153. font-family: 'Inter', sans-serif;
  154. font-weight: 400;
  155. font-size: 11px;
  156. line-height: 14px;
  157. color: #86909C;
  158. }
  159. .im-detail__header-right {
  160. display: flex;
  161. align-items: center;
  162. gap: 8px;
  163. flex: 0 0 auto;
  164. }
  165. .im-detail__close {
  166. border: none;
  167. background: transparent;
  168. padding: 0;
  169. display: inline-flex;
  170. align-items: center;
  171. justify-content: center;
  172. cursor: pointer;
  173. -webkit-tap-highlight-color: transparent;
  174. }
  175. .im-detail__content {
  176. flex: 1 1 auto;
  177. min-height: 0;
  178. overflow: auto;
  179. padding: 16px;
  180. }
  181. .im-detail__placeholder {
  182. width: fit-content;
  183. max-width: 100%;
  184. margin: 0 auto;
  185. padding: 4px 8px;
  186. border-radius: 999px;
  187. background: #fff;
  188. font-size: 11px;
  189. line-height: 14px;
  190. color: #86909C;
  191. }
  192. .im-detail__composer {
  193. background: #fff;
  194. padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
  195. display: flex;
  196. align-items: center;
  197. gap: 10px;
  198. }
  199. .im-detail__input {
  200. flex: 1 1 auto;
  201. min-width: 0;
  202. background: #F2F3F5;
  203. border-radius: 999px;
  204. padding: 8px 10px;
  205. min-height: 36px;
  206. display: flex;
  207. align-items: center;
  208. }
  209. .im-detail__input-el {
  210. width: 100%;
  211. border: none;
  212. outline: none;
  213. background: transparent;
  214. font-family: 'Inter', sans-serif;
  215. font-weight: 400;
  216. font-size: 14px;
  217. line-height: 20px;
  218. color: #1D2129;
  219. &::placeholder {
  220. color: #86909C;
  221. }
  222. }
  223. .im-detail__send {
  224. @include size(40px);
  225. border: none;
  226. background: #15E5E2;
  227. border-radius: 20px;
  228. flex: 0 0 auto;
  229. cursor: pointer;
  230. -webkit-tap-highlight-color: transparent;
  231. }
  232. </style>