refactor [X-06]: переделаны пользователи онлайн, кнопка скрыть/показать

This commit is contained in:
lexxik753 committed 2025-09-23 16:50:49 +03:00
1 parent e519dc1c85
commit 31a2905dcf
4 files changed
+37 -39

No files matched your search

@@ -14,15 +14,20 @@
import router from '@/router';
import { useTheme } from "vuetify";
import { useAccountStore } from '@/store/AccountStore';
import { ref } from 'vue';
import { ref, computed } from 'vue';
import CardLike from '@/components/cardLike.vue'
const userStore = useAccountStore()
const theme = useTheme()
const isDialog = ref(null)
const rightRail = ref(true)
const navMenu = ref([
const emit = defineEmits(['showUser'])
const navMenu = computed(() => {
return [
{
text: 'F.A.Q.',
icon: 'mdi-comment-question-outline',
@@ -31,7 +36,6 @@ const navMenu = ref([
{
text: 'Обратная связь',
icon: 'mdi-thumb-up-outline',
// Добавить открытие модалки
event: () => isDialog.value = true,
},
{
@@ -41,14 +45,17 @@ const navMenu = ref([
event: () => theme.toggle(),
},
{
text: 'Скрыть пользователей',
text: `${rightRail.value == true ? 'Скрыть ' : 'Показать '} пользователей`,
icon: 'mdi-account-multiple-outline',
event: () => router.push('/faq'),
event: () => {
rightRail.value = !rightRail.value
emit('showUser', rightRail.value)
},
},
{
text: 'Выход',
icon: 'mdi-logout',
event: () => userStore.logout(),
},
])
]})
</script>
+5 -13
View File
@@ -10,17 +10,9 @@
</v-col>
<v-col class="d-flex justify-end align-center">
<vcard-user :author="accountStore.user"/>
<AppNavigation />
<AppNavigation @showUser="showUser"/>
</v-col>
</v-app-bar>
<!-- <v-app-bar v-else 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>
<v-col class="d-flex justify-end">
<AuthForm @challengealert="alarm= true"/>
</v-col>
</v-app-bar> -->
</template>
<script setup>
@@ -30,8 +22,6 @@ import { useAccountStore } from '@/store/AccountStore';
import vcardUser from '@/components/UI/fiousercard/vcardUser.vue';
import AppNavigation from '@/components/UI/AppHeader/AppNavigation.vue';
import { ref } from 'vue';
const accountStore = useAccountStore()
const props = defineProps({
@@ -39,8 +29,10 @@ const props = defineProps({
logo: String,
})
defineEmits(['showSide'])
const emit = defineEmits(['showSide', 'showUser'])
const alarm = ref(false)
const showUser = (val) => {
emit('showUser', val)
}
</script>
+7 -3
View File
@@ -44,23 +44,28 @@
<page-counter :rail="props.isRail"/>
</div>
</v-navigation-drawer>
<v-navigation-drawer v-model="props.showUser" rail location="right">
<online-users />
</v-navigation-drawer>
</template>
<script setup>
import router from "@/router"
import router from "@/router";
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";
import onlineUsers from "@/components/UI/fiousercard/onlineUsers.vue";
const store = useMainmenuStore()
const accountUser = useAccountStore()
store.loadlinks()
defineEmits(['showUser'])
const props = defineProps({
isRail: Boolean,
showUser: Boolean,
asideNavigation: {
type: Array,
default: () => [{
@@ -78,5 +83,4 @@ const props = defineProps({
const getAbbreviation = (text) => {
return text.substring(0, 2).toUpperCase();
};
</script>
+12 -17
View File
@@ -1,7 +1,7 @@
<template>
<v-app>
<AppHeader @show-side="rail = !rail" :showSideBar="rail" :logo="imageSrc"/>
<AsideNav :asideNavigation="navigations" :isRail="rail"/>
<AppHeader @show-side="rail = !rail" :logo="imageSrc" @showUser="usersOnline" />
<AsideNav :asideNavigation="navigations" :isRail="rail" :showUser="showUser" />
<v-main class="d-flex">
<router-view />
<alert-default />
@@ -24,10 +24,6 @@
<alert-default />
</v-main> -->
<v-navigation-drawer v-model="drawer_right" rail permanent location="right"
@click="rail = false">
<Online-users />
</v-navigation-drawer>
</v-app>
</template>
@@ -38,28 +34,29 @@ import { useTheme } from "vuetify";
import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
import { baseURL } from "@/utils/axios-api";
import OnlineUsers from "@/components/UI/fiousercard/onlineUsers.vue";
import AppHeader from "./AppHeader.vue";
import AsideNav from "./AsideNav.vue";
import alertDefault from "./alertDefault.vue"
export default {
components: {
OnlineUsers,
AppHeader,
AsideNav,
alertDefault,
},
emits: ['showUser'],
setup() {
const theme = useTheme();
const accountStore = useAccountStore();
const drawer_right = ref(true);
const showUser = ref(true);
const rail = ref(false);
const alert = ref(false);
const burl = baseURL.slice(0, -1);
const scrimg = ref([]);
const usersOnline = (val) => {
showUser.value = val;
}
const message = computed({
get: () => {
return process.env.NODE_ENV == "development" ? true : false;
@@ -75,7 +72,7 @@ export default {
}
};
screenimg();
screenimg();
const navigations = ref([
{
@@ -148,7 +145,7 @@ export default {
path: "/portal",
},
]);
const imageSrc = computed(() => {
@@ -180,24 +177,22 @@ export default {
return {
theme,
accountStore,
drawer_right,
showUser,
navigations,
imageSrc,
scrimg,
scrimg,
rail,
alert,
burl,
name,
baseURL,
usersOnline,
message,
};
},
};
</script>
<style lang="scss">
.textcolor {
color: #2f535e;
}