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