提交 9f2369dc 编写于 作者: D DebugIsFalse

feature: 添加接口

上级 8ab91b3c
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</div> </div>
<div class="flex items-center text-sm gap-0.5" :class="textColor"> <div class="flex items-center text-sm gap-0.5" :class="textColor">
<UIcon name="i-heroicons-clock" /> <UIcon name="i-heroicons-clock" />
<span>52 分钟前</span> <span>{{formatTime}}</span>
</div> </div>
</div> </div>
<div class="flex gap-4"> <div class="flex gap-4">
...@@ -50,4 +50,7 @@ const props = defineProps({ ...@@ -50,4 +50,7 @@ const props = defineProps({
function handleOpenSelect (id) { function handleOpenSelect (id) {
$openLibrarySelect(id) $openLibrarySelect(id)
} }
const formatTime = computed(() => {
return useTime(props.item.create_time)
})
</script> </script>
\ No newline at end of file
...@@ -43,11 +43,11 @@ export default () => { ...@@ -43,11 +43,11 @@ export default () => {
} }
// 查询收藏夹会话列表 // 查询收藏夹会话列表
const findCollection = async (collection_id) => { const findCollection = async (collection_id) => {
const {data, error} = await useRequest(`/v1/collection/${collection_id}/items`, { const {data, error} = await useRequest(`/v1/collection/${collection_id}/items`, { method: 'get' })
method: 'post', if (error.value) {
body return []
}) }
return { data, error } return data.value.data || []
} }
// 删除收藏夹会话 // 删除收藏夹会话
const deleteCollectionRecord = async (collection_id, c_id) => { const deleteCollectionRecord = async (collection_id, c_id) => {
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<div class="flex gap-10"> <div class="flex gap-10">
<div class="flex flex-col flex-grow"> <div class="flex flex-col flex-grow">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<ILibraryThread /> <ILibraryThread
<ILibraryThread /> v-for="item in themesTagList"
<ILibraryThread /> :item="item"
<ILibraryThread /> :key="item.id"
<ILibraryThread /> />
</div> </div>
</div> </div>
</div> </div>
...@@ -18,7 +18,20 @@ ...@@ -18,7 +18,20 @@
</template> </template>
<script setup> <script setup>
const route = useRoute() const route = useRoute()
const { findCollection } = useCollectionRequest()
const state = reactive({ const state = reactive({
id: route.params.id id: route.params.id
}) })
const themesTagList = ref([])
async function findCollectionData() {
const data = await findCollection(state.id)
themesTagList.value = data.map(item => {
return {
...item,
title: item.c_title
}
})
console.log(`themesTagList.value:`, themesTagList.value)
}
await findCollectionData()
</script> </script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册