提交 f1424aff authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 050a286a
......@@ -55,7 +55,7 @@ function handleTop(data: CourseListItemType) {
</div>
</router-link>
<div class="course-item-ft">
<div class="course-item-playlist" v-if="data.section?.id">
<div class="course-item-playlist" v-if="data.section?.watch_video_length">
<p class="t1">{{ data.section.name }}</p>
<p class="t2">已观看{{ data.section.schedule }}%</p>
<router-link
......
......@@ -53,7 +53,11 @@ function canDownload(type: number) {
}
// 下载资源
function downloadFile(data: CourseResourceType) {
data.info.url && saveAs(data.info.url, data.info.name)
const { url, name } = data.info
const urlExtensionName = url?.split('.').pop()
const nameExtensionName = name?.split('.').pop()
const filename = nameExtensionName === urlExtensionName ? name : `${name}.${urlExtensionName}`
url && saveAs(url, filename)
}
</script>
......
<!-- 课程考核 -->
<script setup lang="ts">
import type { CourseAssessChapterType } from '../types'
import format from 'format-duration'
import { getChapterVideoTreeList } from '../api'
......@@ -60,11 +61,16 @@ function fetchList() {
onMounted(() => {
fetchList()
})
// 时长转换
function formatDuration(duration: number | undefined) {
if (!duration) return ''
return format(duration * 1000, { leading: true })
}
</script>
<template>
<div class="course-assess">
<div class="course-assess-hd">
<p class="t1">课程“音视频”观看统计(累计学习时长:{{ studyTime }}</p>
<p class="t1">课程“音视频”观看统计(累计学习时长:{{ formatDuration(studyTime) }}</p>
<div class="course-assess-hd__aside">
<p class="t2">完成率</p>
<el-progress :percentage="completedPercent" style="width: 200px" />
......@@ -90,7 +96,9 @@ onMounted(() => {
<template v-else>{{ row.name }}</template>
</template>
</el-table-column>
<el-table-column prop="watch_video_length" label="学习时长" width="180" align="center" />
<el-table-column prop="watch_video_length" label="学习时长" width="180" align="center">
<template #default="{ row }">{{ formatDuration(row.watch_video_length) }}</template>
</el-table-column>
<el-table-column prop="name" label="百分比" width="180" align="center">
<template #default="{ row }">
<el-progress :percentage="parseFloat(row.schedule)" />
......
......@@ -72,7 +72,11 @@ function canDownload(type: number) {
}
// 下载资源
function downloadFile(data: CourseResourceType) {
data.info.url && saveAs(data.info.url, data.info.name)
const { url, name } = data.info
const urlExtensionName = url?.split('.').pop()
const nameExtensionName = name?.split('.').pop()
const filename = nameExtensionName === urlExtensionName ? name : `${name}.${urlExtensionName}`
url && saveAs(url, filename)
}
// 跳转链接
function targetUrl(resource: CourseResourceType, section: CourseSectionType, chapter: CourseChapterType) {
......
......@@ -93,7 +93,12 @@ function showInfo(title: string, content: string) {
<img :src="item.avatar" class="lecturer-item__pic" />
<div class="lecturer-item__info">
<h2>{{ item.name }}</h2>
<el-popover :width="400" trigger="hover" v-if="item.summarize">
<template #reference>
<div v-html="item.summarize" style="height: 66px; overflow: hidden"></div>
</template>
<div v-html="item.summarize"></div>
</el-popover>
</div>
</el-carousel-item>
</el-carousel>
......
......@@ -77,7 +77,11 @@ function canDownload(type: number) {
}
// 下载资源
function downloadFile(data: CollectionType) {
data.info.url && saveAs(data.info.url, data.info.name)
const { url, name } = data.info
const urlExtensionName = url?.split('.').pop()
const nameExtensionName = name?.split('.').pop()
const filename = nameExtensionName === urlExtensionName ? name : `${name}.${urlExtensionName}`
url && saveAs(url, filename)
}
function targetUrl(item: CollectionType) {
if (item.type === 5) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论