diff --git a/main_dc/yalarba/easySite/easySite/app/components/layout/Header.vue b/main_dc/yalarba/easySite/easySite/app/components/layout/Header.vue index ab137f9..2930fec 100644 --- a/main_dc/yalarba/easySite/easySite/app/components/layout/Header.vue +++ b/main_dc/yalarba/easySite/easySite/app/components/layout/Header.vue @@ -1,64 +1,162 @@ \ No newline at end of file +// Простой хедер без проверки авторизации + + + \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/composables/useObjects.ts b/main_dc/yalarba/easySite/easySite/app/composables/useObjects.ts index 8c595fd..666f4c9 100644 --- a/main_dc/yalarba/easySite/easySite/app/composables/useObjects.ts +++ b/main_dc/yalarba/easySite/easySite/app/composables/useObjects.ts @@ -1,225 +1,39 @@ -import { ref } from 'vue' +// В файле composables/useObjects.ts обновляем fetchObjects: -export interface ObjectItem { - id: number - title: string - description: string - type: 'hotel' | 'apartment' | 'villa' | 'camping' | 'restaurant' | 'attraction' - category: string - address: string - city: string - country: string - price: number - priceUnit: 'per_night' | 'per_person' | 'fixed' - amenities: string[] - images: string[] - contactEmail: string - contactPhone: string - website?: string - coordinates?: { - lat: number - lng: number - } - isActive: boolean - createdAt: string - updatedAt: string - userId: number - rating?: number - reviewCount?: number -} - -export const useObjects = () => { - const objects = ref([]) - const loading = ref(false) - const error = ref(null) - - // Мок-данные объектов - const mockObjects: ObjectItem[] = [ - { - id: 1, - title: 'Отель "Морской бриз"', - description: 'Комфортабельный отель с видом на море. Идеальное место для отдыха всей семьей.', - type: 'hotel', - category: 'accommodation', - address: 'ул. Приморская, 15', - city: 'Сочи', - country: 'Россия', - price: 5000, - priceUnit: 'per_night', - amenities: ['wifi', 'parking', 'breakfast', 'pool', 'spa'], - images: ['/images/hotel1.jpg', '/images/hotel2.jpg'], - contactEmail: 'hotel@example.com', - contactPhone: '+7 999 123-45-67', - website: 'https://hotel-example.com', - coordinates: { lat: 43.5855, lng: 39.7231 }, - isActive: true, - createdAt: '2024-01-15T10:00:00Z', - updatedAt: '2024-01-15T10:00:00Z', - userId: 1, - rating: 4.5, - reviewCount: 23 - }, - { - id: 2, - title: 'Апартаменты в центре', - description: 'Современные апартаменты в историческом центре города.', - type: 'apartment', - category: 'accommodation', - address: 'ул. Центральная, 25', - city: 'Москва', - country: 'Россия', - price: 3500, - priceUnit: 'per_night', - amenities: ['wifi', 'kitchen', 'washing_machine'], - images: ['/images/apartment1.jpg'], - contactEmail: 'apart@example.com', - contactPhone: '+7 999 765-43-21', - isActive: true, - createdAt: '2024-01-10T14:30:00Z', - updatedAt: '2024-01-12T09:15:00Z', - userId: 2, - rating: 4.2, - reviewCount: 15 - } - ] - - // Получить все объекты - const fetchObjects = async (filters?: any): Promise => { - loading.value = true - error.value = null - - return new Promise((resolve) => { - setTimeout(() => { - let filteredObjects = [...mockObjects] - - // Применяем фильтры - if (filters) { - if (filters.type) { - filteredObjects = filteredObjects.filter(obj => obj.type === filters.type) - } - if (filters.city) { - filteredObjects = filteredObjects.filter(obj => - obj.city.toLowerCase().includes(filters.city.toLowerCase()) - ) - } - if (filters.userId) { - filteredObjects = filteredObjects.filter(obj => obj.userId === filters.userId) - } +const fetchObjects = async (filters?: any): Promise => { + loading.value = true + error.value = null + + return new Promise((resolve) => { + setTimeout(() => { + let filteredObjects = [...mockObjects] + + // Применяем фильтры + if (filters) { + if (filters.search) { + const searchTerm = filters.search.toLowerCase() + filteredObjects = filteredObjects.filter(obj => + obj.title.toLowerCase().includes(searchTerm) || + obj.city.toLowerCase().includes(searchTerm) || + obj.description.toLowerCase().includes(searchTerm) + ) } - - objects.value = filteredObjects - loading.value = false - resolve(filteredObjects) - }, 500) - }) - } - - // Получить объект по ID - const fetchObjectById = async (id: number): Promise => { - loading.value = true - - return new Promise((resolve) => { - setTimeout(() => { - const object = mockObjects.find(obj => obj.id === id) || null - loading.value = false - resolve(object) - }, 300) - }) - } - - // Создать новый объект - const createObject = async (objectData: Omit): Promise => { - loading.value = true - error.value = null - - return new Promise((resolve, reject) => { - setTimeout(() => { - try { - const newObject: ObjectItem = { - ...objectData, - id: Date.now(), - createdAt: new Date().toISOString(), - updatedAt: new Date().toISOString() - } - - mockObjects.push(newObject) - objects.value.push(newObject) - loading.value = false - resolve(newObject) - } catch (err) { - error.value = 'Ошибка при создании объекта' - loading.value = false - reject(err) + if (filters.type) { + filteredObjects = filteredObjects.filter(obj => obj.type === filters.type) } - }, 1000) - }) - } - - // Обновить объект - const updateObject = async (id: number, objectData: Partial): Promise => { - loading.value = true - error.value = null - - return new Promise((resolve, reject) => { - setTimeout(() => { - try { - const index = mockObjects.findIndex(obj => obj.id === id) - if (index === -1) { - throw new Error('Объект не найден') - } - - const updatedObject: ObjectItem = { - ...mockObjects[index], - ...objectData, - updatedAt: new Date().toISOString() - } - - mockObjects[index] = updatedObject - objects.value[index] = updatedObject - loading.value = false - resolve(updatedObject) - } catch (err) { - error.value = 'Ошибка при обновлении объекта' - loading.value = false - reject(err) + if (filters.city) { + filteredObjects = filteredObjects.filter(obj => + obj.city.toLowerCase().includes(filters.city.toLowerCase()) + ) } - }, 800) - }) - } - - // Удалить объект - const deleteObject = async (id: number): Promise => { - loading.value = true - - return new Promise((resolve) => { - setTimeout(() => { - const index = mockObjects.findIndex(obj => obj.id === id) - if (index !== -1) { - mockObjects.splice(index, 1) - objects.value.splice(index, 1) + if (filters.userId) { + filteredObjects = filteredObjects.filter(obj => obj.userId === filters.userId) } - loading.value = false - resolve() - }, 500) - }) - } - - // Получить объекты текущего пользователя - const fetchMyObjects = async (): Promise => { - // В реальном приложении здесь будет userId из авторизации - const currentUserId = 1 - return fetchObjects({ userId: currentUserId }) - } - - return { - objects, - loading, - error, - fetchObjects, - fetchObjectById, - createObject, - updateObject, - deleteObject, - fetchMyObjects - } + } + + objects.value = filteredObjects + loading.value = false + resolve(filteredObjects) + }, 500) + }) } \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/pages/auth/login.vue b/main_dc/yalarba/easySite/easySite/app/pages/auth/login.vue index a280646..dc76164 100644 --- a/main_dc/yalarba/easySite/easySite/app/pages/auth/login.vue +++ b/main_dc/yalarba/easySite/easySite/app/pages/auth/login.vue @@ -1,23 +1,53 @@ \ No newline at end of file + +const handleSubmit = () => { + // В демо-режиме просто переходим в профиль + alert('Демо-режим: вход выполнен') + navigateTo('/profile') +} + + + \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/pages/auth/register.vue b/main_dc/yalarba/easySite/easySite/app/pages/auth/register.vue index 5af3c26..63fd7ff 100644 --- a/main_dc/yalarba/easySite/easySite/app/pages/auth/register.vue +++ b/main_dc/yalarba/easySite/easySite/app/pages/auth/register.vue @@ -1,52 +1,76 @@ \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/pages/objects/create.vue b/main_dc/yalarba/easySite/easySite/app/pages/objects/create.vue index 252b467..7100895 100644 --- a/main_dc/yalarba/easySite/easySite/app/pages/objects/create.vue +++ b/main_dc/yalarba/easySite/easySite/app/pages/objects/create.vue @@ -16,37 +16,37 @@ \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/pages/objects/my-objects.vue b/main_dc/yalarba/easySite/easySite/app/pages/objects/my-objects.vue index 6bb8982..1c14e42 100644 --- a/main_dc/yalarba/easySite/easySite/app/pages/objects/my-objects.vue +++ b/main_dc/yalarba/easySite/easySite/app/pages/objects/my-objects.vue @@ -1,36 +1,28 @@ \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/app/pages/profile/index.vue b/main_dc/yalarba/easySite/easySite/app/pages/profile/index.vue index 4fdb822..d5bec52 100644 --- a/main_dc/yalarba/easySite/easySite/app/pages/profile/index.vue +++ b/main_dc/yalarba/easySite/easySite/app/pages/profile/index.vue @@ -1,6 +1,300 @@ \ No newline at end of file + + + + + \ No newline at end of file diff --git a/main_dc/yalarba/easySite/easySite/nuxt.config.ts b/main_dc/yalarba/easySite/easySite/nuxt.config.ts index 5307771..64ec435 100644 --- a/main_dc/yalarba/easySite/easySite/nuxt.config.ts +++ b/main_dc/yalarba/easySite/easySite/nuxt.config.ts @@ -56,6 +56,7 @@ export default defineNuxtConfig({ css: { devSourcemap: false } - } + }, + }) \ No newline at end of file