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

View File

@@ -9,7 +9,7 @@
</label>
<div class="relative">
<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>
<input
v-model="lastName"
@@ -27,7 +27,7 @@
</label>
<div class="relative">
<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>
<input
v-model="password"
@@ -42,8 +42,13 @@
<button
type="submit"
: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 ? 'Вход...' : 'Войти' }}
</button>
@@ -63,7 +68,7 @@
import { ref } from 'vue';
import { useRouter } from 'vue-router';
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 authStore = useAuthStore();
@@ -84,9 +89,10 @@ async function handleSubmit() {
alert('Неверная фамилия или пароль');
}
} catch (error) {
console.error('Error:', error);
alert('Ошибка авторизации');
} finally {
isLoading.value = false;
}
}
</script>
</script>

View File

@@ -9,7 +9,7 @@
</label>
<div class="relative">
<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>
<input
v-model="username"
@@ -27,7 +27,7 @@
</label>
<div class="relative">
<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>
<input
v-model="password"
@@ -42,8 +42,13 @@
<button
type="submit"
: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 ? 'Вход...' : 'Войти' }}
</button>
@@ -63,7 +68,7 @@
import { ref } from 'vue';
import { useRouter } from 'vue-router';
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 authStore = useAuthStore();
@@ -89,4 +94,4 @@ async function handleSubmit() {
isLoading.value = false;
}
}
</script>
</script>