多租户自定义主页

This commit is contained in:
lai
2024-10-16 14:50:15 +08:00
parent 009c4cf590
commit cd3e87c1c9
5 changed files with 129 additions and 4 deletions

View File

@@ -1,10 +1,6 @@
<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';
@@ -16,12 +12,24 @@ const currentComponent = shallowRef(
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');
//获取当前系统设置的首页路径
getConfigKey('sys.homePage').then(res => {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
console.log(res.data);
if (res.data) {
currentComponent.value = defineAsyncComponent(
() => import(`./${res.data}.vue`)
);
}
}
});
}
});
</script>