detail.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="detail-page-container">
  3. <view class="notice-header">
  4. <view class="notice-title">{{ info.noticeTitle }}</view>
  5. <view class="notice-meta">
  6. <text class="author">发布人:{{ info.createdName || '-' }}</text>
  7. <text class="time">{{ info.noticeTime || '-' }}</text>
  8. </view>
  9. </view>
  10. <scroll-view scroll-y class="detail-body">
  11. <view class="content-box">
  12. <uv-parse v-if="info.noticeContent" :content="info.noticeContent"></uv-parse>
  13. <uv-empty v-else mode="data" text="暂无内容"></uv-empty>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref } from 'vue';
  20. import { onLoad } from '@dcloudio/uni-app';
  21. import { useSystemApi } from '@/api/system/index';
  22. const systemApi = useSystemApi();
  23. const info = ref<any>({});
  24. const fetchDetail = async (id: string | number) => {
  25. try {
  26. const res: any = await systemApi.getNoticeDetail(id);
  27. if (res.code == 200) {
  28. info.value = res.data || {};
  29. }
  30. } catch (error) {
  31. console.error(error);
  32. }
  33. };
  34. onLoad((options: any) => {
  35. if (options.id) {
  36. fetchDetail(options.id);
  37. }
  38. });
  39. </script>
  40. <style lang="scss" scoped>
  41. .detail-page-container {
  42. height: 100vh;
  43. display: flex;
  44. flex-direction: column;
  45. background-color: #fff;
  46. }
  47. .notice-header {
  48. padding: 40rpx 30rpx;
  49. border-bottom: 2rpx solid #f2f2f2;
  50. .notice-title {
  51. font-size: 36rpx;
  52. font-weight: bold;
  53. color: #333;
  54. line-height: 1.4;
  55. margin-bottom: 24rpx;
  56. }
  57. .notice-meta {
  58. display: flex;
  59. font-size: 24rpx;
  60. color: #999;
  61. .author {
  62. margin-right: 30rpx;
  63. }
  64. }
  65. }
  66. .detail-body {
  67. flex: 1;
  68. overflow: hidden;
  69. .content-box {
  70. padding: 30rpx;
  71. line-height: 1.6;
  72. color: #555;
  73. font-size: 30rpx;
  74. word-break: break-all;
  75. }
  76. }
  77. </style>