feat: 新增租户切换组件和css目录优化
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<script setup lang="ts">
|
||||
import { type RouteLocationNormalized } from "vue-router";
|
||||
import { useSettingsStore, useTagsViewStore } from "@/store";
|
||||
import variables from "@/styles/variables.scss";
|
||||
import variables from "@/styles/variables.module.scss";
|
||||
import Error404 from "@/views/error/404.vue";
|
||||
|
||||
const { cachedViews } = toRefs(useTagsViewStore());
|
||||
|
||||
@@ -33,7 +33,7 @@ import { SidebarColor } from "@/enums/settings";
|
||||
import { useSettingsStore, useAppStore } from "@/store";
|
||||
import { isExternal } from "@/utils/index";
|
||||
import MenuItem from "./components/MenuItem.vue";
|
||||
import variables from "@/styles/variables.scss";
|
||||
import variables from "@/styles/variables.module.scss";
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
|
||||
@@ -39,7 +39,7 @@ defineOptions({
|
||||
|
||||
import { LocationQueryRaw, RouteRecordRaw } from "vue-router";
|
||||
import { usePermissionStore, useAppStore, useSettingsStore } from "@/store";
|
||||
import variables from "@/styles/variables.scss";
|
||||
import variables from "@/styles/variables.module.scss";
|
||||
import { SidebarColor } from "@/enums/settings";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<!-- 租户选择(如果启用多租户) -->
|
||||
<div v-if="showTenantSelect" class="navbar-actions__item">
|
||||
<TenantSelect />
|
||||
<TenantSwitcher @change="handleTenantChange" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -83,7 +83,7 @@ import Fullscreen from "@/components/Fullscreen/index.vue";
|
||||
import SizeSelect from "@/components/SizeSelect/index.vue";
|
||||
import LangSelect from "@/components/LangSelect/index.vue";
|
||||
import Notification from "@/components/Notification/index.vue";
|
||||
import TenantSelect from "@/components/TenantSelect/index.vue";
|
||||
import TenantSwitcher from "@/components/TenantSwitcher/index.vue";
|
||||
import { useTenantStoreHook } from "@/store/modules/tenant-store";
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -113,6 +113,18 @@ const showTenantSelect = computed(() => {
|
||||
return true;
|
||||
});
|
||||
|
||||
function handleTenantChange(tenantId: number) {
|
||||
tenantStore
|
||||
.switchTenant(tenantId)
|
||||
.then(() => {
|
||||
ElMessage.success("切换租户成功");
|
||||
window.location.reload();
|
||||
})
|
||||
.catch((error: any) => {
|
||||
ElMessage.error(error?.message || "切换租户失败");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开个人中心页面
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ import LeftLayout from "@/layouts/modes/left/index.vue";
|
||||
import TopLayout from "@/layouts/modes/top/index.vue";
|
||||
import MixLayout from "@/layouts/modes/mix/index.vue";
|
||||
import Settings from "./components/Settings/index.vue";
|
||||
import { LayoutMode } from "@/enums/settings/layout-enum";
|
||||
import { LayoutMode } from "@/enums/settings";
|
||||
import { defaultSettings } from "@/settings";
|
||||
|
||||
const { currentLayout } = useLayout();
|
||||
|
||||
@@ -69,7 +69,7 @@ import TagsView from "../../components/TagsView/index.vue";
|
||||
import AppMain from "../../components/AppMain/index.vue";
|
||||
import MenuItem from "../../components/Menu/components/MenuItem.vue";
|
||||
import Hamburger from "@/components/Hamburger/index.vue";
|
||||
import variables from "@/styles/variables.scss";
|
||||
import variables from "@/styles/variables.module.scss";
|
||||
import { isExternal } from "@/utils/index";
|
||||
import { useAppStore, usePermissionStore } from "@/store";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user