WIP Исправлен null при отсутствии имени, отчества
(cherry picked from commit b6d4b46eed8704d840eb0ca8c6e9e44e9b21db3a)
This commit is contained in:
@@ -65,15 +65,24 @@ export default {
|
||||
computed: {
|
||||
ownerName() {
|
||||
if (this.ownerData.id) {
|
||||
return `${this.ownerData.last_name} ${this.ownerData.first_name.slice(
|
||||
0,
|
||||
1
|
||||
)}.${this.ownerData.patronymic.slice(0, 1)}.`;
|
||||
let checkedFirstName =
|
||||
this.ownerData.first_name !== null
|
||||
? this.ownerData.first_name[0] + "."
|
||||
: "";
|
||||
let checkedPatronymic =
|
||||
this.ownerData.patronymic !== null
|
||||
? this.ownerData.patronymic[0] + "."
|
||||
: "";
|
||||
return `${this.ownerData.last_name} ${checkedFirstName}${checkedPatronymic}`;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
defaultAvatar() {
|
||||
return `${this.ownerData.last_name[0]}${this.ownerData.first_name[0]}`;
|
||||
let checkedFirstName =
|
||||
this.ownerData.first_name !== null
|
||||
? this.ownerData.first_name[0]
|
||||
: this.ownerData.last_name[1];
|
||||
return `${this.ownerData.last_name[0]}${checkedFirstName}`;
|
||||
},
|
||||
pixelsPerMinute() {
|
||||
return this.pixelsPerHour / 60;
|
||||
|
||||
@@ -210,7 +210,9 @@ export default {
|
||||
return time.slice(11, -4);
|
||||
},
|
||||
composeFullName(object) {
|
||||
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
||||
return `${object.last_name} ${object.first_name ?? ""} ${
|
||||
object.patronymic ?? ""
|
||||
}`;
|
||||
},
|
||||
setActiveTheme() {
|
||||
this.isActive = true;
|
||||
|
||||
@@ -140,7 +140,9 @@ export default {
|
||||
return time.slice(11, -4);
|
||||
},
|
||||
composeFullName(object) {
|
||||
return `${object.last_name} ${object.first_name} ${object.patronymic}`;
|
||||
return `${object.last_name} ${object.first_name ?? ""} ${
|
||||
object.patronymic ?? ""
|
||||
}`;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@@ -357,11 +357,13 @@ export default {
|
||||
}
|
||||
return counter === 0;
|
||||
},
|
||||
trimOwnerName(lastName, firsName, patronymic) {
|
||||
return `${lastName} ${firsName[0]}.${patronymic[0]}.`;
|
||||
trimOwnerName(lastName, firstName, patronymic) {
|
||||
let checkedFirstName = firstName !== null ? firstName[0] + "." : "";
|
||||
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
|
||||
return `${lastName} ${checkedFirstName}${checkedPatronymic}`;
|
||||
},
|
||||
trimMemberName(lastName, firsName, patronymic) {
|
||||
return `${lastName} ${firsName} ${patronymic}`;
|
||||
trimMemberName(lastName, firstName, patronymic) {
|
||||
return `${lastName} ${firstName ?? ""} ${patronymic ?? ""}`;
|
||||
},
|
||||
async sendEventData() {
|
||||
if (!this.checkTime()) return;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.team-card(v-for="teammate in teamData" :key="teammate.id")
|
||||
base-avatar(:size="32", :color="teammate.color")
|
||||
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
||||
span(v-if="!teammate.photo") {{`${teammate.last_name[0]}${teammate.first_name[0]}`}}
|
||||
span(v-if="!teammate.photo") {{teammateAvatar(teammate)}}
|
||||
.flex.flex-col.gap-y-4.w-full(v-else, :style="{ color: 'var(--font-dark-blue-color)' }")
|
||||
.flex.items-center.justify-between
|
||||
.flex.text-base.font-bold Команды
|
||||
@@ -17,7 +17,7 @@
|
||||
.flex.items-center
|
||||
base-avatar(:size="32", :color="teammate.color")
|
||||
img.h-full.object-cover(:src="url + teammate.photo", alt="Team member", v-if="teammate.photo")
|
||||
span(v-if="!teammate.photo") {{`${teammate.last_name[0]}${teammate.first_name[0]}`}}
|
||||
span(v-if="!teammate.photo") {{teammateAvatar(teammate)}}
|
||||
.flex.ml-2.not-italic.font-medium.text-xxs {{ changeName(teammate.last_name, teammate.first_name, teammate.patronymic) }}
|
||||
span.icon-change-place.cursor-pointer.w-5.flex.items-center.justify-center.w-6.h-6
|
||||
</template>
|
||||
@@ -42,15 +42,22 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeName(lastName, fitstName, patronymic) {
|
||||
changeName(lastName, firstName, patronymic) {
|
||||
let checkedFirstName = firstName !== null ? firstName[0] + "." : "";
|
||||
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
|
||||
return lastName.length > this.maxLengthLastName
|
||||
? lastName.slice(0, this.maxLengthLastName) +
|
||||
"... " +
|
||||
fitstName[0] +
|
||||
"." +
|
||||
patronymic[0] +
|
||||
"."
|
||||
: lastName + " " + fitstName[0] + "." + patronymic[0] + ".";
|
||||
checkedFirstName +
|
||||
checkedPatronymic
|
||||
: lastName + " " + checkedFirstName + checkedPatronymic;
|
||||
},
|
||||
teammateAvatar(teammate) {
|
||||
let checkedFirstName =
|
||||
teammate.first_name !== null
|
||||
? teammate.first_name[0]
|
||||
: teammate.last_name[1];
|
||||
return `${teammate.last_name[0]}${checkedFirstName}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user