کار اولیه
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
export default defineAppConfig({
|
||||
ui: {
|
||||
colors: {
|
||||
primary: "primary",
|
||||
secondary: "purple",
|
||||
neutral: "zinc",
|
||||
},
|
||||
button: {
|
||||
slots: {
|
||||
base: ["cursor-pointer"],
|
||||
},
|
||||
defaultVariants: {
|
||||
color: "primary",
|
||||
variant: "solid",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<UApp>
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
<ConfirmModal />
|
||||
</UApp>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, watch } from "vue";
|
||||
import { useHead } from "#imports";
|
||||
import { composSystemTheme } from "~/composables/composSystemTheme";
|
||||
import { getUserPermission } from "~/stores/permissionStore";
|
||||
|
||||
const userPermissionStore = getUserPermission();
|
||||
const systemTheme = composSystemTheme();
|
||||
const { applyTheme, logo, currentTheme, isRtl } = systemTheme;
|
||||
|
||||
// تنظیم اولیه در کلاینت
|
||||
onMounted(async () => {
|
||||
await applyTheme();
|
||||
userPermissionStore.fetchUserPermissions();
|
||||
});
|
||||
|
||||
// بهروزرسانی واکنشگرای عنوان و هدر
|
||||
watch(
|
||||
[logo, currentTheme, isRtl],
|
||||
([newLogo, newTheme, currentRtl]) => {
|
||||
useHead({
|
||||
title: `${newTheme?.title || "سامانه"} - ${newTheme?.subTitle || "مدیریت"}`,
|
||||
htmlAttrs: {
|
||||
dir: currentRtl ? "rtl" : "ltr",
|
||||
lang: currentRtl ? "fa" : "en",
|
||||
},
|
||||
link: [
|
||||
{
|
||||
rel: "icon",
|
||||
type: "image/x-icon",
|
||||
href: newLogo || "/favicon.ico",
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -0,0 +1,116 @@
|
||||
@import "tailwindcss";
|
||||
@import "@nuxt/ui";
|
||||
|
||||
/* تعریف فونتهای محلی از پوشه public */
|
||||
@font-face {
|
||||
font-family: 'Vazirmatn';
|
||||
src: url('/fonts/vazir/Vazirmatn-Regular.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Vazirmatn';
|
||||
src: url('/fonts/vazir/Vazirmatn-Medium.woff2') format('woff2');
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Vazirmatn';
|
||||
src: url('/fonts/vazir/Vazirmatn-Bold.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Sahel';
|
||||
src: url('/fonts/sahel/Sahel.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Sahel';
|
||||
src: url('/fonts/sahel/Sahel-Bold.woff2') format('woff2');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Yekan';
|
||||
src: url('/fonts/Yekan/Yekan.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@theme static {
|
||||
/* Light colors */
|
||||
--color-light-primary: #ffffff;
|
||||
--color-text__orange: #d99058;
|
||||
--color-link-color: #c37943;
|
||||
|
||||
/* Dark colors */
|
||||
--color-dark-primary: #111827;
|
||||
--color-dark-primary-800: #1f2937;
|
||||
--color-dark-primary-700: #374151;
|
||||
--color-dark-primary-600: #4b5563;
|
||||
--color-dark-primary-500: #6b7280;
|
||||
--color-dark-primary-400: #9ca3af;
|
||||
--color-dark-primary-300: #d1d5db;
|
||||
--color-dark-primary-200: #e5e7eb;
|
||||
--color-dark-primary-100: #f3f4f6;
|
||||
--color-dark-primary-50: #f9fafb;
|
||||
|
||||
/* Text colors */
|
||||
--color-white-normal: #ffffff;
|
||||
--color-black-normal: #111827;
|
||||
--color-white-bold: #ffffff;
|
||||
--color-white-light: rgba(255, 255, 255, 0.6);
|
||||
--color-white-strong: #ffffff;
|
||||
--color-dark-normal: #e5e7eb;
|
||||
--color-dark-bold: #111827;
|
||||
--color-dark-light: #6b7280;
|
||||
--color-dark-strong: #ffffff;
|
||||
--color-text-disabled: #9ca3af;
|
||||
--color-text-orange: #d99058;
|
||||
}
|
||||
|
||||
:root {
|
||||
--app-font: 'Vazirmatn', 'Sahel', 'Yekan', system-ui, -apple-system, sans-serif;
|
||||
--color-primary: #d99058;
|
||||
--color-primary-50: #fbf6f1;
|
||||
--color-primary-100: #f6ece1;
|
||||
--color-primary-200: #ebd7c3;
|
||||
--color-primary-300: #dfbfa1;
|
||||
--color-primary-400: #d4a37b;
|
||||
--color-primary-500: #d99058;
|
||||
--color-primary-600: #c37943;
|
||||
--color-primary-700: #a35f34;
|
||||
--color-primary-800: #834c2b;
|
||||
--color-primary-900: #6b3f25;
|
||||
--color-primary-950: #391f11;
|
||||
--ui-primary: #d99058;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: var(--app-font, 'Vazirmatn', sans-serif);
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#__nuxt,
|
||||
.root {
|
||||
font-family: var(--app-font, 'Vazirmatn', sans-serif);
|
||||
}
|
||||
|
||||
button,
|
||||
a {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "سامانه همیار حوزه",
|
||||
"title": "سامانه مدیریت و خدمات همیار",
|
||||
"subTitle": "مرکز خدمات و پشتیبانی مدارس علمیه",
|
||||
"description": "پرتال جامع خدمات، پشتیبانی و امور رفاهی طلاب و اساتید",
|
||||
"version": "1.0.0",
|
||||
"logo": {
|
||||
"light": "/logo/hamyar/light_logo.png",
|
||||
"dark": "/logo/hamyar/dark_logo.png",
|
||||
"favicon": "/favicon.ico",
|
||||
"icon": "/logo/hamyar/light_logo.png"
|
||||
},
|
||||
"font": "Sahel",
|
||||
"fontFallback": "'Vazirmatn', system-ui, Tahoma, sans-serif",
|
||||
"colors": {
|
||||
"primary": {
|
||||
"50": "#eff6ff",
|
||||
"100": "#dbeafe",
|
||||
"200": "#bfdbfe",
|
||||
"300": "#93c5fd",
|
||||
"400": "#60a5fa",
|
||||
"500": "#3b82f6",
|
||||
"600": "#2563eb",
|
||||
"700": "#1d4ed8",
|
||||
"800": "#1e40af",
|
||||
"900": "#1e3a8a",
|
||||
"950": "#172554"
|
||||
}
|
||||
},
|
||||
"rtl": true,
|
||||
"direction": "rtl",
|
||||
"darkMode": {
|
||||
"enabled": true,
|
||||
"default": "light",
|
||||
"storageKey": "theme-mode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"name": "حوزه علمیه سفیران هدایت",
|
||||
"title": "مدرسه علمیه سفیران هدایت",
|
||||
"subTitle": "سامانه جامع آموزشی، تهذیبی و پژوهشی طلاب",
|
||||
"description": "پرتال جامع اطلاعرسانی، امور آموزشی، پژوهش و خدمات طلاب حوزه علمیه سفیران هدایت",
|
||||
"version": "1.0.0",
|
||||
"logo": {
|
||||
"light": "/logo/school/light_logo.png",
|
||||
"dark": "/logo/school/dark_logo.png",
|
||||
"favicon": "/favicon.ico",
|
||||
"icon": "/logo/school/light_logo.png"
|
||||
},
|
||||
"font": "Vazirmatn",
|
||||
"fontFallback": "'Sahel', 'Yekan', system-ui, Tahoma, sans-serif",
|
||||
"fontFiles": [
|
||||
{
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"src": "/fonts/vazir/Vazirmatn-Regular.woff2"
|
||||
},
|
||||
{
|
||||
"weight": "500",
|
||||
"style": "normal",
|
||||
"src": "/fonts/vazir/Vazirmatn-Medium.woff2"
|
||||
},
|
||||
{
|
||||
"weight": "700",
|
||||
"style": "normal",
|
||||
"src": "/fonts/vazir/Vazirmatn-Bold.woff2"
|
||||
},
|
||||
{
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"src": "/fonts/sahel/Sahel.woff2"
|
||||
},
|
||||
{
|
||||
"weight": "700",
|
||||
"style": "normal",
|
||||
"src": "/fonts/sahel/Sahel-Bold.woff2"
|
||||
},
|
||||
{
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"src": "/fonts/Yekan/Yekan.woff2"
|
||||
}
|
||||
],
|
||||
"colors": {
|
||||
"primary": {
|
||||
"50": "#fbf6f1",
|
||||
"100": "#f6ece1",
|
||||
"200": "#ebd7c3",
|
||||
"300": "#dfbfa1",
|
||||
"400": "#d4a37b",
|
||||
"500": "#d99058",
|
||||
"600": "#c37943",
|
||||
"700": "#a35f34",
|
||||
"800": "#834c2b",
|
||||
"900": "#6b3f25",
|
||||
"950": "#391f11"
|
||||
}
|
||||
},
|
||||
"rtl": true,
|
||||
"direction": "rtl",
|
||||
"icons": {
|
||||
"sun": "i-lucide-sun",
|
||||
"moon": "i-lucide-moon",
|
||||
"menu": "i-lucide-menu",
|
||||
"close": "i-lucide-x",
|
||||
"check": "i-lucide-check",
|
||||
"chevronRight": "i-lucide-chevron-right",
|
||||
"chevronLeft": "i-lucide-chevron-left",
|
||||
"search": "i-lucide-search",
|
||||
"user": "i-lucide-user",
|
||||
"palette": "i-lucide-palette",
|
||||
"font": "i-lucide-type",
|
||||
"direction": "i-lucide-arrow-left-right",
|
||||
"network": "i-lucide-wifi",
|
||||
"settings": "i-lucide-settings",
|
||||
"bell": "i-lucide-bell",
|
||||
"dashboard": "i-lucide-layout-dashboard",
|
||||
"logout": "i-lucide-log-out",
|
||||
"bookOpen": "i-lucide-book-open",
|
||||
"graduationCap": "i-lucide-graduation-cap",
|
||||
"users": "i-lucide-users",
|
||||
"calendar": "i-lucide-calendar",
|
||||
"award": "i-lucide-award",
|
||||
"library": "i-lucide-library",
|
||||
"fileText": "i-lucide-file-text",
|
||||
"phone": "i-lucide-phone",
|
||||
"mapPin": "i-lucide-map-pin"
|
||||
},
|
||||
"layout": {
|
||||
"containerWidth": "1280px",
|
||||
"sidebarWidth": "280px",
|
||||
"headerHeight": "64px",
|
||||
"footerHeight": "80px"
|
||||
},
|
||||
"darkMode": {
|
||||
"enabled": true,
|
||||
"default": "light",
|
||||
"storageKey": "theme-mode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<UModal
|
||||
v-model:open="isModalOpen"
|
||||
:title="localModalSchema.title || ''"
|
||||
:description="localModalSchema.description || ''"
|
||||
:ui="modalUi"
|
||||
:dismissible="localModalSchema.dismissible !== false"
|
||||
>
|
||||
<!-- Body -->
|
||||
<template #body>
|
||||
<slot name="modal-body-content" />
|
||||
</template>
|
||||
|
||||
<!-- Footer -->
|
||||
<template v-if="hasFooter" #footer>
|
||||
<div class="flex w-full flex-wrap items-center justify-between gap-3">
|
||||
<!-- right actions -->
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UButton
|
||||
v-for="action in rightActions"
|
||||
:key="action.key"
|
||||
v-bind="resolveActionProps(action)"
|
||||
@click="onActionClick(action)"
|
||||
size="md"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- left actions -->
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<UButton
|
||||
v-for="action in leftActions"
|
||||
:key="action.key"
|
||||
v-bind="resolveActionProps(action)"
|
||||
@click="onActionClick(action)"
|
||||
size="md"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="footerText" class="mt-2 text-sm text-gray-500">
|
||||
{{ footerText }}
|
||||
</div>
|
||||
</template>
|
||||
</UModal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from "vue";
|
||||
|
||||
/* ---------------- props & emits ---------------- */
|
||||
|
||||
const props = defineProps({
|
||||
modalSchema: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
title: "مدال",
|
||||
description: "",
|
||||
size: "lg",
|
||||
footerDescription: "",
|
||||
actions: {
|
||||
left: [
|
||||
{
|
||||
key: "close",
|
||||
label: "بستن",
|
||||
variant: "outline",
|
||||
color: "neutral",
|
||||
closeOnClick: true,
|
||||
},
|
||||
{
|
||||
key: "save",
|
||||
label: "ذخیره",
|
||||
color: "primary",
|
||||
closeOnClick: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
},
|
||||
isOpen: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["modal-action", "update:isOpen", "modal-close"]);
|
||||
|
||||
/* ---------------- state ---------------- */
|
||||
|
||||
const isModalOpen = ref(props.isOpen);
|
||||
const footerText = ref("");
|
||||
|
||||
/* ---------------- computed ---------------- */
|
||||
|
||||
const localModalSchema = computed(() => props.modalSchema || {});
|
||||
|
||||
const actions = computed(() => localModalSchema.value.actions || {});
|
||||
const leftActions = computed(() => {
|
||||
const actionsList = actions.value.left || [];
|
||||
return actionsList.filter((action) => action && action.key);
|
||||
});
|
||||
const rightActions = computed(() => {
|
||||
const actionsList = actions.value.right || [];
|
||||
return actionsList.filter((action) => action && action.key);
|
||||
});
|
||||
|
||||
const hasFooter = computed(
|
||||
() => leftActions.value.length > 0 || rightActions.value.length > 0
|
||||
);
|
||||
|
||||
/* -------- modal width by size -------- */
|
||||
|
||||
const modalWidthMap = {
|
||||
sm: "max-w-[400px]",
|
||||
md: "max-w-[600px]",
|
||||
lg: "max-w-[900px]",
|
||||
xl: "max-w-[1200px]",
|
||||
};
|
||||
|
||||
const modalUi = computed(() => {
|
||||
const size = localModalSchema.value.size || "md";
|
||||
const widthClass = modalWidthMap[size] || modalWidthMap.md;
|
||||
|
||||
return {
|
||||
...localModalSchema.value.ui,
|
||||
content: [widthClass, localModalSchema.value.ui?.content]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
};
|
||||
});
|
||||
|
||||
/* ---------------- watchers ---------------- */
|
||||
|
||||
watch(
|
||||
() => props.isOpen,
|
||||
(val) => {
|
||||
isModalOpen.value = val;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(isModalOpen, (newVal) => {
|
||||
emit("update:isOpen", newVal);
|
||||
|
||||
if (newVal === false) {
|
||||
emit("modal-close");
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => localModalSchema.value.footerDescription,
|
||||
(val) => {
|
||||
footerText.value = val || "";
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
/* ---------------- methods ---------------- */
|
||||
|
||||
function onActionClick(action) {
|
||||
emit("modal-action", action.key);
|
||||
|
||||
if (action.closeOnClick) {
|
||||
isModalOpen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveActionProps(action) {
|
||||
return {
|
||||
label: action.label,
|
||||
icon: action.icon,
|
||||
color: action.color || "neutral",
|
||||
variant: action.variant || "solid",
|
||||
size: action.size || "sm",
|
||||
loading: action.loading || false,
|
||||
disabled: action.disabled || false,
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<UModal v-model:open="confirmState.isOpen" :title="confirmState.title">
|
||||
<template #body>
|
||||
<div class="py-2 text-sm text-gray-700 dark:text-gray-300">
|
||||
{{ confirmState.message }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2 w-full">
|
||||
<UButton
|
||||
color="neutral"
|
||||
variant="outline"
|
||||
:label="confirmState.cancelText"
|
||||
@click="ucoCancelConfirmModal"
|
||||
/>
|
||||
<UButton
|
||||
color="primary"
|
||||
variant="solid"
|
||||
:label="confirmState.confirmText"
|
||||
@click="ucoConfirm"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</UModal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useConfirmState, useConfirmActions } from "~/composables/useConfirm";
|
||||
|
||||
const confirmState = useConfirmState();
|
||||
const { ucoConfirm, ucoCancelConfirmModal } = useConfirmActions();
|
||||
</script>
|
||||
@@ -0,0 +1,356 @@
|
||||
import { ref, computed } from "vue";
|
||||
import defaultSchoolTheme from "~/assets/school/theme.json";
|
||||
|
||||
export interface ThemeFontFile {
|
||||
weight: string;
|
||||
style: string;
|
||||
src: string;
|
||||
}
|
||||
|
||||
export interface ThemeColors {
|
||||
primary?: Record<string, string>;
|
||||
secondary?: Record<string, string>;
|
||||
[key: string]: Record<string, string> | undefined;
|
||||
}
|
||||
|
||||
export interface ThemeConfig {
|
||||
name?: string;
|
||||
title?: string;
|
||||
subTitle?: string;
|
||||
description?: string;
|
||||
version?: string;
|
||||
logo?: {
|
||||
light?: string;
|
||||
dark?: string;
|
||||
favicon?: string;
|
||||
icon?: string;
|
||||
};
|
||||
font?: string;
|
||||
fontFallback?: string;
|
||||
fontFiles?: ThemeFontFile[];
|
||||
colors?: ThemeColors;
|
||||
rtl?: boolean;
|
||||
direction?: "rtl" | "ltr";
|
||||
icons?: Record<string, string>;
|
||||
layout?: {
|
||||
containerWidth?: string;
|
||||
sidebarWidth?: string;
|
||||
headerHeight?: string;
|
||||
footerHeight?: string;
|
||||
};
|
||||
darkMode?: {
|
||||
enabled?: boolean;
|
||||
default?: "light" | "dark" | "system";
|
||||
storageKey?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function composSystemTheme() {
|
||||
const nuxtApp = useNuxtApp();
|
||||
|
||||
// دسترسی به تم تزریقشده توسط پلاگین بر اساس NUXT_PUBLIC_SYSTEM یا تم پیشفرض school
|
||||
const initialTheme: ThemeConfig = (nuxtApp.$theme as ThemeConfig) || defaultSchoolTheme;
|
||||
|
||||
// وضعیت سراسری تم
|
||||
const currentTheme = useState<ThemeConfig>("system_theme", () => initialTheme);
|
||||
const themeKey = useState<string>("system_theme_key", () => (nuxtApp.$themeKey as string) || "school");
|
||||
const isDark = useState<boolean>("system_is_dark", () => false);
|
||||
const isRtl = useState<boolean>("system_is_rtl", () => currentTheme.value?.rtl ?? true);
|
||||
|
||||
// وضعیت reactive آیکونها
|
||||
const icons = useState<Record<string, string>>("system_icons", () => ({
|
||||
sun: "i-lucide-sun",
|
||||
moon: "i-lucide-moon",
|
||||
menu: "i-lucide-menu",
|
||||
close: "i-lucide-x",
|
||||
check: "i-lucide-check",
|
||||
chevronRight: "i-lucide-chevron-right",
|
||||
chevronLeft: "i-lucide-chevron-left",
|
||||
search: "i-lucide-search",
|
||||
user: "i-lucide-user",
|
||||
palette: "i-lucide-palette",
|
||||
font: "i-lucide-type",
|
||||
direction: "i-lucide-arrow-left-right",
|
||||
network: "i-lucide-wifi",
|
||||
settings: "i-lucide-settings",
|
||||
bell: "i-lucide-bell",
|
||||
dashboard: "i-lucide-layout-dashboard",
|
||||
logout: "i-lucide-log-out",
|
||||
bookOpen: "i-lucide-book-open",
|
||||
graduationCap: "i-lucide-graduation-cap",
|
||||
users: "i-lucide-users",
|
||||
calendar: "i-lucide-calendar",
|
||||
award: "i-lucide-award",
|
||||
library: "i-lucide-library",
|
||||
fileText: "i-lucide-file-text",
|
||||
phone: "i-lucide-phone",
|
||||
mapPin: "i-lucide-map-pin",
|
||||
...(currentTheme.value?.icons || {}),
|
||||
}));
|
||||
|
||||
// جهت صفحه
|
||||
const direction = computed(() => (isRtl.value ? "rtl" : "ltr"));
|
||||
|
||||
// لوگوی متناسب با تم روز/شب
|
||||
const logo = computed(() => {
|
||||
if (!currentTheme.value?.logo) return "";
|
||||
return isDark.value
|
||||
? currentTheme.value.logo.dark || currentTheme.value.logo.light || ""
|
||||
: currentTheme.value.logo.light || currentTheme.value.logo.dark || "";
|
||||
});
|
||||
|
||||
// رنگ اصلی جاری (shade 500)
|
||||
const primaryColor = computed(() => {
|
||||
return currentTheme.value?.colors?.primary?.["500"] || "#d99058";
|
||||
});
|
||||
|
||||
// پالت کامل رنگ اصلی
|
||||
const primaryPalette = computed(() => {
|
||||
return currentTheme.value?.colors?.primary || {};
|
||||
});
|
||||
|
||||
// نام فونت جاری
|
||||
const fontName = computed(() => {
|
||||
return currentTheme.value?.font || "Vazirmatn";
|
||||
});
|
||||
|
||||
// متد استخراج آیکون
|
||||
const getIcon = (key: string, fallback = "i-lucide-circle"): string => {
|
||||
return icons.value[key] || fallback;
|
||||
};
|
||||
|
||||
// تغییر یک آیکون
|
||||
const setIcon = (key: string, iconClass: string) => {
|
||||
icons.value = {
|
||||
...icons.value,
|
||||
[key]: iconClass,
|
||||
};
|
||||
if (currentTheme.value.icons) {
|
||||
currentTheme.value.icons[key] = iconClass;
|
||||
}
|
||||
};
|
||||
|
||||
// بهروزرسانی گروهی آیکونها
|
||||
const setIcons = (newIcons: Record<string, string>) => {
|
||||
icons.value = {
|
||||
...icons.value,
|
||||
...newIcons,
|
||||
};
|
||||
currentTheme.value.icons = {
|
||||
...(currentTheme.value.icons || {}),
|
||||
...newIcons,
|
||||
};
|
||||
};
|
||||
|
||||
// تغییر دارک مود
|
||||
const toggleDarkMode = () => {
|
||||
setDarkMode(!isDark.value);
|
||||
};
|
||||
|
||||
const setDarkMode = (dark: boolean) => {
|
||||
isDark.value = dark;
|
||||
if (import.meta.client) {
|
||||
const storageKey = currentTheme.value?.darkMode?.storageKey || "theme-mode";
|
||||
localStorage.setItem(storageKey, dark ? "dark" : "light");
|
||||
const root = document.documentElement;
|
||||
if (dark) {
|
||||
root.classList.add("dark");
|
||||
} else {
|
||||
root.classList.remove("dark");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// تغییر جهت RTL / LTR
|
||||
const toggleDirection = () => {
|
||||
setDirection(!isRtl.value);
|
||||
};
|
||||
|
||||
const setDirection = (rtl: boolean) => {
|
||||
isRtl.value = rtl;
|
||||
currentTheme.value.rtl = rtl;
|
||||
currentTheme.value.direction = rtl ? "rtl" : "ltr";
|
||||
if (import.meta.client) {
|
||||
const root = document.documentElement;
|
||||
root.setAttribute("dir", rtl ? "rtl" : "ltr");
|
||||
root.style.direction = rtl ? "rtl" : "ltr";
|
||||
}
|
||||
};
|
||||
|
||||
// تولید پالت رنگی داینامیک از روی یک رنگ hex
|
||||
const generateShades = (hex: string): Record<string, string> => {
|
||||
return {
|
||||
"50": hex,
|
||||
"100": hex,
|
||||
"200": hex,
|
||||
"300": hex,
|
||||
"400": hex,
|
||||
"500": hex,
|
||||
"600": hex,
|
||||
"700": hex,
|
||||
"800": hex,
|
||||
"900": hex,
|
||||
"950": hex,
|
||||
};
|
||||
};
|
||||
|
||||
// تغییر پالت رنگ primary
|
||||
const setPrimaryPalette = (palette: Record<string, string>) => {
|
||||
if (!currentTheme.value.colors) {
|
||||
currentTheme.value.colors = {};
|
||||
}
|
||||
currentTheme.value.colors.primary = palette;
|
||||
|
||||
if (import.meta.client) {
|
||||
const root = document.documentElement;
|
||||
Object.entries(palette).forEach(([shade, val]) => {
|
||||
root.style.setProperty(`--color-primary-${shade}`, val);
|
||||
root.style.setProperty(`--ui-color-primary-${shade}`, val);
|
||||
});
|
||||
if (palette["500"]) {
|
||||
root.style.setProperty("--color-primary", palette["500"]);
|
||||
root.style.setProperty("--ui-primary", palette["500"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// تغییر رنگ اصلی فقط با ارسال کد رنگ
|
||||
const setPrimaryColor = (hex: string) => {
|
||||
const defaultShades = currentTheme.value?.colors?.primary;
|
||||
const newShades = defaultShades ? { ...defaultShades, "500": hex, "600": hex } : generateShades(hex);
|
||||
newShades["500"] = hex;
|
||||
setPrimaryPalette(newShades);
|
||||
};
|
||||
|
||||
// تغییر فونت پروژه
|
||||
const setFont = (fontFamily: string, fallback?: string, fontFiles?: ThemeFontFile[]) => {
|
||||
currentTheme.value.font = fontFamily;
|
||||
if (fallback) currentTheme.value.fontFallback = fallback;
|
||||
if (fontFiles) currentTheme.value.fontFiles = fontFiles;
|
||||
|
||||
if (import.meta.client) {
|
||||
const root = document.documentElement;
|
||||
const fullFont = fallback ? `"${fontFamily}", ${fallback}` : `"${fontFamily}", sans-serif`;
|
||||
root.style.setProperty("--app-font", fullFont);
|
||||
|
||||
if (fontFiles && fontFiles.length > 0) {
|
||||
const fontStyleId = `font-style-${fontFamily.replace(/\s+/g, "-")}`;
|
||||
let styleEl = document.getElementById(fontStyleId) as HTMLStyleElement | null;
|
||||
if (!styleEl) {
|
||||
styleEl = document.createElement("style");
|
||||
styleEl.id = fontStyleId;
|
||||
document.head.appendChild(styleEl);
|
||||
}
|
||||
let cssRules = "";
|
||||
fontFiles.forEach((f) => {
|
||||
cssRules += `
|
||||
@font-face {
|
||||
font-family: "${fontFamily}";
|
||||
src: url("${f.src}") format("woff2");
|
||||
font-weight: ${f.weight || "normal"};
|
||||
font-style: ${f.style || "normal"};
|
||||
font-display: swap;
|
||||
}
|
||||
`;
|
||||
});
|
||||
styleEl.textContent = cssRules;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// اعمال جامع تم روی DOM و متغیرهای CSS
|
||||
const applyTheme = async (newThemeConfig?: ThemeConfig) => {
|
||||
if (newThemeConfig) {
|
||||
currentTheme.value = { ...currentTheme.value, ...newThemeConfig };
|
||||
}
|
||||
const theme = currentTheme.value;
|
||||
|
||||
if (import.meta.client) {
|
||||
const root = document.documentElement;
|
||||
|
||||
// 1. تنظیم RTL / Direction
|
||||
const rtl = theme.rtl ?? (theme.direction === "rtl");
|
||||
isRtl.value = rtl;
|
||||
root.setAttribute("dir", rtl ? "rtl" : "ltr");
|
||||
root.style.direction = rtl ? "rtl" : "ltr";
|
||||
|
||||
// 2. تنظیم رنگهای Primary
|
||||
if (theme.colors?.primary) {
|
||||
Object.entries(theme.colors.primary).forEach(([shade, val]) => {
|
||||
root.style.setProperty(`--color-primary-${shade}`, val);
|
||||
root.style.setProperty(`--ui-color-primary-${shade}`, val);
|
||||
});
|
||||
if (theme.colors.primary["500"]) {
|
||||
root.style.setProperty("--color-primary", theme.colors.primary["500"]);
|
||||
root.style.setProperty("--ui-primary", theme.colors.primary["500"]);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. تنظیم فونت
|
||||
if (theme.font) {
|
||||
setFont(theme.font, theme.fontFallback, theme.fontFiles);
|
||||
}
|
||||
|
||||
// 4. تنظیم ابعاد Layout
|
||||
if (theme.layout) {
|
||||
if (theme.layout.containerWidth) root.style.setProperty("--container-width", theme.layout.containerWidth);
|
||||
if (theme.layout.sidebarWidth) root.style.setProperty("--sidebar-width", theme.layout.sidebarWidth);
|
||||
if (theme.layout.headerHeight) root.style.setProperty("--header-height", theme.layout.headerHeight);
|
||||
if (theme.layout.footerHeight) root.style.setProperty("--footer-height", theme.layout.footerHeight);
|
||||
}
|
||||
|
||||
// 5. تنظیم آیکونها
|
||||
if (theme.icons) {
|
||||
setIcons(theme.icons);
|
||||
}
|
||||
|
||||
// 6. همگامسازی دارک مود
|
||||
const storageKey = theme.darkMode?.storageKey || "theme-mode";
|
||||
const savedDark = localStorage.getItem(storageKey);
|
||||
if (savedDark !== null) {
|
||||
setDarkMode(savedDark === "dark");
|
||||
} else if (theme.darkMode?.default === "dark") {
|
||||
setDarkMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
return currentTheme.value;
|
||||
};
|
||||
|
||||
// سوئیچ داینامیک به تم یک پروژه دیگر
|
||||
const switchSystemTheme = (newSystemKey: string) => {
|
||||
const allThemes = (nuxtApp.$allThemes as Record<string, ThemeConfig>) || {};
|
||||
if (allThemes[newSystemKey]) {
|
||||
themeKey.value = newSystemKey;
|
||||
applyTheme(allThemes[newSystemKey]);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
// Reactive State
|
||||
currentTheme,
|
||||
themeKey,
|
||||
isDark,
|
||||
isRtl,
|
||||
direction,
|
||||
logo,
|
||||
fontName,
|
||||
primaryColor,
|
||||
primaryPalette,
|
||||
icons,
|
||||
|
||||
// Methods
|
||||
applyTheme,
|
||||
switchSystemTheme,
|
||||
toggleDarkMode,
|
||||
setDarkMode,
|
||||
toggleDirection,
|
||||
setDirection,
|
||||
setPrimaryColor,
|
||||
setPrimaryPalette,
|
||||
setFont,
|
||||
getIcon,
|
||||
setIcon,
|
||||
setIcons,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { reactive, readonly } from "vue";
|
||||
|
||||
// یک state مشترک برای تمام کامپوننتها
|
||||
const confirmState = reactive({
|
||||
isOpen: false,
|
||||
title: "تأیید عملیات",
|
||||
message: "آیا از انجام این عملیات اطمینان دارید؟",
|
||||
confirmText: "تأیید",
|
||||
cancelText: "انصراف",
|
||||
resolve: null as ((value: boolean) => void) | null,
|
||||
});
|
||||
|
||||
export const useConfirmState = () => readonly(confirmState);
|
||||
|
||||
export const useConfirm = () => {
|
||||
const ucoShowConfirmModal = (
|
||||
options: {
|
||||
title?: string;
|
||||
message?: string;
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
} = {}
|
||||
): Promise<boolean> => {
|
||||
confirmState.title = options.title || "تأیید عملیات";
|
||||
confirmState.message = options.message || "آیا از انجام این عملیات اطمینان دارید؟";
|
||||
confirmState.confirmText = options.confirmText || "تأیید";
|
||||
confirmState.cancelText = options.cancelText || "انصراف";
|
||||
confirmState.isOpen = true;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
confirmState.resolve = resolve;
|
||||
});
|
||||
};
|
||||
|
||||
return { ucoShowConfirmModal };
|
||||
};
|
||||
|
||||
export const useConfirmActions = () => {
|
||||
const ucoConfirm = () => {
|
||||
confirmState.isOpen = false;
|
||||
if (confirmState.resolve) confirmState.resolve(true);
|
||||
confirmState.resolve = null;
|
||||
};
|
||||
|
||||
const ucoCancelConfirmModal = () => {
|
||||
confirmState.isOpen = false;
|
||||
if (confirmState.resolve) confirmState.resolve(false);
|
||||
confirmState.resolve = null;
|
||||
};
|
||||
|
||||
return { ucoConfirm, ucoCancelConfirmModal };
|
||||
};
|
||||
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-stone-50 dark:bg-stone-950 text-stone-900 dark:text-stone-100 flex flex-col transition-colors duration-200">
|
||||
<!-- Top Announcement Bar -->
|
||||
<div class="bg-primary-500 text-white text-xs py-1.5 px-4 text-center font-medium shadow-sm flex items-center justify-center gap-2">
|
||||
<UIcon :name="getIcon('award', 'i-lucide-award')" class="w-4 h-4" />
|
||||
<span>پذیرش حوزه علمیه سفیران هدایت برای سال تحصیلی جدید آغاز شد — ثبتنام آنلاین فعال است</span>
|
||||
</div>
|
||||
|
||||
<!-- Main Header -->
|
||||
<header class="sticky top-0 z-40 w-full border-b border-stone-200/80 dark:border-stone-800/80 bg-white/90 dark:bg-stone-900/90 backdrop-blur-md">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-20 flex items-center justify-between">
|
||||
<!-- Logo & Title -->
|
||||
<NuxtLink to="/" class="flex items-center gap-3.5 group">
|
||||
<div class="w-12 h-12 rounded-2xl bg-gradient-to-tr from-primary-600 to-primary-400 text-white flex items-center justify-center shadow-md shadow-primary-500/20 group-hover:scale-105 transition transform">
|
||||
<UIcon :name="getIcon('bookOpen', 'i-lucide-book-open')" class="w-7 h-7 text-white" />
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-lg font-extrabold text-stone-900 dark:text-white tracking-tight flex items-center gap-1.5">
|
||||
<span>{{ currentTheme?.name || 'حوزه علمیه سفیران هدایت' }}</span>
|
||||
</div>
|
||||
<div class="text-xs text-primary-600 dark:text-primary-400 font-medium">
|
||||
{{ currentTheme?.subTitle || 'سامانه جامع آموزشی و پژوهشی طلاب' }}
|
||||
</div>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
|
||||
<!-- Navigation Links -->
|
||||
<nav class="hidden lg:flex items-center gap-1 text-sm font-medium">
|
||||
<NuxtLink
|
||||
to="/"
|
||||
class="px-3.5 py-2 rounded-xl text-stone-700 dark:text-stone-200 hover:text-primary-600 dark:hover:text-primary-400 hover:bg-stone-100 dark:hover:bg-stone-800 transition"
|
||||
>
|
||||
صفحه اصلی
|
||||
</NuxtLink>
|
||||
<a
|
||||
href="#departments"
|
||||
class="px-3.5 py-2 rounded-xl text-stone-700 dark:text-stone-200 hover:text-primary-600 dark:hover:text-primary-400 hover:bg-stone-100 dark:hover:bg-stone-800 transition"
|
||||
>
|
||||
معاونتها
|
||||
</a>
|
||||
<a
|
||||
href="#courses"
|
||||
class="px-3.5 py-2 rounded-xl text-stone-700 dark:text-stone-200 hover:text-primary-600 dark:hover:text-primary-400 hover:bg-stone-100 dark:hover:bg-stone-800 transition"
|
||||
>
|
||||
دورههای آموزشی
|
||||
</a>
|
||||
<a
|
||||
href="#news"
|
||||
class="px-3.5 py-2 rounded-xl text-stone-700 dark:text-stone-200 hover:text-primary-600 dark:hover:text-primary-400 hover:bg-stone-100 dark:hover:bg-stone-800 transition"
|
||||
>
|
||||
اخبار و اطلاعیهها
|
||||
</a>
|
||||
<a
|
||||
href="#contact"
|
||||
class="px-3.5 py-2 rounded-xl text-stone-700 dark:text-stone-200 hover:text-primary-600 dark:hover:text-primary-400 hover:bg-stone-100 dark:hover:bg-stone-800 transition"
|
||||
>
|
||||
ارتباط با مدرسه
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<!-- Header Actions & Theme Settings -->
|
||||
<div class="flex items-center gap-2 sm:gap-3">
|
||||
<!-- RTL / LTR Switcher -->
|
||||
<UButton
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
:icon="getIcon('direction', 'i-lucide-arrow-left-right')"
|
||||
:title="isRtl ? 'سوئیچ به چپچین (LTR)' : 'سوئیچ به راستچین (RTL)'"
|
||||
@click="toggleDirection"
|
||||
>
|
||||
<span class="hidden sm:inline text-xs font-semibold">{{ isRtl ? 'RTL' : 'LTR' }}</span>
|
||||
</UButton>
|
||||
|
||||
<!-- Dark / Light Switcher -->
|
||||
<UButton
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
:icon="isDark ? getIcon('sun', 'i-lucide-sun') : getIcon('moon', 'i-lucide-moon')"
|
||||
:title="isDark ? 'حالت روز' : 'حالت شب'"
|
||||
@click="toggleDarkMode"
|
||||
/>
|
||||
|
||||
<!-- Student Portal Button -->
|
||||
<UButton
|
||||
color="primary"
|
||||
variant="solid"
|
||||
size="md"
|
||||
:icon="getIcon('user', 'i-lucide-user')"
|
||||
label="ورود طلاب و اساتید"
|
||||
class="hidden sm:inline-flex shadow-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Page Body -->
|
||||
<main class="flex-1">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="border-t border-stone-200 dark:border-stone-800 bg-white dark:bg-stone-900 pt-12 pb-8">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-8 pb-10 border-b border-stone-100 dark:border-stone-800">
|
||||
<!-- About Column -->
|
||||
<div class="space-y-4 md:col-span-2">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-xl bg-primary-500 text-white flex items-center justify-center">
|
||||
<UIcon :name="getIcon('bookOpen', 'i-lucide-book-open')" class="w-6 h-6" />
|
||||
</div>
|
||||
<h3 class="font-extrabold text-base text-stone-900 dark:text-white">
|
||||
حوزه علمیه سفیران هدایت
|
||||
</h3>
|
||||
</div>
|
||||
<p class="text-sm text-stone-600 dark:text-stone-300 leading-relaxed max-w-lg">
|
||||
مدرسه علمیه تخصصی سفیران هدایت با هدف تربیت مبلغان متعهد، دینپژوهان فاضل و پژوهشگران معارف غنی اهلبیت (علیهمالسلام) در راستای پاسخگویی به نیازهای دینی و معنوی جامعه اسلامی فعالیت مینماید.
|
||||
</p>
|
||||
<div class="flex items-center gap-4 text-xs text-stone-500 dark:text-stone-400">
|
||||
<span class="flex items-center gap-1">
|
||||
<UIcon :name="getIcon('mapPin', 'i-lucide-map-pin')" class="w-4 h-4 text-primary-500" />
|
||||
قم المقدسه، بلوار شهید صدوقی
|
||||
</span>
|
||||
<span class="flex items-center gap-1">
|
||||
<UIcon :name="getIcon('phone', 'i-lucide-phone')" class="w-4 h-4 text-primary-500" />
|
||||
۰۲۵-۳۲۹۰۰۰۰۰
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick Links -->
|
||||
<div class="space-y-3">
|
||||
<h4 class="font-bold text-sm text-stone-900 dark:text-white">دسترسی سریع</h4>
|
||||
<ul class="space-y-2 text-xs text-stone-600 dark:text-stone-300">
|
||||
<li><a href="#" class="hover:text-primary-600 transition">پایگاه جامع دروس خارج و سطوح عالی</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">تقویم آموزشی سال تحصیلی ۱۴۰۵-۱۴۰۶</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">کتابخانه تخصصی دیجیتال فقه و اصول</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">سامانه امور تهذیبی و اخلاقی طلاب</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Student Services -->
|
||||
<div class="space-y-3">
|
||||
<h4 class="font-bold text-sm text-stone-900 dark:text-white">خدمات و امور طلاب</h4>
|
||||
<ul class="space-y-2 text-xs text-stone-600 dark:text-stone-300">
|
||||
<li><a href="#" class="hover:text-primary-600 transition">درخواست گواهی اشتغال به تحصیل</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">سامانه انتخاب واحد و کارنامه ترم</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">امور خوابگاه و اسکان طلاب</a></li>
|
||||
<li><a href="#" class="hover:text-primary-600 transition">پژوهشسرای تخصصی علامه مجلسی</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-6 flex flex-col sm:flex-row items-center justify-between text-xs text-stone-500 dark:text-stone-400 gap-3">
|
||||
<p>© کلیه حقوق مادی و معنوی برای حوزه علمیه سفیران هدایت محفوظ است.</p>
|
||||
<div class="flex items-center gap-2">
|
||||
<span>فونت: {{ fontName }}</span>
|
||||
<span>•</span>
|
||||
<span>رنگ اصلی: <span class="font-mono text-primary-600 font-bold">#d99058</span></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { composSystemTheme } from "~/composables/composSystemTheme";
|
||||
|
||||
const {
|
||||
currentTheme,
|
||||
isDark,
|
||||
isRtl,
|
||||
fontName,
|
||||
toggleDarkMode,
|
||||
toggleDirection,
|
||||
getIcon,
|
||||
} = composSystemTheme();
|
||||
</script>
|
||||
@@ -0,0 +1,505 @@
|
||||
<template>
|
||||
<div class="space-y-16 pb-16">
|
||||
<!-- 1. Hero Section -->
|
||||
<section class="relative overflow-hidden pt-8 pb-12 sm:pt-14 sm:pb-20 border-b border-stone-200/60 dark:border-stone-800/60 bg-gradient-to-b from-primary-50/50 via-transparent to-transparent dark:from-primary-950/20">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-12 gap-12 items-center">
|
||||
<!-- Text column -->
|
||||
<div class="lg:col-span-7 space-y-6 text-center lg:text-start">
|
||||
<div class="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full text-xs font-semibold bg-primary-100/80 dark:bg-primary-900/40 text-primary-800 dark:text-primary-300 border border-primary-200 dark:border-primary-800">
|
||||
<UIcon :name="getIcon('award', 'i-lucide-award')" class="w-4 h-4 text-primary-600 dark:text-primary-400" />
|
||||
<span>پذیرش برادران علاقهمند به فراگیری علوم حوزوی</span>
|
||||
</div>
|
||||
|
||||
<h1 class="text-3xl sm:text-4xl lg:text-5xl font-extrabold text-stone-900 dark:text-white tracking-tight leading-tight">
|
||||
{{ currentTheme.name }}
|
||||
</h1>
|
||||
|
||||
<p class="text-base sm:text-lg text-stone-600 dark:text-stone-300 leading-relaxed max-w-2xl">
|
||||
مرکز تخصصی تربیت مبلغان متعهد، آشنا به شیوههای نوین تبلیغ و پژوهشگران معارف اهلبیت (علیهمالسلام) در فضایی معنوی و پویا.
|
||||
</p>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex flex-wrap items-center justify-center lg:justify-start gap-3.5 pt-2">
|
||||
<UButton
|
||||
color="primary"
|
||||
variant="solid"
|
||||
size="lg"
|
||||
:icon="getIcon('graduationCap', 'i-lucide-graduation-cap')"
|
||||
label="ثبتنام و پذیرش دوره جدید"
|
||||
class="shadow-lg shadow-primary-500/25 px-6 font-bold"
|
||||
@click="openAdmissionModal"
|
||||
/>
|
||||
<UButton
|
||||
color="neutral"
|
||||
variant="outline"
|
||||
size="lg"
|
||||
:icon="getIcon('bookOpen', 'i-lucide-book-open')"
|
||||
label="آشنایی با نظام آموزشی"
|
||||
class="px-5 font-semibold"
|
||||
@click="scrollToCourses"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Key Highlights List -->
|
||||
<div class="pt-6 grid grid-cols-2 sm:grid-cols-3 gap-4 text-xs font-medium text-stone-600 dark:text-stone-300 border-t border-stone-200/80 dark:border-stone-800/80">
|
||||
<div class="flex items-center gap-2">
|
||||
<UIcon :name="getIcon('check', 'i-lucide-check')" class="w-4 h-4 text-primary-500 flex-shrink-0" />
|
||||
<span>مدرک رسمی سطح ۲ حوزه علمیه</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<UIcon :name="getIcon('check', 'i-lucide-check')" class="w-4 h-4 text-primary-500 flex-shrink-0" />
|
||||
<span>اساتید برجسته سطوح عالی</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<UIcon :name="getIcon('check', 'i-lucide-check')" class="w-4 h-4 text-primary-500 flex-shrink-0" />
|
||||
<span>امکانات اسکان و خوابگاه طلاب</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Feature Cards Showcase column -->
|
||||
<div class="lg:col-span-5">
|
||||
<div class="relative">
|
||||
<!-- Glow backdrop -->
|
||||
<div class="absolute -inset-2 bg-gradient-to-r from-primary-500 to-amber-600 rounded-3xl blur-2xl opacity-20 dark:opacity-30"></div>
|
||||
|
||||
<div class="relative bg-white dark:bg-stone-900 border border-stone-200/80 dark:border-stone-800 rounded-3xl p-6 sm:p-8 shadow-xl space-y-6">
|
||||
<!-- Header inside card -->
|
||||
<div class="flex items-center justify-between border-b border-stone-100 dark:border-stone-800 pb-4">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-xl bg-primary-500/10 text-primary-600 dark:text-primary-400 flex items-center justify-center">
|
||||
<UIcon :name="getIcon('calendar', 'i-lucide-calendar')" class="w-5 h-5" />
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-stone-500 dark:text-stone-400">تقویم جاری حوزه</div>
|
||||
<div class="text-sm font-bold text-stone-900 dark:text-white">نیمسال تحصیلی ۱۴۰۵-۱۴۰۶</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-emerald-100 dark:bg-emerald-950/60 text-emerald-800 dark:text-emerald-300">
|
||||
فعال
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Stats grid -->
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="p-4 rounded-2xl bg-stone-50 dark:bg-stone-800/60 border border-stone-100 dark:border-stone-700/60">
|
||||
<div class="text-2xl font-black text-primary-600 dark:text-primary-400">۳۵۰+</div>
|
||||
<div class="text-xs text-stone-500 dark:text-stone-400 mt-0.5">طلبه در حال تحصیل</div>
|
||||
</div>
|
||||
<div class="p-4 rounded-2xl bg-stone-50 dark:bg-stone-800/60 border border-stone-100 dark:border-stone-700/60">
|
||||
<div class="text-2xl font-black text-primary-600 dark:text-primary-400">۲۸</div>
|
||||
<div class="text-xs text-stone-500 dark:text-stone-400 mt-0.5">استاد سطوح عالی</div>
|
||||
</div>
|
||||
<div class="p-4 rounded-2xl bg-stone-50 dark:bg-stone-800/60 border border-stone-100 dark:border-stone-700/60">
|
||||
<div class="text-2xl font-black text-primary-600 dark:text-primary-400">۱۲,۰۰۰</div>
|
||||
<div class="text-xs text-stone-500 dark:text-stone-400 mt-0.5">جلد کتب کتابخانه</div>
|
||||
</div>
|
||||
<div class="p-4 rounded-2xl bg-stone-50 dark:bg-stone-800/60 border border-stone-100 dark:border-stone-700/60">
|
||||
<div class="text-2xl font-black text-primary-600 dark:text-primary-400">۱۰۰٪</div>
|
||||
<div class="text-xs text-stone-500 dark:text-stone-400 mt-0.5">اعزام مبلغان به سراسر کشور</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Fast entrance link -->
|
||||
<div class="pt-2">
|
||||
<UButton
|
||||
block
|
||||
color="primary"
|
||||
variant="soft"
|
||||
size="md"
|
||||
label="ورود به سامانه انتخاب واحد و دروس"
|
||||
:icon="getIcon('chevronLeft', 'i-lucide-chevron-left')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 2. Interactive Theme & Font Customizer Live Bar -->
|
||||
<section class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="p-6 rounded-2xl bg-white dark:bg-stone-900 border border-stone-200 dark:border-stone-800 shadow-sm space-y-4">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-stone-100 dark:border-stone-800 pb-4">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-9 h-9 rounded-xl bg-primary-100 dark:bg-primary-950 text-primary-600 dark:text-primary-400 flex items-center justify-center">
|
||||
<UIcon :name="getIcon('palette', 'i-lucide-palette')" class="w-5 h-5" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-sm font-bold text-stone-900 dark:text-white">پنل تغییر زنده تم و فونت سامانه</h3>
|
||||
<p class="text-xs text-stone-500 dark:text-stone-400">به وسیله theme.json و کامپوزبل composSystemTheme</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Color palette buttons -->
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-xs text-stone-500 dark:text-stone-400">رنگ پایه:</span>
|
||||
<button
|
||||
v-for="color in themePresets"
|
||||
:key="color.hex"
|
||||
:style="{ backgroundColor: color.hex }"
|
||||
:title="color.name"
|
||||
class="w-7 h-7 rounded-lg border-2 transition transform hover:scale-110 active:scale-95 flex items-center justify-center text-white"
|
||||
:class="primaryColor.toLowerCase() === color.hex.toLowerCase() ? 'border-stone-900 dark:border-white ring-2 ring-primary-300' : 'border-transparent'"
|
||||
@click="setPrimaryColor(color.hex)"
|
||||
>
|
||||
<UIcon v-if="primaryColor.toLowerCase() === color.hex.toLowerCase()" :name="getIcon('check', 'i-lucide-check')" class="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Fonts selection from public folder -->
|
||||
<div class="flex flex-wrap items-center justify-between gap-4 pt-1">
|
||||
<div class="flex items-center gap-2 text-xs">
|
||||
<UIcon :name="getIcon('font', 'i-lucide-type')" class="w-4 h-4 text-primary-500" />
|
||||
<span class="text-stone-600 dark:text-stone-400 font-medium">فونتهای پوشه public:</span>
|
||||
<div class="flex flex-wrap gap-1.5">
|
||||
<UButton
|
||||
v-for="f in availableFonts"
|
||||
:key="f.name"
|
||||
size="xs"
|
||||
:variant="fontName === f.name ? 'solid' : 'outline'"
|
||||
color="neutral"
|
||||
@click="setFont(f.name, f.fallback)"
|
||||
>
|
||||
{{ f.label }}
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 text-xs text-stone-500">
|
||||
<span>جهت: <strong class="text-primary-600">{{ isRtl ? 'راستچین (RTL)' : 'چپچین (LTR)' }}</strong></span>
|
||||
<span>•</span>
|
||||
<span>رنگ جاری: <code class="font-mono text-primary-600">{{ primaryColor }}</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 3. Departments / معاونتهای حوزه -->
|
||||
<section id="departments" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-8">
|
||||
<div class="text-center max-w-2xl mx-auto space-y-2">
|
||||
<h2 class="text-2xl sm:text-3xl font-extrabold text-stone-900 dark:text-white">
|
||||
معاونتهای تخصصی مدرسه علمیه
|
||||
</h2>
|
||||
<p class="text-sm text-stone-600 dark:text-stone-400">
|
||||
ارائه خدمات آموزشی، تهذیبی، پژوهشی و تبلیغی هدفمند به طلاب محترم
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
<div
|
||||
v-for="dept in departments"
|
||||
:key="dept.title"
|
||||
class="p-6 rounded-2xl bg-white dark:bg-stone-900 border border-stone-200 dark:border-stone-800 shadow-sm hover:border-primary-500/60 hover:shadow-md transition group space-y-3"
|
||||
>
|
||||
<div class="w-12 h-12 rounded-2xl bg-primary-50 dark:bg-primary-950/60 text-primary-600 dark:text-primary-400 flex items-center justify-center group-hover:bg-primary-500 group-hover:text-white transition duration-200">
|
||||
<UIcon :name="getIcon(dept.icon, 'i-lucide-book-open')" class="w-6 h-6" />
|
||||
</div>
|
||||
<h3 class="font-bold text-base text-stone-900 dark:text-white">{{ dept.title }}</h3>
|
||||
<p class="text-xs text-stone-600 dark:text-stone-400 leading-relaxed">{{ dept.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 4. Educational Courses / دورههای آموزشی -->
|
||||
<section id="courses" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-8">
|
||||
<div class="flex flex-col sm:flex-row sm:items-end justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-2xl sm:text-3xl font-extrabold text-stone-900 dark:text-white">
|
||||
دورههای تخصصی و آموزشی
|
||||
</h2>
|
||||
<p class="text-sm text-stone-600 dark:text-stone-400 mt-1">
|
||||
برنامههای درسی جامع با تأکید بر ادبیات عرب، فقه و اصول، کلام، تفسیر و فن خطابه
|
||||
</p>
|
||||
</div>
|
||||
<UButton
|
||||
color="primary"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
label="دانلود سرفصل دروس"
|
||||
:icon="getIcon('fileText', 'i-lucide-file-text')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div
|
||||
v-for="course in courses"
|
||||
:key="course.title"
|
||||
class="p-6 rounded-2xl bg-white dark:bg-stone-900 border border-stone-200 dark:border-stone-800 shadow-sm flex flex-col justify-between space-y-4 hover:border-primary-500/50 transition"
|
||||
>
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="px-2.5 py-1 rounded-lg text-xs font-semibold bg-stone-100 dark:bg-stone-800 text-stone-700 dark:text-stone-300">
|
||||
{{ course.level }}
|
||||
</span>
|
||||
<span class="text-xs text-primary-600 font-bold">{{ course.duration }}</span>
|
||||
</div>
|
||||
<h3 class="text-base font-bold text-stone-900 dark:text-white">{{ course.title }}</h3>
|
||||
<p class="text-xs text-stone-600 dark:text-stone-400 leading-relaxed">{{ course.desc }}</p>
|
||||
</div>
|
||||
|
||||
<div class="pt-3 border-t border-stone-100 dark:border-stone-800 flex items-center justify-between text-xs">
|
||||
<span class="text-stone-500">مدرس: {{ course.instructor }}</span>
|
||||
<UButton size="xs" color="primary" variant="ghost" label="مشاهده جزییات" :icon="getIcon('chevronLeft', 'i-lucide-chevron-left')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 5. News & Announcements / اخبار و رویدادها -->
|
||||
<section id="news" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-8">
|
||||
<div class="text-center max-w-2xl mx-auto space-y-2">
|
||||
<h2 class="text-2xl sm:text-3xl font-extrabold text-stone-900 dark:text-white">
|
||||
تازهترین رویدادها و اخبار حوزه
|
||||
</h2>
|
||||
<p class="text-sm text-stone-600 dark:text-stone-400">
|
||||
اطلاعیههای آموزشی، همایشها و برنامههای فرهنگی سفیران هدایت
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div
|
||||
v-for="news in newsList"
|
||||
:key="news.id"
|
||||
class="rounded-2xl bg-white dark:bg-stone-900 border border-stone-200 dark:border-stone-800 overflow-hidden shadow-sm flex flex-col justify-between hover:shadow-md transition"
|
||||
>
|
||||
<div class="p-6 space-y-3">
|
||||
<div class="flex items-center gap-2 text-xs text-stone-400">
|
||||
<UIcon :name="getIcon('calendar', 'i-lucide-calendar')" class="w-3.5 h-3.5 text-primary-500" />
|
||||
<span>{{ news.date }}</span>
|
||||
</div>
|
||||
<h3 class="font-bold text-sm sm:text-base text-stone-900 dark:text-white leading-snug hover:text-primary-600 transition cursor-pointer">
|
||||
{{ news.title }}
|
||||
</h3>
|
||||
<p class="text-xs text-stone-600 dark:text-stone-400 leading-relaxed">
|
||||
{{ news.summary }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="p-4 bg-stone-50/60 dark:bg-stone-800/40 border-t border-stone-100 dark:border-stone-800/80 flex items-center justify-between text-xs">
|
||||
<span class="text-stone-500 font-medium">{{ news.category }}</span>
|
||||
<button class="text-primary-600 dark:text-primary-400 font-bold hover:underline flex items-center gap-1">
|
||||
متن کامل
|
||||
<UIcon :name="getIcon('chevronLeft', 'i-lucide-chevron-left')" class="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 6. Contact & Consultation Modal Form -->
|
||||
<BaseModal
|
||||
:isOpen="isAdmissionModalOpen"
|
||||
:modalSchema="admissionModalSchema"
|
||||
@modal-action="handleAdmissionAction"
|
||||
@update:isOpen="(val) => isAdmissionModalOpen = val"
|
||||
>
|
||||
<template #modal-body-content>
|
||||
<div class="space-y-4 py-2">
|
||||
<p class="text-xs text-stone-600 dark:text-stone-300">
|
||||
جهت ثبتنام اولیه در دوره جدید حوزه علمیه سفیران هدایت، مشخصات خود را وارد نمایید. کارشناسان پذیرش در اسرع وقت با شما تماس خواهند گرفت:
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">نام و نامخانوادگی داوطلب:</label>
|
||||
<input
|
||||
type="text"
|
||||
v-model="admissionForm.fullName"
|
||||
placeholder="مثال: علی رضایی"
|
||||
class="w-full px-3 py-2 text-xs rounded-xl border border-stone-300 dark:border-stone-700 bg-white dark:bg-stone-800 focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">شماره تماس (همراه):</label>
|
||||
<input
|
||||
type="text"
|
||||
v-model="admissionForm.phone"
|
||||
placeholder="۰۹۱۲۰۰۰۰۰۰۰"
|
||||
class="w-full px-3 py-2 text-xs rounded-xl border border-stone-300 dark:border-stone-700 bg-white dark:bg-stone-800 focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold mb-1">آخرین مدرک تحصیلی:</label>
|
||||
<select
|
||||
v-model="admissionForm.education"
|
||||
class="w-full px-3 py-2 text-xs rounded-xl border border-stone-300 dark:border-stone-700 bg-white dark:bg-stone-800 focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
>
|
||||
<option value="diploma">دیپلم متوسطه</option>
|
||||
<option value="associate">کاردانی</option>
|
||||
<option value="bachelor">کارشناسی (لیسانس)</option>
|
||||
<option value="master">کارشناسی ارشد و بالاتر</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</BaseModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { composSystemTheme } from "~/composables/composSystemTheme";
|
||||
import { useConfirm } from "~/composables/useConfirm";
|
||||
|
||||
const { ucoShowConfirmModal } = useConfirm();
|
||||
|
||||
const {
|
||||
currentTheme,
|
||||
primaryColor,
|
||||
isRtl,
|
||||
fontName,
|
||||
setPrimaryColor,
|
||||
setFont,
|
||||
getIcon,
|
||||
} = composSystemTheme();
|
||||
|
||||
// پالتهای رنگی آماده با اولویت رنگ درخواستی #d99058
|
||||
const themePresets = [
|
||||
{ name: "رنگ اصلی سفیران هدایت", hex: "#d99058" },
|
||||
{ name: "سبز سنتی اسلامی", hex: "#15803d" },
|
||||
{ name: "آبی فیروزهای اصیل", hex: "#0284c7" },
|
||||
{ name: "لاجوردی حوزوی", hex: "#1e3a8a" },
|
||||
{ name: "زرشکی سنتی", hex: "#991b1b" },
|
||||
];
|
||||
|
||||
// فونتهای موجود در پوشه public
|
||||
const availableFonts = [
|
||||
{ name: "Vazirmatn", label: "وزیر متن (پیشفرض)", fallback: "'Sahel', sans-serif" },
|
||||
{ name: "Sahel", label: "فونت ساحل (Sahel)", fallback: "'Vazirmatn', sans-serif" },
|
||||
{ name: "Yekan", label: "یکان (Yekan)", fallback: "sans-serif" },
|
||||
{ name: "system-ui", label: "سیستمی", fallback: "sans-serif" },
|
||||
];
|
||||
|
||||
// معاونتهای مدرسه علمیه
|
||||
const departments = [
|
||||
{
|
||||
title: "معاونت آموزش",
|
||||
icon: "bookOpen",
|
||||
description: "برنامهریزی آموزشی، نظارت بر کلاسها، امتحانات، ارزیابی علمی و نظام جامع دروس سطح یک و دو.",
|
||||
},
|
||||
{
|
||||
title: "معاونت پژوهش",
|
||||
icon: "library",
|
||||
description: "توسعه فعالیتهای پژوهشی، نشریات تخصصی، هدایت مقالات طلاب و کارگاههای روش تحقیق.",
|
||||
},
|
||||
{
|
||||
title: "معاونت تهذیب و اخلاق",
|
||||
icon: "award",
|
||||
description: "برگزاری درسهای اخلاق اساتید، مشاورههای مذهبی و برنامهریزی تعالی روحی طلاب.",
|
||||
},
|
||||
{
|
||||
title: "معاونت تبلیغ و فرهنگ",
|
||||
icon: "users",
|
||||
description: "سازماندهی گروههای جهادی تبلیغی، اعزام مبلغان به مدارس و مساجد در مناسبتهای مذهبی.",
|
||||
},
|
||||
];
|
||||
|
||||
// دورههای آموزشی
|
||||
const courses = [
|
||||
{
|
||||
title: "دوره عمومی سطح ۲ سفیران هدایت",
|
||||
level: "عمومی تخصصی",
|
||||
duration: "۵ سال پیوسته",
|
||||
desc: "شامل ادبیات پیشرفته عرب، فقه، اصول، منطق، کلام، تفسیر قرآن و مهارتهای خطابه و مناظره.",
|
||||
instructor: "شورای علمی اساتید",
|
||||
},
|
||||
{
|
||||
title: "کارگاه مهارتهای نوین تبلیغ و خطابه",
|
||||
level: "کارگاهی - عملی",
|
||||
duration: "۲ ترم تحصیلی",
|
||||
desc: "آموزش فن بیان، پاسخ به شبهات اعتقادی روز، سخنوری مذهبی و تولید محتوا در رسانههای نوین.",
|
||||
instructor: "اساتید برجسته خطابه قم",
|
||||
},
|
||||
{
|
||||
title: "دوره تخصصی علوم قرآن و حدیث",
|
||||
level: "تکمیلی",
|
||||
duration: "۱ سال",
|
||||
desc: "روشهای تحلیل احادیث فقهی و اخلاقی، درایة الحدیث و تدبر موضوعی در آیات قرآن مجید.",
|
||||
instructor: "اساتید تفسیر حوزه علمیه",
|
||||
},
|
||||
];
|
||||
|
||||
// اخبار و اطلاعیهها
|
||||
const newsList = [
|
||||
{
|
||||
id: 1,
|
||||
title: "شروع نامنویسی داوطلبان دوره جدید مدرسه علمیه سفیران هدایت",
|
||||
date: "۱۴۰۵/۰۸/۱۰",
|
||||
category: "پذیرش و ثبتنام",
|
||||
summary: "به اطلاع میرساند کلیه متقاضیان دارای مدرک دیپلم و بالاتر میتوانند نسبت به ثبت نام اولیه اقدام نمایند.",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "برگزاری نشست اخلاقی هفتگی با حضور استاد اخلاق حوزه علمیه قم",
|
||||
date: "۱۴۰۵/۰۸/۰۸",
|
||||
category: "معاونت تهذیب",
|
||||
summary: "سلسله جلسات هفتگی تهذیب نفس و اخلاق اسلامی روزهای چهارشنبه پس از نماز مغرب و عشا منعقد میگردد.",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "اعزام کاروان مبلغان طلاب سفیران هدایت به مناطق محروم",
|
||||
date: "۱۴۰۵/۰۸/۰۴",
|
||||
category: "معاونت تبلیغ",
|
||||
summary: "گروه تبلیغی مدرسه علمیه جهت اجرای برنامههای فرهنگی و دینی عازم روستاهای تابعه گردیدند.",
|
||||
},
|
||||
];
|
||||
|
||||
// اسکرول نرم به بخش دورهها
|
||||
const scrollToCourses = () => {
|
||||
const el = document.getElementById("courses");
|
||||
if (el) {
|
||||
el.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
// مدال پذیرش و ثبتنام
|
||||
const isAdmissionModalOpen = ref(false);
|
||||
const admissionForm = ref({
|
||||
fullName: "",
|
||||
phone: "",
|
||||
education: "diploma",
|
||||
});
|
||||
|
||||
const admissionModalSchema = {
|
||||
title: "درخواست ثبتنام و مشاوره پذیرش",
|
||||
description: "حوزه علمیه تخصصی سفیران هدایت",
|
||||
size: "md",
|
||||
actions: {
|
||||
left: [
|
||||
{ key: "cancel", label: "انصراف", variant: "outline", color: "neutral", closeOnClick: true },
|
||||
{ key: "submit", label: "ثبت درخواست", color: "primary", closeOnClick: false },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const openAdmissionModal = () => {
|
||||
isAdmissionModalOpen.value = true;
|
||||
};
|
||||
|
||||
const handleAdmissionAction = async (key: string) => {
|
||||
if (key === "submit") {
|
||||
if (!admissionForm.value.fullName || !admissionForm.value.phone) {
|
||||
alert("لطفاً نام و شماره همراه خود را وارد نمایید.");
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmed = await ucoShowConfirmModal({
|
||||
title: "تأیید ثبت اطلاعات",
|
||||
message: `آیا از ثبت اطلاعات داوطلب (${admissionForm.value.fullName}) اطمینان دارید؟`,
|
||||
confirmText: "بله، ثبت نهایی",
|
||||
cancelText: "ویرایش",
|
||||
});
|
||||
|
||||
if (confirmed) {
|
||||
isAdmissionModalOpen.value = false;
|
||||
alert("درخواست شما با موفقیت ثبت شد. کارشناسان پذیرش به زودی با شما تماس خواهند گرفت.");
|
||||
admissionForm.value = { fullName: "", phone: "", education: "diploma" };
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,37 @@
|
||||
import schoolTheme from "~/assets/school/theme.json";
|
||||
import { composSystemTheme } from "~/composables/composSystemTheme";
|
||||
|
||||
// بارگذاری خودکار تمام فایلهای theme.json موجود در پوشه assets/*
|
||||
const themeModules = import.meta.glob<Record<string, any>>("~/assets/*/theme.json", {
|
||||
eager: true,
|
||||
import: "default",
|
||||
});
|
||||
|
||||
export const themes: Record<string, any> = {
|
||||
school: schoolTheme,
|
||||
};
|
||||
|
||||
// نگاشت تمام پروژهها بر اساس نام پوشه (school, hamyar, ...)
|
||||
for (const [path, moduleContent] of Object.entries(themeModules)) {
|
||||
const match = path.match(/assets\/([^/]+)\/theme\.json/);
|
||||
if (match && match[1]) {
|
||||
themes[match[1]] = moduleContent;
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const config = useRuntimeConfig();
|
||||
// کلید سیستم از فایل .env فعال (پیشفرض: school)
|
||||
const systemKey = (config.public.NUXT_PUBLIC_SYSTEM as string) || "school";
|
||||
const theme = themes[systemKey] || themes.school || schoolTheme;
|
||||
|
||||
// ارائه به تمام کانتکستهای Nuxt
|
||||
nuxtApp.provide("theme", theme);
|
||||
nuxtApp.provide("themeKey", systemKey);
|
||||
nuxtApp.provide("allThemes", themes);
|
||||
|
||||
if (import.meta.client) {
|
||||
const systemTheme = composSystemTheme();
|
||||
await systemTheme.applyTheme(theme);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
import { useStorage } from "@vueuse/core";
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
// ======================
|
||||
// Runtime Config (Public)
|
||||
// ======================
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
const BASE_URL = (config.public.NUXT_PUBLIC_BASE_URL as string) || "";
|
||||
const API_NAME = (config.public.NUXT_PUBLIC_API_NAME as string) || "";
|
||||
|
||||
// ======================
|
||||
// Safe URL Joiner
|
||||
// ======================
|
||||
const joinURL = (base: string, path: string) => {
|
||||
if (!base) return path;
|
||||
if (!path) return base;
|
||||
return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
||||
};
|
||||
|
||||
const baseURL = joinURL(BASE_URL, API_NAME);
|
||||
|
||||
// ======================
|
||||
// Reactive Token
|
||||
// ======================
|
||||
const token = useStorage<string>("id_token", "");
|
||||
|
||||
// ======================
|
||||
// Fetch Instance
|
||||
// ======================
|
||||
const api = $fetch.create({
|
||||
baseURL,
|
||||
|
||||
// ======================
|
||||
// Request Interceptor
|
||||
// ======================
|
||||
onRequest({ options }) {
|
||||
const auth = token.value;
|
||||
if (!auth) return;
|
||||
const headers = (options.headers ||= {});
|
||||
if (headers instanceof Headers) {
|
||||
headers.set("Authorization", `Bearer ${auth}`);
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.push(["Authorization", `Bearer ${auth}`]);
|
||||
} else {
|
||||
(headers as Record<string, string>).Authorization = `Bearer ${auth}`;
|
||||
}
|
||||
},
|
||||
|
||||
// ======================
|
||||
// Response Handler
|
||||
// ======================
|
||||
onResponse({ response }) {
|
||||
return response._data;
|
||||
},
|
||||
|
||||
// ======================
|
||||
// Error Handler
|
||||
// ======================
|
||||
async onResponseError({ response }) {
|
||||
const status = response?.status;
|
||||
|
||||
if (status === 401) {
|
||||
token.value = "";
|
||||
if (import.meta.client) {
|
||||
await nuxtApp.runWithContext(() => navigateTo("/login"));
|
||||
}
|
||||
}
|
||||
|
||||
throw {
|
||||
status,
|
||||
message:
|
||||
response?._data?.message || response?.statusText || "خطای نامشخص در ارتباط با سرور",
|
||||
data: response?._data || null,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// ======================
|
||||
// HTTP Service (Public API)
|
||||
// ======================
|
||||
const http = {
|
||||
getRequest: <T = any>(url: string, options: any = {}) =>
|
||||
api<T>(url, { method: "GET", ...options }),
|
||||
|
||||
postRequest: <T = any>(url: string, body?: any, options: any = {}) =>
|
||||
api<T>(url, { method: "POST", body, ...options }),
|
||||
|
||||
putRequest: <T = any>(url: string, body?: any, options: any = {}) =>
|
||||
api<T>(url, { method: "PUT", body, ...options }),
|
||||
|
||||
patchRequest: <T = any>(url: string, body?: any, options: any = {}) =>
|
||||
api<T>(url, { method: "PATCH", body, ...options }),
|
||||
|
||||
deleteRequest: <T = any>(url: string, options: any = {}) =>
|
||||
api<T>(url, { method: "DELETE", ...options }),
|
||||
|
||||
// متدهای مدیریت توکن که در authStore استفاده میشوند
|
||||
setToken: (newToken: string) => {
|
||||
token.value = newToken;
|
||||
},
|
||||
|
||||
clearToken: () => {
|
||||
token.value = "";
|
||||
},
|
||||
|
||||
getToken: () => token.value,
|
||||
|
||||
// دسترسی مستقیم به کلاینت خام Fetch
|
||||
raw: api,
|
||||
};
|
||||
|
||||
// ======================
|
||||
// Provide to Nuxt
|
||||
// ======================
|
||||
return {
|
||||
provide: {
|
||||
http,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,202 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref, computed } from "vue";
|
||||
import { useStorage } from "@vueuse/core";
|
||||
|
||||
export const useAuthStore = defineStore("authStore", () => {
|
||||
// ===== state =====
|
||||
const user = ref<any>({});
|
||||
const isAuthenticated = ref(false);
|
||||
const isRealUser = ref(false);
|
||||
const errors = ref<any>(null);
|
||||
const loading = ref(false);
|
||||
|
||||
// ===== getters =====
|
||||
const isLoggedIn = computed(() => isAuthenticated.value && !!user.value?.token);
|
||||
const userName = computed(() => {
|
||||
if (!user.value) return "";
|
||||
return `${user.value.first_name || ""} ${user.value.last_name || ""}`.trim() || user.value.username || "";
|
||||
});
|
||||
|
||||
// ===== actions =====
|
||||
function setUser(response: any) {
|
||||
const payload = response?.data ?? response ?? {};
|
||||
|
||||
const userData = {
|
||||
id: payload.user_id ?? payload.id ?? null,
|
||||
level: payload.user_level ?? payload.level ?? null,
|
||||
token: payload.token ?? null,
|
||||
expire: payload.expire ?? null,
|
||||
refresh_token: payload.refresh_token ?? null,
|
||||
first_name: payload.first_name ?? payload.user_data?.first_name ?? "",
|
||||
last_name: payload.last_name ?? payload.user_data?.last_name ?? "",
|
||||
avatar: payload.avatar ?? payload.user_data?.avatar ?? "",
|
||||
username: payload.username ?? payload.user_data?.username ?? "",
|
||||
email: payload.email ?? payload.user_data?.email ?? "",
|
||||
mobile: payload.mobile ?? payload.user_data?.mobile ?? "",
|
||||
...(payload.user_data || {}),
|
||||
};
|
||||
|
||||
isAuthenticated.value = true;
|
||||
isRealUser.value = true;
|
||||
user.value = userData;
|
||||
errors.value = null;
|
||||
loading.value = false;
|
||||
|
||||
try {
|
||||
const tokenStorage = useStorage("id_token", "");
|
||||
tokenStorage.value = userData.token || "";
|
||||
|
||||
const userStorage = useStorage("user", {});
|
||||
userStorage.value = userData;
|
||||
|
||||
const userIdStorage = useStorage("user_id", "");
|
||||
userIdStorage.value = String(userData.id || "");
|
||||
|
||||
const nuxtApp = useNuxtApp();
|
||||
if (nuxtApp.$http && userData.token) {
|
||||
nuxtApp.$http.setToken(userData.token);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Could not write to storage:", e);
|
||||
}
|
||||
}
|
||||
|
||||
async function login(credentials: { username: string; password: string; captcha?: string }) {
|
||||
loading.value = true;
|
||||
errors.value = null;
|
||||
|
||||
try {
|
||||
const nuxtApp = useNuxtApp();
|
||||
const { $http } = nuxtApp;
|
||||
|
||||
const response = await $http.postRequest("/auth/login", credentials);
|
||||
|
||||
if (response?.data || response?.token) {
|
||||
setUser(response);
|
||||
return { success: true, data: response };
|
||||
}
|
||||
|
||||
throw new Error(response?.message || "ورود ناموفق بود");
|
||||
} catch (error: any) {
|
||||
errors.value = error?.message || "خطا در ارتباط با سرور";
|
||||
loading.value = false;
|
||||
return { success: false, error: errors.value };
|
||||
}
|
||||
}
|
||||
|
||||
async function getCaptcha() {
|
||||
try {
|
||||
const nuxtApp = useNuxtApp();
|
||||
const { $http } = nuxtApp;
|
||||
return await $http.getRequest("/auth/captcha");
|
||||
} catch (error) {
|
||||
console.error("Captcha Error:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function register(credentials: any) {
|
||||
loading.value = true;
|
||||
errors.value = null;
|
||||
|
||||
try {
|
||||
const nuxtApp = useNuxtApp();
|
||||
const { $http } = nuxtApp;
|
||||
|
||||
const response = await $http.postRequest("/auth/register", credentials);
|
||||
|
||||
if (response?.data || response?.token) {
|
||||
setUser(response);
|
||||
return { success: true, data: response };
|
||||
}
|
||||
|
||||
throw new Error(response?.message || "ثبت نام ناموفق بود");
|
||||
} catch (error: any) {
|
||||
errors.value = error?.message || "خطا در ثبت نام";
|
||||
loading.value = false;
|
||||
return { success: false, error: errors.value };
|
||||
}
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
try {
|
||||
const nuxtApp = useNuxtApp();
|
||||
const { $http } = nuxtApp;
|
||||
|
||||
if (isAuthenticated.value) {
|
||||
await $http.postRequest("/auth/logout", {});
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Logout API error:", error);
|
||||
} finally {
|
||||
userReset();
|
||||
}
|
||||
}
|
||||
|
||||
function userReset() {
|
||||
user.value = {};
|
||||
isAuthenticated.value = false;
|
||||
isRealUser.value = false;
|
||||
errors.value = null;
|
||||
loading.value = false;
|
||||
|
||||
try {
|
||||
const tokenStorage = useStorage("id_token", "");
|
||||
tokenStorage.value = "";
|
||||
|
||||
const userStorage = useStorage("user", {});
|
||||
userStorage.value = {};
|
||||
|
||||
const userIdStorage = useStorage("user_id", "");
|
||||
userIdStorage.value = "";
|
||||
|
||||
const nuxtApp = useNuxtApp();
|
||||
if (nuxtApp.$http) {
|
||||
nuxtApp.$http.clearToken();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Could not clear storage:", e);
|
||||
}
|
||||
}
|
||||
|
||||
const restoreSession = () => {
|
||||
try {
|
||||
const userStorage = useStorage("user", {});
|
||||
const storedUser = userStorage.value as any;
|
||||
|
||||
if (storedUser && storedUser.token) {
|
||||
user.value = storedUser;
|
||||
isAuthenticated.value = true;
|
||||
isRealUser.value = !!storedUser.id;
|
||||
|
||||
const nuxtApp = useNuxtApp();
|
||||
if (nuxtApp.$http && storedUser.token) {
|
||||
nuxtApp.$http.setToken(storedUser.token);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Could not restore session:", e);
|
||||
}
|
||||
};
|
||||
|
||||
if (import.meta.client) {
|
||||
restoreSession();
|
||||
}
|
||||
|
||||
return {
|
||||
user,
|
||||
isAuthenticated,
|
||||
isRealUser,
|
||||
errors,
|
||||
loading,
|
||||
isLoggedIn,
|
||||
userName,
|
||||
setUser,
|
||||
login,
|
||||
getCaptcha,
|
||||
register,
|
||||
logout,
|
||||
userReset,
|
||||
restoreSession,
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
|
||||
export const useCommonStore = defineStore("commonStore", () => {
|
||||
const sidebarOpen = ref(false);
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarOpen.value = !sidebarOpen.value;
|
||||
}
|
||||
|
||||
function closeSidebar() {
|
||||
sidebarOpen.value = false;
|
||||
}
|
||||
|
||||
function openSidebar() {
|
||||
sidebarOpen.value = true;
|
||||
}
|
||||
|
||||
return {
|
||||
sidebarOpen,
|
||||
toggleSidebar,
|
||||
closeSidebar,
|
||||
openSidebar,
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { useAuthStore } from "./authStore";
|
||||
import { useStorage } from "@vueuse/core";
|
||||
|
||||
export const getUserPermission = defineStore("permissionStore", () => {
|
||||
const permissions = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const hasPagePermission = (to_fullPath: string) => {
|
||||
let path = to_fullPath;
|
||||
const index = path.indexOf("?");
|
||||
if (index !== -1) path = path.substring(0, index);
|
||||
|
||||
const items = path.split("/");
|
||||
const page_key = (items[1] || "") + "_" + (items[2] || "");
|
||||
|
||||
return permissions.value.some((p) => p.section_tag === page_key);
|
||||
};
|
||||
|
||||
const hasActionPermission = (to_fullPath: string, action_tag: string) => {
|
||||
let path = to_fullPath;
|
||||
const index = path.indexOf("?");
|
||||
if (index !== -1) path = path.substring(0, index);
|
||||
|
||||
const items = path.split("/");
|
||||
const page_key = (items[1] || "") + "_" + (items[2] || "");
|
||||
|
||||
return permissions.value.some(
|
||||
(p) => p.section_tag === page_key && p.action_tag === action_tag
|
||||
);
|
||||
};
|
||||
|
||||
const fetchUserPermissions = async (projectId?: number) => {
|
||||
const { $http } = useNuxtApp();
|
||||
const authStore = useAuthStore();
|
||||
|
||||
if (!authStore.isAuthenticated && import.meta.client && !localStorage.getItem("user")) {
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const data = {
|
||||
project_id: projectId || 50,
|
||||
project_only: 1,
|
||||
};
|
||||
|
||||
const response = await $http.postRequest("/permissions/user-permissions", data);
|
||||
permissions.value = response?.data || response || [];
|
||||
|
||||
if (import.meta.client) {
|
||||
const permitStorage = useStorage("permit", []);
|
||||
permitStorage.value = permissions.value;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Could not fetch user permissions:", error);
|
||||
permissions.value = [];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
permissions.value = [];
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
return {
|
||||
permissions,
|
||||
loading,
|
||||
hasPagePermission,
|
||||
hasActionPermission,
|
||||
fetchUserPermissions,
|
||||
reset,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user