forward.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  3. <view>
  4. <cu-custom bgImage="/static/bg.png" :isBack="true">
  5. <template v-slot:content>
  6. <text class="text-black">{{ displayName }}的聊天记录</text>
  7. </template>
  8. </cu-custom>
  9. <view v-if="message" class='cu-chat' style="height: calc(100vh - 45px);padding-top: 10px">
  10. <view v-for='(item,index) in message.extend?.messageList' :id="`z-paging-${index}`" :key="item.id">
  11. <view class='cu-item' :id="'m-'+index">
  12. <view class='flex flex-direction'>
  13. <image class='cu-avatar radius' :src='userStore.getMapUser(item.fromId)?.avatar'></image>
  14. </view>
  15. <view class='main' style='display: block;'>
  16. <view class='text-gray text-sm padding-bottom-sm'>
  17. <text>{{ userStore.getMapUser(item!.fromId)!.name }}</text>
  18. <view class='margin-left inline'>
  19. <Time :time='item.timestamp'></Time>
  20. </view>
  21. </view>
  22. <view class='content shadow'>
  23. <message-view :item='item'></message-view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup lang="ts">
  32. import {computed, ref} from 'vue';
  33. import MessageView from '@/components/MessageView.vue';
  34. import Time from '@/components/Time.vue';
  35. import CuCustom from '@/colorui/components/cu-custom.vue';
  36. import {useUserStore} from "@/store/userStore";
  37. import {useMessageStore} from "@/store/messageStore";
  38. import {storeToRefs} from "pinia";
  39. import ChatType from "@/utils/ChatType";
  40. import Auth from "@/api/Auth";
  41. const fontValue=ref(Auth.getfontSize());
  42. const userStore = useUserStore();
  43. const {message} = storeToRefs(useMessageStore())
  44. const displayName = ref()
  45. const message0 = message.value.extend?.messageList![0];
  46. const fromId = message0?.fromId
  47. const toId = message0?.chatId
  48. if(message0?.type === ChatType.FRIEND && fromId && toId){
  49. displayName.value = computed(
  50. () => userStore.getMapUser(fromId)?.name + '和' + userStore.getMapUser(toId)?.name
  51. )
  52. }else {
  53. displayName.value = '群聊'
  54. }
  55. </script>
  56. <style scoped>
  57. .inline {
  58. display: inline-block;
  59. }
  60. .cu-chat {
  61. background-color: #eeeeee;
  62. }
  63. .cu-chat .cu-item {
  64. padding: 0 0.625rem;
  65. }
  66. </style>