dynamic.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="container">
  3. <view class="list-box">
  4. <view class="list-item-box" v-for="item in list" :key="item.id" @click="onDynamicClick(item)">
  5. <view class="main-box">
  6. <view class="icon-box">
  7. <cover-image class="icon" :src="`https://sylwt.top/api/visitor/resources/image?name=/ydl/menber-center/notice/icon-1.jpg`"></cover-image>
  8. </view>
  9. <view class="content-box">
  10. <view class="title">
  11. {{item.title}}
  12. </view>
  13. <view class="text">
  14. {{item.desc}}
  15. </view>
  16. </view>
  17. <view class="other-box">
  18. <view class="date">
  19. {{item.date}}
  20. </view>
  21. </view>
  22. </view>
  23. <view class="line-box"></view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref } from 'vue'
  30. import { onLoad } from '@dcloudio/uni-app'
  31. const uToast = ref()
  32. const searchInputStyle = {
  33. backgroundColor: '#E5E5E5'
  34. }
  35. const searchForm = ref({
  36. keyword: ''
  37. })
  38. const list = ref([
  39. {
  40. "id": "1",
  41. "title": "参观科技博览会",
  42. "desc": "20名协会成员于10月15日参加了全国科技博览会,收获颇丰。此次活动增进了大家对科技前沿的认识。",
  43. "date": "2023-10-16"
  44. },
  45. {
  46. "id": "2",
  47. "title": "举办文化交流活动",
  48. "desc": "我们于10月22日成功举行了文化交流活动,各个文化团体分享了他们的传统和故事,气氛热烈。",
  49. "date": "2023-10-23"
  50. },
  51. {
  52. "id": "3",
  53. "title": "秋季运动会开幕",
  54. "desc": "10月29日上午,协会在体育场举办了秋季运动会,吸引了众多会员参与,为大家提供了锻炼身体的机会。",
  55. "date": "2023-10-30"
  56. },
  57. {
  58. "id": "4",
  59. "title": "爱心捐赠活动",
  60. "desc": "协会发起的爱心捐赠活动于11月1日正式启动,希望大家积极参与,共同为需要帮助的人贡献一份力量。",
  61. "date": "2023-11-01"
  62. },
  63. {
  64. "id": "5",
  65. "title": "庆祝协会成立周年",
  66. "desc": "我们将于12月5日庆祝协会成立五周年,届时会举办庆祝晚会,欢迎所有成员莅临共庆佳节!",
  67. "date": "2023-11-02"
  68. }
  69. ])
  70. function onDynamicClick(dynamic) {
  71. uni.navigateTo({
  72. url: `/pages/dynamic/dynamicDetail/dynamicDetail?id=${dynamic.id}&title=${dynamic.title}`
  73. })
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .container {
  78. height: 100vh;
  79. width: 100vw;
  80. background-color: $uni-bg-color;
  81. padding: 0 20rpx;
  82. .search-box {
  83. margin-bottom: 20rpx;
  84. ::v-deep(.u-search) {
  85. background-color: #e5e5e5;
  86. border-radius: 50rpx;
  87. .u-action {
  88. width: 18%;
  89. background-color: $uni-color-primary;
  90. border-radius: 50rpx;
  91. color: $uni-text-color-inverse;
  92. margin-right: 8rpx;
  93. font-size: 28rpx;
  94. line-height: 50rpx;
  95. letter-spacing: 3rpx;
  96. text-align: center;
  97. }
  98. }
  99. }
  100. .list-box {
  101. padding: 0 20rpx;
  102. .list-item-box {
  103. .main-box {
  104. display: flex;
  105. justify-content: space-between;
  106. align-items: center;
  107. padding: 30rpx 0;
  108. &:active {
  109. background-color: $uni-bg-color-hover;
  110. }
  111. .icon-box {
  112. width: 15%;
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. .icon {
  117. width: 70rpx;
  118. height: 70rpx;
  119. }
  120. }
  121. .content-box {
  122. width: 67%;
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: space-around;
  126. gap: 10rpx;
  127. .title {
  128. height: calc(70% - 5rpx);
  129. font-size: $uni-title-font-size-2;
  130. font-weight: bold;
  131. }
  132. .text {
  133. height: calc(30% - 5rpx);
  134. font-size: $uni-font-size-3;
  135. color: $uni-text-color-grey;
  136. @include text-overflow();
  137. }
  138. }
  139. .other-box {
  140. width: 18%;
  141. display: flex;
  142. flex-direction: column;
  143. justify-content: space-around;
  144. align-items: center;
  145. gap: 10rpx;
  146. .date {
  147. font-size: $uni-font-size-3;
  148. color: $uni-text-color-grey;
  149. }
  150. .tag {
  151. font-size: $uni-font-size-3;
  152. width: 42rpx;
  153. background-color: $uni-color-error;
  154. color: $uni-text-color-inverse;
  155. border-radius: 20rpx;
  156. text-align: center;
  157. }
  158. }
  159. }
  160. .line-box {
  161. height: 1rpx;
  162. width: 80%;
  163. background-color: #E5E5E5;
  164. margin: 0 auto;
  165. }
  166. }
  167. }
  168. }
  169. </style>