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>
|
<script setup>
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { useTheme } from "vuetify";
|
import { useTheme } from "vuetify";
|
||||||
|
|
||||||
import CardLike from '@/components/cardLike.vue'
|
|
||||||
|
|
||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import CardLike from '@/components/cardLike.vue'
|
||||||
|
|
||||||
const userStore = useAccountStore()
|
const userStore = useAccountStore()
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const isDialog = ref(null)
|
const isDialog = ref(null)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<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>
|
<template v-slot:image>
|
||||||
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" />
|
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" />
|
||||||
</template>
|
</template>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<v-app-bar-title class="pl-2 text-h6 font-weight-bold">Портал МИ ФНС России по ЦОД № 2</v-app-bar-title>
|
<v-app-bar-title class="pl-2 text-h6 font-weight-bold">Портал МИ ФНС России по ЦОД № 2</v-app-bar-title>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="d-flex justify-end align-center">
|
<v-col class="d-flex justify-end align-center">
|
||||||
<vcard-user :author="props.author"/>
|
<vcard-user :author="accountStore.user"/>
|
||||||
<AppNavigation />
|
<AppNavigation />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
@@ -25,17 +25,19 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
|
|
||||||
import vcardUser from '@/components/UI/fiousercard/vcardUser.vue';
|
import vcardUser from '@/components/UI/fiousercard/vcardUser.vue';
|
||||||
import AppNavigation from '@/components/UI/AppHeader/AppNavigation.vue';
|
import AppNavigation from '@/components/UI/AppHeader/AppNavigation.vue';
|
||||||
import AuthForm from '@/components/UI/Auth-form.vue';
|
import AuthForm from '@/components/UI/Auth-form.vue';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const accountStore = useAccountStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
showSideBar: Boolean,
|
showSideBar: Boolean,
|
||||||
logo: String,
|
logo: String,
|
||||||
author: Object,
|
|
||||||
isAuth: Boolean,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
defineEmits(['showSide'])
|
defineEmits(['showSide'])
|
||||||
|
|||||||
@@ -1,50 +1,64 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-navigation-drawer v-if="props.isAuth" :rail="props.isRail" permanent class="text-body-2">
|
<v-navigation-drawer v-if="accountStore.cod2user" :rail="props.isRail" permanent class="text-body-2">
|
||||||
<v-list v-for="(nav, index) in props.asideNavigation" :key="index" density="compact" nav>
|
<div class="d-flex flex-column h-100">
|
||||||
<v-list-item v-if="!('submenu' in nav)" :prepend-icon="nav.ico" @click="router.push(`${nav.path}`)">
|
<v-list v-for="(nav, index) in props.asideNavigation" :key="index" density="compact" nav>
|
||||||
{{ nav.name }}
|
<v-list-item v-if="!('submenu' in nav)" :prepend-icon="nav.ico" @click="router.push(`${nav.path}`)">
|
||||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
|
||||||
{{ nav.name }}
|
{{ 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">
|
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||||
{{ sub.name }}
|
{{ nav.name }}
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list-group>
|
<v-list-group v-else :fluid="props.isRail ? true : false">
|
||||||
</v-list>
|
<template v-slot:activator="{ props: groupProps }">
|
||||||
<v-list nav>
|
<v-list-item v-bind="groupProps" :prepend-icon="nav.ico">
|
||||||
<v-list-item v-for="links in store.portallinks" :key="links.id" :href="links.link" target="_blank"
|
{{ nav.name }}
|
||||||
:prepend-icon="links.imagecode" link>
|
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||||
{{ links.name }}
|
{{ nav.name }}
|
||||||
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
</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 }}
|
{{ links.name }}
|
||||||
</v-tooltip>
|
<v-tooltip v-if="props.isRail" location="top" activator="parent">
|
||||||
</v-list-item>
|
{{ links.name }}
|
||||||
</v-list>
|
</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>
|
</v-navigation-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import router from "@/router"
|
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 store = useMainmenuStore()
|
||||||
|
const accountStore = useAccountStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isRail: Boolean,
|
isRail: Boolean,
|
||||||
isAuth: Boolean,
|
|
||||||
asideNavigation: {
|
asideNavigation: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [{
|
default: () => [{
|
||||||
|
|||||||
@@ -1,79 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-app>
|
<v-app>
|
||||||
<AppHeader :isAuth="accountStore.cod2user" @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc" :author="accountStore.user"/>
|
<AppHeader @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc"/>
|
||||||
|
<AsideNav :asideNavigation="navigations" :isRail="rail"/>
|
||||||
<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> -->
|
|
||||||
|
|
||||||
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
||||||
<router-view />
|
<router-view />
|
||||||
|
|
||||||
@@ -106,9 +34,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import uf from "@/utils/universal_functions";
|
|
||||||
import { useAccountStore } from "@/store/AccountStore";
|
import { useAccountStore } from "@/store/AccountStore";
|
||||||
import { useMainmenuStore } from "@/store/MainmenuStore";
|
|
||||||
import { useTheme } from "vuetify";
|
import { useTheme } from "vuetify";
|
||||||
import AuthForm from "@/components/UI/Auth-form.vue";
|
import AuthForm from "@/components/UI/Auth-form.vue";
|
||||||
import OnlineUsers from "@/components/UI/fiousercard/onlineUsers.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 { baseURL } from "@/utils/axios-api";
|
||||||
import VcardUser from "@/components/UI/fiousercard/vcardUser.vue";
|
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 AdminMenu from "@/layouts/default/AdminMenu.vue";
|
||||||
|
|
||||||
import AppHeader from "./AppHeader.vue";
|
import AppHeader from "./AppHeader.vue";
|
||||||
@@ -129,17 +54,13 @@ export default {
|
|||||||
OnlineUsers,
|
OnlineUsers,
|
||||||
CardLike,
|
CardLike,
|
||||||
VcardUser,
|
VcardUser,
|
||||||
PageCounter,
|
|
||||||
AdminMenu,
|
AdminMenu,
|
||||||
AppHeader,
|
AppHeader,
|
||||||
AsideNav,
|
AsideNav,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [uf],
|
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const mainmenuStore = useMainmenuStore();
|
|
||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
const drawer_right = ref(true);
|
const drawer_right = ref(true);
|
||||||
const LikeDialog = ref(false);
|
const LikeDialog = ref(false);
|
||||||
@@ -164,11 +85,7 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
screenimg();
|
screenimg();
|
||||||
|
|
||||||
mainmenuStore.loadlinks();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const navigations = ref([
|
const navigations = ref([
|
||||||
{
|
{
|
||||||
@@ -277,7 +194,6 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
theme,
|
theme,
|
||||||
mainmenuStore,
|
|
||||||
accountStore,
|
accountStore,
|
||||||
drawer_right,
|
drawer_right,
|
||||||
navigations,
|
navigations,
|
||||||
@@ -298,27 +214,9 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<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 {
|
.textcolor {
|
||||||
color: #2f535e;
|
color: #2f535e;
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
#tr-popup {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in new issue
Block a user