提交 4ac0163e 编写于 作者: View Design's avatar View Design

update Library

上级 7ed5e4a4
...@@ -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>{{formatTime}}</span> <span>{{ useTime(item.create_time) }}</span>
</div> </div>
</div> </div>
<div class="flex gap-4"> <div class="flex gap-4">
...@@ -50,8 +50,4 @@ const props = defineProps({ ...@@ -50,8 +50,4 @@ 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
export default () => { export default () => {
// 查询主题列表 // 查询主题列表
const getThemeList = async () => { const getThreadsList = async () => {
const { data, error } = await useRequest('/v1/chat/completion/list', { const { data, error } = await useRequest('/v1/chat/completion/list')
method: 'get'
})
if (error.value) { if (error.value) {
return [] return []
} }
return data.value.data || [] return data.value.data || []
} }
return { return {
getThemeList getThreadsList
} }
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<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
v-for="item in themes" v-for="item in threads"
:item="item" :item="item"
:key="item.c_id" :key="item.c_id"
/> />
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<ILibraryCollect <ILibraryCollect
v-for="item in collection" v-for="item in collection"
:item="item" :item="item"
:key="item.id"
/> />
</div> </div>
</div> </div>
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
<script setup> <script setup>
const { $openLibraryCreate } = useLibraryStore() const { $openLibraryCreate } = useLibraryStore()
const { getCollection } = useCollectionRequest() const { getCollection } = useCollectionRequest()
const { getThemeList } = useThemeRequest() const { getThreadsList } = useLibraryRequest()
function handleOpenCreateLibrary () { function handleOpenCreateLibrary () {
$openLibraryCreate() $openLibraryCreate()
...@@ -46,15 +47,13 @@ function handleOpenCreateLibrary () { ...@@ -46,15 +47,13 @@ function handleOpenCreateLibrary () {
// 合集列表 // 合集列表
const collection = ref([]) const collection = ref([])
// 主题列表 // 主题列表
const themes = ref([]) const threads = ref([])
async function getCollectionData () { async function getCollectionData () {
collection.value = await getCollection() collection.value = await getCollection()
} }
async function getThemeListData() { async function getThreadData() {
themes.value = await getThemeList() threads.value = await getThreadsList()
} }
nextTick(() => { getThreadData()
getThemeListData() getCollectionData()
getCollectionData()
})
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册