фикс
This commit is contained in:
parent
35ee06c0bf
commit
b25511805d
12
index.html
12
index.html
@ -6,7 +6,17 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>DatingApp</title>
|
<title>DatingApp</title>
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
||||||
|
<style>
|
||||||
|
/* Фолбек для Bootstrap Icons, если CDN недоступен */
|
||||||
|
.bi::before {
|
||||||
|
display: inline-block;
|
||||||
|
content: "";
|
||||||
|
vertical-align: -.125em;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 1rem 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180">
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180">
|
||||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 440px) and (device-height: 956px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)" href="splash_screens/iPhone_16_Pro_Max_landscape.png">
|
<link rel="apple-touch-startup-image" media="screen and (device-width: 440px) and (device-height: 956px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)" href="splash_screens/iPhone_16_Pro_Max_landscape.png">
|
||||||
<link rel="apple-touch-startup-image" media="screen and (device-width: 402px) and (device-height: 874px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)" href="splash_screens/iPhone_16_Pro_landscape.png">
|
<link rel="apple-touch-startup-image" media="screen and (device-width: 402px) and (device-height: 874px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)" href="splash_screens/iPhone_16_Pro_landscape.png">
|
||||||
|
@ -387,10 +387,22 @@ const toggleEditMode = () => {
|
|||||||
|
|
||||||
if (isEditMode.value) {
|
if (isEditMode.value) {
|
||||||
// При входе в режим редактирования копируем данные профиля в редактируемый объект
|
// При входе в режим редактирования копируем данные профиля в редактируемый объект
|
||||||
|
// Преобразуем формат даты из ISO в yyyy-MM-dd
|
||||||
|
let formattedDate = '';
|
||||||
|
if (profileData.value.dateOfBirth) {
|
||||||
|
try {
|
||||||
|
const date = new Date(profileData.value.dateOfBirth);
|
||||||
|
formattedDate = date.toISOString().split('T')[0]; // Получаем только yyyy-MM-dd часть
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Ошибка форматирования даты:', e);
|
||||||
|
formattedDate = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
editableProfileData.value = {
|
editableProfileData.value = {
|
||||||
name: profileData.value.name || '',
|
name: profileData.value.name || '',
|
||||||
bio: profileData.value.bio || '',
|
bio: profileData.value.bio || '',
|
||||||
dateOfBirth: profileData.value.dateOfBirth || '',
|
dateOfBirth: formattedDate,
|
||||||
gender: profileData.value.gender || '',
|
gender: profileData.value.gender || '',
|
||||||
location: {
|
location: {
|
||||||
city: profileData.value.location?.city || '',
|
city: profileData.value.location?.city || '',
|
||||||
@ -749,13 +761,22 @@ const saveProfileChanges = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('[ProfileView] Сохранение данных профиля:', editableProfileData.value);
|
console.log('[ProfileView] Сохранение данных профиля:', editableProfileData.value);
|
||||||
|
|
||||||
// Подготавливаем данные для отправки на сервер
|
// Подготавливаем данные для отправки на сервер
|
||||||
const dataToUpdate = { ...editableProfileData.value };
|
const dataToUpdate = { ...editableProfileData.value };
|
||||||
|
|
||||||
// Обрабатываем дату рождения - если это строка с датой, преобразуем в формат ISO
|
// Обрабатываем дату рождения - если это строка с датой в формате yyyy-MM-dd
|
||||||
|
// преобразуем её в полноценную дату (в формат ISO)
|
||||||
if (dataToUpdate.dateOfBirth) {
|
if (dataToUpdate.dateOfBirth) {
|
||||||
// dateOfBirth уже в нужном формате из input type="date"
|
try {
|
||||||
|
// Получаем дату в формате ISO с поправкой на часовой пояс
|
||||||
|
const dateObj = new Date(dataToUpdate.dateOfBirth);
|
||||||
|
if (!isNaN(dateObj.getTime())) { // Проверяем, что дата валидна
|
||||||
|
dataToUpdate.dateOfBirth = dateObj.toISOString();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[ProfileView] Ошибка обработки даты:', e);
|
||||||
|
// Оставляем как есть, если возникла ошибка
|
||||||
|
}
|
||||||
console.log('[ProfileView] Дата рождения для отправки:', dataToUpdate.dateOfBirth);
|
console.log('[ProfileView] Дата рождения для отправки:', dataToUpdate.dateOfBirth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,10 +808,21 @@ const loadCities = async () => {
|
|||||||
try {
|
try {
|
||||||
// Используем правильный путь к файлу для Vite
|
// Используем правильный путь к файлу для Vite
|
||||||
const response = await import('@/assets/russian-cities.json');
|
const response = await import('@/assets/russian-cities.json');
|
||||||
cities = response.default || [];
|
const rawData = response.default || [];
|
||||||
|
|
||||||
|
// Проверяем, что данные - массив строк
|
||||||
|
if (Array.isArray(rawData)) {
|
||||||
|
// Фильтруем и очищаем данные, оставляя только строки
|
||||||
|
cities = rawData.filter(city => typeof city === 'string');
|
||||||
|
} else {
|
||||||
|
cities = [];
|
||||||
|
console.error('[ProfileView] Неверный формат данных городов:', typeof rawData);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('[ProfileView] Загружен список городов:', cities.length);
|
console.log('[ProfileView] Загружен список городов:', cities.length);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[ProfileView] Ошибка при загрузке списка городов:', err);
|
console.error('[ProfileView] Ошибка при загрузке списка городов:', err);
|
||||||
|
cities = []; // Инициализируем пустым массивом в случае ошибки
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -807,11 +839,12 @@ const onCitySearch = () => {
|
|||||||
|
|
||||||
const query = citySearchQuery.value.toLowerCase().trim();
|
const query = citySearchQuery.value.toLowerCase().trim();
|
||||||
filteredCities.value = cities
|
filteredCities.value = cities
|
||||||
.filter(city => city.toLowerCase().includes(query))
|
.filter(city => typeof city === 'string' && city.toLowerCase().includes(query))
|
||||||
.slice(0, 10); // Ограничиваем количество результатов
|
.slice(0, 10); // Ограничиваем количество результатов
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectCity = (city) => {
|
const selectCity = (city) => {
|
||||||
|
console.log('[ProfileView] Выбран город:', city, typeof city);
|
||||||
citySearchQuery.value = city;
|
citySearchQuery.value = city;
|
||||||
|
|
||||||
if (!editableProfileData.value.location) {
|
if (!editableProfileData.value.location) {
|
||||||
@ -863,7 +896,7 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css');
|
/* Bootstrap Icons загружаются в index.html */
|
||||||
|
|
||||||
/* Global Reset and Base Styles */
|
/* Global Reset and Base Styles */
|
||||||
.modern-profile-view {
|
.modern-profile-view {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user