1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00
This commit is contained in:
MoonTestUse1
2024-12-23 22:22:47 +06:00
parent 31079cc3cc
commit 7401e55c66
3 changed files with 25 additions and 10 deletions

View File

@@ -46,7 +46,11 @@ defineProps<{
label: string; label: string;
type?: string; type?: string;
required?: boolean; required?: boolean;
disabled?: boolean;
placeholder?: string;
help?: string;
icon?: Component; icon?: Component;
size?: number | string; // Добавляем поддержку как числа, так и строки
options?: Array<{ value: string; label: string }>; options?: Array<{ value: string; label: string }>;
}>(); }>();

View File

@@ -9,7 +9,7 @@
</label> </label>
<div class="relative"> <div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
<UserIcon size="18" class="text-slate-400" /> <UserIcon :size="18" class="text-slate-400" />
</div> </div>
<input <input
v-model="lastName" v-model="lastName"
@@ -27,7 +27,7 @@
</label> </label>
<div class="relative"> <div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
<LockIcon size="18" class="text-slate-400" /> <LockIcon :size="18" class="text-slate-400" />
</div> </div>
<input <input
v-model="password" v-model="password"
@@ -42,8 +42,13 @@
<button <button
type="submit" type="submit"
:disabled="isLoading" :disabled="isLoading"
class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50" class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-2"
> >
<component
:is="isLoading ? LoaderIcon : LogInIcon"
:size="18"
:class="{ 'animate-spin': isLoading }"
/>
{{ isLoading ? 'Вход...' : 'Войти' }} {{ isLoading ? 'Вход...' : 'Войти' }}
</button> </button>
@@ -63,7 +68,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useAuthStore } from '@/stores/auth'; import { useAuthStore } from '@/stores/auth';
import { UserIcon, LockIcon } from 'lucide-vue-next'; import { UserIcon, LockIcon, LogInIcon, LoaderIcon } from 'lucide-vue-next';
const router = useRouter(); const router = useRouter();
const authStore = useAuthStore(); const authStore = useAuthStore();
@@ -84,6 +89,7 @@ async function handleSubmit() {
alert('Неверная фамилия или пароль'); alert('Неверная фамилия или пароль');
} }
} catch (error) { } catch (error) {
console.error('Error:', error);
alert('Ошибка авторизации'); alert('Ошибка авторизации');
} finally { } finally {
isLoading.value = false; isLoading.value = false;

View File

@@ -9,7 +9,7 @@
</label> </label>
<div class="relative"> <div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
<UserIcon size="18" class="text-slate-400" /> <UserIcon :size="18" class="text-slate-400" />
</div> </div>
<input <input
v-model="username" v-model="username"
@@ -27,7 +27,7 @@
</label> </label>
<div class="relative"> <div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center">
<LockIcon size="18" class="text-slate-400" /> <LockIcon :size="18" class="text-slate-400" />
</div> </div>
<input <input
v-model="password" v-model="password"
@@ -42,8 +42,13 @@
<button <button
type="submit" type="submit"
:disabled="isLoading" :disabled="isLoading"
class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50" class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-2"
> >
<component
:is="isLoading ? LoaderIcon : LogInIcon"
:size="18"
:class="{ 'animate-spin': isLoading }"
/>
{{ isLoading ? 'Вход...' : 'Войти' }} {{ isLoading ? 'Вход...' : 'Войти' }}
</button> </button>
@@ -63,7 +68,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useAuthStore } from '@/stores/auth'; import { useAuthStore } from '@/stores/auth';
import { UserIcon, LockIcon } from 'lucide-vue-next'; import { UserIcon, LockIcon, LogInIcon, LoaderIcon } from 'lucide-vue-next';
const router = useRouter(); const router = useRouter();
const authStore = useAuthStore(); const authStore = useAuthStore();