Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pic-reader
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
pic-reader
Commits
06968f64
提交
06968f64
authored
6月 27, 2025
作者:
龙菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复从详情页直接进无法查看书签的问题
上级
e0813d99
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
2 行删除
+34
-2
index.js
src/api/index.js
+13
-0
index.vue
src/views/detail/index.vue
+21
-2
没有找到文件。
src/api/index.js
浏览文件 @
06968f64
...
@@ -25,3 +25,16 @@ export function getDocumentDetail(id) {
...
@@ -25,3 +25,16 @@ export function getDocumentDetail(id) {
method
:
'get'
method
:
'get'
});
});
}
}
/**
* 获取文档书签
* @param {string} id - 文档ID
* @returns {Promise} 返回文档详情数据
*/
export
function
getDocumentBookmarks
(
id
)
{
return
request
({
url
:
`/micro-mgz/
${
id
}
/bookmarks`
,
method
:
'get'
});
}
src/views/detail/index.vue
浏览文件 @
06968f64
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</div>
</div>
</
template
>
</
template
>
<
script
setup
>
<
script
setup
>
import
{
getDocumentDetail
}
from
"@/api"
;
import
{
getDocumentDetail
,
getDocumentBookmarks
}
from
"@/api"
;
import
BookReader
from
"@/components/BookReader/index.vue"
;
import
BookReader
from
"@/components/BookReader/index.vue"
;
const
route
=
useRoute
();
const
route
=
useRoute
();
const
router
=
useRouter
();
const
router
=
useRouter
();
...
@@ -42,11 +42,30 @@ function goBack() {
...
@@ -42,11 +42,30 @@ function goBack() {
// router.go(-1);
// router.go(-1);
router
.
push
(
"/"
);
router
.
push
(
"/"
);
}
}
async
function
fetchBookmarks
(
id
)
{
try
{
const
res
=
await
getDocumentBookmarks
(
id
);
if
(
res
.
status
==
"success"
)
{
localStorage
.
setItem
(
`bookmarks-
${
id
}
`
,
JSON
.
stringify
(
res
.
bookmarks
));
bookmarks
.
value
=
res
.
bookmarks
;
}
}
catch
(
error
)
{
console
.
log
(
error
);
}
finally
{
}
}
onMounted
(()
=>
{
onMounted
(()
=>
{
const
{
id
}
=
route
.
params
;
const
{
id
}
=
route
.
params
;
bookmarks
.
value
=
JSON
.
parse
(
localStorage
.
getItem
(
`bookmarks-
${
id
}
`
));
title
.
value
=
route
.
query
.
title
;
title
.
value
=
route
.
query
.
title
;
loadData
(
id
);
loadData
(
id
);
const
bookmarksData
=
JSON
.
parse
(
localStorage
.
getItem
(
`bookmarks-
${
id
}
`
));
if
(
bookmarksData
)
{
bookmarks
.
value
=
bookmarksData
;
}
else
{
fetchBookmarks
(
id
);
}
});
});
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论