notice.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container">
  3. <uni-card title="通知公告" :isFull="true" type="line" padding="0px" spacing="0px">
  4. <template #extra> <view @click="onMore">查看更多</view> </template>
  5. <uni-list>
  6. <uni-list-item :ellipsis="1" v-for="item in data" :rightText="item.publishDate" clickable @click="goto(item.noticeId)" :title="item.title" />
  7. </uni-list>
  8. </uni-card>
  9. </view>
  10. </template>
  11. <script setup>
  12. import { ref } from 'vue';
  13. import { noticeApi } from '@/api/business/oa/notice-api';
  14. import { smartSentry } from '@/lib/smart-sentry';
  15. import { onShow } from '@dcloudio/uni-app';
  16. const queryForm = {
  17. pageNum: 1,
  18. pageSize: 5,
  19. searchCount: false,
  20. };
  21. let data = ref([]);
  22. const loading = ref(false);
  23. // 查询列表
  24. async function queryNoticeList() {
  25. try {
  26. loading.value = true;
  27. const result = await noticeApi.queryEmployeeNotice(queryForm);
  28. data.value = result.data.list;
  29. } catch (err) {
  30. smartSentry.captureError(err);
  31. } finally {
  32. loading.value = false;
  33. }
  34. }
  35. // 跳转详情
  36. function goto(noticeId) {
  37. uni.navigateTo({ url: '/pages/notice/notice-detail?noticeId=' + noticeId });
  38. }
  39. onShow(() => {
  40. queryNoticeList();
  41. });
  42. // 查看更多
  43. function onMore() {
  44. uni.navigateTo({
  45. url: '/pages/notice/notice-index',
  46. });
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .container {
  51. width: 700rpx;
  52. margin: 0 auto 20rpx;
  53. border-radius: 12rpx;
  54. padding: 0;
  55. overflow: hidden;
  56. :deep(.uni-card__header-box) {
  57. font-weight: bold;
  58. }
  59. :deep(.uni-list--border-bottom) {
  60. background-color: transparent;
  61. }
  62. :deep(.uni-card__content) {
  63. padding: 0 !important;
  64. }
  65. :deep(.uni-card__header) {
  66. border: none;
  67. }
  68. :deep(.uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-title) {
  69. font-size: 32rpx;
  70. }
  71. :deep(.uni-list-item__container) {
  72. padding: 16rpx 20rpx;
  73. }
  74. :deep(.uni-card__header) {
  75. background: linear-gradient(180deg, #e8f4ff, #f8fcff);
  76. }
  77. :deep(.uni-card__header-extra) {
  78. font-size: 30rpx;
  79. font-weight: 400;
  80. text-align: center;
  81. color: #1a9aff;
  82. }
  83. :deep(.uni-list-item__content-title) {
  84. font-size: 30rpx;
  85. }
  86. }
  87. </style>