Коммит 45994c7a создал по автору Парфиненко Роман Сергеевич's avatar Парфиненко Роман Сергеевич
Просмотр файлов

# 22

владелец 0e67f1c0
......@@ -14,7 +14,7 @@
</q-avatar>
</q-item-section>
<q-item-section>
<q-file ref="fileInput" v-model="avatar" accept="image/*" style="display: none"></q-file>
<!-- <q-file ref="fileInput" v-model="avatar" accept="image/*" style="display: none"></q-file> -->
<q-btn outline label="Добавить фото" class="text-capitalize" rounded color="primary"
style="max-width: 120px" @click="openFileDialog"></q-btn>
</q-item-section>
......@@ -41,7 +41,7 @@
<q-input type="text" v-model="user_details.last_name" label="Фамилия" />
</q-item-section>
</q-item>
<q-item class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<!-- <q-item class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<q-item-section>
<q-input autogrow v-model="user_details.address" label="Адрес" />
</q-item-section>
......@@ -55,7 +55,7 @@
<q-item-section>
<q-input v-model="user_details.post_code" label="Почтовый индекс" />
</q-item-section>
</q-item>
</q-item> -->
<q-item class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<q-item-section>
<q-input type="textarea" v-model="user_details.about" label="обо мне" />
......@@ -133,6 +133,7 @@ export default defineComponent({
last_name: '',
// city: '',
email: '',
about: '',
},
currentPassword: '',
......@@ -158,20 +159,25 @@ export default defineComponent({
handler(val) {
this.user_details.first_name = val.unuaNomo.enhavo;
this.user_details.last_name = val.familinomo.enhavo;
// this.user_details.city = val.regiono.enhavo;
}, immediate: true
},
userEmail: {
handler(val) {
this.user_details.email = val.chefaRetposhto;
this.user_details.email = this.userEmail;
}, immediate: true
},
userAbout: {
handler(val) {
this.user_details.about = val.statuso.enhavo;
}, immediate: true
},
userName: {
handler(val) {
this.user_details.user_name = val.retnomo;
this.user_details.user_name = this.userName;
this.user_details.user_name = val;
}, immediate: true
},
......@@ -185,7 +191,8 @@ export default defineComponent({
...mapState(useCurrentUserStore, ['getAvatar']),
...mapState(useCurrentUserStore, { user: 'getUser' }),
...mapState(useCurrentUserStore, { userEmail: 'getUserEmail' }),
...mapState(useCurrentUserStore, { userName: 'getUserName' })
...mapState(useCurrentUserStore, { userName: 'getUserName' }),
...mapState(useCurrentUserStore, { userAbout: 'getUser' })
},
methods: {
onChangePassword() {
......@@ -234,15 +241,42 @@ export default defineComponent({
...mapActions(useUsersStore, ['changeUzanto', 'changeTelephoneNumberOrEmail']),
...mapActions(useCurrentUserStore, ['addUniversoUzanto']),
updateUserName() {
if (this.userName === this.user_details.user_name) return;
this.addUniversoUzanto({ retnomo: this.user_details.user_name, uuid: this.user.universoUzanto.uuid })
.then(() => {
this.$q.notify({
color: 'positive',
message: 'Ваши данные успешно обновлены!'
});
})
.catch(error => {
this.$q.notify({
color: 'negative',
message: 'Ошибка при изменении данных! '
});
});
},
updateAbout() {
},
updateUser() {
const payload = {};
if (this.user_details.first_name !== this.user.unuaNomo.enhavo) payload.unuaNomo = this.user_details.first_name;
if (this.user_details.last_name !== this.user.familinomo.enhavo) payload.familinomo = this.user_details.last_name;
if (this.user_details.email === this.userEmail.chefaRetposhto) payload.chefaRetposhto = this.user_details.email;
// if (this.user_details.user_name === this.userName.retnomo) payload.retnomo = this.user_details.user_name;
if (this.user_details.about !== this.user.statuso.enhavo) payload.statuso = this.user_details.about;
this.updateUserName();
if (!Object.keys(payload).length) return;
this.changeUzanto(payload)
this.changeUzanto(payload);
this.addUniversoUzanto(payload)
.then(() => {
this.$q.notify({
color: 'positive',
......@@ -253,7 +287,7 @@ export default defineComponent({
.catch(error => {
this.$q.notify({
color: 'negative',
message: 'Ошибка при изменении данных: ' + error.message
message: 'Ошибка при изменении данных! '
});
});
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать