Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-learn
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-learn
Commits
ab2d3548
提交
ab2d3548
authored
8月 03, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
e22f07ca
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
71 行增加
和
37 行删除
+71
-37
CourseExamQuestion.vue
src/modules/course/components/CourseExamQuestion.vue
+2
-2
CoursePlayerResourceItem.vue
src/modules/course/components/CoursePlayerResourceItem.vue
+21
-3
CourseViewLiveItem.vue
src/modules/course/components/CourseViewLiveItem.vue
+6
-6
CoursePlayer.vue
src/modules/course/views/CoursePlayer.vue
+9
-2
types.ts
src/types.ts
+7
-7
dictionary.ts
src/utils/dictionary.ts
+8
-17
index.ts
src/utils/index.ts
+18
-0
没有找到文件。
src/modules/course/components/CourseExamQuestion.vue
浏览文件 @
ab2d3548
...
...
@@ -2,7 +2,7 @@
import
type
{
PaperQuestionType
}
from
'@/types'
import
CourseExamQuestionItem
from
'./CourseExamQuestionItem.vue'
import
{
questionType
}
from
'@/utils/dictionary
'
import
{
formatQuestionType
}
from
'@/utils/index
'
interface
Props
{
index
:
number
...
...
@@ -13,7 +13,7 @@ const props = defineProps<Props>()
// 试题类型
const
questionTypeText
=
computed
(()
=>
{
return
questionType
[
props
.
question
.
question_type
]
||
props
.
question
.
question_type
return
formatQuestionType
(
props
.
question
.
question_type
)
})
</
script
>
...
...
src/modules/course/components/CoursePlayerResourceItem.vue
浏览文件 @
ab2d3548
<
script
setup
lang=
"ts"
>
import
type
{
CourseResourceType
}
from
'../types'
import
{
formatLiveDate
,
formatLiveStatus
}
from
'@/utils/index'
import
ResourceIcon
from
'@/components/ResourceIcon.vue'
import
{
Download
}
from
'@element-plus/icons-vue'
...
...
@@ -22,13 +23,18 @@ const targetUrl = computed(() => {
const
info
=
props
.
data
.
info
if
(
props
.
data
.
resource_type
===
3
||
props
.
data
.
resource_type
===
9
)
{
return
`/course/exam?course_id=
${
courseId
}
&semester_id=
${
semesterId
}
&paper_id=
${
props
.
data
.
resource_id
}
&type=2&paper_title=
${
props
.
data
.
name
}
`
}
else
if
(
props
.
data
.
resource_type
===
6
)
{
return
info
.
join_url
}
else
if
([
'pptx'
,
'doc'
,
'docx'
,
'xls'
,
'xlsx'
].
includes
(
info
.
type
))
{
return
`https://view.officeapps.live.com/op/view.aspx?src=
${
info
.
url
}
`
}
else
{
return
info
.
url
}
})
// 是否可以收藏
function
canCollection
(
type
:
number
)
{
return
[
3
,
4
,
9
,
10
,
11
].
includes
(
type
)
}
// 收藏/取消收藏
function
toggleCollection
(
data
:
CourseResourceType
)
{
// 资源类型: 1章节,2视频,3作业,4其他,6腾讯会议,9考试,10课件,11教案
...
...
@@ -77,8 +83,17 @@ function downloadFile(data: CourseResourceType) {
>
<el-button
round
size=
"small"
>
查看报告
</el-button>
</router-link>
<template
v-if=
"data.resource_type === 6"
>
<span>
{{
formatLiveDate
(
data
.
info
.
start_time
)
}}
</span>
<span
style=
"margin-left: 10px"
>
{{
formatLiveStatus
(
data
.
info
.
status
)
}}
</span>
</
template
>
<div
class=
"actions"
>
<i
class=
"icon-star"
:class=
"!!data.collection_count ? 'is-active' : ''"
@
click=
"toggleCollection(data)"
></i>
<i
class=
"icon-star"
:class=
"!!data.collection_count ? 'is-active' : ''"
@
click=
"toggleCollection(data)"
v-if=
"canCollection(data.resource_type)"
></i>
<i
class=
"icon-download"
@
click=
"downloadFile(data)"
v-if=
"canDownload(data.resource_type)"
><Download
/></i>
</div>
</div>
...
...
@@ -100,10 +115,13 @@ function downloadFile(data: CourseResourceType) {
}
.actions
{
width
:
60px
;
min-
width
:
60px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
&
:empty
{
min-width
:
auto
;
}
}
}
.icon-star
{
...
...
src/modules/course/components/CourseViewLiveItem.vue
浏览文件 @
ab2d3548
<
script
setup
lang=
"ts"
>
import
type
{
LiveType
}
from
'@/types'
import
dayjs
from
'dayjs'
import
{
formatLiveDate
,
formatLiveStatus
}
from
'@/utils/index'
import
{
VideoPlay
}
from
'@element-plus/icons-vue'
interface
Props
{
data
:
LiveType
}
defineProps
<
Props
>
()
function
formatDate
(
startTime
:
number
)
{
return
dayjs
(
startTime
*
1000
).
format
(
'YYYY-MM-DD HH:mm'
)
}
</
script
>
<
template
>
...
...
@@ -21,7 +18,10 @@ function formatDate(startTime: number) {
{{
data
.
subject
}}
</a>
</p>
<div
class=
"actions"
>
{{
formatDate
(
data
.
start_time
)
}}
</div>
<div
class=
"actions"
>
<span>
{{
formatLiveDate
(
data
.
start_time
)
}}
</span>
<span
style=
"margin-left: 10px"
>
{{
formatLiveStatus
(
data
.
status
)
}}
</span>
</div>
</div>
</
template
>
...
...
src/modules/course/views/CoursePlayer.vue
浏览文件 @
ab2d3548
...
...
@@ -23,7 +23,8 @@ const detail = reactive<{
jobs
:
CourseResourceType
[]
lesson_plans
:
CourseResourceType
[]
other_infos
:
CourseResourceType
[]
}
>
({
course_name
:
''
,
coursewares
:
[],
exams
:
[],
jobs
:
[],
lesson_plans
:
[],
other_infos
:
[]
})
meetings
:
CourseResourceType
[]
}
>
({
course_name
:
''
,
coursewares
:
[],
exams
:
[],
jobs
:
[],
lesson_plans
:
[],
other_infos
:
[],
meetings
:
[]
})
let
loading
=
$ref
<
boolean
>
(
false
)
// 获取详情信息
function
fetchInfo
()
{
...
...
@@ -94,7 +95,13 @@ onMounted(() => {
:key=
"item.id"
></CoursePlayerResourceItem>
</el-tab-pane>
<!--
<el-tab-pane
label=
"直播"
lazy
></el-tab-pane>
-->
<el-tab-pane
label=
"直播"
lazy
>
<CoursePlayerResourceItem
v-for=
"item in detail.meetings"
:data=
"item"
:key=
"item.id"
></CoursePlayerResourceItem>
</el-tab-pane>
</el-tabs>
</div>
<div
class=
"course-player-aside"
>
...
...
src/types.ts
浏览文件 @
ab2d3548
import
type
{
Component
}
from
'vue'
import
type
{
questionType
}
from
'@/utils/dictionary'
import
type
{
questionType
,
liveStatus
}
from
'@/utils/dictionary'
export
interface
IMenuItem
{
tag
?:
string
...
...
@@ -69,7 +69,10 @@ export interface LecturerType {
}
// 资源类型
export
interface
ResourceType
{
export
type
ResourceType
=
FileType
&
LiveType
&
PaperType
// 资源类型
export
interface
FileType
{
id
:
string
knowledge_points
:
string
name
:
string
...
...
@@ -80,11 +83,7 @@ export interface ResourceType {
length
?:
number
size
:
number
source_id
:
string
paper_title
?:
string
paper_type
?:
number
paper_status
?:
number
}
// 直播类型
export
interface
LiveType
{
end_time
:
number
...
...
@@ -95,10 +94,11 @@ export interface LiveType {
meeting_id
:
string
meeting_type
:
number
start_time
:
number
status
:
number
status
:
LiveStatusType
sub_meetings
:
[]
subject
:
string
}
export
type
LiveStatusType
=
keyof
typeof
liveStatus
// 试卷类型
export
interface
PaperType
{
...
...
src/utils/dictionary.ts
浏览文件 @
ab2d3548
...
...
@@ -3,15 +3,6 @@ export const json2Array = function (data: any, isValueToNumber = true) {
return
Object
.
keys
(
data
).
map
(
value
=>
({
label
:
data
[
value
],
value
:
isValueToNumber
?
parseInt
(
value
)
:
value
}))
}
// 组卷模式
export
const
paperType
=
{
1
:
'选题组卷'
,
2
:
'自动组卷'
,
3
:
'自由组卷'
}
// 组卷模式列表
export
const
paperTypeList
=
json2Array
(
paperType
)
// 试题类型
export
const
questionType
=
{
1
:
'单选题'
,
...
...
@@ -25,12 +16,12 @@ export const questionType = {
// 试题类型列表
export
const
questionTypeList
=
json2Array
(
questionType
,
false
)
//
试题难度
export
const
questionDifficulty
=
{
1
:
'易
'
,
2
:
'中
'
,
3
:
'难
'
,
0
:
'无
'
//
直播状态
export
const
liveStatus
=
{
0
:
'未知
'
,
1
:
'直播未开始
'
,
2
:
'直播中
'
,
3
:
'直播已结束
'
}
// 试题
难度
列表
export
const
questionDifficultyList
=
json2Array
(
questionDifficulty
,
false
)
// 试题
类型
列表
export
const
liveStatusList
=
json2Array
(
liveStatus
,
false
)
src/utils/index.ts
0 → 100644
浏览文件 @
ab2d3548
import
dayjs
from
'dayjs'
import
{
liveStatus
,
questionType
}
from
'./dictionary'
import
type
{
LiveStatusType
,
QuestionType
}
from
'@/types'
// 直播时间
export
function
formatLiveDate
(
startTime
:
number
)
{
return
dayjs
(
startTime
*
1000
).
format
(
'YYYY-MM-DD HH:mm'
)
}
// 直播状态
export
function
formatLiveStatus
(
status
:
LiveStatusType
)
{
return
liveStatus
[
status
]
||
status
}
// 试题类型
export
function
formatQuestionType
(
type
:
QuestionType
)
{
return
questionType
[
type
]
||
type
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论