<template>
  <a-spin :spinning="loading" :delay="100">
    <HomePage :designId="designId" v-if="designId"/>
  </a-spin>
</template>

<script setup>
import HomePage from '../portal/backend/design/preview/index.vue';
import { ref, onMounted } from 'vue';
import { HomeApi } from './api/HomeApi';

const loading = ref(false);

const designId = ref('');

onMounted(() => {
  getUserPortalList();
});

// 获取用户门户设计
const getUserPortalList = () => {
  loading.value = false;
  HomeApi.getUserPortalList()
    .then(res => {
      if (res.data?.length) {
        designId.value = res.data[0].designId;
      }
    })
    .finally(() => (loading.value = false));
};
</script>

<style lang="less" scoped>

</style>
