<script setup lang="ts">
import Index from '@/views/index/tenantIndex.vue';
import defalutIndex from '@/views/index/defaultIndex.vue';
import Dash from '@/views/dashboard/overview/index.vue';
import Gold from '@/views/perfManage/goldTarget/index.vue';
import { getConfigKey } from '@/api/system/config';

import { defineAsyncComponent, onMounted, shallowRef } from 'vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useUserStore from '@/store/modules/user';
import useLayoutStore from '@/store/modules/layout';

const currentComponent = shallowRef(
  defineAsyncComponent(() => import('@/views/index/defaultIndex.vue'))
);

onMounted(() => {
  if (useUserStore().roles.includes('tenant')) {
    currentComponent.value = Index;
    useLayoutStore().changeConf('layout', 'top');
    useLayoutStore().changeConf('menuTheme', 'light');
    useLayoutStore().changeConf('tabRender', false);
  } else {
    useLayoutStore().changeConf('layout', 'mix');
  }
});
</script>

<template>
  <component :is="currentComponent" />
</template>
<style lang="less" scoped></style>
