2024-08-23 12:42:32 +00:00
|
|
|
<template>
|
|
|
|
<SidebarLayout>
|
|
|
|
<template #sidebar>
|
|
|
|
<SidebarTemplate
|
|
|
|
:mainTitle="activeNavigationObject.mainTitle"
|
|
|
|
:topTitle="activeNavigationObject.topTitle"
|
|
|
|
:showTopList="activeNavigationObject.top != null"
|
|
|
|
>
|
|
|
|
<template #topList>
|
|
|
|
<RoutingLink v-for="item in activeNavigationObject.top" :key="item.key" :link="item" />
|
|
|
|
</template>
|
|
|
|
<template #list>
|
|
|
|
<RoutingLink v-for="item in activeNavigationObject.main" :key="item.key" :link="item" />
|
|
|
|
</template>
|
|
|
|
</SidebarTemplate>
|
|
|
|
</template>
|
|
|
|
<template #main>
|
2024-08-25 11:37:23 +00:00
|
|
|
<component v-if="display" :is="displayed" />
|
2024-08-23 12:42:32 +00:00
|
|
|
<div v-else class="w-full h-full bg-white rounded-lg"></div>
|
|
|
|
</template>
|
|
|
|
</SidebarLayout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import { mapState, mapActions } from "pinia";
|
|
|
|
import { useNavigationStore } from "@/stores/admin/navigation";
|
|
|
|
import SidebarLayout from "@/layouts/Sidebar.vue";
|
|
|
|
import SidebarTemplate from "@/templates/Sidebar.vue";
|
|
|
|
import RoutingLink from "@/components/admin/RoutingLink.vue";
|
2024-08-26 15:56:07 +00:00
|
|
|
import { useAbilityStore } from "../../stores/ability";
|
2024-08-23 12:42:32 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
props: {
|
|
|
|
contestId: {
|
|
|
|
type: String,
|
|
|
|
default: "",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
2024-08-25 11:37:23 +00:00
|
|
|
...mapState(useNavigationStore, [
|
|
|
|
"activeNavigationObject",
|
|
|
|
"activeTopLevelObject",
|
|
|
|
"activeLink",
|
|
|
|
"componentOverwrite",
|
|
|
|
]),
|
|
|
|
display(): boolean {
|
|
|
|
return this.activeLink?.component || this.componentOverwrite;
|
|
|
|
},
|
|
|
|
displayed() {
|
|
|
|
if (this.componentOverwrite != null) {
|
|
|
|
return this.componentOverwrite;
|
|
|
|
} else {
|
|
|
|
return this.activeLink?.component;
|
|
|
|
}
|
|
|
|
},
|
2024-08-23 12:42:32 +00:00
|
|
|
},
|
|
|
|
created() {
|
2024-08-26 15:56:07 +00:00
|
|
|
useAbilityStore().$subscribe(() => {
|
|
|
|
this.updateTopLevel();
|
|
|
|
this.updateNavigation();
|
|
|
|
});
|
|
|
|
this.updateTopLevel();
|
|
|
|
this.updateNavigation();
|
|
|
|
|
2024-08-23 12:42:32 +00:00
|
|
|
this.setLink(this.activeTopLevelObject.levelDefault);
|
|
|
|
},
|
|
|
|
beforeUnmount() {
|
|
|
|
this.resetNavigation();
|
|
|
|
},
|
|
|
|
methods: {
|
2024-08-26 15:56:07 +00:00
|
|
|
...mapActions(useNavigationStore, [
|
|
|
|
"setLink",
|
|
|
|
"resetNavigation",
|
|
|
|
"setTopLevel",
|
|
|
|
"updateTopLevel",
|
|
|
|
"updateNavigation",
|
|
|
|
]),
|
2024-08-23 12:42:32 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|