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="`https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/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. const chatId = ref()
  23. const chatTitle = ref('')
  24. const chat = ref({
  25. id: '1',
  26. title: '课程提醒',
  27. content: '尊敬的用户,您预约2023年8月16日《广州市存量房网……》直播课堂已经开始,请及时观看!',
  28. type: 'jiaoyu',
  29. time: '8/16',
  30. })
  31. onLoad((load) => {
  32. chatId.value = load.id
  33. detail(chatId.value).then(res => {
  34. if (res && res.message === 'success') {
  35. chat.value = res.data
  36. }
  37. })
  38. chatTitle.value = load.title
  39. uni.setNavigationBarTitle({
  40. title: chatTitle.value
  41. })
  42. })
  43. </script>
  44. <style lang="scss" scoped>
  45. .container {
  46. height: 100vh;
  47. width: 100vw;
  48. background-color: $uni-bg-color;
  49. padding: 0 40rpx;
  50. .chat-box {
  51. padding: 20rpx;
  52. background-color: $uni-text-color-inverse;
  53. margin-bottom: 30rpx;
  54. border-radius: $uni-card-border-radius;
  55. &:active {
  56. background-color: $uni-bg-color-hover;
  57. }
  58. .header-box {
  59. display: flex;
  60. align-items: center;
  61. margin-bottom: 10rpx;
  62. .icon-box {
  63. width: 50rpx;
  64. .icon {
  65. width: 35rpx;
  66. height: 35rpx;
  67. }
  68. }
  69. .title-box {
  70. font-size: $uni-title-font-size-2;
  71. font-weight: bolder;
  72. }
  73. }
  74. .main-box {
  75. padding: 10rpx;
  76. padding-bottom: 0;
  77. font-size: $uni-font-size-1;
  78. font-weight: bold;
  79. line-height: 40rpx;
  80. }
  81. }
  82. }
  83. </style>