modified: main_dc/yalarba/easySite/easySite/app/layouts/auth.vue
modified: main_dc/yalarba/easySite/easySite/app/pages/auth/login.vue modified: main_dc/yalarba/easySite/easySite/app/pages/profile/edit.vue fix fix fix
This commit is contained in:
@@ -4,14 +4,10 @@
|
||||
<div class="container py-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<NuxtLink to="/" class="flex items-center gap-2">
|
||||
<div class="w-8 h-8 bg-primary-500 rounded-lg"></div>
|
||||
<div class="w-8 h-8 bg-primary-500 rounded-lg"/>
|
||||
<span class="font-bold text-xl">TravelEasy</span>
|
||||
</NuxtLink>
|
||||
|
||||
<nav class="flex gap-4">
|
||||
<NuxtLink to="/" class="nav-link">Главная</NuxtLink>
|
||||
<NuxtLink to="/objects" class="nav-link">Объекты</NuxtLink>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -69,7 +69,8 @@ import { loginSchema } from '~/schemas/auth'
|
||||
import type { LoginForm } from '~/types/auth'
|
||||
|
||||
definePageMeta({
|
||||
middleware: 'auth'
|
||||
middleware: 'auth',
|
||||
layout: 'auth'
|
||||
})
|
||||
|
||||
const auth = useAuth()
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<h2 class="card-title">Личная информация</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form @submit.prevent="saveProfile" class="profile-form">
|
||||
<form class="profile-form" @submit.prevent="saveProfile">
|
||||
<div class="user-avatar-section">
|
||||
<div class="user-avatar">
|
||||
<span class="avatar-text">{{ userInitials }}</span>
|
||||
@@ -30,35 +30,62 @@
|
||||
<div class="form-grid">
|
||||
<div class="form-group">
|
||||
<label for="fullName" class="form-label">Полное имя</label>
|
||||
<input type="text" id="fullName" v-model="formData.full_name" class="form-input"
|
||||
placeholder="Введите ваше полное имя" autocomplete="name">
|
||||
<input
|
||||
id="fullName"
|
||||
v-model="formData.full_name"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите ваше полное имя"
|
||||
autocomplete="name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inn" class="form-label">ИНН</label>
|
||||
<input type="text" id="inn" v-model="formData.inn" class="form-input" placeholder="Введите ваш ИНН"
|
||||
maxlength="12" autocomplete="off">
|
||||
<input
|
||||
id="inn"
|
||||
v-model="formData.inn"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите ваш ИНН"
|
||||
maxlength="12"
|
||||
autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="phone" class="form-label">Телефон</label>
|
||||
<input type="tel" id="phone" v-model="formData.phone" class="form-input"
|
||||
placeholder="+7 (___) ___-__-__" autocomplete="tel">
|
||||
<input
|
||||
id="phone"
|
||||
v-model="formData.phone"
|
||||
type="tel"
|
||||
class="form-input"
|
||||
placeholder="+7 (___) ___-__-__"
|
||||
autocomplete="tel">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="city" class="form-label">Город</label>
|
||||
<input type="text" id="city" v-model="formData.city" class="form-input"
|
||||
placeholder="Введите ваш город" autocomplete="address-level2">
|
||||
<input
|
||||
id="city"
|
||||
v-model="formData.city"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите ваш город"
|
||||
autocomplete="address-level2">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<div class="email-input-group">
|
||||
<input type="email" id="email" v-model="formData.email" class="form-input"
|
||||
:class="{ 'input-error': emailError }" placeholder="Введите ваш email" @blur="validateEmail"
|
||||
autocomplete="email" required>
|
||||
<!-- ... остальной код ... -->
|
||||
<input
|
||||
id="email"
|
||||
v-model="formData.email"
|
||||
type="email"
|
||||
class="form-input"
|
||||
:class="{ 'input-error': emailError }"
|
||||
placeholder="Введите ваш email"
|
||||
autocomplete="email"
|
||||
required
|
||||
@blur="validateEmail">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,19 +119,31 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="orgFullName" class="form-label">Полное название организации</label>
|
||||
<input type="text" id="orgFullName" v-model="formData.org_full_name" class="form-input"
|
||||
<input
|
||||
id="orgFullName"
|
||||
v-model="formData.org_full_name"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите полное название организации">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="orgShortName" class="form-label">Короткое название организации</label>
|
||||
<input type="text" id="orgShortName" v-model="formData.org_short_name" class="form-input"
|
||||
<input
|
||||
id="orgShortName"
|
||||
v-model="formData.org_short_name"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите короткое название организации">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="orgInn" class="form-label">ИНН организации</label>
|
||||
<input type="text" id="orgInn" v-model="formData.org_inn" class="form-input"
|
||||
<input
|
||||
id="orgInn"
|
||||
v-model="formData.org_inn"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="Введите ИНН организации" maxlength="12">
|
||||
</div>
|
||||
</div>
|
||||
@@ -159,14 +198,14 @@
|
||||
|
||||
<!-- Загрузка -->
|
||||
<div v-else-if="auth.loading.value" class="loading-container">
|
||||
<div class="loading-spinner"></div>
|
||||
<div class="loading-spinner"/>
|
||||
<p>Загрузка профиля...</p>
|
||||
</div>
|
||||
|
||||
<!-- Ошибка -->
|
||||
<div v-else class="error-container">
|
||||
<p>Не удалось загрузить данные профиля</p>
|
||||
<button @click="reload" class="btn btn-primary">Попробовать снова</button>
|
||||
<button class="btn btn-primary" @click="reload">Попробовать снова</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -184,7 +223,17 @@ onMounted(async () => {
|
||||
|
||||
// Заполняем форму данными пользователя
|
||||
if (auth.user.value) {
|
||||
formData.value = { ...auth.user.value }
|
||||
formData.value = {
|
||||
full_name: auth.user.value.full_name || '',
|
||||
inn: auth.user.value.inn || '',
|
||||
phone: auth.user.value.phone || '',
|
||||
city: auth.user.value.city || '',
|
||||
email: auth.user.value.email || '',
|
||||
org_type: auth.user.value.org_type || '',
|
||||
org_full_name: auth.user.value.org_full_name || '',
|
||||
org_short_name: auth.user.value.org_short_name || '',
|
||||
org_inn: auth.user.value.org_inn || ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -216,7 +265,7 @@ const userInitials = computed(() => {
|
||||
if (!formData.value.full_name) return '??'
|
||||
|
||||
const names = formData.value.full_name.split(' ')
|
||||
if (names.length >= 2) {
|
||||
if (names.length >= 2 && names[0] && names[1]) {
|
||||
return `${names[0][0]}${names[1][0]}`.toUpperCase()
|
||||
}
|
||||
return formData.value.full_name.substring(0, 2).toUpperCase()
|
||||
@@ -245,6 +294,7 @@ const validateEmail = () => {
|
||||
}
|
||||
|
||||
// Отправка кода верификации
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const sendVerificationCode = async () => {
|
||||
isSendingCode.value = true
|
||||
verificationError.value = ''
|
||||
@@ -255,6 +305,7 @@ const sendVerificationCode = async () => {
|
||||
showVerificationModal.value = true
|
||||
console.log(`Код верификации отправлен на ${formData.value.email}`)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
verificationError.value = 'Ошибка при отправке кода. Попробуйте позже.'
|
||||
} finally {
|
||||
isSendingCode.value = false
|
||||
@@ -262,6 +313,7 @@ const sendVerificationCode = async () => {
|
||||
}
|
||||
|
||||
// Верификация кода
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const verifyEmailCode = async () => {
|
||||
isVerifyingCode.value = true
|
||||
verificationError.value = ''
|
||||
@@ -287,6 +339,7 @@ const verifyEmailCode = async () => {
|
||||
}
|
||||
|
||||
// Закрытие модального окна верификации
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const closeVerificationModal = () => {
|
||||
showVerificationModal.value = false
|
||||
verificationCode.value = ''
|
||||
|
||||
Reference in New Issue
Block a user