detail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="message-detail-page">
  3. <!-- 导航栏 -->
  4. <Navbar title="消息详情" fixed border> </Navbar>
  5. <!-- 消息详情内容 -->
  6. <view class="message-content">
  7. <!-- 消息头部 -->
  8. <view class="msg-header">
  9. <!-- <view class="msg-sender">
  10. <uni-icons
  11. :type="currentMsg.type === 'system' ? 'notification' : 'chat'"
  12. size="24"
  13. color="#36D"
  14. class="sender-icon"
  15. ></uni-icons>
  16. <text class="sender-name">{{ getSenderName(currentMsg.type) }}</text>
  17. </view> -->
  18. <text class="msg-time">{{
  19. useGlobal().$format(currentMsg.indate)
  20. }}</text>
  21. <!-- <view class="read-tag" v-if="!currentMsg.read">未读</view> -->
  22. </view>
  23. <!-- 消息标题 -->
  24. <view class="msg-title">{{ currentMsg.title }}</view>
  25. <!-- 消息正文 -->
  26. <view class="msg-body">
  27. <text class="body-content">{{ currentMsg.content }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import { ref } from "vue";
  34. import Navbar from "@/components/navbar";
  35. import { onLoad } from "@dcloudio/uni-app";
  36. import { useGlobal } from "@/utils";
  37. import { USERS_MESSAGE_DETAIL } from "@/api";
  38. const currentMsg = ref({});
  39. const getDeatil = async (id) => {
  40. const res = await USERS_MESSAGE_DETAIL(id);
  41. currentMsg.value = res.data;
  42. };
  43. onLoad((options) => {
  44. getDeatil(options.id);
  45. });
  46. </script>
  47. <style lang="less" scoped>
  48. .message-detail-page {
  49. min-height: 100vh;
  50. background-color: #f5f7fa;
  51. }
  52. // 消息内容样式
  53. .message-content {
  54. padding: 16px;
  55. background-color: #fff;
  56. margin: 10px;
  57. border-radius: 8px;
  58. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  59. // 消息头部
  60. .msg-header {
  61. padding-bottom: 16px;
  62. border-bottom: 1px solid #f5f5f5;
  63. margin-bottom: 16px;
  64. .msg-sender {
  65. display: flex;
  66. align-items: center;
  67. margin-bottom: 8px;
  68. .sender-icon {
  69. margin-right: 8px;
  70. }
  71. .sender-name {
  72. font-size: 16px;
  73. color: #333;
  74. font-weight: 500;
  75. }
  76. }
  77. .msg-time {
  78. font-size: 12px;
  79. color: #999;
  80. margin-right: 10px;
  81. }
  82. .read-tag {
  83. display: inline-block;
  84. padding: 2px 8px;
  85. background-color: #36d;
  86. color: #fff;
  87. font-size: 12px;
  88. border-radius: 4px;
  89. }
  90. }
  91. // 消息标题
  92. .msg-title {
  93. font-size: 18px;
  94. color: #333;
  95. font-weight: 500;
  96. margin-bottom: 16px;
  97. line-height: 1.5;
  98. }
  99. // 消息正文
  100. .msg-body {
  101. .body-content {
  102. font-size: 16px;
  103. color: #666;
  104. line-height: 1.8;
  105. white-space: pre-line; // 保留换行符
  106. }
  107. }
  108. }
  109. </style>