refactor [X-04]: удалена портянка кода старого, переработан Default Portla.vue, разбито на компоненты
This commit is contained in:
1 parent
1dd6959f0b
commit
8226fb74e6
4 files changed
+57
-144
No files matched your search
@@ -13,12 +13,11 @@
|
||||
<script setup>
|
||||
import router from '@/router';
|
||||
import { useTheme } from "vuetify";
|
||||
|
||||
import CardLike from '@/components/cardLike.vue'
|
||||
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import CardLike from '@/components/cardLike.vue'
|
||||
|
||||
const userStore = useAccountStore()
|
||||
const theme = useTheme()
|
||||
const isDialog = ref(null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-app-bar v-if="props.isAuth" density="compact" color="teal-darken-4" elevation="1">
|
||||
<v-app-bar v-if="accountStore.cod2user" density="compact" color="teal-darken-4" elevation="1">
|
||||
<template v-slot:image>
|
||||
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" />
|
||||
</template>
|
||||
@@ -9,7 +9,7 @@
|
||||
<v-app-bar-title class="pl-2 text-h6 font-weight-bold">Портал МИ ФНС России по ЦОД № 2</v-app-bar-title>
|
||||
</v-col>
|
||||
<v-col class="d-flex justify-end align-center">
|
||||
<vcard-user :author="props.author"/>
|
||||
<vcard-user :author="accountStore.user"/>
|
||||
<AppNavigation />
|
||||
</v-col>
|
||||
</v-app-bar>
|
||||
@@ -25,17 +25,19 @@
|
||||
|
||||
<script setup>
|
||||
import router from '@/router';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
|
||||
import vcardUser from '@/components/UI/fiousercard/vcardUser.vue';
|
||||
import AppNavigation from '@/components/UI/AppHeader/AppNavigation.vue';
|
||||
import AuthForm from '@/components/UI/Auth-form.vue';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
const props = defineProps({
|
||||
showSideBar: Boolean,
|
||||
logo: String,
|
||||
author: Object,
|
||||
isAuth: Boolean,
|
||||
})
|
||||
|
||||
defineEmits(['showSide'])
|
||||
|
||||
@@ -1,50 +1,64 @@
|
||||
<template>
|
||||
<v-navigation-drawer v-if="props.isAuth" :rail="props.isRail" permanent class="text-body-2">
|
||||
<v-list v-for="(nav, index) in props.asideNavigation" :key="index" density="compact" nav>
|
||||
<v-list-item v-if="!('submenu' in nav)" :prepend-icon="nav.ico" @click="router.push(`${nav.path}`)">
|
||||
{{ nav.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
<v-navigation-drawer v-if="accountStore.cod2user" :rail="props.isRail" permanent class="text-body-2">
|
||||
<div class="d-flex flex-column h-100">
|
||||
<v-list v-for="(nav, index) in props.asideNavigation" :key="index" density="compact" nav>
|
||||
<v-list-item v-if="!('submenu' in nav)" :prepend-icon="nav.ico" @click="router.push(`${nav.path}`)">
|
||||
{{ nav.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
<v-list-group v-else :fluid="props.isRail ? true : false">
|
||||
<template v-slot:activator="{ props: groupProps }">
|
||||
<v-list-item v-bind="groupProps" :prepend-icon="nav.ico">
|
||||
{{ nav.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
{{ nav.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-list-item v-for="(sub, index) in nav.submenu" :key="index">
|
||||
{{ props.isRail ? getAbbreviation(sub.name) : sub.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
{{ sub.name }}
|
||||
{{ nav.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
</v-list>
|
||||
<v-list nav>
|
||||
<v-list-item v-for="links in store.portallinks" :key="links.id" :href="links.link" target="_blank"
|
||||
:prepend-icon="links.imagecode" link>
|
||||
{{ links.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
<v-list-group v-else :fluid="props.isRail ? true : false">
|
||||
<template v-slot:activator="{ props: groupProps }">
|
||||
<v-list-item v-bind="groupProps" :prepend-icon="nav.ico">
|
||||
{{ nav.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
{{ nav.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-list-item v-for="(sub, index) in nav.submenu" :key="index" @click="router.push(`${sub.path}`)">
|
||||
{{ props.isRail ? getAbbreviation(sub.name) : sub.name }}
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
{{ sub.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
</v-list>
|
||||
<v-list class="flex-grow-1" nav>
|
||||
<v-list-item v-for="links in store.portallinks" :key="links.id" :href="links.link" target="_blank"
|
||||
:prepend-icon="links.imagecode" link>
|
||||
{{ links.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
{{ links.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-list class="text-blue-grey-lighten-1" nav>
|
||||
<v-list-item prepend-icon="mdi-wrench" title="Панель администратора" :href="baseURL + 'admin'" target="_blank" link>
|
||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||
Панель администратора
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<page-counter :rail="props.isRail"/>
|
||||
</div>
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import router from "@/router"
|
||||
import { useMainmenuStore } from "../../store/MainmenuStore";
|
||||
import { useMainmenuStore } from "@/store/MainmenuStore";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import { baseURL } from '@/utils/axios-api';
|
||||
|
||||
import pageCounter from "@/components/UI/defaultportal/page-counter.vue";
|
||||
|
||||
const store = useMainmenuStore()
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
const props = defineProps({
|
||||
isRail: Boolean,
|
||||
isAuth: Boolean,
|
||||
asideNavigation: {
|
||||
type: Array,
|
||||
default: () => [{
|
||||
|
||||
@@ -1,79 +1,7 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<AppHeader :isAuth="accountStore.cod2user" @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc" :author="accountStore.user"/>
|
||||
|
||||
<AsideNav :isAuth="accountStore.cod2user" :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-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' : ''"
|
||||
color="navigation"
|
||||
|
||||
>
|
||||
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
{{ x.name }}
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
<v-list-group v-if="x.path != '/portal' && 'submenu' in x" :class="rail ? 'railmenu' : ''" :key="key"
|
||||
:value="x.name">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-bind="props" :title="x.name" :prepend-icon="x.ico" color="navigation">
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
{{ x.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<v-list-item v-for="(child, k) in x.submenu" color="navigation" :href="child.link" :key="k"
|
||||
:value="child.name" :title="!rail ? child.name : menuTruncated(child.name)" :to="child.path"
|
||||
:target="child.link ? '_blank' : ''">
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
{{ child.name }}
|
||||
</v-tooltip>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
</template>
|
||||
</v-list>
|
||||
|
||||
<v-list nav density="compact">
|
||||
<v-list-item v-for="x of mainmenuStore.portallinks" :key="x.name" :title="x.name" :value="x.name"
|
||||
:href="x.link" color="app_bar" :target="x.link ? '_blank' : ''">
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.imagecode" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
{{ x.name }}
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||
<v-col>
|
||||
<AdminMenu :rail="rail" />
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
<v-col>
|
||||
<page-counter :rail="rail" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-navigation-drawer> -->
|
||||
|
||||
<AppHeader @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc"/>
|
||||
<AsideNav :asideNavigation="navigations" :isRail="rail"/>
|
||||
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
||||
<router-view />
|
||||
|
||||
@@ -106,9 +34,7 @@
|
||||
|
||||
<script>
|
||||
import { ref, computed } from "vue";
|
||||
import uf from "@/utils/universal_functions";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import { useMainmenuStore } from "@/store/MainmenuStore";
|
||||
import { useTheme } from "vuetify";
|
||||
import AuthForm from "@/components/UI/Auth-form.vue";
|
||||
import OnlineUsers from "@/components/UI/fiousercard/onlineUsers.vue";
|
||||
@@ -117,7 +43,6 @@ import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
|
||||
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
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 AppHeader from "./AppHeader.vue";
|
||||
@@ -129,17 +54,13 @@ export default {
|
||||
OnlineUsers,
|
||||
CardLike,
|
||||
VcardUser,
|
||||
PageCounter,
|
||||
AdminMenu,
|
||||
AppHeader,
|
||||
AsideNav,
|
||||
},
|
||||
|
||||
mixins: [uf],
|
||||
|
||||
setup() {
|
||||
const theme = useTheme();
|
||||
const mainmenuStore = useMainmenuStore();
|
||||
const accountStore = useAccountStore();
|
||||
const drawer_right = ref(true);
|
||||
const LikeDialog = ref(false);
|
||||
@@ -164,11 +85,7 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
screenimg();
|
||||
|
||||
mainmenuStore.loadlinks();
|
||||
|
||||
|
||||
screenimg();
|
||||
|
||||
const navigations = ref([
|
||||
{
|
||||
@@ -277,7 +194,6 @@ export default {
|
||||
|
||||
return {
|
||||
theme,
|
||||
mainmenuStore,
|
||||
accountStore,
|
||||
drawer_right,
|
||||
navigations,
|
||||
@@ -298,27 +214,9 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.mystat {
|
||||
position: fixed;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
z-index: 1005;
|
||||
}
|
||||
|
||||
.btnNav .v-navigation-drawer__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.railmenu .v-list-group__items .v-list-item {
|
||||
padding-inline-start: 11px !important;
|
||||
}
|
||||
|
||||
.textcolor {
|
||||
color: #2f535e;
|
||||
}
|
||||
|
||||
#tr-popup {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in new issue
Block a user