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

View File

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

View File

@@ -20,7 +20,12 @@
:size="24" :size="24"
) )
.icon-plus(class="pt-[2px]") .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( base-adding-network(
:value="network", :value="network",
:selected-option="getSelectedIcon", :selected-option="getSelectedIcon",
@@ -71,7 +76,8 @@ export default {
computed: { computed: {
getNetworks() { getNetworks() {
return this.networks.filter( return this.networks.filter(
(el) => el.kind !== "EMAIL" && el.kind !== "PHONE" (el) =>
el.kind !== "EMAIL" && el.kind !== "PHONE" && el.deleted_flg !== true
); );
}, },
getSelectedIcon() { getSelectedIcon() {

View File

@@ -7,7 +7,7 @@
.flex.flex-col.gap-y-2 .flex.flex-col.gap-y-2
.text-welcome.flex.not-italic.font-bold.text-5xl Добро пожаловать! .text-welcome.flex.not-italic.font-bold.text-5xl Добро пожаловать!
.text-under.flex.not-italic.font-medium.text-base( .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-5
.flex.flex-col.gap-y-6px .flex.flex-col.gap-y-6px
.flex.non-italic.font-semibold.text-xss Логин .flex.non-italic.font-semibold.text-xss Логин