chatDetail.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="container">
  3. <view class="chat-box">
  4. <view class="header-box">
  5. <view class="icon-box">
  6. <cover-image class="icon" :src="`${FILE_URL}/chat-icon/${chat.type}.png`"></cover-image>
  7. </view>
  8. <view class="title-box">
  9. {{chat.title}}
  10. </view>
  11. </view>
  12. <view class="main-box">
  13. {{chat.content}}
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script setup>
  19. import { ref } from 'vue'
  20. import { onLoad } from '@dcloudio/uni-app'
  21. import { detail } from '@/api/chat.js'
  22. import configService from '@/utils/baseurl.js'
  23. const FILE_URL = configService.FILE_URL;
  24. const chatId = ref()
  25. const chatTitle = ref('')
  26. const chat = ref({
  27. id: '1',
  28. title: '课程提醒',
  29. content: '尊敬的用户,您预约2023年8月16日《广州市存量房网……》直播课堂已经开始,请及时观看!',
  30. createTime: '8/16',
  31. })
  32. onLoad((load) => {
  33. chatId.value = load.id
  34. detail(chatId.value).then(res => {
  35. if (res && res.message === 'success') {
  36. chat.value = res.data
  37. }
  38. })
  39. chatTitle.value = load.title
  40. uni.setNavigationBarTitle({
  41. title: chatTitle.value
  42. })
  43. })
  44. </script>
  45. <style lang="scss" scoped>
  46. .container {
  47. height: 100vh;
  48. width: 100vw;
  49. background-color: $uni-bg-color;
  50. padding: 0 40rpx;
  51. .chat-box {
  52. padding: 20rpx;
  53. background-color: $uni-text-color-inverse;
  54. margin-bottom: 30rpx;
  55. border-radius: $uni-card-border-radius;
  56. &:active {
  57. background-color: $uni-bg-color-hover;
  58. }
  59. .header-box {
  60. display: flex;
  61. align-items: center;
  62. margin-bottom: 10rpx;
  63. .icon-box {
  64. width: 50rpx;
  65. .icon {
  66. width: 35rpx;
  67. height: 35rpx;
  68. }
  69. }
  70. .title-box {
  71. font-size: $uni-title-font-size-2;
  72. font-weight: bolder;
  73. }
  74. }
  75. .main-box {
  76. padding: 10rpx;
  77. padding-bottom: 0;
  78. font-size: $uni-font-size-1;
  79. font-weight: bold;
  80. line-height: 40rpx;
  81. }
  82. }
  83. }
  84. </style>