Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-book
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-book
Commits
a7fb05b3
提交
a7fb05b3
authored
11月 04, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 新增关联知识图谱
上级
e63ceb03
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
83 行增加
和
1 行删除
+83
-1
BindKnowledgeGraph.jsx
src/pages/books/section/components/BindKnowledgeGraph.jsx
+65
-0
EditChapterEditors.jsx
src/pages/books/section/components/EditChapterEditors.jsx
+2
-1
index.jsx
src/pages/books/section/index.jsx
+16
-0
没有找到文件。
src/pages/books/section/components/BindKnowledgeGraph.jsx
0 → 100644
浏览文件 @
a7fb05b3
import
{
useState
,
useEffect
}
from
'react'
import
{
Modal
,
TreeSelect
,
App
}
from
'antd'
import
{
getChapterEditors
,
updateChapterEditors
}
from
'../api'
const
EditChapterEditors
=
({
chapter
=
{},
onOk
,
...
props
})
=>
{
const
{
message
}
=
App
.
useApp
()
const
[
value
,
setValue
]
=
useState
(
''
)
const
[
treeData
,
setTreeData
]
=
useState
([
{
id
:
'1'
,
name
:
'项目一:初识商务数据分析'
,
children
:
[
{
id
:
'1-1'
,
name
:
'任务一:人人都需要商务数据分析'
,
children
:
[
{
id
:
'1-1-1'
,
name
:
' 商务数据分析就业情况'
,
children
:
[
{
id
:
'1-1-1-1'
,
name
:
' 商务数据分析师岗位'
},
{
id
:
'1-1-1-2'
,
name
:
' 商务数据分析师的市场优势'
},
{
id
:
'1-1-1-3'
,
name
:
' 商务数据分析师的工作职责'
}
]
}
]
}
]
}
])
useEffect
(()
=>
{
getChapterEditors
({
book_id
:
chapter
.
book_id
,
chapter_id
:
chapter
.
id
}).
then
(
res
=>
{
const
value
=
res
.
data
.
selected_editor_ids
[
0
]
||
''
setValue
(
value
)
})
},
[
chapter
])
const
handleSubmit
=
async
()
=>
{
message
.
success
(
'关联成功'
)
onOk
?.()
}
return
(
<
Modal
title=
"关联知识图谱"
centered
{
...
props
}
onOk=
{
handleSubmit
}
>
<
TreeSelect
showSearch
treeDefaultExpandAll
treeData=
{
treeData
}
fieldNames=
{
{
label
:
'name'
,
value
:
'id'
}
}
style=
{
{
width
:
'100%'
}
}
></
TreeSelect
>
</
Modal
>
)
}
export
default
EditChapterEditors
src/pages/books/section/components/EditChapterEditors.jsx
浏览文件 @
a7fb05b3
import
{
useState
,
useEffect
}
from
'react'
import
{
Modal
,
Form
,
Radio
,
Space
,
message
}
from
'antd'
import
{
Modal
,
Form
,
Radio
,
Space
,
App
}
from
'antd'
import
{
getChapterEditors
,
updateChapterEditors
}
from
'../api'
const
EditChapterEditors
=
({
chapter
=
{},
onChange
,
...
props
})
=>
{
const
{
message
}
=
App
.
useApp
()
const
[
editors
,
setEditors
]
=
useState
([])
const
[
value
,
setValue
]
=
useState
(
''
)
...
...
src/pages/books/section/index.jsx
浏览文件 @
a7fb05b3
...
...
@@ -8,6 +8,7 @@ import { setAutosaveTime } from '@/store/modules/editor'
import
{
setTreeChapter
}
from
'@/store/modules/user'
import
EditChapterTitle
from
'./components/form-chapter-title'
import
EditChapterEditors
from
'./components/EditChapterEditors'
import
BindKnowledgeGraph
from
'./components/BindKnowledgeGraph'
import
{
get
}
from
'lodash-es'
import
md5
from
'js-md5'
...
...
@@ -55,6 +56,10 @@ const Examine = () => {
const
onChapterEditorsChange
=
()
=>
{
setEditChapterEditorsIsOpen
(
false
)
}
// 关联知识图谱
const
[
bindKnowledgeGraphIsOpen
,
setBindKnowledgeGraphIsOpen
]
=
useState
(
false
)
// 编辑器内容
const
editorRef
=
useRef
()
const
saveInterRef
=
useRef
()
...
...
@@ -298,6 +303,7 @@ const Examine = () => {
let
chapterMenuItems
=
[
{
key
:
'1'
,
label
:
'展开全部'
},
{
key
:
'2'
,
label
:
'添加子节'
},
{
key
:
'7'
,
label
:
'关联知识图谱'
},
{
key
:
'5'
,
label
:
'设置编者'
},
{
key
:
'6'
,
...
...
@@ -342,6 +348,8 @@ const Examine = () => {
})
}
else
if
(
e
.
key
==
5
)
{
setEditChapterEditorsIsOpen
(
true
)
}
else
if
(
e
.
key
==
7
)
{
setBindKnowledgeGraphIsOpen
(
true
)
}
}
...
...
@@ -540,6 +548,14 @@ const Examine = () => {
onCancel=
{
()
=>
setEditChapterEditorsIsOpen
(
false
)
}
onChange=
{
onChapterEditorsChange
}
></
EditChapterEditors
>
)
}
{
/* 关联知识图谱 */
}
{
currentChapter
&&
bindKnowledgeGraphIsOpen
&&
(
<
BindKnowledgeGraph
open=
{
bindKnowledgeGraphIsOpen
}
chapter=
{
currentChapter
}
onCancel=
{
()
=>
setBindKnowledgeGraphIsOpen
(
false
)
}
onOk=
{
()
=>
setBindKnowledgeGraphIsOpen
(
false
)
}
></
BindKnowledgeGraph
>
)
}
</
div
>
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论