提交 3134f178 编写于 作者: View Design's avatar View Design

thread

上级 538bb4b2
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div class="flex"> <div class="flex">
<div class="flex items-center text-gray-500 text-sm gap-0.5"> <div class="flex items-center text-gray-500 text-sm gap-0.5">
<UIcon name="i-heroicons-square-3-stack-3d" /> <UIcon name="i-heroicons-square-3-stack-3d" />
<span>1</span> <span>{{ item.record_count }}</span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
@click="handleSelected(item.id)" @click="handleSelected(item.id)"
> >
<div class="flex flex-grow justify-between items-center"> <div class="flex flex-grow justify-between items-center">
<div>{{item.name}}</div> <div>{{ item.name }}</div>
<UIcon v-if="selected.includes(item.id)" name="i-heroicons-check-circle-20-solid" class="text-primary text-lg" /> <UIcon v-if="selected.includes(item.id)" name="i-heroicons-check-circle-20-solid" class="text-primary text-lg" />
</div> </div>
</UButton> </UButton>
...@@ -73,6 +73,8 @@ async function handleSelected(id) { ...@@ -73,6 +73,8 @@ async function handleSelected(id) {
selected.value = [id] selected.value = [id]
} }
async function handleSave() { async function handleSave() {
console.log(788)
return
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
// 取消合集 // 取消合集
......
<template> <template>
<ULink :to="`/search/${item.c_id}`" class="flex flex-col group"> <ULink :to="`/search/${thread.c_id}`" class="flex flex-col group">
<div class="transition truncate group-hover:text-primary">{{ item.title }}</div> <div class="transition truncate group-hover:text-primary">{{ thread.title }}</div>
<div class="break-word text-balance line-clamp-2 font-sans text-base" :class="textColor"> <div class="break-word text-balance line-clamp-2 font-sans text-base" :class="textColor">
{{ item.description || ' 待补充' }} {{ thread.description || ' 待补充' }}
</div> </div>
</ULink> </ULink>
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
...@@ -13,18 +13,20 @@ ...@@ -13,18 +13,20 @@
</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>{{ useTime(item.create_time) }}</span> <span>{{ useTime(thread.create_time) }}</span>
</div> </div>
</div> </div>
<div class="flex gap-4"> <div class="flex gap-4">
<UButton <template v-for="collect in thread.collections" :key="collect.collection_id">
:ui="{ rounded: 'rounded-full' }" <UButton
to="/library/123" :ui="{ rounded: 'rounded-full' }"
color="white" :to="`/library/${collect.collection_id}`"
size="2xs" color="white"
label="前端开发" size="2xs"
/> :label="collect.collection_name"
<UTooltip text="添加到收藏"> />
</template>
<UTooltip text="添加到收藏" v-if="!thread.collections.length">
<UButton <UButton
color="gray" color="gray"
variant="ghost" variant="ghost"
...@@ -45,9 +47,30 @@ const props = defineProps({ ...@@ -45,9 +47,30 @@ const props = defineProps({
item: { item: {
type: Object, type: Object,
default: (() => {})() default: (() => {})()
},
isItem: {
type: Boolean,
default: false
}
})
const thread = computed(() => {
if (!props.isItem) return props.item
else {
const item = props.item
item.title = props.item.c_title
item.collections = []
if (props.item.collection_id && props.item.collection_name) {
item.collections = [
{
collection_id: props.item.collection_id,
collection_name: props.item.collection_name
}
]
}
return item
} }
}) })
function handleOpenSelect (id) { function handleOpenSelect () {
$openLibrarySelect(id) $openLibrarySelect(props.item.c_id)
} }
</script> </script>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
v-for="item in themesTagList" v-for="item in themesTagList"
:item="item" :item="item"
:key="item.id" :key="item.id"
is-item
/> />
</div> </div>
</div> </div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册