notice.vue 4.9 KB

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