first commit
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<div class="admin-layout">
|
||||
<aside v-if="!isMobile" class="admin-layout__sidebar">
|
||||
<AdminSidebar :menu-items="menuItems" />
|
||||
</aside>
|
||||
|
||||
<div class="admin-layout__content">
|
||||
<div class="admin-layout__inner">
|
||||
<HeaderBlock :page-title="pageTitle" class="admin-layout__header" />
|
||||
<div class="admin-layout__page">
|
||||
<RouterView />
|
||||
</div>
|
||||
<div class="admin-layout__footer">
|
||||
<Copyright />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Transition name="fade">
|
||||
<div
|
||||
v-if="isMobile && ui.isSidebarOpen"
|
||||
class="admin-layout__backdrop"
|
||||
@click="ui.setSidebarState(false)"
|
||||
/>
|
||||
</Transition>
|
||||
<Transition name="slide-drawer">
|
||||
<aside
|
||||
v-if="isMobile && ui.isSidebarOpen"
|
||||
class="admin-layout__sidebar admin-layout__sidebar--mobile"
|
||||
>
|
||||
<AdminSidebar :menu-items="menuItems" />
|
||||
</aside>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { RouterView, useRoute } from 'vue-router'
|
||||
|
||||
import AdminSidebar from '@/layouts/sidebars/AdminSidebar.vue'
|
||||
import HeaderBlock from '@/components/HeaderBlock.vue'
|
||||
import Copyright from '@/components/Copyright.vue'
|
||||
import { useUIStore } from '@/store/ui'
|
||||
|
||||
const ui = useUIStore()
|
||||
const route = useRoute()
|
||||
|
||||
const isMobile = ref(window.innerWidth < 1024)
|
||||
const onResize = () => {
|
||||
isMobile.value = window.innerWidth < 1024
|
||||
}
|
||||
onMounted(() => window.addEventListener('resize', onResize))
|
||||
onBeforeUnmount(() => window.removeEventListener('resize', onResize))
|
||||
|
||||
const pageTitle = computed(() => route.meta?.title || 'پیشخوان')
|
||||
|
||||
const educationRoutes = new Set([
|
||||
'admin-terms',
|
||||
'admin-add-term',
|
||||
'admin-edit-term',
|
||||
'admin-courses',
|
||||
'admin-add-course-template',
|
||||
'admin-edit-course-template',
|
||||
'admin-sessions',
|
||||
'admin-add-session',
|
||||
'admin-edit-session',
|
||||
'admin-assignments',
|
||||
'admin-exams',
|
||||
'admin-add-exam',
|
||||
'admin-edit-exam',
|
||||
])
|
||||
|
||||
const menuItems = computed(() => [
|
||||
{
|
||||
title: 'پیشـخوان',
|
||||
icon: 'menu',
|
||||
to: { name: 'admin-dashboard' },
|
||||
active: route.name === 'admin-dashboard',
|
||||
},
|
||||
{
|
||||
title: 'تایید هویت کاربران',
|
||||
icon: 'user',
|
||||
to: { name: 'admin-user-verification' },
|
||||
active: route.name === 'admin-user-verification',
|
||||
},
|
||||
{
|
||||
title: 'مدیریت کاربران',
|
||||
icon: 'users',
|
||||
to: { name: 'admin-users' },
|
||||
active: ['admin-users', 'admin-add-user', 'admin-edit-user'].includes(route.name),
|
||||
},
|
||||
{
|
||||
title: 'مدیریت آمـوزش',
|
||||
icon: 'file',
|
||||
active: educationRoutes.has(route.name),
|
||||
children: [
|
||||
{
|
||||
title: 'مدیریت ترم',
|
||||
to: { name: 'admin-terms' },
|
||||
active: ['admin-terms', 'admin-add-term', 'admin-edit-term'].includes(route.name),
|
||||
},
|
||||
{
|
||||
title: 'مدیریت دورهها',
|
||||
to: { name: 'admin-courses' },
|
||||
active: [
|
||||
'admin-courses',
|
||||
'admin-add-course-template',
|
||||
'admin-edit-course-template',
|
||||
].includes(route.name),
|
||||
},
|
||||
{
|
||||
title: 'مدیریت جلسه',
|
||||
to: { name: 'admin-sessions' },
|
||||
active: ['admin-sessions', 'admin-add-session', 'admin-edit-session'].includes(route.name),
|
||||
},
|
||||
{
|
||||
title: 'مدیریت تکالیف',
|
||||
to: { name: 'admin-assignments' },
|
||||
active: route.name === 'admin-assignments',
|
||||
},
|
||||
{
|
||||
title: 'مدیریت آزمونها',
|
||||
to: { name: 'admin-exams' },
|
||||
active: ['admin-exams', 'admin-add-exam', 'admin-edit-exam'].includes(route.name),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'مدیریت پیامها',
|
||||
icon: 'chat',
|
||||
to: { name: 'admin-messages' },
|
||||
active: route.name === 'admin-messages',
|
||||
},
|
||||
{
|
||||
title: 'مدیریت خدمات',
|
||||
icon: 'users-three',
|
||||
to: { name: 'admin-services' },
|
||||
active: route.name === 'admin-services',
|
||||
},
|
||||
{
|
||||
title: 'مدیریت مشاوره',
|
||||
icon: 'chat',
|
||||
to: { name: 'admin-consultations' },
|
||||
active: route.name === 'admin-consultations',
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.admin-layout {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
background-color: #f3f3f3;
|
||||
|
||||
&__sidebar {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 16.6667%;
|
||||
min-height: 100vh;
|
||||
z-index: 30;
|
||||
padding: 1rem;
|
||||
display: none;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&--mobile {
|
||||
display: block;
|
||||
width: 70%;
|
||||
max-width: 18rem;
|
||||
|
||||
@media (min-width: 640px) {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
width: 83.3333%;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__inner {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
&__header {
|
||||
margin-bottom: 1.25rem;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__page {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
&__footer {
|
||||
padding-top: 0.5rem;
|
||||
margin-top: 2.5rem;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
width: fit-content;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 20;
|
||||
background-color: rgba(0, 0, 0, 20%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div class="public-layout" :style="bgStyle">
|
||||
<RouterView />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { RouterView } from 'vue-router'
|
||||
|
||||
import { gallery } from '@/utils/gallery'
|
||||
|
||||
const props = defineProps({
|
||||
background: { type: String, default: '' },
|
||||
})
|
||||
|
||||
const bgStyle = computed(() =>
|
||||
props.background ? { backgroundImage: `url(${props.background || gallery.loginPattern})` } : {}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.public-layout {
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="student-layout">
|
||||
<div class="student-layout__row">
|
||||
<Transition name="fade">
|
||||
<div
|
||||
v-if="isMobile && ui.isSidebarOpen"
|
||||
class="student-layout__backdrop"
|
||||
@click="ui.setSidebarState(false)"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<Transition :name="isMobile ? 'slide-drawer' : ''">
|
||||
<aside
|
||||
v-if="(isMobile && ui.isSidebarOpen) || !isMobile"
|
||||
class="student-layout__sidebar"
|
||||
:class="{ 'student-layout__sidebar--mobile': isMobile }"
|
||||
>
|
||||
<StudentSidebar :menu-items="menuItems" />
|
||||
</aside>
|
||||
</Transition>
|
||||
|
||||
<div class="student-layout__content">
|
||||
<div class="student-layout__inner">
|
||||
<HeaderBlock :page-title="pageTitle" class="student-layout__header" />
|
||||
<RouterView />
|
||||
<div class="student-layout__footer">
|
||||
<Copyright />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { RouterView, useRoute } from 'vue-router'
|
||||
|
||||
import StudentSidebar from '@/layouts/sidebars/StudentSidebar.vue'
|
||||
import HeaderBlock from '@/components/HeaderBlock.vue'
|
||||
import Copyright from '@/components/Copyright.vue'
|
||||
import { useUIStore } from '@/store/ui'
|
||||
|
||||
const ui = useUIStore()
|
||||
const route = useRoute()
|
||||
|
||||
const isMobile = ref(window.innerWidth < 1024)
|
||||
const onResize = () => {
|
||||
isMobile.value = window.innerWidth < 1024
|
||||
}
|
||||
onMounted(() => window.addEventListener('resize', onResize))
|
||||
onBeforeUnmount(() => window.removeEventListener('resize', onResize))
|
||||
|
||||
const pageTitle = computed(() => route.meta?.title || 'پیشخوان')
|
||||
|
||||
const menuItems = computed(() => [
|
||||
{
|
||||
title: 'پیشـخوان',
|
||||
icon: 'menu',
|
||||
to: { name: 'student-dashboard' },
|
||||
active: route.name === 'student-dashboard',
|
||||
},
|
||||
{
|
||||
title: 'دورههای من',
|
||||
icon: 'book',
|
||||
to: { name: 'student-courses' },
|
||||
active: ['student-courses', 'student-course-details'].includes(route.name),
|
||||
},
|
||||
{
|
||||
title: 'ویرایش پروفایل',
|
||||
icon: 'user',
|
||||
to: { name: 'student-profile' },
|
||||
active: route.name === 'student-profile',
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.student-layout {
|
||||
min-height: 100dvh;
|
||||
width: 100%;
|
||||
background-color: #f5f5f5;
|
||||
overflow: hidden;
|
||||
|
||||
&__row {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__sidebar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 30;
|
||||
height: 100%;
|
||||
min-height: 100dvh;
|
||||
width: 70%;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
position: static;
|
||||
width: auto;
|
||||
flex-basis: 16.6667%;
|
||||
}
|
||||
|
||||
&--mobile {
|
||||
width: 70%;
|
||||
max-width: 20rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 20;
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
&__content {
|
||||
flex-basis: 83.3333%;
|
||||
width: 100%;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
flex-basis: 93%;
|
||||
}
|
||||
}
|
||||
|
||||
&__inner {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
&__header {
|
||||
margin-bottom: 1.25rem;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 1.25rem;
|
||||
width: 100%;
|
||||
padding: 0.5rem 0 1.25rem;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<aside class="admin-sidebar">
|
||||
<div class="admin-sidebar__logo">
|
||||
<img :src="logo" alt="banu" />
|
||||
</div>
|
||||
<nav class="admin-sidebar__nav">
|
||||
<ul>
|
||||
<li v-for="item in menuItems" :key="item.title" class="admin-sidebar__item">
|
||||
<component
|
||||
:is="item.to ? 'RouterLink' : 'div'"
|
||||
:to="item.to"
|
||||
class="admin-sidebar__link"
|
||||
:class="{ 'admin-sidebar__link--active': item.active }"
|
||||
>
|
||||
<SvgIcon v-if="item.icon" :name="item.icon" :size="22" />
|
||||
<span>{{ item.title }}</span>
|
||||
</component>
|
||||
<ul v-if="item.children?.length" class="admin-sidebar__submenu">
|
||||
<li v-for="child in item.children" :key="child.title">
|
||||
<RouterLink
|
||||
:to="child.to"
|
||||
class="admin-sidebar__sublink"
|
||||
:class="{ 'admin-sidebar__sublink--active': child.active }"
|
||||
>
|
||||
{{ child.title }}
|
||||
</RouterLink>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import { gallery } from '@/utils/gallery'
|
||||
|
||||
defineProps({
|
||||
menuItems: { type: Array, default: () => [] },
|
||||
})
|
||||
|
||||
const logo = gallery.logoPinkishRed
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.admin-sidebar {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 1.5rem 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
border-radius: 1rem;
|
||||
|
||||
&__logo {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
height: 3.5rem;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
&__nav {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
padding: 0.625rem 0.875rem;
|
||||
border-radius: 9999px;
|
||||
font-family: var(--font-family-fa);
|
||||
font-size: 0.875rem;
|
||||
color: #4b5563;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.15s, color 0.15s;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&__submenu {
|
||||
margin-top: 0.25rem !important;
|
||||
padding-inline-start: 1.5rem !important;
|
||||
gap: 0.125rem !important;
|
||||
}
|
||||
|
||||
&__sublink {
|
||||
display: block;
|
||||
padding: 0.375rem 0.625rem;
|
||||
border-radius: 9999px;
|
||||
font-family: var(--font-family-fa);
|
||||
font-size: 0.8125rem;
|
||||
color: #6b7280;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
background: #fff;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: #fff;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<aside class="student-sidebar" :style="bgStyle">
|
||||
<div class="student-sidebar__logo">
|
||||
<img :src="logo" alt="banu" />
|
||||
</div>
|
||||
<nav class="student-sidebar__nav">
|
||||
<ul>
|
||||
<li v-for="item in menuItems" :key="item.title">
|
||||
<component
|
||||
:is="item.to ? 'RouterLink' : 'div'"
|
||||
:to="item.to"
|
||||
class="student-sidebar__link"
|
||||
:class="{ 'student-sidebar__link--active': item.active }"
|
||||
>
|
||||
<SvgIcon v-if="item.icon" :name="item.icon" :size="22" color="#fff" />
|
||||
<span>{{ item.title }}</span>
|
||||
</component>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import { gallery } from '@/utils/gallery'
|
||||
|
||||
defineProps({
|
||||
menuItems: { type: Array, default: () => [] },
|
||||
})
|
||||
|
||||
const logo = gallery.logoWhite
|
||||
const bgStyle = computed(() => ({
|
||||
backgroundImage: `url(${gallery.loginPattern})`,
|
||||
}))
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.student-sidebar {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 1.5rem 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
border-radius: 1rem;
|
||||
background-color: var(--color-primary);
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
&__logo {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
height: 3.5rem;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
&__nav {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
padding: 0.625rem 0.875rem;
|
||||
border-radius: 9999px;
|
||||
font-family: var(--font-family-fa);
|
||||
font-size: 0.875rem;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.15s;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 10%);
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: rgba(255, 255, 255, 10%);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user