From 9a7f07cfa397fc859661de64bab8df01c707ad63 Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Thu, 30 May 2024 16:04:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/i/library/create.vue | 4 +-- components/i/library/select.vue | 11 +++++++ ...seFavorites.js => useCollectionRequest.js} | 30 +++++++++---------- 3 files changed, 28 insertions(+), 17 deletions(-) rename composables/{useFavorites.js => useCollectionRequest.js} (75%) diff --git a/components/i/library/create.vue b/components/i/library/create.vue index 564c83e..b4de9b4 100644 --- a/components/i/library/create.vue +++ b/components/i/library/create.vue @@ -53,7 +53,7 @@ diff --git a/composables/useFavorites.js b/composables/useCollectionRequest.js similarity index 75% rename from composables/useFavorites.js rename to composables/useCollectionRequest.js index 57f5810..c00ee5a 100644 --- a/composables/useFavorites.js +++ b/composables/useCollectionRequest.js @@ -1,6 +1,6 @@ export default () => { // 创建及修改收藏夹 - const setOrUpdateFavorites = async (body) => { + const setOrUpdateCollection = async (body) => { /* * id number 非必须 有ID参数是修改,没有ID则为新增 * name string 非必须 @@ -14,8 +14,8 @@ export default () => { }) return { data, error } } - // 收藏夹列表 - const getFavorites = async () => { + // 集合列表 + const getCollection = async () => { const { data, error } = await useRequest('/v1/collection/list', { method: 'get' }) @@ -25,14 +25,14 @@ export default () => { return data.value.data || [] } // 删除收藏夹 - const deleteFavorite = async (collection_id) => { + const deleteCollection = async (collection_id) => { const {data, error} = await useRequest(`/v1/collection/${collection_id}/remove`, { method: 'post' }) return { data, error } } // 将会话添加到收藏夹 - const saveFavorite = async (body) => { + const saveCollection = 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 findFavorite = async (collection_id) => { + const findCollection = 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 deleteFavoriteCollection = async (collection_id, c_id) => { + const deleteCollectionRecord = 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 findCollectionFavorites = async (c_id) => { + const findRecordCollection = async (c_id) => { const {data, error} = await useRequest(`/v1/collection/item/check/${c_id}`, { method: 'get' }) return { data, error } } return { - getFavorites, - setOrUpdateFavorites, - deleteFavorite, - saveFavorite, - findFavorite, - deleteFavoriteCollection, - findCollectionFavorites + getCollection, + setOrUpdateCollection, + deleteCollection, + saveCollection, + findCollection, + deleteCollectionRecord, + findRecordCollection } } \ No newline at end of file -- GitLab