notice.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div class="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <el-col :span="24" class="one">
  6. <el-table :data="list" style="width: 100%" size="large" :header-cell-style="{ backgroundColor: '#edf3ff' }">
  7. <template #empty>
  8. <el-empty description="暂无数据" />
  9. </template>
  10. <el-table-column prop="type" align="center" label="通知种类" width="180" />
  11. <el-table-column prop="title" align="center" label="标题" />
  12. <el-table-column prop="time" align="center" label="时间" width="180" />
  13. </el-table>
  14. </el-col>
  15. <el-col :span="24" class="two">
  16. <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" v-model:current-page="currentPage" @current-change="changePage" @size-change="sizeChange" />
  17. </el-col>
  18. </el-col>
  19. </el-row>
  20. </div>
  21. </template>
  22. <script setup>
  23. import { UserStore } from '@/store/user'
  24. const userStore = UserStore()
  25. const user = computed(() => userStore.user)
  26. // 加载中
  27. const loading = ref(false)
  28. // 路由
  29. const router = useRouter()
  30. // 列表
  31. const list = ref([])
  32. let skip = 0
  33. let limit = inject('limit')
  34. const total = ref(0)
  35. const currentPage = ref(1)
  36. // 请求
  37. onMounted(async () => {
  38. loading.value = true
  39. await searchOther()
  40. await search()
  41. loading.value = false
  42. })
  43. const search = async (query = { skip, limit }) => {
  44. // skip = query.skip
  45. // limit = query.limit
  46. // const info = {
  47. // skip: query.skip,
  48. // limit: query.limit,
  49. // user: user.value.id
  50. // }
  51. // const res = await store.query(info)
  52. // if (res.errcode == '0') {
  53. // list.value = res.data
  54. // total.value = res.total
  55. // }
  56. }
  57. const searchOther = async () => {}
  58. // 分页
  59. const changePage = (page = currentPage.value) => {
  60. search({ skip: (page - 1) * limit, limit: limit })
  61. }
  62. const sizeChange = (limits) => {
  63. limit = limits
  64. currentPage.value = 1
  65. search({ skip: 0, limit: limit })
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .main {
  70. .two {
  71. display: flex;
  72. justify-content: center;
  73. margin: 20px 0 0 0;
  74. }
  75. }
  76. </style>