Conversation
src/pages/LecturerPage.vue
Outdated
| const middleName = ref(lecturer?.middle_name); | ||
| const avatarLink = ref(lecturer?.avatar_link); | ||
| const lecturerSubjects = ref(lecturer?.subjects); | ||
| const lecturer = ref<any>(null); |
There was a problem hiding this comment.
Есть специальный тип Lecturer
src/pages/LecturerPage.vue
Outdated
| const howKind = lecturer?.mark_kindness_weighted ?? 0; | ||
| const howFree = lecturer?.mark_freebie_weighted ?? 0; | ||
| const howClear = lecturer?.mark_clarity_weighted ?? 0; | ||
| async function init() { |
There was a problem hiding this comment.
А зачем так? Как будто достаточно присваивание засунуть в LoadLecturer и вызвать с subject=null
src/pages/LecturerPage.vue
Outdated
| /> | ||
|
|
||
| <div class="mb-3"> | ||
| <v-chip class="mr-2 mb-2" :color="selectedSubject === null ? 'primary' : ''" @click="filterBySubject(null)"> |
There was a problem hiding this comment.
В целом норм, но глянь еще v-chip-group
|
|
||
| await store.init(lecturerId); | ||
|
|
||
| const lecturer = computed(() => store.lecturer); |
There was a problem hiding this comment.
Тебе computed здесь не нужен больше. Теперь можно либо:
- Обращаться через store.lecturer
- Деструктурировать весь стор
const {lecturer} = toRefs(store)
| const lecturer = computed(() => store.lecturer); | ||
| const selectedSubject = computed(() => store.selectedSubject); | ||
| const lecturerPhoto = computed(() => store.lecturerPhoto); | ||
| const firstName = computed(() => lecturer.value?.first_name); |
There was a problem hiding this comment.
Вот здесь уже computed нужен, но лучше вынести их в стор. Посмотри про геттеры: https://pinia.vuejs.org/core-concepts/getters.html#Usage-with-setup-
| const howKind = lecturer?.mark_kindness_weighted ?? 0; | ||
| const howFree = lecturer?.mark_freebie_weighted ?? 0; | ||
| const howClear = lecturer?.mark_clarity_weighted ?? 0; | ||
| const howKind = computed(() => lecturer.value?.mark_kindness_weighted ?? 0); |
There was a problem hiding this comment.
Аналогично, давай уберем в стор
| const howClear = computed(() => lecturer.value?.mark_clarity_weighted ?? 0); | ||
|
|
||
| const lecturerPhoto = getPhoto(avatarLink.value); | ||
| function filteredBySubject(subject: string | null) { |
There was a problem hiding this comment.
Корректнее использовать глагол (чутка душно, но правда)
Лучше filterBySubject, а эту функцию назвать типа handleFilter
Изменения
Реализую фильтрацию отзывов по предмету у преподавателей (В процессе)
Детали реализации
Check-List
blackиisortдля Back-End илиPrettierдля Front-End?