mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-30 22:47:41 +08:00
feat: add base user avatar component
This commit is contained in:
@@ -44,7 +44,12 @@
|
||||
<div v-if="item.replyTo" class="reply-preview info-content-text">
|
||||
<div class="reply-header">
|
||||
<next class="reply-icon" />
|
||||
<BaseImage class="reply-avatar" :src="item.replyTo.sender.avatar" alt="avatar" />
|
||||
<BaseUserAvatar
|
||||
class="reply-avatar"
|
||||
:src="item.replyTo.sender.avatar"
|
||||
:user-id="item.replyTo.sender.id"
|
||||
:alt="item.replyTo.sender.username"
|
||||
/>
|
||||
<div class="reply-author">{{ item.replyTo.sender.username }}:</div>
|
||||
</div>
|
||||
<div class="reply-content" v-html="renderMarkdown(item.replyTo.content)"></div>
|
||||
@@ -121,6 +126,7 @@ import TimeManager from '~/utils/time'
|
||||
import BaseTimeline from '~/components/BaseTimeline.vue'
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import VueEasyLightbox from 'vue-easy-lightbox'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const route = useRoute()
|
||||
@@ -243,6 +249,7 @@ async function fetchMessages(page = 0) {
|
||||
const newMessages = pageData.content.reverse().map((item) => ({
|
||||
...item,
|
||||
src: item.sender.avatar,
|
||||
userId: item.sender.id,
|
||||
iconClick: () => {
|
||||
openUser(item.sender.id)
|
||||
},
|
||||
@@ -328,6 +335,7 @@ async function sendMessage(content, clearInput) {
|
||||
messages.value.push({
|
||||
...newMessage,
|
||||
src: newMessage.sender.avatar,
|
||||
userId: newMessage.sender.id,
|
||||
iconClick: () => {
|
||||
openUser(newMessage.sender.id)
|
||||
},
|
||||
@@ -403,6 +411,7 @@ const subscribeToConversation = () => {
|
||||
messages.value.push({
|
||||
...parsedMessage,
|
||||
src: parsedMessage.sender.avatar,
|
||||
userId: parsedMessage.sender.id,
|
||||
iconClick: () => openUser(parsedMessage.sender.id),
|
||||
})
|
||||
|
||||
@@ -686,6 +695,12 @@ function goBack() {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.reply-avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.reply-preview {
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
@click="goToConversation(convo.id)"
|
||||
>
|
||||
<div class="conversation-avatar">
|
||||
<BaseImage
|
||||
:src="getOtherParticipant(convo)?.avatar || '/default-avatar.svg'"
|
||||
<BaseUserAvatar
|
||||
:src="getOtherParticipant(convo)?.avatar"
|
||||
:user-id="getOtherParticipant(convo)?.id"
|
||||
:alt="getOtherParticipant(convo)?.username || '用户'"
|
||||
class="avatar-img"
|
||||
@error="handleAvatarError"
|
||||
:disable-link="true"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -130,6 +131,7 @@ import { stripMarkdownLength } from '~/utils/markdown'
|
||||
import SearchPersonDropdown from '~/components/SearchPersonDropdown.vue'
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import BaseTabs from '~/components/BaseTabs.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const conversations = ref([])
|
||||
@@ -431,6 +433,11 @@ function minimize() {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.avatar-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user