朋友圈

This commit is contained in:
2025-12-08 10:18:50 +08:00
parent 05a8422007
commit a9dfc56342
7 changed files with 72 additions and 27 deletions

View File

@@ -214,3 +214,6 @@ function viewAvatar() {

View File

@@ -63,7 +63,7 @@
<Avatar
:name="moment.user?.name || ''"
:avatar="moment.user?.avatar"
:size="48"
size="xl"
class="shrink-0"
/>
<div class="flex-1 min-w-0">
@@ -134,10 +134,21 @@
<!-- 点赞用户 -->
<div v-if="moment.likes && moment.likes.length > 0" class="mt-4 p-3 bg-white/5 rounded-xl">
<div class="flex items-center gap-2 text-sm">
<i class="fas fa-heart text-red-500"></i>
<span class="text-gray-400 line-clamp-1">
{{ moment.likes.map(l => l.user?.name).filter(Boolean).join('、') }}
</span>
<i class="fas fa-heart text-red-500 shrink-0"></i>
<div class="flex items-center gap-1 flex-wrap">
<template v-for="(like, idx) in moment.likes.slice(0, 8)" :key="like.id">
<Avatar
:name="like.user?.name || ''"
:avatar="like.user?.avatar"
size="sm"
class="shrink-0"
:title="like.user?.name"
/>
</template>
<span v-if="moment.likes.length > 8" class="text-gray-500 text-xs ml-1">
+{{ moment.likes.length - 8 }}
</span>
</div>
</div>
</div>
@@ -148,12 +159,20 @@
:key="comment.id"
class="flex items-start gap-2 p-2 bg-white/5 rounded-lg text-sm"
>
<span class="font-medium text-gray-300 shrink-0">{{ comment.user?.name }}</span>
<span v-if="comment.reply_to_user" class="text-gray-500 shrink-0">
回复 <span class="text-gray-400">{{ comment.reply_to_user.name }}</span>
</span>
<span class="text-gray-500">:</span>
<span class="text-gray-400 flex-1 break-words">{{ comment.content }}</span>
<Avatar
:name="comment.user?.name || ''"
:avatar="comment.user?.avatar"
size="sm"
class="shrink-0"
/>
<div class="flex-1 min-w-0">
<span class="font-medium text-gray-300">{{ comment.user?.name }}</span>
<span v-if="comment.reply_to_user" class="text-gray-500">
回复 <span class="text-gray-400">{{ comment.reply_to_user.name }}</span>
</span>
<span class="text-gray-500">: </span>
<span class="text-gray-400 break-words">{{ comment.content }}</span>
</div>
</div>
<!-- 展开更多评论 -->
<button
@@ -314,7 +333,7 @@ function closeCommentInput() {
}
async function handleComment() {
if (!commentingMoment.value || !commentText.trim() || commenting.value) return
if (!commentingMoment.value || !commentText.value.trim() || commenting.value) return
commenting.value = true
try {

View File

@@ -297,7 +297,7 @@ async function handlePublish() {
await momentStore.publishMoment(req)
emit('published')
} catch (error: any) {
toast.show(error.message || '发布失败', 'error')
toast.error(error.message || '发布失败')
} finally {
publishing.value = false
}
@@ -313,7 +313,7 @@ function handleImageSelect(e: Event) {
for (const file of toAdd) {
if (file.size > 10 * 1024 * 1024) {
toast.show('图片大小不能超过10MB', 'warning')
toast.warning('图片大小不能超过10MB')
continue
}
images.value.push({
@@ -343,7 +343,7 @@ function handleVideoSelect(e: Event) {
if (!file) return
if (file.size > 500 * 1024 * 1024) {
toast.show('视频大小不能超过500MB', 'warning')
toast.warning('视频大小不能超过500MB')
return
}

View File

@@ -310,7 +310,7 @@ async function handlePublish() {
await momentStore.publishMoment(req)
emit('published')
} catch (error: any) {
toast.show(error.message || '发布失败', 'error')
toast.error(error.message || '发布失败')
} finally {
publishing.value = false
}
@@ -326,7 +326,7 @@ function handleImageSelect(e: Event) {
for (const file of toAdd) {
if (file.size > 10 * 1024 * 1024) {
toast.show('图片大小不能超过10MB', 'warning')
toast.warning('图片大小不能超过10MB')
continue
}
images.value.push({
@@ -356,7 +356,7 @@ function handleVideoSelect(e: Event) {
if (!file) return
if (file.size > 500 * 1024 * 1024) {
toast.show('视频大小不能超过500MB', 'warning')
toast.warning('视频大小不能超过500MB')
return
}