Merge pull request #188 from dderbentsov/UC-162

[WIP] Изменил заголовок на странице логина, добавил попап...
This commit is contained in:
frontgavrilin
2022-12-08 18:44:26 +03:00
committed by GitHub
4 changed files with 55 additions and 39 deletions

View File

@@ -20,13 +20,15 @@
:icon-right-size="18",
@click="openForm"
)
button.header-buttons.flex.justify-center.items-center.mr-8.p-0(@click="logout")
button.header-buttons.flex.justify-center.items-center.mr-8.p-0
.icon-bell.text-xxl
.flex.justify-centflexer.items-center
.flex.justify-centflexer.items-center.relative
base-avatar.mr-2(:size="32")
img(:src="avatarSrc", alt="Avatar")
button.header-buttons
button.header-buttons(@click="openPopup")
.icon-down-arrow.text-xxs.flex.justify-center.items-center.p-0
base-popup.right-2.top-10(v-if="showPopup", :width="160", v-click-outside="openPopup")
.text-popup.flex.cursor-pointer.pl-2(@click="logout") Выйти
</template>
<script>
@@ -35,10 +37,17 @@ import chargePersonAvatar from "@/assets/images/charge-person-avatar.svg";
import HeaderInputs from "./HeaderInputs.vue";
import BaseAvatar from "@/components/base/BaseAvatar";
import BaseButton from "@/components/base/BaseButton.vue";
import BasePopup from "@/components/base/BasePopup.vue";
import BaseClientFormCreate from "@/components/base/BaseClientFormCreate";
export default {
name: "TheHeader",
components: { HeaderInputs, BaseAvatar, BaseButton, BaseClientFormCreate },
components: {
HeaderInputs,
BaseAvatar,
BaseButton,
BasePopup,
BaseClientFormCreate,
},
props: {
openForm: Function,
closeForm: Function,
@@ -52,6 +61,7 @@ export default {
avatarSrc: chargePersonAvatar,
name: "Гордеев Николай Степанович",
},
showPopup: false,
};
},
methods: {
@@ -59,6 +69,9 @@ export default {
localStorage.removeItem("tokenAccess");
this.$router.push("/login");
},
openPopup() {
this.showPopup = !this.showPopup;
},
},
};
</script>
@@ -111,4 +124,9 @@ export default {
.charge-person-container
position: absolute
.text-popup
color: var(--btn-blue-color)
&:hover
opacity: 0.8
</style>

View File

@@ -221,9 +221,10 @@ export default {
if (!this.dataClient.fullName) this.dataClient.fullName = clientName;
else if (this.dataClient.fullName !== clientName)
data.full_name = this.dataClient.fullName;
if (this.dataClient.age !== this.client.birth_date && this.dataClient.age)
data.birth_date = this.dataClient.age;
else if (!this.dataClient.age) {
else if (!this.dataClient.age && this.client.birth_date) {
this.addErrorNotification(
"Некорректная дата рождения",
"Пожалуйста, введите дату рождения корректно"
@@ -253,56 +254,46 @@ export default {
if (
this.dataClient.email.username &&
!contacts.find((el) => el.kind === "EMAIL")
) {
)
contacts.push(this.dataClient.email);
}
if (
this.dataClient.phone.username &&
!contacts.find((el) => el.kind === "PHONE")
) {
)
contacts.push(this.dataClient.phone);
}
let mapCreateContacts = this.client.contacts.map((el) => el.kind);
// let mapDeleteContacts = contacts.map((el) => el.kind);
let mapDeleteContacts = contacts.map((el) => el.kind);
let createContacts = contacts.filter(
(el) => !mapCreateContacts.includes(el.kind)
);
// let deleteContacts = this.client.contacts.filter(
// (el) => !mapDeleteContacts.includes(el.kind)
// );
let deleteContacts = this.client.contacts.filter(
(el) => !mapDeleteContacts.includes(el.kind)
);
let updateContacts = [];
this.client.contacts.forEach((el) => {
if (
el.kind === "PHONE" &&
this.dataClient.phone.username.length === 18 &&
el.username !== this.dataClient.phone.username
) {
)
updateContacts.push(this.dataClient.phone);
} else
this.dataClient.phone.username =
this.client.contacts.find((el) => el.kind === "PHONE")?.username ||
"";
if (
el.kind === "EMAIL" &&
this.dataClient.email.username &&
el.username !== this.dataClient.email.username
) {
)
updateContacts.push(this.dataClient.email);
} else
this.dataClient.email.username =
this.client.contacts.find((el) => el.kind === "EMAIL")?.username ||
"";
});
createContacts.forEach((el) => this.postCreateContact(el));
// deleteContacts.forEach((el) => this.postDeleteContact(el));
deleteContacts.forEach((el) => this.postDeleteContact(el));
updateContacts.forEach((el) => this.postUpdateContact(el));
},
postCreateContact(contact) {
fetchWrapper.post("general/contact/create/", {
fetchWrapper
.post("general/contact/create/", {
kind: contact.kind,
username: contact.username,
person_id: this.client.id,
});
})
.then(() => this.fetchDataClients());
},
postUpdateContact(contact) {
fetchWrapper.post(`general/contact/${contact.id}/update/`, {
@@ -558,11 +549,6 @@ export default {
});
},
},
watch: {
rowOverlay() {
if (this.rowOverlay) this.startTimer();
},
},
created() {
this.dataClient = {
id: this.client.id,
@@ -596,6 +582,12 @@ export default {
photo: this.client.photo,
};
},
watch: {
rowOverlay() {
if (this.rowOverlay) this.startTimer();
},
},
beforeUnmount() {
if (this.timer) {
this.deleteClient();

View File

@@ -20,7 +20,12 @@
:size="24"
)
.icon-plus(class="pt-[2px]")
base-popup.right-3.top-6(v-if="isOpenPopupAdding", v-click-outside="closePopup" :width="485")
base-popup.right-3.top-6(
v-if="isOpenPopupAdding",
@click.stop,
v-click-outside="closePopup",
:width="485"
)
base-adding-network(
:value="network",
:selected-option="getSelectedIcon",
@@ -71,7 +76,8 @@ export default {
computed: {
getNetworks() {
return this.networks.filter(
(el) => el.kind !== "EMAIL" && el.kind !== "PHONE"
(el) =>
el.kind !== "EMAIL" && el.kind !== "PHONE" && el.deleted_flg !== true
);
},
getSelectedIcon() {

View File

@@ -7,7 +7,7 @@
.flex.flex-col.gap-y-2
.text-welcome.flex.not-italic.font-bold.text-5xl Добро пожаловать!
.text-under.flex.not-italic.font-medium.text-base(
:style="{color: this.underTextColor}") Очень рады вас видеть. Войдите в аккаунт, чтобы начать пользоваться сервисом «Астра».
:style="{color: this.underTextColor}") Войдите в аккаунт, чтобы начать пользоваться сервисом «Астра».
.flex.flex-col.gap-y-5
.flex.flex-col.gap-y-6px
.flex.non-italic.font-semibold.text-xss Логин