<script setup>
import LastSurvey from './components/LastSurvey/Index.vue';
import Market from './components/Market/Index.vue';
import CreateSurvey from './components/CreateSurvey/Index.vue';
import { onMounted, ref } from 'vue';
// import utils from '@/assets/js/common';
// import { getUserInfo } from '@/api/common/index.js';
// import { showFailToast } from 'vant';
const contentShow = ref(false);
onMounted(async() => {
  contentShow.value = true;
  // if (utils.getSessionStorage('xToken')) {
  //   const appToken = utils.getParameter('digitalYiliToken');
  //   getUserInfo(appToken).then((res) => {
  //     if (res.data) {
  //       contentShow.value = true;
  //       utils.setSessionStorage('userInfo', res.data.data);
  //     } else {
  //       contentShow.value = false;
  //       showFailToast(error.response.data?.message || error.data?.message || error.message || '服务器错误');
  //     }
  //   }).catch((error) => {
  //     contentShow.value = false;
  //     showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
  //   });
  // } else {
  //   contentShow.value = true;
  // }
});
</script>

<template>
  <div v-if="contentShow" class="container">
    <create-survey />

    <!-- 最新问卷 -->
    <last-survey />

    <!-- 模板市场 -->
    <Market />
  </div>
</template>

<style scoped lang="scss">
.container {
  padding: 0 10px 60px;
  background: linear-gradient(0deg, #f5f5f5 0%, #f5f5f5 84%, #a5d380 100%);

  &> :first-child {
    display: flex;
    justify-content: space-around;
    border-radius: 6px;
    background-color: white;

    &>div {
      display: flex;
      flex-direction: column;
      width: 50px;
      height: 50px;
      margin: 10px;

      // background-color: #B9F8CF;

      padding: 20px 10px;
    }
  }
}
</style>
