notice.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div id="support">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <component :is="partsSearch" :is_title="false" :is_search="true" :fields="fields" @search="partSearch"> </component>
  7. </el-col>
  8. <el-col :span="24" class="two">
  9. <el-col class="list" :span="12" v-for="(item, index) in list" :key="index" @click="toView(item)">
  10. <el-col :span="24" class="title">{{ item.title }}</el-col>
  11. <el-col :span="24" class="other">
  12. <el-col :span="8" class="other_1 textOver">
  13. <span>发布时间:</span>
  14. <span>{{ item.date }}</span>
  15. </el-col>
  16. <el-col :span="8" class="other_1 textOver">
  17. <span>来源:</span>
  18. <span>{{ item.origin }}</span>
  19. </el-col>
  20. </el-col>
  21. </el-col>
  22. </el-col>
  23. <el-col :span="24" class="thr">
  24. <component :is="CPage" :total="total" :limit="limit" @query="search"></component>
  25. </el-col>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import CPage from '@/components/common/web/c-page.vue';
  32. import partsSearch from '@/components/c-search.vue';
  33. import type { Ref } from 'vue';
  34. import { ref, onMounted } from 'vue';
  35. import { NoticeStore } from '@common/src/stores/studio/other/notice'; //
  36. import type { IQueryResult } from '@/util/types.util';
  37. const notice = NoticeStore();
  38. let fields: Ref<any[]> = ref([
  39. { label: '标题', model: 'title', isSearch: true },
  40. { label: '来源', model: 'origin', isSearch: true },
  41. ]);
  42. // 查询数据
  43. let searchForm: Ref<{}> = ref({});
  44. let list: Ref<any[]> = ref([]);
  45. // 总数
  46. let total: Ref<number> = ref(0);
  47. let limit: 10;
  48. let skip = 0;
  49. onMounted(async () => {
  50. await search({ skip, limit });
  51. });
  52. // 查询
  53. const search = async (e: { skip: number; limit: number }) => {
  54. const { skip, limit } = e;
  55. let info = { limit: limit, skip: skip, ...searchForm.value, status: '1' };
  56. if (info.limit == undefined) info.limit = 8;
  57. const res: IQueryResult = await notice.query(info);
  58. list.value = res.data as any[];
  59. total.value = res.total;
  60. };
  61. // 查询
  62. const partSearch = (form: { [x: string]: any }) => {
  63. searchForm.value = form;
  64. search({ skip, limit });
  65. };
  66. const emit = defineEmits(['toView']);
  67. const toView = (e: object) => {
  68. emit('toView', { data: e, component: 'notices' });
  69. };
  70. </script>
  71. <style lang="scss" scoped>
  72. .main {
  73. .one {
  74. box-shadow: 0 0 2px #858585;
  75. padding: 10px;
  76. margin: 0 0 10px 0;
  77. }
  78. .two {
  79. display: flex;
  80. flex-direction: row;
  81. flex-wrap: wrap;
  82. box-shadow: 0 0 5px #858585;
  83. padding: 10px;
  84. border-radius: 5px;
  85. margin: 0 0 10px 0;
  86. .list {
  87. max-width: 49%;
  88. border: 3px solid #a2e1f7;
  89. padding: 10px;
  90. border-radius: 5px;
  91. margin: 0 20px 20px 0;
  92. .title {
  93. font-size: 20px;
  94. font-family: cursive;
  95. margin: 0 0 10px 0;
  96. font-weight: bold;
  97. }
  98. .other {
  99. display: flex;
  100. flex-direction: row;
  101. flex-wrap: wrap;
  102. .other_1 {
  103. margin: 0 0 10px 0;
  104. span {
  105. font-size: 14px;
  106. color: #858585;
  107. }
  108. span:nth-child(2) {
  109. color: #000000;
  110. }
  111. }
  112. }
  113. }
  114. .list:hover {
  115. cursor: pointer;
  116. border: 3px solid #65cd94;
  117. .title {
  118. color: #ffffff;
  119. }
  120. }
  121. .list:nth-child(2n) {
  122. margin: 0 0 20px 0;
  123. }
  124. }
  125. }
  126. </style>