<template>
  <div class="pa-3 white fill-height d-flex flex-column">
    <banner-search />
    <banner-date :lists="lists" />
  </div>
</template>

<script>
import BannerSearch from 'components/Banner/BannerSearch.vue';
import BannerDate from 'components/Banner/BannerDate.vue';
import { queryCarousel } from 'config/api';

export default {
  name: 'BannerManage',
  components: {
    BannerSearch,
    BannerDate,
  },

  data() {
    return {
      str: '轮播图管理界面',
      lists: {},
    };
  },

  created() {
    this.getListData();
  },

  methods: {
    // 获取轮播图列表
    async getListData() {
      try {
        const params = {
          param: {
            showPage: '',
            jumpType: '',
            recStatus: '',
            pageNum: 1,
            pageSize: 10,
          },
        };
        const res = await queryCarousel(params);
        const { code, msg, data } = res.data;
        if (code === 200) {
          this.lists = data;
        } else {
          throw msg || '获取失败';
        }
      } catch (error) {
        this.$message.error(error);
      }
    },
  },
};
</script>
