фикс
This commit is contained in:
parent
c9e107a4ec
commit
ff34ff6541
@ -991,6 +991,116 @@ const checkForChanges = () => {
|
||||
|
||||
return currentData !== originalProfileData;
|
||||
};
|
||||
|
||||
// Добавляем отсутствующие функции
|
||||
const logoutUser = async () => {
|
||||
try {
|
||||
await logout();
|
||||
// Перенаправляем на страницу входа после выхода
|
||||
window.location.href = '/login';
|
||||
} catch (err) {
|
||||
console.error('[ProfileView] Ошибка при выходе:', err);
|
||||
}
|
||||
};
|
||||
|
||||
const clearProfileMessages = () => {
|
||||
profileActionError.value = '';
|
||||
profileActionSuccess.value = '';
|
||||
};
|
||||
|
||||
// Функции для работы с городами
|
||||
const onCitySearch = (event) => {
|
||||
const query = event.target.value.toLowerCase().trim();
|
||||
citySearchQuery.value = event.target.value;
|
||||
|
||||
if (query.length > 0) {
|
||||
// Простой список российских городов для демонстрации
|
||||
const allCities = [
|
||||
'Москва', 'Санкт-Петербург', 'Новосибирск', 'Екатеринбург', 'Казань',
|
||||
'Нижний Новгород', 'Челябинск', 'Самара', 'Омск', 'Ростов-на-Дону',
|
||||
'Уфа', 'Красноярск', 'Воронеж', 'Пермь', 'Волгоград', 'Краснодар',
|
||||
'Саратов', 'Тюмень', 'Тольятти', 'Ижевск', 'Барнаул', 'Ульяновск',
|
||||
'Иркутск', 'Хабаровск', 'Ярославль', 'Владивосток', 'Махачкала',
|
||||
'Томск', 'Оренбург', 'Кемерово', 'Новокузнецк', 'Рязань', 'Пенза',
|
||||
'Астрахань', 'Липецк', 'Тула', 'Киров', 'Чебоксары', 'Калининград'
|
||||
];
|
||||
|
||||
filteredCities.value = allCities.filter(city =>
|
||||
city.toLowerCase().includes(query)
|
||||
).slice(0, 10); // Ограничиваем до 10 результатов
|
||||
|
||||
showCityList.value = filteredCities.value.length > 0;
|
||||
} else {
|
||||
filteredCities.value = [];
|
||||
showCityList.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const selectCity = (city) => {
|
||||
citySearchQuery.value = city;
|
||||
editableProfileData.value.location.city = city;
|
||||
showCityList.value = false;
|
||||
};
|
||||
|
||||
const clearCitySelection = () => {
|
||||
citySearchQuery.value = '';
|
||||
editableProfileData.value.location.city = '';
|
||||
showCityList.value = false;
|
||||
};
|
||||
|
||||
// Функции для работы с полом
|
||||
const onGenderSearch = (event) => {
|
||||
const query = event.target.value.toLowerCase().trim();
|
||||
genderSearchQuery.value = event.target.value;
|
||||
|
||||
if (query.length > 0) {
|
||||
filteredGenders.value = genderOptions.value.filter(option =>
|
||||
option.text.toLowerCase().includes(query)
|
||||
);
|
||||
showGenderList.value = filteredGenders.value.length > 0;
|
||||
} else {
|
||||
filteredGenders.value = genderOptions.value;
|
||||
showGenderList.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const selectGender = (option) => {
|
||||
genderSearchQuery.value = option.text;
|
||||
editableProfileData.value.gender = option.value;
|
||||
showGenderList.value = false;
|
||||
};
|
||||
|
||||
const clearGenderSelection = () => {
|
||||
genderSearchQuery.value = '';
|
||||
editableProfileData.value.gender = '';
|
||||
showGenderList.value = false;
|
||||
};
|
||||
|
||||
// Закрытие выпадающих списков при клике вне их
|
||||
const handleClickOutside = (event) => {
|
||||
if (!event.target.closest('.city-input-wrapper')) {
|
||||
showCityList.value = false;
|
||||
showGenderList.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Добавляем onMounted для инициализации компонента
|
||||
onMounted(async () => {
|
||||
console.log('[ProfileView] Компонент смонтирован, начинаем загрузку профиля...');
|
||||
|
||||
// Добавляем обработчик для закрытия выпадающих списков
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
|
||||
// Загружаем данные профиля
|
||||
await fetchProfileDataLocal();
|
||||
});
|
||||
|
||||
// Очистка при размонтировании
|
||||
import { onUnmounted } from 'vue';
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', handleClickOutside);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -1015,6 +1125,7 @@ const checkForChanges = () => {
|
||||
|
||||
.title-gradient {
|
||||
background: linear-gradient(90deg, #667eea, #764ba2);
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
@ -1303,7 +1414,7 @@ const checkForChanges = () => {
|
||||
}
|
||||
|
||||
.card-content {
|
||||
/* padding-top: 10px; */
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
|
Loading…
x
Reference in New Issue
Block a user