NoticeAndRules.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="notice-and-rules-container">
  3. <div class="container-title">
  4. <span class="line"></span>
  5. <span class="title">管理规定与通知</span>
  6. <el-icon class="more" @click="handleJumpToMoreInfo"><DArrowRight /></el-icon>
  7. </div>
  8. <div class="notice-lists" v-loading="loading">
  9. <div v-if="noticeLists.length === 0" class="empty-style">
  10. <img class="empty-img" src="@/assets/images/empty.png" alt="" />
  11. <span>暂无数据</span>
  12. </div>
  13. <div v-for="(item, index) in noticeLists" :key="index" class="notice-item" @click="handleJumpToDetail(item.id)">
  14. <img src="@/assets/svg/bell.svg" alt="" />
  15. <div class="notice-title">{{ item.title }}</div>
  16. <div class="notice-info">
  17. <span>{{ item.pushTime }}</span>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script lang="ts" setup>
  24. import { onMounted, ref } from 'vue';
  25. import { useRouter } from 'vue-router';
  26. import { ElIcon } from 'element-plus';
  27. import { DArrowRight } from '@element-plus/icons-vue';
  28. import { NoticeAndRulesRes, getNoticeAndRules } from '@/api/disaster-overview';
  29. const router = useRouter();
  30. const loading = ref(true);
  31. const noticeLists = ref<NoticeAndRulesRes[]>([]);
  32. const handleJumpToMoreInfo = () => {
  33. router.push({
  34. path: '/disaster-prevention/disaster-warning/defense-notice',
  35. });
  36. };
  37. const handleJumpToDetail = (id: number) => {
  38. router.push({
  39. path: '/disaster-prevention/disaster-warning/defense-notice-item',
  40. query: {
  41. id: id,
  42. },
  43. });
  44. };
  45. onMounted(async () => {
  46. loading.value = true;
  47. noticeLists.value = await getNoticeAndRules();
  48. loading.value = false;
  49. });
  50. </script>
  51. <style lang="scss" scoped>
  52. .notice-and-rules-container {
  53. padding: 10px 0;
  54. display: flex;
  55. flex-direction: column;
  56. .container-title {
  57. height: 24px;
  58. display: flex;
  59. align-items: center;
  60. font-weight: 500;
  61. font-size: 16px;
  62. color: #000000;
  63. .line {
  64. width: 3px;
  65. height: 16px;
  66. background: #1777ff;
  67. margin-right: 10px;
  68. }
  69. .title {
  70. margin-right: 12px;
  71. }
  72. .more {
  73. margin-left: auto;
  74. margin-right: 10px;
  75. cursor: pointer;
  76. font-size: 14px;
  77. }
  78. .more:hover {
  79. color: #1777ff;
  80. }
  81. }
  82. .notice-lists {
  83. flex: 1;
  84. display: flex;
  85. flex-direction: column;
  86. // justify-content: space-evenly;
  87. padding: 0 13px;
  88. margin-top: 10px;
  89. overflow: auto;
  90. .notice-item {
  91. margin-bottom: 10px;
  92. display: flex;
  93. align-items: center;
  94. cursor: pointer;
  95. img {
  96. width: 18px;
  97. height: 17px;
  98. margin-right: 10px;
  99. }
  100. .notice-title {
  101. width: 60%;
  102. font-size: 14px;
  103. color: rgba(0, 0, 0, 0.85);
  104. overflow: hidden;
  105. white-space: nowrap;
  106. text-overflow: ellipsis;
  107. }
  108. .notice-info {
  109. font-size: 12px;
  110. color: rgba(0, 0, 0, 0.45);
  111. margin-left: auto;
  112. display: flex;
  113. }
  114. }
  115. .notice-item:hover {
  116. .notice-title {
  117. color: #1777ff;
  118. }
  119. }
  120. }
  121. }
  122. .empty-style {
  123. width: 100%;
  124. height: 100%;
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: center;
  128. align-items: center;
  129. font-size: 12px;
  130. color: rgba(0, 0, 0, 0.5);
  131. .empty-img {
  132. height: 80%;
  133. object-fit: contain;
  134. }
  135. }
  136. </style>