@@ -4,19 +4,19 @@
|
||||
|
||||
<div class="student-exam-item__stats">
|
||||
<div class="student-exam-item__stat student-exam-item__stat--duration">
|
||||
<span class="student-exam-item__stat-value">{{ durationText }}</span>
|
||||
<span class="student-exam-item__stat-label">مدت آزمون :</span>
|
||||
<SvgIcon name="calendar" :size="11" color="#5d5d5d" />
|
||||
<span class="student-exam-item__stat-label">مدت آزمون :</span>
|
||||
<span class="student-exam-item__stat-value">{{ durationText }}</span>
|
||||
</div>
|
||||
<div class="student-exam-item__stat">
|
||||
<SvgIcon name="users-three" :size="11" color="#5d5d5d" />
|
||||
<span class="student-exam-item__stat-label">نمره قبولی :</span>
|
||||
<span class="student-exam-item__stat-value">{{ passingScoreText }}</span>
|
||||
<SvgIcon name="users-three" :size="11" color="#5d5d5d" />
|
||||
</div>
|
||||
<div class="student-exam-item__stat">
|
||||
<SvgIcon name="file" :size="11" color="#5d5d5d" />
|
||||
<span class="student-exam-item__stat-label">تعداد سوال :</span>
|
||||
<span class="student-exam-item__stat-value">{{ questionsCountText }}</span>
|
||||
<SvgIcon name="file" :size="11" color="#5d5d5d" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@ const durationText = computed(() =>
|
||||
props.exam.durationMinutes == null ? '—' : `${props.exam.durationMinutes} دقیقه`
|
||||
)
|
||||
const passingScoreText = computed(() =>
|
||||
props.exam.passingScore == null ? '—' : `${props.exam.passingScore}`
|
||||
props.exam.minimumScore == null ? '—' : `${props.exam.minimumScore}`
|
||||
)
|
||||
const questionsCountText = computed(() =>
|
||||
props.exam.questionsCount == null ? '—' : `${props.exam.questionsCount}`
|
||||
@@ -80,7 +80,7 @@ const questionsCountText = computed(() =>
|
||||
font-size: 0.95rem;
|
||||
color: #4b4b4b;
|
||||
margin: 0;
|
||||
text-align: end;
|
||||
text-align: start;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -96,7 +96,7 @@ const questionsCountText = computed(() =>
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,34 +2,51 @@
|
||||
<div class="student-lesson-item">
|
||||
<div class="student-lesson-item__head">
|
||||
<span class="student-lesson-item__decor" aria-hidden="true">
|
||||
<SvgIcon name="users-three" :size="20" color="rgba(0, 112, 116, 0.31)" />
|
||||
<img
|
||||
v-if="lesson.coverUrl"
|
||||
:src="lesson.coverUrl"
|
||||
:alt="lesson.title || ''"
|
||||
class="student-lesson-item__cover"
|
||||
/>
|
||||
<SvgIcon v-else name="users-three" :size="20" color="rgba(0, 112, 116, 0.31)" />
|
||||
</span>
|
||||
<div>
|
||||
<p class="student-lesson-item__title">{{ lesson.title || '—' }}</p>
|
||||
<div class="student-lesson-item__hours">
|
||||
<SvgIcon name="calendar" :size="11" color="#007074" />
|
||||
<span class="student-lesson-item__hours-label">زمان یادگیری :</span>
|
||||
<span class="student-lesson-item__hours-value">{{ hoursText }}</span>
|
||||
</div>
|
||||
<Badge
|
||||
variant="primary"
|
||||
label="زمان یادگیری :"
|
||||
:value="hoursText"
|
||||
class="student-lesson-item__hours"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="calendar" :size="11" color="#007074" />
|
||||
</template>
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="student-lesson-item__stats">
|
||||
<div class="student-lesson-item__stat">
|
||||
<SvgIcon name="users-three" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-item__stat-label">تعداد دانشجویان :</span>
|
||||
<span class="student-lesson-item__stat-value">{{ studentsText }}</span>
|
||||
</div>
|
||||
<div class="student-lesson-item__stat">
|
||||
<SvgIcon name="file" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-item__stat-label">تعداد آزمون :</span>
|
||||
<span class="student-lesson-item__stat-value">{{ quizzesText }}</span>
|
||||
</div>
|
||||
<div class="student-lesson-item__stat">
|
||||
<SvgIcon name="list-bullets" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-item__stat-label">تعداد جلسات :</span>
|
||||
<span class="student-lesson-item__stat-value">{{ sessionsText }}</span>
|
||||
</div>
|
||||
<Badge
|
||||
variant="neutral"
|
||||
label="استاد :"
|
||||
:value="teacherText"
|
||||
class="student-lesson-item__stat"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="user" :size="12" color="#5d5d5d" />
|
||||
</template>
|
||||
</Badge>
|
||||
|
||||
<Badge
|
||||
variant="neutral"
|
||||
label="تعداد جلسات :"
|
||||
:value="sessionsText"
|
||||
class="student-lesson-item__stat"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="list-bullets" :size="12" color="#5d5d5d" />
|
||||
</template>
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
<div class="student-lesson-item__actions">
|
||||
@@ -48,6 +65,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import Badge from '@/components/Badge.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
|
||||
@@ -63,12 +81,8 @@ const hoursText = computed(() =>
|
||||
const sessionsText = computed(() =>
|
||||
props.lesson.sessionsCount == null ? '—' : `${props.lesson.sessionsCount} جلسه`
|
||||
)
|
||||
const quizzesText = computed(() =>
|
||||
props.lesson.quizzesCount == null ? '—' : `${props.lesson.quizzesCount}`
|
||||
)
|
||||
const studentsText = computed(() =>
|
||||
props.lesson.studentsCount == null ? '—' : `${props.lesson.studentsCount} دانشجو`
|
||||
)
|
||||
|
||||
const teacherText = computed(() => props.lesson.teacher?.name || '—')
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -106,6 +120,13 @@ const studentsText = computed(() =>
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(0, 112, 116, 4%);
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&__title {
|
||||
@@ -125,54 +146,28 @@ const studentsText = computed(() =>
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
&__stat {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
&__hours.badge,
|
||||
&__stat.badge {
|
||||
padding: 0.375rem 0.875rem;
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(107, 107, 107, 4%);
|
||||
font-family: var(--font-family-fa);
|
||||
white-space: nowrap;
|
||||
|
||||
:deep(.badge__label) {
|
||||
font-size: 0.7rem;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&__stat-label {
|
||||
font-weight: 300;
|
||||
font-size: 0.7rem;
|
||||
color: #5d5d5d;
|
||||
}
|
||||
|
||||
&__stat-value {
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
color: #5d5d5d;
|
||||
}
|
||||
|
||||
&__hours {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.375rem 0.875rem;
|
||||
border-radius: 0.75rem;
|
||||
&__hours.badge {
|
||||
background: rgba(0, 112, 116, 4%);
|
||||
font-family: var(--font-family-fa);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__hours-label {
|
||||
font-weight: 300;
|
||||
font-size: 0.7rem;
|
||||
color: #007074;
|
||||
}
|
||||
|
||||
&__hours-value {
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
color: #007074;
|
||||
&__stat.badge {
|
||||
background: rgba(107, 107, 107, 4%);
|
||||
color: #5d5d5d;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
|
||||
@@ -13,37 +13,47 @@
|
||||
<SkeletonLoaderBlock v-if="isLoading && !lesson" :rows="2" :cols-per-row="1" />
|
||||
<div v-else-if="lesson" class="student-lesson-details__summary">
|
||||
<span class="student-lesson-details__decor" aria-hidden="true">
|
||||
<SvgIcon name="users-three" :size="40" color="rgba(0, 112, 116, 0.31)" />
|
||||
<img
|
||||
v-if="lesson.coverUrl"
|
||||
:src="lesson.coverUrl"
|
||||
:alt="lesson.title || ''"
|
||||
class="student-lesson-details__cover"
|
||||
/>
|
||||
<SvgIcon v-else name="users-three" :size="40" color="rgba(0, 112, 116, 0.31)" />
|
||||
</span>
|
||||
<div class="student-lesson-details__summary-content">
|
||||
<p class="student-lesson-details__summary-title">{{ lesson.title || '—' }}</p>
|
||||
<div class="student-lesson-details__summary-stats">
|
||||
<div class="student-lesson-details__summary-stat">
|
||||
<SvgIcon name="users-three" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-details__summary-stat-label">تعداد دانشجویان :</span>
|
||||
<span class="student-lesson-details__summary-stat-value">
|
||||
{{ studentsText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="student-lesson-details__summary-stat">
|
||||
<SvgIcon name="file" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-details__summary-stat-label">تعداد آزمون :</span>
|
||||
<span class="student-lesson-details__summary-stat-value">
|
||||
{{ quizzesText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="student-lesson-details__summary-stat">
|
||||
<SvgIcon name="list-bullets" :size="12" color="#5d5d5d" />
|
||||
<span class="student-lesson-details__summary-stat-label">تعداد جلسات :</span>
|
||||
<span class="student-lesson-details__summary-stat-value">
|
||||
{{ sessionsText }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="student-lesson-details__summary-stat">
|
||||
<SvgIcon name="calendar" :size="12" color="#535353" />
|
||||
<span class="student-lesson-details__summary-stat-label">تاریخ پایان :</span>
|
||||
<span class="student-lesson-details__summary-stat-value">{{ endDateText }}</span>
|
||||
</div>
|
||||
<Badge
|
||||
variant="neutral"
|
||||
label="استاد :"
|
||||
:value="teacherText"
|
||||
class="student-lesson-details__summary-stat"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="user" :size="12" color="#5d5d5d" />
|
||||
</template>
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="neutral"
|
||||
label="تعداد جلسات :"
|
||||
:value="sessionsText"
|
||||
class="student-lesson-details__summary-stat"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="list-bullets" :size="12" color="#5d5d5d" />
|
||||
</template>
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="neutral"
|
||||
label="ظرفیت :"
|
||||
:value="capacityText"
|
||||
class="student-lesson-details__summary-stat"
|
||||
>
|
||||
<template #prepend>
|
||||
<SvgIcon name="users-three" :size="12" color="#5d5d5d" />
|
||||
</template>
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +61,7 @@
|
||||
<TabsBlock :tabs="tabs" v-model="activeTab">
|
||||
<template #sessions>
|
||||
<SkeletonLoaderBlock
|
||||
v-if="isLoading && sessions.length === 0"
|
||||
v-if="sessionsLoading && sessions.length === 0"
|
||||
:rows="3"
|
||||
:cols-per-row="1"
|
||||
/>
|
||||
@@ -67,7 +77,11 @@
|
||||
</template>
|
||||
|
||||
<template #exams>
|
||||
<SkeletonLoaderBlock v-if="isLoading && exams.length === 0" :rows="3" :cols-per-row="1" />
|
||||
<SkeletonLoaderBlock
|
||||
v-if="examsLoading && exams.length === 0"
|
||||
:rows="3"
|
||||
:cols-per-row="1"
|
||||
/>
|
||||
<div v-else-if="exams.length > 0">
|
||||
<StudentExamItem v-for="exam in exams" :key="exam.id" :exam="exam" @start="onStartExam" />
|
||||
</div>
|
||||
@@ -79,14 +93,16 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import Badge from '@/components/Badge.vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import NoItems from '@/components/blocks/NoItems.vue'
|
||||
import { formatJalaaliDate } from '@/utils/date-utils'
|
||||
import TabsBlock from '@/components/blocks/TabsBlock.vue'
|
||||
import { useStudentCourseQuery } from '@/services/query/student-courses'
|
||||
import { useStudentExamsListQuery } from '@/services/query/student-exams'
|
||||
import BoxedIconTitleBlock from '@/components/blocks/BoxedIconTitleBlock.vue'
|
||||
import SkeletonLoaderBlock from '@/components/blocks/SkeletonLoaderBlock.vue'
|
||||
import { useStudentSessionsListQuery } from '@/services/query/student-sessions'
|
||||
import StudentExamItem from '@/features/student/exams/components/StudentExamItem.vue'
|
||||
import StudentSessionItem from '@/features/student/sessions/components/StudentSessionItem.vue'
|
||||
|
||||
@@ -99,20 +115,31 @@ const { data: lesson, isLoading } = useStudentCourseQuery(lessonId, {
|
||||
enabled: () => !!lessonId.value,
|
||||
})
|
||||
|
||||
const sessions = computed(() => lesson.value?.sessions ?? [])
|
||||
const exams = computed(() => lesson.value?.exams ?? [])
|
||||
const sessionsFilters = computed(() => ({ courseId: lessonId.value }))
|
||||
const sessionsPagination = ref({ page: 1, perPage: 50 })
|
||||
const { data: sessionsData, isLoading: sessionsLoading } = useStudentSessionsListQuery(
|
||||
sessionsFilters,
|
||||
sessionsPagination,
|
||||
{ enabled: () => !!lessonId.value, keepPreviousData: true }
|
||||
)
|
||||
|
||||
const sessions = computed(() => sessionsData.value?.data ?? [])
|
||||
|
||||
const examsFilters = computed(() => ({ courseId: lessonId.value }))
|
||||
const examsPagination = ref({ page: 1, perPage: 50 })
|
||||
const { data: examsData, isLoading: examsLoading } = useStudentExamsListQuery(
|
||||
examsFilters,
|
||||
examsPagination,
|
||||
{ enabled: () => !!lessonId.value, keepPreviousData: true }
|
||||
)
|
||||
const exams = computed(() => examsData.value?.data ?? [])
|
||||
|
||||
const sessionsText = computed(() =>
|
||||
lesson.value?.sessionsCount == null ? '—' : `${lesson.value.sessionsCount} جلسه`
|
||||
)
|
||||
const quizzesText = computed(() =>
|
||||
lesson.value?.quizzesCount == null ? '—' : `${lesson.value.quizzesCount}`
|
||||
)
|
||||
const studentsText = computed(() =>
|
||||
lesson.value?.studentsCount == null ? '—' : `${lesson.value.studentsCount} دانشجو`
|
||||
)
|
||||
const endDateText = computed(
|
||||
() => lesson.value?.faEndDate || formatJalaaliDate(lesson.value?.endDate) || '—'
|
||||
const teacherText = computed(() => lesson.value?.teacher?.name || '—')
|
||||
const capacityText = computed(() =>
|
||||
lesson.value?.capacity == null ? '—' : `${lesson.value.capacity} نفر`
|
||||
)
|
||||
|
||||
const tabs = [
|
||||
@@ -171,12 +198,19 @@ const onStartExam = (exam) => {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
display: inline-flex;
|
||||
}
|
||||
}
|
||||
|
||||
&__cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&__summary-title {
|
||||
font-family: var(--font-family-fa);
|
||||
font-weight: 400;
|
||||
@@ -200,27 +234,15 @@ const onStartExam = (exam) => {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
&__summary-stat {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
&__summary-stat.badge {
|
||||
padding: 0.375rem 0.875rem;
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(107, 107, 107, 4%);
|
||||
font-family: var(--font-family-fa);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__summary-stat-label {
|
||||
font-weight: 300;
|
||||
font-size: 0.7rem;
|
||||
color: #5d5d5d;
|
||||
}
|
||||
|
||||
&__summary-stat-value {
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
color: #5d5d5d;
|
||||
:deep(.badge__label) {
|
||||
font-size: 0.7rem;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -27,30 +27,18 @@
|
||||
<div class="edit-profile__row">
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<TextField
|
||||
v-model="form.firstName"
|
||||
name="firstName"
|
||||
label="نام"
|
||||
:error="errors.firstName"
|
||||
@blur="validateAt('firstName', form.firstName)"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="user" :size="20" color="var(--color-thd-gray)" />
|
||||
</template>
|
||||
</TextField>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<TextField
|
||||
v-model="form.lastName"
|
||||
name="lastName"
|
||||
label="نام خانوادگی"
|
||||
:error="errors.lastName"
|
||||
@blur="validateAt('lastName', form.lastName)"
|
||||
v-model="form.name"
|
||||
name="name"
|
||||
label="نام و نام خانوادگی"
|
||||
:error="errors.name"
|
||||
@blur="validateAt('name', form.name)"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="user" :size="20" color="var(--color-thd-gray)" />
|
||||
</template>
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<DatePickerField
|
||||
v-model="form.birthDate"
|
||||
@@ -60,6 +48,22 @@
|
||||
:error="errors.birthDate"
|
||||
/>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<TextField
|
||||
v-model="form.phone"
|
||||
name="phone"
|
||||
label="شماره تلفن همراه"
|
||||
inputmode="numeric"
|
||||
:convert-digits="true"
|
||||
:disabled="!!initialPhoneNumber"
|
||||
:error="errors.phone"
|
||||
@blur="validateAt('phone', form.phone)"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="phone" :size="20" color="var(--color-thd-gray)" />
|
||||
</template>
|
||||
</TextField>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<TextField
|
||||
v-model="form.nationalCode"
|
||||
@@ -78,8 +82,8 @@
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<SelectField
|
||||
v-model="form.maritalStatus"
|
||||
name="maritalStatus"
|
||||
v-model="form.marriageStatus"
|
||||
name="marriageStatus"
|
||||
label="وضعیت تاهل"
|
||||
:options="maritalStatusOptions"
|
||||
option-label="label"
|
||||
@@ -96,29 +100,10 @@
|
||||
option-value="value"
|
||||
/>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--full">
|
||||
<TextareaField v-model="form.bio" name="bio" label="زندگی نامه" :row="3" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LineTitleBlock title="اطلاعات تماس" title-en="Contact Details" />
|
||||
<LineTitleBlock title="مشخصات محل سکونت" title-en="Address Details" />
|
||||
<div class="edit-profile__row">
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<TextField
|
||||
v-model="form.phoneNumber"
|
||||
name="phoneNumber"
|
||||
label="شماره تلفن همراه"
|
||||
inputmode="numeric"
|
||||
:convert-digits="true"
|
||||
:disabled="!!initialPhoneNumber"
|
||||
:error="errors.phoneNumber"
|
||||
@blur="validateAt('phoneNumber', form.phoneNumber)"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="phone" :size="20" color="var(--color-thd-gray)" />
|
||||
</template>
|
||||
</TextField>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--third">
|
||||
<SelectField
|
||||
v-model="form.provinceId"
|
||||
@@ -155,24 +140,40 @@
|
||||
<div class="edit-profile__row">
|
||||
<div class="edit-profile__cell edit-profile__cell--half">
|
||||
<PasswordField
|
||||
v-model="form.password"
|
||||
v-model="passwordForm.password"
|
||||
name="password"
|
||||
label="رمز عبور"
|
||||
:error="errors.password"
|
||||
@blur="validateAt('password', form.password)"
|
||||
:error="passwordErrors.password"
|
||||
@blur="validateAtPassword('password', passwordForm.password)"
|
||||
/>
|
||||
</div>
|
||||
<div class="edit-profile__cell edit-profile__cell--half">
|
||||
<PasswordField
|
||||
v-model="form.passwordConfirmation"
|
||||
v-model="passwordForm.passwordConfirmation"
|
||||
name="passwordConfirmation"
|
||||
label="تکرار رمز عبور"
|
||||
:error="errors.passwordConfirmation"
|
||||
@blur="validateAt('passwordConfirmation', form.passwordConfirmation)"
|
||||
:error="passwordErrors.passwordConfirmation"
|
||||
@blur="
|
||||
validateAtPassword('passwordConfirmation', passwordForm.passwordConfirmation)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit-profile__password-actions">
|
||||
<BaseButton
|
||||
type="button"
|
||||
text="تغییر رمز عبور"
|
||||
:loading="resetPasswordMutation.isPending.value"
|
||||
custom-class="edit-profile__btn-reset"
|
||||
@click="onResetPassword"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="arrows-clockwise" :size="20" color="#fff" />
|
||||
</template>
|
||||
</BaseButton>
|
||||
</div>
|
||||
|
||||
<div class="edit-profile__actions">
|
||||
<BaseButton
|
||||
variant="transparent"
|
||||
@@ -212,18 +213,20 @@ import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import TextField from '@/components/form/TextField.vue'
|
||||
import SelectField from '@/components/form/SelectField.vue'
|
||||
import LineTitleBlock from '@/components/LineTitleBlock.vue'
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import ImageCropper from '@/components/form/ImageCropper.vue'
|
||||
import { objectToFormData } from '@/utils/object-to-formdata'
|
||||
import { applyValidationErrors } from '@/utils/error-handler'
|
||||
import TextareaField from '@/components/form/TextareaField.vue'
|
||||
import PasswordField from '@/components/form/PasswordField.vue'
|
||||
import DatePickerField from '@/components/form/DatePickerField.vue'
|
||||
import { studentProfileSchema } from '@/features/student/profile/schema'
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import BoxedIconTitleBlock from '@/components/blocks/BoxedIconTitleBlock.vue'
|
||||
import { useGetCitiesOfProvinceQuery, useGetProvincesQuery } from '@/services/query/common'
|
||||
import { studentProfileSchema, studentResetPasswordSchema } from '@/features/student/profile/schema'
|
||||
import {
|
||||
authKeys,
|
||||
useGetMeQuery,
|
||||
useResetPasswordMutation,
|
||||
useUpdateProfileMutation,
|
||||
useUploadMediaMutation,
|
||||
} from '@/services/query/auth'
|
||||
@@ -246,29 +249,23 @@ const maritalStatusOptions = Object.entries(MARITAL_STATUS).map(([value, label])
|
||||
}))
|
||||
const genderOptions = Object.entries(GENDER).map(([value, label]) => ({ value, label }))
|
||||
|
||||
const { data: provinces = ref([]) } = useGetProvincesQuery()
|
||||
|
||||
const provinceIdRef = ref(null)
|
||||
const { data: cities = ref([]) } = useGetCitiesOfProvinceQuery(provinceIdRef, {
|
||||
enabled: () => !!provinceIdRef.value,
|
||||
})
|
||||
|
||||
const initialNationalCode = ref('')
|
||||
const initialPhoneNumber = ref('')
|
||||
|
||||
const form = ref({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
name: '',
|
||||
birthDate: '',
|
||||
nationalCode: '',
|
||||
maritalStatus: '',
|
||||
marriageStatus: '',
|
||||
gender: '',
|
||||
bio: '',
|
||||
phoneNumber: '',
|
||||
phone: '',
|
||||
provinceId: '',
|
||||
cityId: '',
|
||||
address: '',
|
||||
avatarId: null,
|
||||
avatarMediaId: null,
|
||||
})
|
||||
|
||||
const passwordForm = ref({
|
||||
password: '',
|
||||
passwordConfirmation: '',
|
||||
})
|
||||
@@ -278,44 +275,47 @@ const avatar = ref(null)
|
||||
const schema = studentProfileSchema
|
||||
|
||||
const { validate, validateAt, errors } = useYup(schema)
|
||||
const {
|
||||
validate: validatePassword,
|
||||
validateAt: validateAtPassword,
|
||||
errors: passwordErrors,
|
||||
resetErrors: resetPasswordErrors,
|
||||
setError: setPasswordError,
|
||||
} = useYup(studentResetPasswordSchema, () => ({
|
||||
...passwordForm.value,
|
||||
phone: form.value.phone,
|
||||
}))
|
||||
|
||||
const { data: provinces = ref([]) } = useGetProvincesQuery()
|
||||
|
||||
const provinceIdRef = computed(() => form.value.provinceId)
|
||||
const { data: cities = ref([]) } = useGetCitiesOfProvinceQuery(provinceIdRef, {
|
||||
enabled: () => !!provinceIdRef.value,
|
||||
})
|
||||
|
||||
const onProvinceChange = () => {
|
||||
provinceIdRef.value = form.value.provinceId
|
||||
form.value.cityId = ''
|
||||
}
|
||||
|
||||
watch(
|
||||
() => form.value.provinceId,
|
||||
(val) => {
|
||||
provinceIdRef.value = val
|
||||
}
|
||||
)
|
||||
|
||||
const { data: profile } = useGetMeQuery()
|
||||
|
||||
watch(profile, (user) => {
|
||||
if (!user) return
|
||||
const nameParts = String(user.name || '')
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.filter(Boolean)
|
||||
const firstName = user.firstName || nameParts[0] || ''
|
||||
const lastName = user.lastName || nameParts.slice(1).join(' ') || ''
|
||||
const fullName =
|
||||
user.name || [user.firstName, user.lastName].filter(Boolean).join(' ').trim() || ''
|
||||
const phone = user.phone || user.phoneNumber || ''
|
||||
form.value = {
|
||||
...form.value,
|
||||
firstName,
|
||||
lastName,
|
||||
name: fullName,
|
||||
birthDate: user.profile?.birthDate || '',
|
||||
nationalCode: user.nationalCode || '',
|
||||
maritalStatus: user.profile?.maritalStatus || '',
|
||||
marriageStatus: user.profile?.marriageStatus || '',
|
||||
gender: user.profile?.gender || '',
|
||||
bio: user.profile?.bio || '',
|
||||
phoneNumber: phone,
|
||||
phone,
|
||||
provinceId: user?.province?.id || '',
|
||||
cityId: user?.city?.id || '',
|
||||
address: user?.address || '',
|
||||
avatarId: user.profile?.avatarId || null,
|
||||
avatarMediaId: user.profile?.avatarMediaId || null,
|
||||
}
|
||||
initialNationalCode.value = user.nationalCode || ''
|
||||
initialPhoneNumber.value = phone
|
||||
@@ -330,7 +330,7 @@ const onAvatarCropped = async (file) => {
|
||||
const response = await uploadMutation.mutateAsync(formData)
|
||||
const payload = response?.data ?? response
|
||||
avatar.value = { url: payload?.url, uploadId: payload?.uploadId, ...payload }
|
||||
form.value.avatarId = payload?.uploadId || payload?.id
|
||||
form.value.avatarMediaId = payload?.uploadId || payload?.id
|
||||
} catch {
|
||||
/* handled globally */
|
||||
}
|
||||
@@ -339,23 +339,20 @@ const onAvatarCropped = async (file) => {
|
||||
const onAvatarError = (msg) => toast.error(msg)
|
||||
|
||||
const updateMutation = useUpdateProfileMutation()
|
||||
const resetPasswordMutation = useResetPasswordMutation()
|
||||
|
||||
const onSubmit = async () => {
|
||||
const { isValid, payload } = await validate(form.value)
|
||||
if (!isValid) return
|
||||
// Backend PATCH /me accepts: name, email, phone, password (+confirmation),
|
||||
// avatar_media_id. Other UI-only fields (province/city/address/birthDate/…)
|
||||
// are not in the backend Postman doc and are dropped here.
|
||||
const name = [payload.firstName, payload.lastName].filter(Boolean).join(' ').trim()
|
||||
// Backend PATCH /me accepts: name, email, phone, avatar_media_id.
|
||||
// Other UI-only fields (province/city/address/birthDate/…) are not in
|
||||
// the backend Postman doc and are dropped here. Password is handled
|
||||
// separately via POST /reset-password.
|
||||
const body = {
|
||||
...(name ? { name } : {}),
|
||||
...(payload.phoneNumber ? { phone: payload.phoneNumber } : {}),
|
||||
...(payload.name ? { name: payload.name } : {}),
|
||||
...(payload.phone ? { phone: payload.phone } : {}),
|
||||
...(payload.email ? { email: payload.email } : {}),
|
||||
...(payload.avatarId ? { avatarMediaId: payload.avatarId } : {}),
|
||||
}
|
||||
if (payload.password) {
|
||||
body.password = payload.password
|
||||
body.passwordConfirmation = payload.passwordConfirmation
|
||||
...(payload.avatarMediaId ? { avatarMediaId: payload.avatarMediaId } : {}),
|
||||
}
|
||||
await updateMutation.mutateAsync(body)
|
||||
await queryClient.invalidateQueries({ queryKey: authKeys.me() })
|
||||
@@ -363,6 +360,25 @@ const onSubmit = async () => {
|
||||
router.push({ name: 'student-dashboard' })
|
||||
}
|
||||
|
||||
const onResetPassword = async () => {
|
||||
resetPasswordErrors()
|
||||
const { isValid, payload } = await validatePassword({
|
||||
phone: form.value.phone,
|
||||
password: passwordForm.value.password,
|
||||
passwordConfirmation: passwordForm.value.passwordConfirmation,
|
||||
})
|
||||
if (!isValid) return
|
||||
try {
|
||||
await resetPasswordMutation.mutateAsync(payload)
|
||||
passwordForm.value.password = ''
|
||||
passwordForm.value.passwordConfirmation = ''
|
||||
resetPasswordErrors()
|
||||
toast.success('رمز عبور با موفقیت تغییر یافت')
|
||||
} catch (error) {
|
||||
applyValidationErrors(error, setPasswordError)
|
||||
}
|
||||
}
|
||||
|
||||
const onCancel = () => router.push({ name: 'student-dashboard' })
|
||||
</script>
|
||||
|
||||
@@ -457,6 +473,13 @@ const onCancel = () => router.push({ name: 'student-dashboard' })
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
&__password-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
&__btn-cancel {
|
||||
min-width: 9rem;
|
||||
}
|
||||
@@ -464,5 +487,9 @@ const onCancel = () => router.push({ name: 'student-dashboard' })
|
||||
&__btn-submit {
|
||||
min-width: 12rem;
|
||||
}
|
||||
|
||||
&__btn-reset {
|
||||
min-width: 12rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
import { object, string } from 'yup'
|
||||
|
||||
import { passwordRule } from '@/constants/rules/passwordRule'
|
||||
import { phoneNumberRule } from '@/constants/rules/phoneNumberRule'
|
||||
import { nationalCodeRule } from '@/constants/rules/nationalCodeRule'
|
||||
import { optionalPasswordRule } from '@/constants/rules/passwordRule'
|
||||
import { optionalPasswordConfirmationRule } from '@/constants/rules/passwordConfirmationRule'
|
||||
import { passwordConfirmationRule } from '@/constants/rules/passwordConfirmationRule'
|
||||
|
||||
export const studentProfileSchema = object().shape({
|
||||
firstName: string().required().min(2),
|
||||
lastName: string().required().min(2),
|
||||
phoneNumber: phoneNumberRule,
|
||||
name: string().required().min(2),
|
||||
phone: phoneNumberRule,
|
||||
nationalCode: nationalCodeRule,
|
||||
birthDate: string().nullable().notRequired(),
|
||||
maritalStatus: string().nullable().notRequired(),
|
||||
marriageStatus: string().nullable().notRequired(),
|
||||
gender: string().nullable().notRequired(),
|
||||
bio: string().nullable().notRequired(),
|
||||
provinceId: string().nullable().notRequired(),
|
||||
cityId: string().nullable().notRequired(),
|
||||
address: string().nullable().notRequired(),
|
||||
password: optionalPasswordRule,
|
||||
passwordConfirmation: optionalPasswordConfirmationRule,
|
||||
})
|
||||
|
||||
export const studentResetPasswordSchema = object().shape({
|
||||
phone: phoneNumberRule,
|
||||
password: passwordRule,
|
||||
passwordConfirmation: passwordConfirmationRule,
|
||||
})
|
||||
|
||||
@@ -10,24 +10,12 @@
|
||||
</div>
|
||||
|
||||
<div class="student-session-item__badges">
|
||||
<span
|
||||
v-if="session.isSeen"
|
||||
class="student-session-item__badge student-session-item__badge--seen"
|
||||
>
|
||||
دیده شده
|
||||
</span>
|
||||
<span v-if="session.needsAssignment" class="student-session-item__badge">
|
||||
<SvgIcon name="paper-plane" :size="11" color="#5d5d5d" />
|
||||
ارسال تکلیف
|
||||
</span>
|
||||
<span v-if="session.hasQuiz" class="student-session-item__badge">
|
||||
<SvgIcon name="file" :size="11" color="#5d5d5d" />
|
||||
دارای آزمون
|
||||
</span>
|
||||
<span v-if="session.isOnline" class="student-session-item__badge">
|
||||
<SvgIcon name="users-three" :size="11" color="#5d5d5d" />
|
||||
جلسه آنلاین
|
||||
</span>
|
||||
<Badge v-if="isComplete" variant="success">تکمیل شده</Badge>
|
||||
<Badge v-if="session.isSeen" variant="success">دیده شده</Badge>
|
||||
<Badge v-if="session.grade != null" variant="primary" label="نمره" :value="session.grade" />
|
||||
<Badge v-if="session.needsAssignment" icon="paper-plane">دارای تکلیف</Badge>
|
||||
<Badge v-if="session.hasQuiz" icon="file">دارای آزمون</Badge>
|
||||
<Badge v-if="isOnline" icon="users-three">جلسه آنلاین</Badge>
|
||||
</div>
|
||||
|
||||
<div class="student-session-item__actions">
|
||||
@@ -46,6 +34,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import Badge from '@/components/Badge.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
|
||||
@@ -58,6 +47,9 @@ const emit = defineEmits(['start'])
|
||||
const durationText = computed(() =>
|
||||
props.session.durationHours == null ? '—' : `${props.session.durationHours} ساعت`
|
||||
)
|
||||
|
||||
const isOnline = computed(() => props.session.type === 'online')
|
||||
const isComplete = computed(() => props.session.isComplete === true)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -84,7 +76,7 @@ const durationText = computed(() =>
|
||||
font-size: 0.95rem;
|
||||
color: #4b4b4b;
|
||||
margin: 0;
|
||||
text-align: end;
|
||||
text-align: start;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -104,25 +96,6 @@ const durationText = computed(() =>
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
&__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.375rem 0.875rem;
|
||||
border-radius: 0.75rem;
|
||||
background: rgba(107, 107, 107, 4%);
|
||||
font-family: var(--font-family-fa);
|
||||
font-weight: 400;
|
||||
font-size: 0.7rem;
|
||||
color: #5d5d5d;
|
||||
white-space: nowrap;
|
||||
|
||||
&--seen {
|
||||
background: rgba(0, 255, 68, 4%);
|
||||
color: #009a12;
|
||||
}
|
||||
}
|
||||
|
||||
&__hours {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -10,103 +10,92 @@
|
||||
</template>
|
||||
</BoxedIconTitleBlock>
|
||||
|
||||
<TabsBlock :tabs="tabs" v-model="activeTab" @change-tab="onTabChange">
|
||||
<template #homework>
|
||||
<SkeletonLoaderBlock v-if="isLoading && !session" :rows="3" :cols-per-row="1" />
|
||||
<div v-else class="ssd__panel">
|
||||
<div class="ssd__prompt">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" class="ssd__prompt-icon" />
|
||||
<p class="ssd__prompt-text">
|
||||
{{ session?.homeworkPrompt || 'متنی برای این جلسه ثبت نشده است.' }}
|
||||
</p>
|
||||
</div>
|
||||
<SkeletonLoaderBlock v-if="isLoading && !session" :rows="3" :cols-per-row="1" />
|
||||
<div v-else class="ssd__panel">
|
||||
<div class="ssd__prompt">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" class="ssd__prompt-icon" />
|
||||
<p class="ssd__prompt-text">
|
||||
{{ session?.homeworkPrompt || 'متنی برای این جلسه ثبت نشده است.' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="ssd__media">
|
||||
<div class="ssd__content">
|
||||
<div v-if="contentKind === 'video'" class="ssd__video">
|
||||
<VideoPlayerBlock
|
||||
:src="session?.videoUrl || ''"
|
||||
:poster="session?.poster || ''"
|
||||
:video-id="sessionId"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'audio'" class="ssd__audio">
|
||||
<SvgIcon name="paper-plane-right" :size="40" color="rgba(0, 112, 116, 0.31)" />
|
||||
<audio :src="session.audioUrl" controls class="ssd__audio-player" />
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'text'" class="ssd__text">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" class="ssd__text-icon" />
|
||||
<p class="ssd__text-body">{{ session.text }}</p>
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'link'" class="ssd__link">
|
||||
<div class="ssd__link__box">
|
||||
<span>https://link</span>
|
||||
<SvgIcon name="link" :size="22" class="ssd__link-icon" />
|
||||
</div>
|
||||
<BaseButton text="ورود به جلسه " custom-class="ssd__link-btn">
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="arrow-left" :size="18" color="#fff" />
|
||||
</template>
|
||||
</BaseButton>
|
||||
</div>
|
||||
<div v-else class="ssd__empty">
|
||||
<SvgIcon name="warning" :size="32" color="#bcbcbc" />
|
||||
<p>محتوایی برای این جلسه ثبت نشده است.</p>
|
||||
</div>
|
||||
<div class="ssd__media">
|
||||
<div class="ssd__content">
|
||||
<div v-if="contentKind === 'video'" class="ssd__video">
|
||||
<VideoPlayerBlock
|
||||
:src="session?.videoUrl || ''"
|
||||
:poster="session?.poster || ''"
|
||||
:video-id="sessionId"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'audio'" class="ssd__audio">
|
||||
<VoiceRecorder :model-value="session.audioUrl" disabled />
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'text'" class="ssd__text">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" class="ssd__text-icon" />
|
||||
<p class="ssd__text-body">{{ session.text }}</p>
|
||||
</div>
|
||||
<div v-else-if="contentKind === 'link'" class="ssd__link">
|
||||
<div class="ssd__link__box">
|
||||
<span>https://link</span>
|
||||
<SvgIcon name="link" :size="22" class="ssd__link-icon" />
|
||||
</div>
|
||||
|
||||
<div class="ssd__uploads" v-if="contentKind !== 'link'">
|
||||
<VoiceRecorder
|
||||
class="ssd__uploads-recorder"
|
||||
v-model="homeworkAudio"
|
||||
:error="errors.audio"
|
||||
/>
|
||||
<ImageUploader
|
||||
class="ssd__uploads-uploader"
|
||||
v-model="homeworkImage"
|
||||
:error="errors.image"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ssd__hint">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" />
|
||||
<p class="ssd__hint-text">
|
||||
{{ session?.homeworkHint || '' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="ssd__footer">
|
||||
<BaseButton
|
||||
text="ارسال تکلیف"
|
||||
:loading="submitMutation.isPending.value"
|
||||
:disabled="!canSubmit"
|
||||
custom-class="ssd__submit-btn"
|
||||
@click="onSubmit"
|
||||
>
|
||||
<BaseButton text="ورود به جلسه " custom-class="ssd__link-btn">
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="arrow-left" :size="18" color="#fff" />
|
||||
</template>
|
||||
</BaseButton>
|
||||
</div>
|
||||
<div v-else class="ssd__empty">
|
||||
<SvgIcon name="warning" :size="32" color="#bcbcbc" />
|
||||
<p>محتوایی برای این جلسه ثبت نشده است.</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #exam>
|
||||
<NoItems title="در حال انتقال" desc="در حال انتقال به صفحه آزمون..." />
|
||||
</template>
|
||||
</TabsBlock>
|
||||
<div class="ssd__uploads" v-if="contentKind !== 'link'">
|
||||
<VoiceRecorder
|
||||
class="ssd__uploads-recorder"
|
||||
v-model="homeworkAudio"
|
||||
:error="errors.audio"
|
||||
/>
|
||||
<ImageUploader
|
||||
class="ssd__uploads-uploader"
|
||||
v-model="homeworkImage"
|
||||
:error="errors.image"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ssd__hint">
|
||||
<SvgIcon name="warning" :size="22" color="#b8b8b8" />
|
||||
<p class="ssd__hint-text">
|
||||
{{ session?.homeworkHint || '' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="ssd__footer">
|
||||
<BaseButton
|
||||
text="ارسال تکلیف"
|
||||
:loading="submitMutation.isPending.value"
|
||||
:disabled="!canSubmit"
|
||||
custom-class="ssd__submit-btn"
|
||||
@click="onSubmit"
|
||||
>
|
||||
<template #appendIcon>
|
||||
<SvgIcon name="arrow-left" :size="18" color="#fff" />
|
||||
</template>
|
||||
</BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { toast } from 'vue3-toastify'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import NoItems from '@/components/blocks/NoItems.vue'
|
||||
import TabsBlock from '@/components/blocks/TabsBlock.vue'
|
||||
import { objectToFormData } from '@/utils/object-to-formdata'
|
||||
import { useUploadMediaMutation } from '@/services/query/auth'
|
||||
import VoiceRecorder from '@/components/form/VoiceRecorder.vue'
|
||||
@@ -120,7 +109,6 @@ import {
|
||||
} from '@/services/query/student-sessions'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const sessionId = computed(() => route.params.id)
|
||||
|
||||
@@ -131,19 +119,13 @@ const { data: session, isLoading } = useStudentSessionQuery(sessionId, {
|
||||
const contentKind = computed(() => {
|
||||
const s = session.value
|
||||
if (!s) return ''
|
||||
if (s.type === 'online') return 'link'
|
||||
if (s.videoUrl) return 'link'
|
||||
if (s.audioUrl) return 'audio'
|
||||
if (s.text) return 'text'
|
||||
if (s.link) return 'link'
|
||||
return ''
|
||||
})
|
||||
|
||||
const tabs = [
|
||||
{ name: 'homework', label: 'ارسال تکلیف', icon: 'list-bullets' },
|
||||
{ name: 'exam', label: 'آزمـــــون', icon: 'file' },
|
||||
]
|
||||
const activeTab = ref('homework')
|
||||
|
||||
const homeworkAudio = ref(null)
|
||||
const homeworkImage = ref(null)
|
||||
const errors = reactive({ audio: '', image: '' })
|
||||
@@ -190,17 +172,6 @@ const onSubmit = async () => {
|
||||
toast.error('ارسال تکلیف با خطا مواجه شد.')
|
||||
}
|
||||
}
|
||||
|
||||
const onTabChange = (name) => {
|
||||
if (name !== 'exam') return
|
||||
const examId = session.value?.examId
|
||||
if (examId) {
|
||||
router.push({ name: 'student-exam', params: { id: examId } }).catch(() => {})
|
||||
} else {
|
||||
toast.info('آزمونی برای این جلسه ثبت نشده است.')
|
||||
activeTab.value = 'homework'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -313,7 +284,7 @@ const onTabChange = (name) => {
|
||||
|
||||
&__footer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: flex-end;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user