Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
inscode
NodeJS_639770
提交
9a7f07cf
N
NodeJS_639770
项目概览
inscode
/
NodeJS_639770
与 Fork 源项目一致
Fork自
inscode / NodeJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NodeJS_639770
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9a7f07cf
编写于
5月 30, 2024
作者:
D
DebugIsFalse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修改事件名称
上级
afaab892
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
17 deletion
+28
-17
components/i/library/create.vue
components/i/library/create.vue
+2
-2
components/i/library/select.vue
components/i/library/select.vue
+11
-0
composables/useCollectionRequest.js
composables/useCollectionRequest.js
+15
-15
未找到文件。
components/i/library/create.vue
浏览文件 @
9a7f07cf
...
...
@@ -53,7 +53,7 @@
<
script
setup
>
const
{
$isLibraryCreateOpen
}
=
storeToRefs
(
useLibraryStore
())
const
{
$closeLibraryCreate
}
=
useLibraryStore
()
const
{
setOrUpdateFavorites
}
=
use
Favorites
()
const
{
setOrUpdateFavorites
}
=
use
CollectionRequest
()
const
title
=
ref
(
''
)
const
description
=
ref
(
''
)
const
loading
=
ref
(
false
)
...
...
@@ -63,7 +63,7 @@ function handleClose () {
async
function
handleCreate
()
{
if
(
loading
.
value
)
return
loading
.
value
=
true
const
{
data
,
error
}
=
await
setOrUpdateFavorites
({
const
{
error
}
=
await
setOrUpdateFavorites
({
name
:
title
.
value
,
description
:
description
.
value
})
...
...
components/i/library/select.vue
浏览文件 @
9a7f07cf
...
...
@@ -13,6 +13,7 @@
</div>
</
template
>
<div
class=
"flex flex-col gap-4"
>
{{ collection }}
<UButton
leading-icon=
"i-heroicons-plus-20-solid"
label=
"创建新集合"
...
...
@@ -47,6 +48,9 @@
<
script
setup
>
const
{
$isLibrarySelectOpen
}
=
storeToRefs
(
useLibraryStore
())
const
{
$openLibrarySelect
,
$closeLibrarySelect
,
$openLibraryCreate
}
=
useLibraryStore
()
const
{
getCollection
}
=
useCollectionRequest
()
// 收藏夹数据
const
collection
=
ref
([])
function
handleClose
()
{
$closeLibrarySelect
()
}
...
...
@@ -57,4 +61,11 @@ function handleOpenCreate () {
handleClose
()
$openLibraryCreate
()
}
async
function
getCollectionData
()
{
collection
.
value
=
await
getCollection
()
}
watch
(()
=>
$isLibrarySelectOpen
.
value
,
()
=>
{
getCollectionData
()
})
</
script
>
composables/use
Favorites
.js
→
composables/use
CollectionRequest
.js
浏览文件 @
9a7f07cf
export
default
()
=>
{
// 创建及修改收藏夹
const
setOrUpdate
Favorites
=
async
(
body
)
=>
{
const
setOrUpdate
Collection
=
async
(
body
)
=>
{
/*
* id number 非必须 有ID参数是修改,没有ID则为新增
* name string 非必须
...
...
@@ -14,8 +14,8 @@ export default () => {
})
return
{
data
,
error
}
}
//
收藏夹
列表
const
get
Favorites
=
async
()
=>
{
//
集合
列表
const
get
Collection
=
async
()
=>
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/list
'
,
{
method
:
'
get
'
})
...
...
@@ -25,14 +25,14 @@ export default () => {
return
data
.
value
.
data
||
[]
}
// 删除收藏夹
const
delete
Favorite
=
async
(
collection_id
)
=>
{
const
delete
Collection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/remove`
,
{
method
:
'
post
'
})
return
{
data
,
error
}
}
// 将会话添加到收藏夹
const
save
Favorite
=
async
(
body
)
=>
{
const
save
Collection
=
async
(
body
)
=>
{
// collection_id number 收藏夹ID
// c_id string 会话ID
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/add`
,
{
...
...
@@ -42,7 +42,7 @@ export default () => {
return
{
data
,
error
}
}
// 查询收藏夹会话列表
const
find
Favorite
=
async
(
collection_id
)
=>
{
const
find
Collection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/items`
,
{
method
:
'
post
'
,
body
...
...
@@ -50,7 +50,7 @@ export default () => {
return
{
data
,
error
}
}
// 删除收藏夹会话
const
delete
FavoriteCollection
=
async
(
collection_id
,
c_id
)
=>
{
const
delete
CollectionRecord
=
async
(
collection_id
,
c_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/delete`
,
{
method
:
'
post
'
,
body
:
{
collection_id
,
c_id
}
...
...
@@ -58,19 +58,19 @@ export default () => {
return
{
data
,
error
}
}
// 查询会话是否被收藏
const
find
CollectionFavorites
=
async
(
c_id
)
=>
{
const
find
RecordCollection
=
async
(
c_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/check/
${
c_id
}
`
,
{
method
:
'
get
'
})
return
{
data
,
error
}
}
return
{
get
Favorites
,
setOrUpdate
Favorites
,
delete
Favorite
,
save
Favorite
,
find
Favorite
,
delete
FavoriteCollection
,
find
CollectionFavorites
get
Collection
,
setOrUpdate
Collection
,
delete
Collection
,
save
Collection
,
find
Collection
,
delete
CollectionRecord
,
find
RecordCollection
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录