Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
inscode
NodeJS_639770
提交
43a6ddf4
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看板
提交
43a6ddf4
编写于
5月 31, 2024
作者:
View Design
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
收藏夹
上级
3134f178
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
38 deletion
+24
-38
components/i/library/Select.vue
components/i/library/Select.vue
+3
-6
composables/useCollectionRequest.js
composables/useCollectionRequest.js
+2
-15
pages/library/[id].vue
pages/library/[id].vue
+5
-7
pages/library/index.vue
pages/library/index.vue
+4
-9
stores/library.js
stores/library.js
+10
-1
未找到文件。
components/i/library/Select.vue
浏览文件 @
43a6ddf4
...
...
@@ -50,8 +50,8 @@
</template>
<
script
setup
>
const
{
$isLibrarySelectOpen
,
$selectCollectionId
,
$selectThreadId
}
=
storeToRefs
(
useLibraryStore
())
const
{
$openLibrarySelect
,
$closeLibrarySelect
,
$openLibraryCreate
,
$setSelectCollectionId
}
=
useLibraryStore
()
const
{
getCollection
,
saveCollection
,
deleteCollectionRecord
}
=
useCollectionRequest
()
const
{
$openLibrarySelect
,
$closeLibrarySelect
,
$openLibraryCreate
,
$setSelectCollectionId
,
$getCollection
}
=
useLibraryStore
()
const
{
saveCollection
,
deleteCollectionRecord
}
=
useCollectionRequest
()
// 合集列表
const
collection
=
ref
([])
const
selected
=
ref
([])
...
...
@@ -66,9 +66,6 @@ function handleOpenCreate () {
handleClose
()
$openLibraryCreate
()
}
async
function
getCollectionData
()
{
collection
.
value
=
await
getCollection
()
}
async
function
handleSelected
(
id
)
{
selected
.
value
=
[
id
]
}
...
...
@@ -94,6 +91,6 @@ async function handleSave() {
}
watch
(()
=>
$isLibrarySelectOpen
.
value
,
()
=>
{
selected
.
value
=
[...
$selectCollectionId
.
value
]
getCollectionData
()
$getCollection
()
})
</
script
>
composables/useCollectionRequest.js
浏览文件 @
43a6ddf4
...
...
@@ -14,16 +14,6 @@ export default () => {
})
return
{
data
,
error
}
}
// 合集列表
const
getCollection
=
async
()
=>
{
const
{
data
,
error
}
=
await
useRequest
(
'
/v1/collection/list
'
,
{
method
:
'
get
'
})
if
(
error
.
value
)
{
return
[]
}
return
data
.
value
.
data
||
[]
}
// 删除收藏夹
const
deleteCollection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/remove`
,
{
...
...
@@ -43,7 +33,7 @@ export default () => {
}
// 查询收藏夹会话列表
const
findCollection
=
async
(
collection_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/items`
,
{
method
:
'
get
'
}
)
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/
${
collection_id
}
/items`
)
if
(
error
.
value
)
{
return
[]
}
...
...
@@ -59,13 +49,10 @@ export default () => {
}
// 查询会话是否被收藏
const
findRecordCollection
=
async
(
c_id
)
=>
{
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/check/
${
c_id
}
`
,
{
method
:
'
get
'
})
const
{
data
,
error
}
=
await
useRequest
(
`/v1/collection/item/check/
${
c_id
}
`
)
return
{
data
,
error
}
}
return
{
getCollection
,
setOrUpdateCollection
,
deleteCollection
,
saveCollection
,
...
...
pages/library/[id].vue
浏览文件 @
43a6ddf4
...
...
@@ -19,13 +19,14 @@
</
template
>
<
script
setup
>
const
route
=
useRoute
()
const
{
findCollection
,
getCollection
}
=
useCollectionRequest
()
const
{
findCollection
}
=
useCollectionRequest
()
const
{
$collection
}
=
storeToRefs
(
useLibraryStore
())
const
{
$getCollection
}
=
useLibraryStore
()
const
state
=
reactive
({
id
:
Number
(
route
.
params
.
id
)
})
const
themesTagList
=
ref
([])
const
collection
=
ref
([])
const
currentCollect
=
computed
(()
=>
collection
.
value
.
find
(
i
=>
i
.
id
===
state
.
id
))
const
currentCollect
=
computed
(()
=>
$collection
.
value
.
find
(
i
=>
i
.
id
===
state
.
id
))
async
function
findCollectionData
()
{
const
data
=
await
findCollection
(
state
.
id
)
themesTagList
.
value
=
data
.
map
(
item
=>
{
...
...
@@ -36,8 +37,5 @@ async function findCollectionData() {
})
}
await
findCollectionData
()
async
function
getCollectionData
()
{
collection
.
value
=
await
getCollection
()
}
await
getCollectionData
()
await
$getCollection
()
</
script
>
\ No newline at end of file
pages/library/index.vue
浏览文件 @
43a6ddf4
...
...
@@ -26,7 +26,7 @@
</div>
<div
class=
"flex flex-col gap-4 mt-4"
>
<ILibraryCollect
v-for=
"item in collection"
v-for=
"item in
$
collection"
:item=
"item"
:key=
"item.id"
/>
...
...
@@ -37,23 +37,18 @@
</div>
</
template
>
<
script
setup
>
const
{
$
openLibraryCreate
}
=
useLibraryStore
(
)
const
{
getCollection
}
=
useCollectionRequest
()
const
{
$
collection
}
=
storeToRefs
(
useLibraryStore
()
)
const
{
$openLibraryCreate
,
$getCollection
}
=
useLibraryStore
()
const
{
getThreadsList
}
=
useLibraryRequest
()
function
handleOpenCreateLibrary
()
{
$openLibraryCreate
()
}
// 合集列表
const
collection
=
ref
([])
// 主题列表
const
threads
=
ref
([])
async
function
getCollectionData
()
{
collection
.
value
=
await
getCollection
()
}
async
function
getThreadData
()
{
threads
.
value
=
await
getThreadsList
()
}
await
getThreadData
()
await
getCollectionData
()
await
$getCollection
()
</
script
>
stores/library.js
浏览文件 @
43a6ddf4
...
...
@@ -6,6 +6,8 @@ export const useLibraryStore = defineStore('library', () => {
const
$selectThreadId
=
ref
(
''
)
const
$selectCollectionId
=
ref
([])
const
$collection
=
ref
([])
function
$openLibraryCreate
()
{
$isLibraryCreateOpen
.
value
=
true
}
...
...
@@ -23,6 +25,11 @@ export const useLibraryStore = defineStore('library', () => {
function
$setSelectCollectionId
(
ids
)
{
$selectCollectionId
.
value
=
ids
}
async
function
$getCollection
()
{
const
{
data
}
=
await
useRequest
(
'
/v1/collection/list
'
)
$collection
.
value
=
data
.
value
.
data
}
return
{
$selectThreadId
,
$isLibraryCreateOpen
,
...
...
@@ -32,6 +39,8 @@ export const useLibraryStore = defineStore('library', () => {
$openLibrarySelect
,
$closeLibrarySelect
,
$selectCollectionId
,
$setSelectCollectionId
$setSelectCollectionId
,
$collection
,
$getCollection
}
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录