refactor [X-02]: переделываю сайдбары
This commit is contained in:
1 parent
049c4a1915
commit
08b36bd65b
2 files changed
+45
-89
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<v-navigation-drawer :rail="props.isRail" permanent>
|
||||
<v-list v-for="nav in props.asideNavigation" density="compact" nav class="text-subtitle-2">
|
||||
<v-list-item :prepend-icon="nav.ico"
|
||||
@click="router.push(`${nav.path}`)">
|
||||
{{ nav.name }}
|
||||
</v-list-item>
|
||||
<v-list-group v-if="'submenu' in nav">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-for="sub in nav.submenu" v-bind="props">
|
||||
{{ sub.name }}
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-list-group>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import router from "@/router"
|
||||
|
||||
const props = defineProps({
|
||||
isRail: Boolean,
|
||||
asideNavigation: {
|
||||
type: Array,
|
||||
default: () => [{
|
||||
name: "",
|
||||
ico: "",
|
||||
path: "",
|
||||
submenu: [{
|
||||
name: "",
|
||||
path: "",
|
||||
}],
|
||||
}]
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -1,86 +1,15 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<AppHeader :isAuth="accountStore.cod2user" @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc" :author="accountStore.user"/>
|
||||
<v-app-bar :elevation="accountStore.cod2user ? 2 : 0" density="compact" color="app_bar" class="pl-4">
|
||||
<v-icon v-if="accountStore.cod2user" class="px-3" size="20" color="black_and_white"
|
||||
:icon="rail ? 'mdi-chevron-right' : 'mdi-chevron-left'" @click="rail = !rail" />
|
||||
<v-card v-if="accountStore.cod2user" class="bg-transparent py" color="black_and_white" density="compact"
|
||||
:prepend-avatar="imageSrc" title="Портал МИ ФНС России по ЦОД № 2" variant="text" :to="'/'" />
|
||||
<template v-slot:image>
|
||||
<v-img class="bggrad" />
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<template v-if="accountStore.cod2user">
|
||||
<vcard-user :author="accountStore.user" />
|
||||
<v-tooltip location="bottom">
|
||||
|
||||
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="black_and_white" v-bind="props" dark to="/faq" icon="mdi-comment-question-outline" />
|
||||
</template>
|
||||
<span>F.A.Q.</span>
|
||||
</v-tooltip>
|
||||
|
||||
|
||||
<v-dialog v-model="LikeDialog" persistent width="800">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="black_and_white" v-bind="props" dark icon="mdi-thumb-up-outline">
|
||||
<v-icon></v-icon>
|
||||
<v-tooltip activator="parent" location="bottom">Обратная связь</v-tooltip>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<Card-like :LikeDialog="LikeDialog" @menusClose="closeinfo()" />
|
||||
</v-dialog>
|
||||
|
||||
<v-tooltip location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn icon @click="toggleTheme">
|
||||
<v-icon v-bind="props" class="mr-1" :color="theme.global.current.value.dark ? 'yellow' : 'lampa'">
|
||||
mdi-lightbulb-outline
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span> Сменить тему</span>
|
||||
</v-tooltip>
|
||||
|
||||
<v-card v-show="message" class="" width="50">{{ name }}</v-card>
|
||||
|
||||
<v-tooltip location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="black_and_white" icon="mdi-account-multiple-outline" @click="drawer_right = !drawer_right"
|
||||
v-bind="props" />
|
||||
</template>
|
||||
<span>
|
||||
{{
|
||||
drawer_right == true
|
||||
? "Скрыть пользователей"
|
||||
: "Показать пользователей"
|
||||
}}
|
||||
</span>
|
||||
</v-tooltip>
|
||||
<v-tooltip location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn color="black_and_white" icon="mdi-logout" @click="accountStore.logout" v-bind="props" />
|
||||
</template>
|
||||
<span> Выход </span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<v-row justify="center">
|
||||
<Auth-form @challengealert="alert = true" />
|
||||
</v-row>
|
||||
</template>
|
||||
</template>
|
||||
</v-app-bar>
|
||||
<v-navigation-drawer v-if="accountStore.cod2user" :width="245" :rail="rail" permanent v-model="drawer">
|
||||
|
||||
<AsideNav :asideNavigation="navigations" :isRail="rail"/>
|
||||
<!-- <v-navigation-drawer v-if="accountStore.cod2user" :width="245" :rail="rail" permanent v-model="drawer">
|
||||
<v-row class="my-0 h-100">
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row><v-col>
|
||||
<v-list nav density="compact">
|
||||
<template v-for="(x, key) in navigations" :key="key">
|
||||
<!-- v-if="!('submenu' in x) || (x.path== '/portal' && accountStore.user.is_staff)" -->
|
||||
v-if="!('submenu' in x) || (x.path== '/portal' && accountStore.user.is_staff)"
|
||||
<v-list-item v-if="(x.path == '/portal'? accountStore.user.is_superuser : true) && !('submenu' in x)
|
||||
" :key="x.key" :title="x.name" :value="x.name" :href="x.link" :disabled="x.path == ''" :to="x.path"
|
||||
:target="x.link ? '_blank' : ''"
|
||||
@@ -143,7 +72,7 @@
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-navigation-drawer>
|
||||
</v-navigation-drawer> -->
|
||||
|
||||
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
||||
<router-view />
|
||||
@@ -191,9 +120,8 @@ import VcardUser from "@/components/UI/fiousercard/vcardUser.vue";
|
||||
import PageCounter from "@/components/UI/defaultportal/page-counter.vue";
|
||||
import AdminMenu from "@/layouts/default/AdminMenu.vue";
|
||||
|
||||
|
||||
import { useDisplay } from "vuetify";
|
||||
import AppHeader from "./AppHeader.vue";
|
||||
import AsideNav from "./AsideNav.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -204,18 +132,16 @@ export default {
|
||||
PageCounter,
|
||||
AdminMenu,
|
||||
AppHeader,
|
||||
AsideNav,
|
||||
},
|
||||
|
||||
mixins: [uf],
|
||||
|
||||
setup() {
|
||||
const { name } = useDisplay();
|
||||
const theme = useTheme();
|
||||
const mainmenuStore = useMainmenuStore();
|
||||
const accountStore = useAccountStore();
|
||||
const drawer = ref(true);
|
||||
const drawer_right = ref(true);
|
||||
|
||||
const LikeDialog = ref(false);
|
||||
const rail = ref(false);
|
||||
const showTooltip = ref(false);
|
||||
@@ -244,12 +170,6 @@ export default {
|
||||
return menus.slice(0, 2).toUpperCase();
|
||||
};
|
||||
|
||||
const toggleTheme = () => {
|
||||
theme.global.name.value = theme.global.current.value.dark
|
||||
? "light"
|
||||
: "dark";
|
||||
};
|
||||
|
||||
mainmenuStore.loadlinks();
|
||||
|
||||
|
||||
@@ -363,9 +283,7 @@ export default {
|
||||
theme,
|
||||
mainmenuStore,
|
||||
accountStore,
|
||||
drawer,
|
||||
drawer_right,
|
||||
toggleTheme,
|
||||
navigations,
|
||||
imageSrc,
|
||||
LikeDialog,
|
||||
|
||||
Reference in new issue
Block a user