国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
3.3 KiB

4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
  1. <template>
  2. <view class="announcement-page">
  3. <!-- 公告列表 -->
  4. <view class="announcement-list">
  5. <view
  6. class="announcement-item"
  7. v-for="(item, index) in announcementList"
  8. :key="index"
  9. @click="goToDetail(item)"
  10. >
  11. <view class="item-content">
  12. <view class="text-content">
  13. <view class="title">{{ item.title }}</view>
  14. <!-- <view class="description" v-html="item.details"></view> -->
  15. <rich-text class="description" :nodes="item.details"></rich-text>
  16. <view class="time">{{ item.createTime }}</view>
  17. </view>
  18. <!-- <view class="image-content" v-if="item.image">
  19. <image :src="item.image" class="announcement-image" mode="aspectFill"></image>
  20. </view> -->
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'Announcement',
  29. data() {
  30. return {
  31. announcementList: [],
  32. pageNo: 1,
  33. pageSize: 10
  34. }
  35. },
  36. async onShow() {
  37. // 页面加载时的逻辑
  38. await this.queryAnnouncementList()
  39. },
  40. methods: {
  41. goToDetail(item) {
  42. uni.navigateTo({
  43. url: `/subPages/index/announcementDetail?id=${item.id}`
  44. })
  45. },
  46. async queryAnnouncementList() {
  47. const res = await this.$api.home.queryNoticeList({
  48. pageNo: this.pageNo,
  49. pageSize: this.pageSize
  50. })
  51. if (!res.result.records.length) {
  52. uni.showToast({
  53. title: '没有更多数据了',
  54. icon: 'none'
  55. })
  56. return
  57. }
  58. this.announcementList.push(...res.result.records)
  59. this.pageNo++
  60. }
  61. },
  62. onReachBottom() {
  63. // 上拉加载更多的逻辑
  64. this.queryAnnouncementList()
  65. },
  66. async onPullDownRefresh() {
  67. // 下拉刷新的逻辑
  68. this.pageNo = 1
  69. this.announcementList = []
  70. await this.queryAnnouncementList()
  71. uni.stopPullDownRefresh()
  72. }
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .announcement-page {
  77. background-color: $uni-bg-color-grey;
  78. min-height: 100vh;
  79. padding: 20rpx;
  80. }
  81. .announcement-list {
  82. .announcement-item {
  83. background-color: $uni-bg-color;
  84. border-radius: 16rpx;
  85. margin-bottom: 20rpx;
  86. padding: 30rpx;
  87. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  88. .item-content {
  89. display: flex;
  90. justify-content: space-between;
  91. align-items: flex-start;
  92. .text-content {
  93. flex: 1;
  94. margin-right: 20rpx;
  95. .title {
  96. font-size: 32rpx;
  97. font-weight: bold;
  98. color: #000000;
  99. margin-bottom: 16rpx;
  100. line-height: 1.4;
  101. }
  102. .description {
  103. font-size: 28rpx;
  104. color: #0F2248;
  105. line-height: 1.5;
  106. margin-bottom: 20rpx;
  107. display: -webkit-box;
  108. -webkit-box-orient: vertical;
  109. -webkit-line-clamp: 2;
  110. overflow: hidden;
  111. text-overflow: ellipsis;
  112. }
  113. .time {
  114. font-size: 24rpx;
  115. color: $uni-text-color-grey;
  116. }
  117. }
  118. .image-content {
  119. flex-shrink: 0;
  120. .announcement-image {
  121. width: 220rpx;
  122. height: 200rpx;
  123. border-radius: 15rpx;
  124. background-color: $uni-bg-color-grey;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>