UPD 3
- checked and fixed problems: timer in lesson, sing-up, page length in courses - add Points and Courses in ProfileAbout NEW: - add icon for RuTube
This commit is contained in:
@@ -134,7 +134,7 @@ const courses = createListResource({
|
||||
doctype: 'LMS Course',
|
||||
url: 'lms.lms.utils.get_courses',
|
||||
cache: ['courses', user.data?.name],
|
||||
pageLength: pageLength.value,
|
||||
//pageLength: pageLength.value,
|
||||
start: start.value,
|
||||
onSuccess(data) {
|
||||
setCategories(data)
|
||||
|
||||
@@ -734,7 +734,7 @@ const updateVideoTime = (video) => {
|
||||
const startTimer = () => {
|
||||
let timerInterval = setInterval(() => {
|
||||
timer.value++
|
||||
if (timer.value == 30) {
|
||||
if (timer.value == 5) {
|
||||
clearInterval(timerInterval)
|
||||
markProgress()
|
||||
}
|
||||
|
||||
@@ -29,6 +29,62 @@
|
||||
{{ __('No introduction') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Points Section -->
|
||||
<div class="mt-7 mb-10" v-if="energyPoints.data?.length">
|
||||
<h2 class="mb-3 text-lg font-semibold text-ink-gray-9">
|
||||
{{ __('Points') }}
|
||||
</h2>
|
||||
<h2 class="mb-3 text-lg font-semibold text-ink-gray-9">
|
||||
{{ __('The last 10 score records have been uploaded') }}
|
||||
</h2>
|
||||
<ul class="space-y-4">
|
||||
<li v-for="item in energyPoints.data.slice(0, 10)" :key="item.name" class="text-sm text-gray-700">
|
||||
<div class="flex justify-between">
|
||||
<span>{{ __('Points') }}: {{ item.points }}</span>
|
||||
<span>{{ dayjs(item.creation).format('DD-MM-YYYY') }}</span>
|
||||
</div>
|
||||
<div v-if="item.rule" class="text-ink-gray-7">
|
||||
{{ __('Reason') }}: {{ item.rule }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="mt-4 text-sm">
|
||||
<div class="font-semibold">
|
||||
{{ __('Total Points') }}: {{ totalPoints }}
|
||||
</div>
|
||||
<div class="font-semibold">
|
||||
{{ __('Additional Points for MPGU Admission') }}: {{ additionalPoints }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="mt-7 text-ink-gray-7 text-sm italic">
|
||||
{{ __('No points yet') }}
|
||||
</div>
|
||||
|
||||
<!-- Courses Section -->
|
||||
<div class="mt-7 mb-10" v-if="coursesWithTitles.length">
|
||||
<h2 class="mb-3 text-lg font-semibold text-ink-gray-9">
|
||||
{{ __('Completed Courses') }}
|
||||
</h2>
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<div v-for="course in coursesWithTitles" :key="course.name">
|
||||
<a
|
||||
:href="`/lms/courses/${course.course}`"
|
||||
class="text-base text-ink-gray-9 hover:text-blue-600"
|
||||
>
|
||||
{{ course.title || course.course }} <!-- Отображаем title, если есть, иначе course -->
|
||||
</a>
|
||||
<div class="text-sm text-ink-gray-7">
|
||||
{{ __('Completed on') }}: {{ dayjs(course.creation).format('DD MMM YYYY') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="mt-7 text-ink-gray-7 text-sm italic">
|
||||
{{ __('No completed courses yet') }}
|
||||
</div>
|
||||
|
||||
<div class="mt-7 mb-10" v-if="badges.data?.length">
|
||||
<h2 class="mb-3 text-lg font-semibold text-ink-gray-9">
|
||||
{{ __('Achievements') }}
|
||||
@@ -153,6 +209,96 @@ const badges = createResource({
|
||||
},
|
||||
})
|
||||
|
||||
const courses = createResource({
|
||||
url: 'frappe.client.get_list',
|
||||
params: {
|
||||
doctype: 'LMS Course Progress',
|
||||
fields: ['name', 'member', 'course', 'status', 'creation'],
|
||||
filters: {
|
||||
member: props.profile.data.email,
|
||||
status: 'Complete',
|
||||
},
|
||||
},
|
||||
auto: true,
|
||||
onSuccess(data) {
|
||||
console.log('LMS Course Progress data:', data) // Отладка
|
||||
},
|
||||
})
|
||||
|
||||
const courseTitles = ref({})
|
||||
const coursesWithTitles = computed(() => {
|
||||
if (!courses.data) return []
|
||||
const result = courses.data.map(course => ({
|
||||
...course,
|
||||
title: courseTitles.value[course.course] || null,
|
||||
}))
|
||||
console.log('Courses with titles:', result) // Отладка
|
||||
return result
|
||||
})
|
||||
|
||||
// Запрашиваем title для каждого курса
|
||||
watch(
|
||||
() => courses.data,
|
||||
(newCourses) => {
|
||||
if (newCourses && newCourses.length) {
|
||||
const courseIds = newCourses.map(course => course.course)
|
||||
console.log('Course IDs:', courseIds) // Отладка
|
||||
createResource({
|
||||
url: 'frappe.client.get_list',
|
||||
params: {
|
||||
doctype: 'LMS Course',
|
||||
fields: ['name', 'title'],
|
||||
filters: {
|
||||
name: ['in', courseIds],
|
||||
},
|
||||
},
|
||||
auto: true,
|
||||
onSuccess(data) {
|
||||
console.log('Raw course titles data:', data) // Отладка сырых данных
|
||||
const titles = {}
|
||||
data.forEach(course => {
|
||||
titles[course.name] = course.title
|
||||
})
|
||||
courseTitles.value = titles
|
||||
console.log('Processed course titles:', titles) // Отладка обработанных titles
|
||||
},
|
||||
onError(error) {
|
||||
console.error('Error fetching course titles:', error) // Отладка ошибок
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const energyPoints = createResource({
|
||||
url: 'frappe.client.get_list',
|
||||
params: {
|
||||
doctype: 'Energy Point Log',
|
||||
fields: ['name', 'user', 'points', 'rule', 'creation'],
|
||||
filters: {
|
||||
user: props.profile.data.email,
|
||||
},
|
||||
limit_page_length: 1000,
|
||||
},
|
||||
auto: true,
|
||||
onSuccess(data) {
|
||||
console.log('Energy Points data:', data) // Отладка
|
||||
data.forEach(item => {
|
||||
console.log('Points for', item.name, ':', item.points, typeof item.points)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
const totalPoints = computed(() => {
|
||||
return energyPoints.data?.reduce((sum, item) => sum + (item.points || 0), 0) || 0
|
||||
})
|
||||
|
||||
const additionalPoints = computed(() => {
|
||||
const points = Math.floor(totalPoints.value / 100)
|
||||
return points < 10 ? points : 10
|
||||
})
|
||||
|
||||
const shareOnSocial = (badge, medium) => {
|
||||
let shareUrl
|
||||
const url = encodeURIComponent(
|
||||
|
||||
Reference in New Issue
Block a user