diff --git a/components/i/library/Select.vue b/components/i/library/Select.vue index ae9104d8e104b09dd9d4fd14a5e32b7343d6d185..dea5e520823a0cd4d9465ae91e8d8e17893182c0 100644 --- a/components/i/library/Select.vue +++ b/components/i/library/Select.vue @@ -50,8 +50,8 @@ diff --git a/composables/useCollectionRequest.js b/composables/useCollectionRequest.js index 0558317aef325c47e6e2a9b14cea452b253f1a51..cf43a34fd193a66624f71596c304b5b8dd8789ad 100644 --- a/composables/useCollectionRequest.js +++ b/composables/useCollectionRequest.js @@ -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, diff --git a/pages/library/[id].vue b/pages/library/[id].vue index 00e3f400f4e30b4d5bc8537ed1f2ac22ad5c84f1..e6938c1d81485d2cc406357b11fc9b517c1254e7 100644 --- a/pages/library/[id].vue +++ b/pages/library/[id].vue @@ -19,13 +19,14 @@ \ No newline at end of file diff --git a/pages/library/index.vue b/pages/library/index.vue index 175b859a9dc32e73c5d959de0c901603df5127f6..6a97bc236cc23ec23e5e97441d39f340f00f9d36 100644 --- a/pages/library/index.vue +++ b/pages/library/index.vue @@ -26,7 +26,7 @@
@@ -37,23 +37,18 @@
diff --git a/stores/library.js b/stores/library.js index 982c9f6e625cb8f0ee6a2499c13c6c15cbc2d1df..30d1cdf918afc51be6fc4ab4bb7049eccfce5776 100644 --- a/stores/library.js +++ b/stores/library.js @@ -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 } })