index.vue 1.52 KB
<script lang="ts" setup>
  import { onMounted } from 'vue';
  import { Spin } from 'ant-design-vue';
  import { ref } from 'vue';
  import { useRoute } from 'vue-router';
  import { useUserStore } from '/@/store/modules/user';
  import BoardDetail from '/@/views/visual/board/detail/index.vue';
  import { doAppLogin } from '/@/api/sys/user';

  const loading = ref(true);
  const ROUTE = useRoute();
  const contentData = ref<any>();
  const canLoadComponent = ref(false);

  const modelVisable = ref(false);

  const userStore = useUserStore();

  const getShareToken = async () => {
    const { params } = ROUTE;
    const { userId }: any = params;
    const { token, refreshToken } = await doAppLogin(userId);
    userStore.storeToken(token, refreshToken);
  };

  const getContentLoading = ref(false);
  const getContentData = async () => {
    try {
      getContentLoading.value = true;
      loading.value = false;
      canLoadComponent.value = true;
      modelVisable.value = false;
    } catch (error) {
    } finally {
      getContentLoading.value = false;
    }
  };

  onMounted(async () => {
    await getShareToken();
    await getContentData();
  });
</script>

<template>
  <Spin
    :spinning="loading"
    tip="正在加载中..."
    size="large"
    class="!flex justify-center items-center w-full h-full share-full-loading"
  >
    <BoardDetail v-if="canLoadComponent" :value="contentData" />
  </Spin>
</template>

<style lang="less">
  .share-page-token-modal {
    .ant-modal-close {
      display: none;
    }
  }
</style>