notice.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <view class="info-card">
  4. <view class="content-title">
  5. <view v-t="'News.Notice'"></view>
  6. </view>
  7. <view class="search-bar">
  8. <cwg-combox v-model:value="search.read" :options="typeMap" :placeholder="t('placeholder.choose')" />
  9. </view>
  10. <cwg-tabel ref="tableRef" :columns="columns" :queryParams="search" :api="listApi" :show-operation="false"
  11. :showPagination="false">
  12. <template #subject="{ row }">
  13. <view class="subject underline" @click="toView(row, 7)">
  14. {{ row.subject }}
  15. </view>
  16. </template>
  17. </cwg-tabel>
  18. </view>
  19. </cwg-page-wrapper>
  20. </template>
  21. <script setup lang="ts">
  22. import { computed, ref, onMounted } from 'vue';
  23. import { useI18n } from 'vue-i18n';
  24. const { t, locale } = useI18n();
  25. import useRouter from '@/hooks/useRouter'
  26. const router = useRouter()
  27. import { newsApi } from '@/service/news';
  28. const search = ref({})
  29. const typeMap = computed(() => ([
  30. { value: null, text: t('State.All') },
  31. { value: 0, text: t('News.Unread') },
  32. { value: 1, text: t('News.Read') }
  33. ]));
  34. const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value));
  35. // 表格列配置
  36. const columns = ref([
  37. {
  38. prop: 'subject',
  39. label: t('News.Title'),
  40. align: 'left',
  41. slot: 'subject'
  42. },
  43. {
  44. prop: 'addTime',
  45. label: t('Drawer.Label.Date'),
  46. type: 'date',
  47. dateFormat: 'YYYY-MM-DD HH:mm',
  48. align: 'left'
  49. },
  50. {
  51. prop: 'status',
  52. label: t('Custom.Recording.Status'),
  53. formatter: ({ row }) => row.read ? t('News.Read') : t('News.Unread'),
  54. align: 'left'
  55. }
  56. ])
  57. //查看详情
  58. const toView = (data, title) => {
  59. router.push({ path: "/pages/mine/new", query: { title, id: data.id } }).catch(err => err);
  60. if (title == 7) {
  61. data.read = 1;
  62. }
  63. }
  64. const addFileDialog = ref(null);
  65. const listApi = ref(null)
  66. listApi.value = newsApi.newsNoticeList
  67. </script>
  68. <style scoped lang="scss">
  69. @import "@/uni.scss";
  70. .avatar {
  71. width: px2rpx(60);
  72. height: px2rpx(60);
  73. border-radius: 4px;
  74. }
  75. .content-title {
  76. display: flex;
  77. justify-content: space-between;
  78. align-items: center;
  79. font-size: px2rpx(20);
  80. font-weight: 500;
  81. .content-title-btns {
  82. margin: px2rpx(8) 0;
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. gap: px2rpx(12);
  87. .btn-primary {
  88. min-width: px2rpx(120);
  89. background-color: var(--color-error);
  90. color: white;
  91. padding: 0 px2rpx(12);
  92. border: none;
  93. font-size: px2rpx(14);
  94. text-align: center;
  95. cursor: pointer;
  96. display: flex;
  97. align-items: center;
  98. justify-content: center;
  99. gap: px2rpx(8);
  100. }
  101. .btn-primary:active {
  102. background-color: var(--color-navy-700);
  103. }
  104. }
  105. }
  106. .operation-btn {
  107. :deep(span) {
  108. display: flex;
  109. align-items: center;
  110. justify-content: center;
  111. gap: px2rpx(4);
  112. cursor: pointer;
  113. background-color: var(--color-slate-150);
  114. padding: px2rpx(8) 0;
  115. }
  116. }
  117. .operation-btn.disabled {
  118. cursor: not-allowed;
  119. opacity: 0.5;
  120. }
  121. .search-bar {
  122. display: flex;
  123. align-items: center;
  124. justify-content: flex-start;
  125. flex-wrap: wrap;
  126. gap: px2rpx(16);
  127. margin: px2rpx(16) 0;
  128. .cwg-combox,
  129. .uni-easyinput,
  130. .uni-date {
  131. width: px2rpx(240) !important;
  132. flex: none;
  133. }
  134. }
  135. </style>