Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-resource
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-resource
Commits
3a583458
提交
3a583458
authored
7月 01, 2025
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
50c8fca1
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
201 行增加
和
20 行删除
+201
-20
AddKnowledge.vue
...urse/create/components/stepTwoComponents/AddKnowledge.vue
+17
-6
KnowledgeGraphPreview.vue
...te/components/stepTwoComponents/KnowledgeGraphPreview.vue
+135
-0
StepTwo.vue
src/modules/course/create/views/StepTwo.vue
+42
-7
Preview.vue
src/modules/course/my/views/Preview.vue
+7
-7
没有找到文件。
src/modules/course/create/components/stepTwoComponents/AddKnowledge.vue
浏览文件 @
3a583458
...
@@ -10,11 +10,16 @@ interface KnowledgeNode {
...
@@ -10,11 +10,16 @@ interface KnowledgeNode {
children
?:
KnowledgeNode
[]
children
?:
KnowledgeNode
[]
isEdit
?:
boolean
isEdit
?:
boolean
originalLabel
?:
string
originalLabel
?:
string
course_id
?:
string
chapter_id
?:
string
section_id
?:
string
}
}
const
props
=
defineProps
<
{
const
props
=
defineProps
<
{
chapterName
:
string
chapterName
:
string
chapterID
:
string
chapterId
:
string
courseId
:
string
parentId
:
string
}
>
()
}
>
()
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -30,14 +35,14 @@ const treeRef = ref()
...
@@ -30,14 +35,14 @@ const treeRef = ref()
const
inputRef
=
ref
()
const
inputRef
=
ref
()
// 获取localStorage key
// 获取localStorage key
const
getStorageKey
=
()
=>
`knowledge
_tree_
${
props
.
chapterID
}
`
const
getStorageKey
=
()
=>
`knowledge`
// 从localStorage加载数据
// 从localStorage加载数据
const
loadFromStorage
=
()
=>
{
const
loadFromStorage
=
()
=>
{
try
{
try
{
const
stored
=
localStorage
.
getItem
(
getStorageKey
()
)
const
allData
=
JSON
.
parse
(
localStorage
.
getItem
(
getStorageKey
())
||
'[]'
)
if
(
stored
)
{
if
(
allData
)
{
treeData
.
value
=
JSON
.
parse
(
stored
)
treeData
.
value
=
allData
?.
filter
((
item
:
any
)
=>
item
.
section_id
===
props
.
chapterId
)
||
[]
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'加载知识点数据失败:'
,
error
)
console
.
error
(
'加载知识点数据失败:'
,
error
)
...
@@ -48,7 +53,10 @@ const loadFromStorage = () => {
...
@@ -48,7 +53,10 @@ const loadFromStorage = () => {
// 保存到localStorage
// 保存到localStorage
const
saveToStorage
=
()
=>
{
const
saveToStorage
=
()
=>
{
try
{
try
{
localStorage
.
setItem
(
getStorageKey
(),
JSON
.
stringify
(
treeData
.
value
))
const
allData
=
JSON
.
parse
(
localStorage
.
getItem
(
getStorageKey
())
||
'[]'
)
const
newData
=
allData
.
filter
((
item
:
any
)
=>
item
.
section_id
!==
props
.
chapterId
)
newData
.
push
(...
treeData
.
value
)
localStorage
.
setItem
(
getStorageKey
(),
JSON
.
stringify
(
newData
))
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'保存知识点数据失败:'
,
error
)
console
.
error
(
'保存知识点数据失败:'
,
error
)
ElMessage
.
error
(
'保存失败'
)
ElMessage
.
error
(
'保存失败'
)
...
@@ -72,6 +80,9 @@ const addRootNode = () => {
...
@@ -72,6 +80,9 @@ const addRootNode = () => {
label
:
'新知识点'
,
label
:
'新知识点'
,
children
:
[],
children
:
[],
isEdit
:
true
,
isEdit
:
true
,
course_id
:
props
.
courseId
,
chapter_id
:
props
.
parentId
,
section_id
:
props
.
chapterId
,
}
}
treeRef
.
value
?.
append
(
newNode
)
treeRef
.
value
?.
append
(
newNode
)
...
...
src/modules/course/create/components/stepTwoComponents/KnowledgeGraphPreview.vue
0 → 100644
浏览文件 @
3a583458
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
,
watch
}
from
'vue'
import
KnowledgeGraph
from
'./KnowledgeGraph.vue'
interface
KnowledgeNode
{
id
:
string
label
:
string
children
?:
KnowledgeNode
[]
course_id
?:
string
chapter_id
?:
string
section_id
?:
string
}
const
props
=
defineProps
<
{
isShowKnowledgeGraphPreview
:
boolean
courseId
:
string
chapterId
?:
string
// 可选的章节ID,如果提供则只显示该章节的知识点
title
?:
string
// 弹框标题
}
>
()
const
emit
=
defineEmits
<
{
(
e
:
'update:isShowKnowledgeGraphPreview'
,
value
:
boolean
):
void
}
>
()
// 知识图谱数据
const
knowledgeData
=
ref
<
KnowledgeNode
[]
>
([])
const
loading
=
ref
(
false
)
// 获取localStorage key
const
getStorageKey
=
()
=>
`knowledge`
// 获取知识图谱数据
const
fetchKnowledgeData
=
async
()
=>
{
if
(
!
props
.
courseId
)
return
loading
.
value
=
true
try
{
// 从localStorage读取数据
const
allData
=
JSON
.
parse
(
localStorage
.
getItem
(
getStorageKey
())
||
'[]'
)
if
(
allData
&&
allData
.
length
>
0
)
{
// 如果提供了章节ID,则筛选该章节的数据
if
(
props
.
chapterId
)
{
knowledgeData
.
value
=
allData
.
filter
((
item
:
any
)
=>
item
.
chapter_id
===
props
.
chapterId
)
||
[]
}
else
{
// 否则显示所有属于该课程的数据
knowledgeData
.
value
=
allData
.
filter
((
item
:
any
)
=>
item
.
course_id
===
props
.
courseId
)
||
[]
}
}
else
{
knowledgeData
.
value
=
[]
}
}
catch
(
error
)
{
console
.
error
(
'获取知识图谱数据失败:'
,
error
)
knowledgeData
.
value
=
[]
}
finally
{
loading
.
value
=
false
}
}
// 关闭弹框
const
handleClose
=
()
=>
{
emit
(
'update:isShowKnowledgeGraphPreview'
,
false
)
}
// 监听弹框显示状态
watch
(
()
=>
props
.
isShowKnowledgeGraphPreview
,
(
newVal
)
=>
{
if
(
newVal
)
{
fetchKnowledgeData
()
}
}
)
// 监听课程ID变化
watch
(
()
=>
props
.
courseId
,
()
=>
{
if
(
props
.
isShowKnowledgeGraphPreview
)
{
fetchKnowledgeData
()
}
}
)
// 监听章节ID变化
watch
(
()
=>
props
.
chapterId
,
()
=>
{
if
(
props
.
isShowKnowledgeGraphPreview
)
{
fetchKnowledgeData
()
}
}
)
onMounted
(()
=>
{
if
(
props
.
isShowKnowledgeGraphPreview
)
{
fetchKnowledgeData
()
}
})
</
script
>
<
template
>
<el-dialog
:model-value=
"isShowKnowledgeGraphPreview"
:title=
"title || '知识点脑图预览'"
width=
"800px"
:before-close=
"handleClose"
draggable
destroy-on-close
@
update:model-value=
"(val) => emit('update:isShowKnowledgeGraphPreview', val)"
>
<div
v-loading=
"loading"
style=
"min-height: 500px"
>
<div
v-if=
"!loading && knowledgeData.length === 0"
class=
"empty-state"
>
<el-empty
description=
"暂无知识点数据"
/>
</div>
<div
v-else-if=
"!loading"
style=
"width: 100%; height: 500px"
>
<KnowledgeGraph
:treeData=
"knowledgeData"
/>
</div>
</div>
<template
#
footer
>
<span>
<el-button
@
click=
"handleClose"
>
关闭
</el-button>
</span>
</
template
>
</el-dialog>
</template>
<
style
scoped
>
.empty-state
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
500px
;
}
</
style
>
src/modules/course/create/views/StepTwo.vue
浏览文件 @
3a583458
...
@@ -15,6 +15,7 @@ import AddChapterDialog from '../components/stepTwoComponents/AddChapterDialog.v
...
@@ -15,6 +15,7 @@ import AddChapterDialog from '../components/stepTwoComponents/AddChapterDialog.v
import
AddTextbookDialog
from
'../components/stepTwoComponents/AddTextbookDialog.vue'
import
AddTextbookDialog
from
'../components/stepTwoComponents/AddTextbookDialog.vue'
import
AddGraphbookDialog
from
'../components/stepTwoComponents/AddGraphbookDialog.vue'
import
AddGraphbookDialog
from
'../components/stepTwoComponents/AddGraphbookDialog.vue'
import
AddKnowledge
from
'../components/stepTwoComponents/AddKnowledge.vue'
import
AddKnowledge
from
'../components/stepTwoComponents/AddKnowledge.vue'
import
KnowledgeGraphPreview
from
'../components/stepTwoComponents/KnowledgeGraphPreview.vue'
import
OpenRules
from
'../components/stepTwoComponents/OpenRules.vue'
import
OpenRules
from
'../components/stepTwoComponents/OpenRules.vue'
const
route
=
useRoute
()
const
route
=
useRoute
()
...
@@ -37,6 +38,7 @@ const isShowExamDialog = ref(false)
...
@@ -37,6 +38,7 @@ const isShowExamDialog = ref(false)
const
isShowVideoPlayDialog
=
ref
(
false
)
const
isShowVideoPlayDialog
=
ref
(
false
)
const
chapterName
=
ref
(
''
)
const
chapterName
=
ref
(
''
)
const
chapterID
=
ref
(
''
)
const
chapterID
=
ref
(
''
)
const
parentID
=
ref
(
''
)
const
btnInfo
=
ref
({})
// 按钮信息
const
btnInfo
=
ref
({})
// 按钮信息
const
isEdit
=
ref
(
false
)
const
isEdit
=
ref
(
false
)
const
videoUrl
=
ref
(
''
)
const
videoUrl
=
ref
(
''
)
...
@@ -82,10 +84,10 @@ const btnList = [
...
@@ -82,10 +84,10 @@ const btnList = [
btn_name
:
'关联数字教材'
,
btn_name
:
'关联数字教材'
,
resource_type
:
'13'
,
resource_type
:
'13'
,
},
},
{
//
{
btn_name
:
'关联知识图谱'
,
//
btn_name: '关联知识图谱',
resource_type
:
'14'
,
//
resource_type: '14',
},
//
},
]
]
const
defaultProps
=
{
const
defaultProps
=
{
children
:
'children'
,
children
:
'children'
,
...
@@ -165,6 +167,7 @@ const handleAddDialog = (node: any, item: any, data: any) => {
...
@@ -165,6 +167,7 @@ const handleAddDialog = (node: any, item: any, data: any) => {
console
.
log
(
data
,
'data'
,
dataSource
)
console
.
log
(
data
,
'data'
,
dataSource
)
chapterID
.
value
=
node
.
key
chapterID
.
value
=
node
.
key
chapterName
.
value
=
node
.
label
chapterName
.
value
=
node
.
label
parentID
.
value
=
data
.
parent_id
btnInfo
.
value
=
item
btnInfo
.
value
=
item
flag
.
value
=
true
flag
.
value
=
true
defaultExpandedKeys
.
value
=
[
node
.
key
]
defaultExpandedKeys
.
value
=
[
node
.
key
]
...
@@ -367,6 +370,22 @@ const handleChangeStatus = (node: any, data: any) => {
...
@@ -367,6 +370,22 @@ const handleChangeStatus = (node: any, data: any) => {
}
}
const
isShowKnowledgeDialog
=
ref
(
false
)
const
isShowKnowledgeDialog
=
ref
(
false
)
const
isShowKnowledgeGraphPreview
=
ref
(
false
)
const
knowledgeGraphTitle
=
ref
(
''
)
const
currentChapterId
=
ref
(
''
)
// 显示知识图谱预览
const
handleShowKnowledgeGraph
=
(
node
:
any
)
=>
{
knowledgeGraphTitle
.
value
=
`
${
node
.
label
}
- 知识点脑图预览`
currentChapterId
.
value
=
node
.
key
isShowKnowledgeGraphPreview
.
value
=
true
}
const
handleShowCourseKnowledgeGraph
=
()
=>
{
knowledgeGraphTitle
.
value
=
'课程知识点脑图预览'
currentChapterId
.
value
=
''
isShowKnowledgeGraphPreview
.
value
=
true
}
</
script
>
</
script
>
<
template
>
<
template
>
<AppCard
:title=
"isEditCourse === '1' ? '编辑课程' : '新建课程'"
>
<AppCard
:title=
"isEditCourse === '1' ? '编辑课程' : '新建课程'"
>
...
@@ -374,13 +393,16 @@ const isShowKnowledgeDialog = ref(false)
...
@@ -374,13 +393,16 @@ const isShowKnowledgeDialog = ref(false)
<el-button
<el-button
type=
"primary"
type=
"primary"
round
round
style=
"margin-bottom: 20px"
style=
"margin-bottom: 20px
; margin-right: 10px
"
@
click=
"handleAddChapter"
@
click=
"handleAddChapter"
v-permission=
"'v1-course-create-chapter'"
v-permission=
"'v1-course-create-chapter'"
>
添加章
</el-button
>
添加章
</el-button
>
>
<el-button
type=
"primary"
round
style=
"margin-bottom: 20px"
@
click=
"handleShowCourseKnowledgeGraph"
>
知识点脑图
</el-button
>
<div
class=
"course_tip"
>
<div
class=
"course_tip"
>
温馨提示:先建
“章”,后建“小节”
;课程资源关联到小节;能够关联的资源包含:视频、作业、考试、直播、其他资料、教案、课件。
温馨提示:先建
"章",后建"小节"
;课程资源关联到小节;能够关联的资源包含:视频、作业、考试、直播、其他资料、教案、课件。
</div>
</div>
</el-row>
</el-row>
<el-tree
<el-tree
...
@@ -466,6 +488,10 @@ const isShowKnowledgeDialog = ref(false)
...
@@ -466,6 +488,10 @@ const isShowKnowledgeDialog = ref(false)
<el-icon><Plus
/></el-icon>
<el-icon><Plus
/></el-icon>
添加小节
添加小节
</el-button>
</el-button>
<el-button
class=
"btn_operate"
v-if=
"data.depth === '1'"
@
click=
"handleShowKnowledgeGraph(node, data)"
>
<el-icon><Plus
/></el-icon>
知识点脑图
</el-button>
<template
v-if=
"data.depth === '2'"
>
<template
v-if=
"data.depth === '2'"
>
<el-button
<el-button
class=
"btn_operate"
class=
"btn_operate"
...
@@ -607,8 +633,17 @@ const isShowKnowledgeDialog = ref(false)
...
@@ -607,8 +633,17 @@ const isShowKnowledgeDialog = ref(false)
v-model=
"isShowKnowledgeDialog"
v-model=
"isShowKnowledgeDialog"
@
create=
"handleFresh"
@
create=
"handleFresh"
:chapterName=
"chapterName"
:chapterName=
"chapterName"
:chapterID=
"chapterID"
:chapterId=
"chapterID"
:courseId=
"id"
:parentId=
"parentID"
v-if=
"isShowKnowledgeDialog === true"
/>
v-if=
"isShowKnowledgeDialog === true"
/>
<!-- 知识图谱预览 -->
<KnowledgeGraphPreview
v-if=
"isShowKnowledgeGraphPreview === true"
v-model:isShowKnowledgeGraphPreview=
"isShowKnowledgeGraphPreview"
:courseId=
"id"
:chapterId=
"currentChapterId"
:title=
"knowledgeGraphTitle"
/>
</template>
</template>
<
style
>
<
style
>
...
...
src/modules/course/my/views/Preview.vue
浏览文件 @
3a583458
...
@@ -15,13 +15,13 @@ const id = route.query.id as string
...
@@ -15,13 +15,13 @@ const id = route.query.id as string
const
activeTab
=
ref
(
'study'
)
const
activeTab
=
ref
(
'study'
)
const
tabList
=
[
const
tabList
=
[
{
label
:
'学习'
,
name
:
'study'
},
{
label
:
'学习'
,
name
:
'study'
},
{
label
:
'论坛'
,
name
:
'forum'
},
//
{ label: '论坛', name: 'forum' },
{
label
:
'大作业'
,
name
:
'homework'
},
//
{ label: '大作业', name: 'homework' },
{
label
:
'考试'
,
name
:
'exam'
},
//
{ label: '考试', name: 'exam' },
{
label
:
'课程教务'
,
name
:
'affair'
},
//
{ label: '课程教务', name: 'affair' },
{
label
:
'直播'
,
name
:
'live'
},
//
{ label: '直播', name: 'live' },
{
label
:
'资料'
,
name
:
'material'
},
//
{ label: '资料', name: 'material' },
{
label
:
'数字教材'
,
name
:
'ebook'
},
//
{ label: '数字教材', name: 'ebook' },
]
]
// 简介/目标切换
// 简介/目标切换
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论