index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <page-meta root-font-size="system" />
  3. <view class="detail_container">
  4. <uni-card>
  5. <template v-slot:title>
  6. <view class="message_title">
  7. {{ msgInfo.title }}
  8. </view>
  9. </template>
  10. <view class="message_container">
  11. <uni-card :border="false" :is-shadow="false" spacing="0px" margin="0px">
  12. <view class="message_contant">
  13. <u-parse :content="msgInfo.content" :selectable="true" @navigate="parseNavigate">
  14. </u-parse>
  15. </view>
  16. <view class="message_info">
  17. <uni-row :gutter="20">
  18. <uni-col :xs="{ span: 24 }" :sm="{ span: 16, offset: 1 }">
  19. <view class="user">
  20. <text class="user_pre">发布者:</text>
  21. {{ msgInfo.name }}
  22. </view>
  23. </uni-col>
  24. <uni-col :xs="{ span: 24 }" :sm="6">
  25. <view class="time">
  26. 发布时间:{{ msgInfo.sendTime }}
  27. </view>
  28. </uni-col>
  29. </uni-row>
  30. </view>
  31. </uni-card>
  32. </view>
  33. </uni-card>
  34. <uni-card v-if="attachments.length > 0">
  35. <view class="file_list">
  36. <uni-section title="附件" type="line" titleFontSize="1rem"></uni-section>
  37. <view>
  38. <attachment-list :attachments="attachments"></attachment-list>
  39. </view>
  40. </view>
  41. </uni-card>
  42. </view>
  43. <view style="height: 5px; margin-top: 20px;"></view>
  44. </template>
  45. <script setup lang="ts">
  46. import { onLoad } from '@dcloudio/uni-app';
  47. import { onMounted, ref } from 'vue';
  48. import { getNoticeInfo, getMessageInfo } from '@/api/message';
  49. import $tab from '@/plugins/tab';
  50. import uParse from '@/components/gaoyia-parse/parse.vue'
  51. import attachmentList from '@/components/ygoa/attachmentList.vue'
  52. import { useUserStore } from '@/store/user';
  53. const userStore = useUserStore();
  54. const type = ref(-1);
  55. const noticeId = ref('');
  56. const universalId = ref('');
  57. const messageId = ref('');
  58. onLoad((options) => {
  59. if (options.noticeId) {
  60. type.value = 0
  61. noticeId.value = options.noticeId;
  62. } else {
  63. type.value = 1
  64. universalId.value = options.universalId;
  65. messageId.value = options.messageId;
  66. }
  67. })
  68. const msgInfo = ref({})
  69. const attachments = ref([]);//附件
  70. //公告详情
  71. function showNoticeInfo(id) {
  72. const params = {
  73. userId: userStore.user.useId, //当前用户id
  74. noticeId: id
  75. }
  76. getNoticeInfo(params).then(({ returnParams }) => {
  77. // console.log('returnParams', returnParams);
  78. msgInfo.value = {
  79. title: returnParams.title,
  80. sendTime: returnParams.sendTime,
  81. name: returnParams.name,
  82. // content: returnParams.noticeContent,
  83. content: "<p>正文<br><br></p><h1>H1内容</h1><h2>H2内容</h2><h3>H3内容</h3><h4>H4内容</h4><h5>H5内容</h5><a href=\"https://www.douyin.com/user/MS4wLjABAAAAoT36HajHfEPMCVKeiukoxGkYU0k0s0NA5khixKqH5Pk\" target=\"_blank\">链接地址</a><p style=\"text-align: left;\">链接图片<img src=\"https://50006360.s21i.huaweicloudsite.cn/4/ABUIABAEGAAg6PTOtwYohbu8vAIw8AM4gAI.png\" alt=\"链接图片\" data-href=\"\" style=\"\"></p><blockquote>引用</blockquote><p><strong>加粗</strong></p><p><u>下划线</u></p><p><em>倾斜</em></p><p><u><strong>加粗+下划线</strong></u></p><p><em><strong>加粗+倾斜</strong></em></p><p><u><em>下划线+倾斜</em></u></p><p><s>删除线</s></p><p><code>行内代码</code></p><p><sup>上标</sup></p><p><sub>下标</sub></p><p><s><code>行内代码+删除线</code></s></p><p><s><u><em><code><strong>加粗+下划线+倾斜+删除线+行内代码</strong></code></em></u></s></p><p><span style=\"color: rgb(225, 60, 57);\">红色文字</span></p><p><span style=\"color: rgb(255, 236, 61);\">黄色文字</span></p><p><span style=\"color: rgb(66, 144, 247);\"><s><u><em><code><strong>蓝色文字+加粗+下划线+倾斜+删除线+行内代码</strong></code></em></u></s></span></p><p><span style=\"color: rgb(0, 0, 0); background-color: rgb(255,255,0);\">黄色背景</span></p><p><span style=\"color: rgb(9, 109, 217); background-color: rgb(255,0,0);\"><s><u><em><code><strong>红色背景+蓝色文字+加粗+下划线+倾斜+删除线+行内代码</strong></code></em></u></s></span></p><p><span style=\"font-size: 12px;\">12px字号</span><span style=\"font-size: 32px;\">32px字号</span></p><p><span style=\"font-size: 14px;\">14px字号</span><span style=\"font-size: 48px;\">48px字号</span></p><p><span style=\"font-family: 仿宋;\">仿宋 </span><span style=\"font-family: 宋体;\">宋体</span></p><p style=\"line-height: 3;\"><span style=\"font-family: 宋体;\">3行高 </span></p><p style=\"line-height: 2;\"><span style=\"font-family: 宋体;\">2行高</span></p><ul><li><span style=\"font-family: 宋体;\">无序列表</span></li><li><span style=\"font-family: 宋体;\">无序列表</span></li></ul><ol><li><span style=\"font-family: 宋体;\">有序列表</span></li><li><span style=\"font-family: 宋体;\">有序列表</span></li></ol><div data-w-e-type=\"todo\"><input type=\"checkbox\" disabled ><span style=\"font-family: 宋体;\">待办</span></div><div data-w-e-type=\"todo\"><input type=\"checkbox\" disabled ><span style=\"font-family: 宋体;\">待办</span></div><p style=\"text-align: left;\"><span style=\"font-family: 宋体;\">左对齐</span></p><p style=\"text-align: right;\"><span style=\"font-family: 宋体;\">右对齐</span></p><p style=\"text-align: center;\"><span style=\"font-family: 宋体;\">居中</span></p><p style=\"text-align: justify;\"><span style=\"font-family: 宋体;\">两侧对齐</span></p><p style=\"text-indent: 2em; text-align: left;\"><span style=\"font-family: 宋体;\">增加缩进</span></p><p style=\"text-align: left;\"><span style=\"font-family: 宋体;\">\uD83D\uDE00表情</span></p><p style=\"text-align: left;\"><span style=\"font-family: 宋体;\"> </span> </p><p style=\"text-align: left;\">100图片<img src=\"https://i0.hdslb.com/bfs/live/new_room_cover/bc717384b4f644ab3e0fd7369e86dce36a5ac515.jpg\" alt=\"图片描述\" data-href=\"\" style=\"\"></p><p style=\"text-align: left;\">50图片<img src=\"https://i0.hdslb.com/bfs/live/new_room_cover/bc717384b4f644ab3e0fd7369e86dce36a5ac515.jpg\" alt=\"\" data-href=\"\" style=\"width: 50%;\"></p><p style=\"text-align: left;\">30图片<img src=\"https://i0.hdslb.com/bfs/live/new_room_cover/bc717384b4f644ab3e0fd7369e86dce36a5ac515.jpg\" alt=\"\" data-href=\"\" style=\"width: 30%;\"></p><table style=\"width: auto;\"><tbody><tr><th colSpan=\"1\" rowSpan=\"1\" width=\"auto\">表格</th><th colSpan=\"1\" rowSpan=\"1\" width=\"auto\">表格</th></tr><tr><td colSpan=\"1\" rowSpan=\"1\" width=\"auto\">表格</td><td colSpan=\"1\" rowSpan=\"1\" width=\"auto\">表格</td></tr><tr><td colSpan=\"1\" rowSpan=\"1\" width=\"auto\">表格</td><td colSpan=\"1\" rowSpan=\"1\" width=\"auto\"><img src=\"https://i0.hdslb.com/bfs/live/new_room_cover/bc717384b4f644ab3e0fd7369e86dce36a5ac515.jpg\" alt=\"\" data-href=\"\" style=\"width: 30%;\"/>表格30图片</td></tr></tbody></table><pre><code class=\"language-css\">代码块 css语言\n代码块</code></pre><p>分割线</p><hr/><p>分割线</p>"
  84. }
  85. attachments.value = returnParams.affixUrl;
  86. })
  87. }
  88. //消息详情
  89. function showMessageInfo({ universalId, messageId }) {
  90. const params = {
  91. universalId: universalId,
  92. messageId: messageId
  93. }
  94. getMessageInfo(params).then(({ returnParams }) => {
  95. msgInfo.value = {
  96. title: returnParams.title,
  97. sendTime: returnParams.sendtime,
  98. name: returnParams.name,
  99. content: returnParams.content,
  100. }
  101. attachments.value = returnParams.fileList;
  102. })
  103. }
  104. onMounted(() => {
  105. switch (type.value) {
  106. case 0:
  107. showNoticeInfo(noticeId.value);
  108. break;
  109. case 1:
  110. showMessageInfo({ universalId: universalId.value, messageId: messageId.value });
  111. break;
  112. }
  113. })
  114. // 超链接 跳转
  115. function parseNavigate(href, e) {
  116. $tab.navigateTo('./URLView?url=' + encodeURIComponent(href));
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .detail_container {
  121. .message_title {
  122. text-align: center;
  123. font-size: calc(1.5rem + 0px);
  124. font-weight: bold;
  125. margin-top: 5px;
  126. }
  127. .message_container {
  128. .message_contant {
  129. ::v-deep .wxParse {
  130. font-size: calc(0.875rem + 0px);
  131. }
  132. }
  133. .message_info {
  134. margin: 20px 0;
  135. text-align: right;
  136. .user {
  137. font-size: calc(0.875rem + 0px);
  138. .user_pre {
  139. font-weight: bold;
  140. }
  141. }
  142. .time {
  143. margin-top:calc(0.625px * (1rem - 16px));
  144. font-size: calc(0.875rem + 0px);
  145. }
  146. }
  147. }
  148. ::v-deep .file_list {
  149. .uni-section .uni-section-header {
  150. margin-left: -10px;
  151. }
  152. .message_attachment {
  153. .attachment {
  154. color: #2196f3;
  155. margin-left: 5px;
  156. font-size: calc(14px + .5*(1rem - 16px)) !important;
  157. }
  158. }
  159. }
  160. }
  161. </style>