notice.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="container">
  3. <!-- <view class="search-box">
  4. <u-search
  5. v-model="searchForm.keyword"
  6. :clearabled="true"
  7. bg-color="#E5E5E5"
  8. :input-style="searchInputStyle"
  9. placeholder="请输入搜索内容"
  10. ></u-search>
  11. </view> -->
  12. <view class="list-box">
  13. <view class="list-item-box" v-for="item in list" :key="item.id" @click="onNoticeClick(item)">
  14. <view class="main-box">
  15. <view class="icon-box">
  16. <cover-image class="icon" :src="`${FILE_URL}/notice/icon-2.jpg`"></cover-image>
  17. </view>
  18. <view class="content-box">
  19. <view class="title">
  20. {{item.title}}
  21. </view>
  22. <view class="text">
  23. {{item.desc}}
  24. </view>
  25. </view>
  26. <view class="other-box">
  27. <view class="date">
  28. {{item.date}}
  29. </view>
  30. </view>
  31. </view>
  32. <view class="line-box"></view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import { ref } from 'vue'
  39. import { onLoad } from '@dcloudio/uni-app'
  40. import { getNoticeList } from '@/api/notice.js'
  41. import configService from '@/utils/baseurl.js'
  42. const FILE_URL = configService.FILE_URL;
  43. const uToast = ref()
  44. const searchInputStyle = {
  45. backgroundColor: '#E5E5E5'
  46. }
  47. const searchForm = ref({
  48. keyword: ''
  49. })
  50. const list = ref([
  51. {
  52. id: '1',
  53. title: '2023年度团队建设活动',
  54. desc: '为了增强团队凝聚力,定于10月30日举行年度团队建设活动。请全员准时参加,期待大家的积极参与!',
  55. date: '2024-10-20'
  56. },
  57. {
  58. id: '2',
  59. title: "新员工入职培训",
  60. date: "2024-10-18",
  61. desc: "欢迎新加入的同事们!我们将于10月25日举办入职培训,届时会介绍公司的文化及各部门职能。"
  62. },
  63. {
  64. id: '3',
  65. title: "系统维护通知",
  66. date: "2023-10-15",
  67. desc: "为提升系统性能,我们将在10月22日进行系统维护,期间系统可能无法访问,请提前做好相关准备。"
  68. },
  69. {
  70. id: '4',
  71. title: "年度业绩总结会议",
  72. date: "2023-11-01",
  73. desc: "请各部门准备年度业绩总结报告,并按时参加11月10日的总结会议,共同探讨未来发展计划。"
  74. },
  75. {
  76. id: '5',
  77. title: "义务植树活动",
  78. date: "2023-10-12",
  79. desc: "我们将在10月28日组织义务植树活动,希望大家积极报名参加,一起为环境保护贡献一份力量。"
  80. }
  81. ])
  82. function init() {
  83. getNoticeList().then(res=>{
  84. if(res?.data){
  85. list.value = res.data
  86. }
  87. })
  88. }
  89. function onNoticeClick(notice) {
  90. uni.navigateTo({
  91. url: `/pages/notice/noticeDetail/noticeDetail?id=${notice.id}&title=${notice.title}`
  92. })
  93. }
  94. onLoad(()=>{
  95. init();
  96. })
  97. </script>
  98. <style lang="scss" scoped>
  99. .container {
  100. // height: 100vh;
  101. width: 100vw;
  102. background-color: $uni-bg-color;
  103. padding: 0 20rpx env(safe-area-inset-bottom, 0);
  104. .search-box {
  105. margin-bottom: 20rpx;
  106. ::v-deep(.u-search) {
  107. background-color: #e5e5e5;
  108. border-radius: 50rpx;
  109. .u-action {
  110. width: 18%;
  111. background-color: $uni-color-primary;
  112. border-radius: 50rpx;
  113. color: $uni-text-color-inverse;
  114. margin-right: 8rpx;
  115. font-size: 28rpx;
  116. line-height: 50rpx;
  117. letter-spacing: 3rpx;
  118. text-align: center;
  119. }
  120. }
  121. }
  122. .list-box {
  123. padding: 0 20rpx;
  124. .list-item-box {
  125. .main-box {
  126. display: flex;
  127. justify-content: space-between;
  128. align-items: center;
  129. padding: 30rpx 0;
  130. &:active {
  131. background-color: $uni-bg-color-hover;
  132. }
  133. .icon-box {
  134. width: 15%;
  135. display: flex;
  136. justify-content: center;
  137. align-items: center;
  138. .icon {
  139. width: 70rpx;
  140. height: 70rpx;
  141. }
  142. }
  143. .content-box {
  144. width: 67%;
  145. display: flex;
  146. flex-direction: column;
  147. justify-content: space-around;
  148. gap: 10rpx;
  149. .title {
  150. height: calc(70% - 5rpx);
  151. font-size: $uni-title-font-size-2;
  152. font-weight: bold;
  153. }
  154. .text {
  155. height: calc(30% - 5rpx);
  156. font-size: $uni-font-size-3;
  157. color: $uni-text-color-grey;
  158. @include text-overflow();
  159. }
  160. }
  161. .other-box {
  162. width: 18%;
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: space-around;
  166. align-items: center;
  167. gap: 10rpx;
  168. .date {
  169. font-size: $uni-font-size-3;
  170. color: $uni-text-color-grey;
  171. }
  172. .tag {
  173. font-size: $uni-font-size-3;
  174. width: 42rpx;
  175. background-color: $uni-color-error;
  176. color: $uni-text-color-inverse;
  177. border-radius: 20rpx;
  178. text-align: center;
  179. }
  180. }
  181. }
  182. .line-box {
  183. height: 1rpx;
  184. width: 80%;
  185. background-color: #E5E5E5;
  186. margin: 0 auto;
  187. }
  188. }
  189. }
  190. }
  191. </style>