mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-07 07:30:54 +08:00
Compare commits
1 Commits
codex/crea
...
codex/crea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efbb83924b |
@@ -3,17 +3,18 @@
|
||||
<div class="timeline-item" v-for="(item, idx) in items" :key="idx">
|
||||
<div
|
||||
class="timeline-icon"
|
||||
:class="{ clickable: !!item.iconClick || hasLink(item) }"
|
||||
@click="onIconClick(item, $event)"
|
||||
:class="{ clickable: !!item.iconClick && !item.src }"
|
||||
@click="!item.src && item.iconClick && item.iconClick()"
|
||||
>
|
||||
<BaseUserAvatar
|
||||
v-if="item.src"
|
||||
:src="item.src"
|
||||
:class="['timeline-img', { 'is-clickable': !!item.iconClick }]"
|
||||
:user-id="item.userId"
|
||||
:to="item.avatarLink"
|
||||
class="timeline-img"
|
||||
alt="timeline item"
|
||||
:disable-link="!hasLink(item) || !!item.iconClick"
|
||||
:avatar="item.src"
|
||||
:username="item.userName || item.username"
|
||||
:width="32"
|
||||
:link="!item.iconClick"
|
||||
@click.stop="item.iconClick && item.iconClick()"
|
||||
/>
|
||||
<component
|
||||
v-else-if="item.icon && (typeof item.icon !== 'string' || !item.icon.includes(' '))"
|
||||
@@ -30,28 +31,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
export default {
|
||||
name: 'BaseTimeline',
|
||||
components: { BaseUserAvatar },
|
||||
props: {
|
||||
items: { type: Array, default: () => [] },
|
||||
},
|
||||
methods: {
|
||||
hasLink(item) {
|
||||
if (!item) return false
|
||||
if (item.avatarLink) return true
|
||||
const id = item?.userId
|
||||
return id !== undefined && id !== null && id !== ''
|
||||
},
|
||||
onIconClick(item, event) {
|
||||
if (item && item.iconClick) {
|
||||
event.preventDefault()
|
||||
item.iconClick()
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -89,14 +73,12 @@ export default {
|
||||
}
|
||||
|
||||
.timeline-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.timeline-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
.timeline-img.is-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.timeline-emoji {
|
||||
|
||||
@@ -1,23 +1,7 @@
|
||||
<template>
|
||||
<NuxtLink
|
||||
v-if="isLink"
|
||||
:to="resolvedLink"
|
||||
class="base-user-avatar"
|
||||
:class="wrapperClass"
|
||||
:style="wrapperStyle"
|
||||
v-bind="wrapperAttrs"
|
||||
>
|
||||
<img :src="currentSrc" :alt="altText" class="base-user-avatar-img" @error="onError" />
|
||||
</NuxtLink>
|
||||
<div
|
||||
v-else
|
||||
class="base-user-avatar"
|
||||
:class="wrapperClass"
|
||||
:style="wrapperStyle"
|
||||
v-bind="wrapperAttrs"
|
||||
>
|
||||
<img :src="currentSrc" :alt="altText" class="base-user-avatar-img" @error="onError" />
|
||||
</div>
|
||||
<component :is="wrapperTag" v-bind="wrapperAttrs" :class="containerClass" :style="mergedStyle">
|
||||
<BaseImage :src="currentSrc" :alt="altText" class="base-user-avatar-img" @error="handleError" />
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -29,77 +13,79 @@ const DEFAULT_AVATAR = '/default-avatar.svg'
|
||||
const props = defineProps({
|
||||
userId: {
|
||||
type: [String, Number],
|
||||
default: null,
|
||||
required: true,
|
||||
},
|
||||
src: {
|
||||
avatar: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
alt: {
|
||||
username: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
default: 40,
|
||||
},
|
||||
rounded: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
disableLink: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
to: {
|
||||
alt: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
link: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
|
||||
const attrs = useAttrs()
|
||||
|
||||
const currentSrc = ref(props.src || DEFAULT_AVATAR)
|
||||
const currentSrc = ref(props.avatar || DEFAULT_AVATAR)
|
||||
|
||||
watch(
|
||||
() => props.src,
|
||||
(value) => {
|
||||
currentSrc.value = value || DEFAULT_AVATAR
|
||||
() => props.avatar,
|
||||
(newVal) => {
|
||||
currentSrc.value = newVal || DEFAULT_AVATAR
|
||||
},
|
||||
)
|
||||
|
||||
const resolvedLink = computed(() => {
|
||||
if (props.to) return props.to
|
||||
if (props.userId !== null && props.userId !== undefined && props.userId !== '') {
|
||||
return `/users/${props.userId}`
|
||||
}
|
||||
return null
|
||||
})
|
||||
|
||||
const isLink = computed(() => !props.disableLink && Boolean(resolvedLink.value))
|
||||
|
||||
const altText = computed(() => props.alt || '用户头像')
|
||||
|
||||
const wrapperTag = computed(() => (props.link ? 'NuxtLink' : 'div'))
|
||||
const sizeStyle = computed(() => {
|
||||
if (!props.width && props.width !== 0) return null
|
||||
const value = typeof props.width === 'number' ? `${props.width}px` : props.width
|
||||
if (!value) return null
|
||||
return { width: value, height: value }
|
||||
const value = typeof props.width === 'number' ? `${props.width}px` : props.width || '40px'
|
||||
return {
|
||||
width: value,
|
||||
height: value,
|
||||
}
|
||||
})
|
||||
|
||||
const wrapperStyle = computed(() => {
|
||||
const attrStyle = attrs.style
|
||||
return [sizeStyle.value, attrStyle]
|
||||
const altText = computed(() => {
|
||||
if (props.alt) return props.alt
|
||||
if (props.username) return `${props.username}的头像`
|
||||
return '用户头像'
|
||||
})
|
||||
|
||||
const wrapperClass = computed(() => [attrs.class, { 'is-rounded': props.rounded }])
|
||||
const containerClass = computed(() => {
|
||||
const classes = ['base-user-avatar']
|
||||
if (props.link) classes.push('is-link')
|
||||
if (attrs.class) classes.push(attrs.class)
|
||||
return classes
|
||||
})
|
||||
|
||||
const mergedStyle = computed(() => {
|
||||
if (!attrs.style) return sizeStyle.value
|
||||
return [sizeStyle.value, attrs.style]
|
||||
})
|
||||
|
||||
const wrapperAttrs = computed(() => {
|
||||
const { class: _class, style: _style, ...rest } = attrs
|
||||
if (props.link) {
|
||||
return {
|
||||
...rest,
|
||||
to: `/users/${props.userId}`,
|
||||
}
|
||||
}
|
||||
return rest
|
||||
})
|
||||
|
||||
function onError() {
|
||||
function handleError() {
|
||||
if (currentSrc.value !== DEFAULT_AVATAR) {
|
||||
currentSrc.value = DEFAULT_AVATAR
|
||||
}
|
||||
@@ -111,21 +97,19 @@ function onError() {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
background-color: var(--avatar-placeholder-color, #f0f0f0);
|
||||
}
|
||||
|
||||
.base-user-avatar.is-rounded {
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
background-color: var(--avatar-background, rgba(0, 0, 0, 0.05));
|
||||
}
|
||||
|
||||
.base-user-avatar:not(.is-rounded) {
|
||||
border-radius: 0;
|
||||
.base-user-avatar.is-link {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.base-user-avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,14 @@
|
||||
<next class="reply-icon" />
|
||||
<span class="reply-info">
|
||||
<BaseUserAvatar
|
||||
v-if="comment.parentUserName"
|
||||
class="reply-avatar"
|
||||
:src="comment.parentUserAvatar"
|
||||
:user-id="comment.parentUserId"
|
||||
:alt="comment.parentUserName"
|
||||
:disable-link="!comment.parentUserId"
|
||||
:avatar="comment.parentUserAvatar"
|
||||
:username="comment.parentUserName"
|
||||
:width="20"
|
||||
:link="Boolean(comment.parentUserId)"
|
||||
@click="comment.parentUserClick && comment.parentUserClick()"
|
||||
/>
|
||||
<span class="reply-user-name">{{ comment.parentUserName }}</span>
|
||||
</span>
|
||||
@@ -112,7 +115,6 @@ import BaseTimeline from '~/components/BaseTimeline.vue'
|
||||
import CommentEditor from '~/components/CommentEditor.vue'
|
||||
import DropdownMenu from '~/components/DropdownMenu.vue'
|
||||
import ReactionsGroup from '~/components/ReactionsGroup.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
const config = useRuntimeConfig()
|
||||
const API_BASE_URL = config.public.apiBaseUrl
|
||||
|
||||
@@ -255,6 +257,7 @@ const submitReply = async (parentUserName, text, clear) => {
|
||||
replyList.push({
|
||||
id: data.id,
|
||||
userName: data.author.username,
|
||||
userId: data.author.id,
|
||||
time: TimeManager.format(data.createdAt),
|
||||
avatar: data.author.avatar,
|
||||
medal: data.author.displayMedal,
|
||||
@@ -266,6 +269,7 @@ const submitReply = async (parentUserName, text, clear) => {
|
||||
reply: (data.replies || []).map((r) => ({
|
||||
id: r.id,
|
||||
userName: r.author.username,
|
||||
userId: r.author.id,
|
||||
time: TimeManager.format(r.createdAt),
|
||||
avatar: r.author.avatar,
|
||||
text: r.content,
|
||||
@@ -273,12 +277,10 @@ const submitReply = async (parentUserName, text, clear) => {
|
||||
reply: [],
|
||||
openReplies: false,
|
||||
src: r.author.avatar,
|
||||
userId: r.author.id,
|
||||
iconClick: () => navigateTo(`/users/${r.author.id}`),
|
||||
})),
|
||||
openReplies: false,
|
||||
src: data.author.avatar,
|
||||
userId: data.author.id,
|
||||
iconClick: () => navigateTo(`/users/${data.author.id}`),
|
||||
})
|
||||
clear()
|
||||
@@ -399,9 +401,7 @@ const handleContentClick = (e) => {
|
||||
.reply-avatar {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.reply-icon {
|
||||
|
||||
@@ -73,10 +73,10 @@
|
||||
<BaseUserAvatar
|
||||
class="avatar-img"
|
||||
:user-id="authState.userId"
|
||||
:src="avatar"
|
||||
alt="avatar"
|
||||
:avatar="avatar"
|
||||
:username="authState.username"
|
||||
:width="32"
|
||||
:disable-link="true"
|
||||
:link="false"
|
||||
/>
|
||||
<down />
|
||||
</div>
|
||||
@@ -100,7 +100,6 @@ import { computed, nextTick, ref, watch } from 'vue'
|
||||
import DropdownMenu from '~/components/DropdownMenu.vue'
|
||||
import ToolTip from '~/components/ToolTip.vue'
|
||||
import SearchDropdown from '~/components/SearchDropdown.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import { authState, clearToken, loadCurrentUser } from '~/utils/auth'
|
||||
import { useUnreadCount } from '~/composables/useUnreadCount'
|
||||
import { useChannelsUnreadCount } from '~/composables/useChannelsUnreadCount'
|
||||
@@ -442,7 +441,6 @@ onMounted(async () => {
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
background-color: lightgray;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.dropdown-icon {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<BaseUserAvatar
|
||||
v-if="log.userAvatar"
|
||||
class="change-log-avatar"
|
||||
:src="log.userAvatar"
|
||||
:to="log.username ? `/users/${log.username}` : ''"
|
||||
alt="avatar"
|
||||
:disable-link="!log.username"
|
||||
:user-id="log.userId"
|
||||
:avatar="log.userAvatar"
|
||||
:username="log.username"
|
||||
:width="20"
|
||||
/>
|
||||
<span v-if="log.username" class="change-log-user">{{ log.username }}</span>
|
||||
<span v-if="log.type === 'CONTENT'" class="change-log-content">变更了文章内容</span>
|
||||
@@ -56,8 +56,8 @@
|
||||
import { computed } from 'vue'
|
||||
import { html } from 'diff2html'
|
||||
import { createTwoFilesPatch } from 'diff'
|
||||
import { useIsMobile } from '~/utils/screen'
|
||||
import 'diff2html/bundles/css/diff2html.min.css'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import { themeState } from '~/utils/theme'
|
||||
import ArticleCategory from '~/components/ArticleCategory.vue'
|
||||
import ArticleTags from '~/components/ArticleTags.vue'
|
||||
@@ -134,12 +134,6 @@ const diffHtml = computed(() => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.change-log-avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.change-log-time {
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
|
||||
@@ -58,8 +58,9 @@
|
||||
:key="p.id"
|
||||
class="prize-member-avatar"
|
||||
:user-id="p.id"
|
||||
:src="p.avatar"
|
||||
alt="avatar"
|
||||
:avatar="p.avatar"
|
||||
:username="p.username"
|
||||
:width="30"
|
||||
/>
|
||||
<div v-if="lotteryEnded && lotteryWinners.length" class="prize-member-winner">
|
||||
<medal-one class="medal-icon"></medal-one>
|
||||
@@ -69,8 +70,9 @@
|
||||
:key="w.id"
|
||||
class="prize-member-avatar"
|
||||
:user-id="w.id"
|
||||
:src="w.avatar"
|
||||
alt="avatar"
|
||||
:avatar="w.avatar"
|
||||
:username="w.username"
|
||||
:width="30"
|
||||
/>
|
||||
<div v-if="lotteryWinners.length === 1" class="prize-member-winner-name">
|
||||
{{ lotteryWinners[0].username }}
|
||||
@@ -87,7 +89,6 @@ import { toast } from '~/main'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { useIsMobile } from '~/utils/screen'
|
||||
import { useCountdown } from '~/composables/useCountdown'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
const props = defineProps({
|
||||
lottery: { type: Object, required: true },
|
||||
@@ -245,16 +246,9 @@ const joinLottery = async () => {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-left: 3px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.prize-member-avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.prize-member-winner {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
:key="p.id"
|
||||
class="poll-participant-avatar"
|
||||
:user-id="p.id"
|
||||
:src="p.avatar"
|
||||
alt="avatar"
|
||||
:avatar="p.avatar"
|
||||
:username="p.username"
|
||||
:width="30"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +120,6 @@ import { getToken, authState } from '~/utils/auth'
|
||||
import { toast } from '~/main'
|
||||
import { useRuntimeConfig } from '#imports'
|
||||
import { useCountdown } from '~/composables/useCountdown'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
const props = defineProps({
|
||||
poll: { type: Object, required: true },
|
||||
@@ -425,13 +425,6 @@ const submitMultiPoll = async () => {
|
||||
.poll-participant-avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.poll-participant-avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
<template #option="{ option }">
|
||||
<div class="search-option-item">
|
||||
<BaseUserAvatar
|
||||
:src="option.avatar"
|
||||
:user-id="option.id"
|
||||
:alt="option.username"
|
||||
class="avatar"
|
||||
:disable-link="true"
|
||||
:user-id="option.id"
|
||||
:avatar="option.avatar"
|
||||
:username="option.username"
|
||||
:width="32"
|
||||
:link="false"
|
||||
/>
|
||||
<div class="result-body">
|
||||
<div class="result-main" v-html="highlight(option.username)"></div>
|
||||
@@ -51,7 +52,6 @@ import Dropdown from '~/components/Dropdown.vue'
|
||||
import { stripMarkdown } from '~/utils/markdown'
|
||||
import { useIsMobile } from '~/utils/screen'
|
||||
import { getToken } from '~/utils/auth'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
const config = useRuntimeConfig()
|
||||
const API_BASE_URL = config.public.apiBaseUrl
|
||||
|
||||
@@ -177,14 +177,6 @@ defineExpose({
|
||||
.avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.result-body {
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
<div class="user-list">
|
||||
<BasePlaceholder v-if="users.length === 0" text="暂无用户" icon="inbox" />
|
||||
<div v-for="u in users" :key="u.id" class="user-item" @click="handleUserClick(u)">
|
||||
<BaseUserAvatar :src="u.avatar" :user-id="u.id" alt="avatar" class="user-avatar" />
|
||||
<BaseUserAvatar
|
||||
class="user-avatar"
|
||||
:user-id="u.id"
|
||||
:avatar="u.avatar"
|
||||
:username="u.username"
|
||||
:width="50"
|
||||
:link="false"
|
||||
/>
|
||||
<div class="user-info">
|
||||
<div class="user-name">{{ u.username }}</div>
|
||||
<div v-if="u.introduction" class="user-intro">{{ u.introduction }}</div>
|
||||
@@ -13,7 +20,6 @@
|
||||
|
||||
<script setup>
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
|
||||
defineProps({
|
||||
users: { type: Array, default: () => [] },
|
||||
@@ -42,15 +48,8 @@ const handleUserClick = (user) => {
|
||||
.user-avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.user-avatar :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -85,20 +85,15 @@
|
||||
</div>
|
||||
|
||||
<div class="article-member-avatars-container">
|
||||
<NuxtLink
|
||||
<BaseUserAvatar
|
||||
v-for="member in article.members"
|
||||
:key="`${article.id}-${member.id}`"
|
||||
class="article-member-avatar-item"
|
||||
:to="`/users/${member.id}`"
|
||||
>
|
||||
<BaseUserAvatar
|
||||
class="article-member-avatar-item-img"
|
||||
:src="member.avatar"
|
||||
:user-id="member.id"
|
||||
alt="avatar"
|
||||
:disable-link="true"
|
||||
/>
|
||||
</NuxtLink>
|
||||
:user-id="member.id"
|
||||
:avatar="member.avatar"
|
||||
:username="member.username"
|
||||
:width="25"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="article-comments main-info-text">
|
||||
@@ -144,7 +139,6 @@ import InfiniteLoadMore from '~/components/InfiniteLoadMore.vue'
|
||||
import { getToken } from '~/utils/auth'
|
||||
import { stripMarkdown } from '~/utils/markdown'
|
||||
import { useIsMobile } from '~/utils/screen'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import TimeManager from '~/utils/time'
|
||||
import { selectedCategoryGlobal, selectedTagsGlobal } from '~/composables/postFilter'
|
||||
useHead({
|
||||
@@ -298,7 +292,11 @@ const {
|
||||
description: p.content,
|
||||
category: p.category,
|
||||
tags: p.tags || [],
|
||||
members: (p.participants || []).map((m) => ({ id: m.id, avatar: m.avatar })),
|
||||
members: (p.participants || []).map((m) => ({
|
||||
id: m.id,
|
||||
avatar: m.avatar,
|
||||
username: m.username,
|
||||
})),
|
||||
comments: p.commentCount,
|
||||
views: p.views,
|
||||
rssExcluded: p.rssExcluded || false,
|
||||
@@ -340,7 +338,11 @@ const fetchNextPage = async () => {
|
||||
description: p.content,
|
||||
category: p.category,
|
||||
tags: p.tags || [],
|
||||
members: (p.participants || []).map((m) => ({ id: m.id, avatar: m.avatar })),
|
||||
members: (p.participants || []).map((m) => ({
|
||||
id: m.id,
|
||||
avatar: m.avatar,
|
||||
username: m.username,
|
||||
})),
|
||||
comments: p.commentCount,
|
||||
views: p.views,
|
||||
rssExcluded: p.rssExcluded || false,
|
||||
@@ -637,19 +639,7 @@ watch([selectedCategory, selectedTags], ([newCategory, newTags]) => {
|
||||
.article-member-avatar-item {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.article-member-avatar-item-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.article-member-avatar-item-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.placeholder-container {
|
||||
|
||||
@@ -46,9 +46,10 @@
|
||||
<next class="reply-icon" />
|
||||
<BaseUserAvatar
|
||||
class="reply-avatar"
|
||||
:src="item.replyTo.sender.avatar"
|
||||
:user-id="item.replyTo.sender.id"
|
||||
:alt="item.replyTo.sender.username"
|
||||
:avatar="item.replyTo.sender.avatar"
|
||||
:username="item.replyTo.sender.username"
|
||||
:width="20"
|
||||
/>
|
||||
<div class="reply-author">{{ item.replyTo.sender.username }}:</div>
|
||||
</div>
|
||||
@@ -126,7 +127,6 @@ 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()
|
||||
@@ -248,8 +248,9 @@ async function fetchMessages(page = 0) {
|
||||
|
||||
const newMessages = pageData.content.reverse().map((item) => ({
|
||||
...item,
|
||||
src: item.sender.avatar,
|
||||
userId: item.sender.id,
|
||||
userName: item.sender.username,
|
||||
src: item.sender.avatar,
|
||||
iconClick: () => {
|
||||
openUser(item.sender.id)
|
||||
},
|
||||
@@ -334,8 +335,9 @@ async function sendMessage(content, clearInput) {
|
||||
const newMessage = await response.json()
|
||||
messages.value.push({
|
||||
...newMessage,
|
||||
src: newMessage.sender.avatar,
|
||||
userId: newMessage.sender.id,
|
||||
userName: newMessage.sender.username,
|
||||
src: newMessage.sender.avatar,
|
||||
iconClick: () => {
|
||||
openUser(newMessage.sender.id)
|
||||
},
|
||||
@@ -410,8 +412,9 @@ const subscribeToConversation = () => {
|
||||
|
||||
messages.value.push({
|
||||
...parsedMessage,
|
||||
src: parsedMessage.sender.avatar,
|
||||
userId: parsedMessage.sender.id,
|
||||
userName: parsedMessage.sender.username,
|
||||
src: parsedMessage.sender.avatar,
|
||||
iconClick: () => openUser(parsedMessage.sender.id),
|
||||
})
|
||||
|
||||
@@ -695,12 +698,6 @@ 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;
|
||||
|
||||
@@ -34,11 +34,22 @@
|
||||
>
|
||||
<div class="conversation-avatar">
|
||||
<BaseUserAvatar
|
||||
:src="getOtherParticipant(convo)?.avatar"
|
||||
:user-id="getOtherParticipant(convo)?.id"
|
||||
:alt="getOtherParticipant(convo)?.username || '用户'"
|
||||
v-if="getOtherParticipant(convo)"
|
||||
class="avatar-img"
|
||||
:disable-link="true"
|
||||
:user-id="getOtherParticipant(convo).id"
|
||||
:avatar="getOtherParticipant(convo).avatar"
|
||||
:username="getOtherParticipant(convo).username"
|
||||
:width="40"
|
||||
@click.stop
|
||||
/>
|
||||
<BaseUserAvatar
|
||||
v-else
|
||||
class="avatar-img"
|
||||
:user-id="convo.id"
|
||||
:avatar="''"
|
||||
username="用户"
|
||||
:width="40"
|
||||
:link="false"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -131,7 +142,6 @@ 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([])
|
||||
@@ -435,12 +445,6 @@ function minimize() {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.avatar-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.conversation-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
@@ -46,16 +46,14 @@
|
||||
</div>
|
||||
|
||||
<div class="info-content-container author-info-container">
|
||||
<div class="user-avatar-container" @click="gotoProfile">
|
||||
<div class="user-avatar-item">
|
||||
<BaseUserAvatar
|
||||
class="user-avatar-item-img"
|
||||
:src="author.avatar"
|
||||
:user-id="author.id"
|
||||
alt="avatar"
|
||||
:disable-link="true"
|
||||
/>
|
||||
</div>
|
||||
<div class="user-avatar-container">
|
||||
<BaseUserAvatar
|
||||
class="user-avatar-item"
|
||||
:user-id="author.id"
|
||||
:avatar="author.avatar"
|
||||
:username="author.username"
|
||||
:width="50"
|
||||
/>
|
||||
<div v-if="isMobile" class="info-content-header">
|
||||
<div class="user-name">
|
||||
{{ author.username }}
|
||||
@@ -199,7 +197,6 @@ import ReactionsGroup from '~/components/ReactionsGroup.vue'
|
||||
import DropdownMenu from '~/components/DropdownMenu.vue'
|
||||
import PostLottery from '~/components/PostLottery.vue'
|
||||
import PostPoll from '~/components/PostPoll.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import { renderMarkdown, handleMarkdownClick, stripMarkdownLength } from '~/utils/markdown'
|
||||
import { getMedalTitle } from '~/utils/medal'
|
||||
import { toast } from '~/main'
|
||||
@@ -348,6 +345,7 @@ const mapComment = (
|
||||
parentUserName: parentUserName,
|
||||
parentUserAvatar: parentUserAvatar,
|
||||
parentUserId: parentUserId,
|
||||
parentUserClick: parentUserId ? () => navigateTo(`/users/${parentUserId}`) : null,
|
||||
})
|
||||
|
||||
const changeLogIcon = (l) => {
|
||||
@@ -386,6 +384,7 @@ const mapChangeLog = (l) => ({
|
||||
id: l.id,
|
||||
kind: 'log',
|
||||
username: l.username,
|
||||
userId: l.userId ?? l.username,
|
||||
userAvatar: l.userAvatar,
|
||||
type: l.type,
|
||||
createdAt: l.time,
|
||||
@@ -870,10 +869,6 @@ const jumpToHashComment = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const gotoProfile = () => {
|
||||
navigateTo(`/users/${author.value.id}`, { replace: true })
|
||||
}
|
||||
|
||||
const initPage = async () => {
|
||||
scrollTo(0, 0)
|
||||
await fetchTimeline()
|
||||
@@ -967,6 +962,8 @@ onMounted(async () => {
|
||||
.user-avatar-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.scroller-middle {
|
||||
@@ -1179,24 +1176,13 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.user-avatar-container {
|
||||
cursor: pointer;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.user-avatar-item {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.user-avatar-item-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.user-avatar-item-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-content {
|
||||
|
||||
@@ -15,13 +15,7 @@
|
||||
<div class="avatar-row">
|
||||
<!-- label 充当点击区域,内部隐藏 input -->
|
||||
<label class="avatar-container">
|
||||
<BaseUserAvatar
|
||||
:src="avatar"
|
||||
:user-id="userId"
|
||||
alt="avatar"
|
||||
class="avatar-preview"
|
||||
:disable-link="true"
|
||||
/>
|
||||
<BaseImage :src="avatar" class="avatar-preview" alt="avatar" />
|
||||
<!-- 半透明蒙层:hover 时出现 -->
|
||||
<div class="avatar-overlay">更换头像</div>
|
||||
<input type="file" class="avatar-input" accept="image/*" @change="onAvatarChange" />
|
||||
@@ -80,7 +74,6 @@ import AvatarCropper from '~/components/AvatarCropper.vue'
|
||||
import BaseInput from '~/components/BaseInput.vue'
|
||||
import Dropdown from '~/components/Dropdown.vue'
|
||||
import BaseSwitch from '~/components/BaseSwitch.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import { toast } from '~/main'
|
||||
import { fetchCurrentUser, getToken, setToken } from '~/utils/auth'
|
||||
import { frostedState, setFrosted } from '~/utils/frosted'
|
||||
@@ -94,7 +87,6 @@ const avatarFile = ref(null)
|
||||
const tempAvatar = ref('')
|
||||
const showCropper = ref(false)
|
||||
const role = ref('')
|
||||
const userId = ref(null)
|
||||
const publishMode = ref('DIRECT')
|
||||
const passwordStrength = ref('LOW')
|
||||
const aiFormatLimit = ref(3)
|
||||
@@ -111,7 +103,6 @@ onMounted(async () => {
|
||||
username.value = user.username
|
||||
introduction.value = user.introduction || ''
|
||||
avatar.value = user.avatar
|
||||
userId.value = user.id
|
||||
role.value = user.role
|
||||
if (role.value === 'ADMIN') {
|
||||
loadAdminConfig()
|
||||
@@ -280,11 +271,6 @@ const save = async () => {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 40px;
|
||||
}
|
||||
|
||||
.avatar-preview :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
<div class="profile-page-header">
|
||||
<div class="profile-page-header-avatar">
|
||||
<BaseUserAvatar
|
||||
:src="user.avatar"
|
||||
:user-id="user.id"
|
||||
alt="avatar"
|
||||
class="profile-page-header-avatar-img"
|
||||
:user-id="user.id"
|
||||
:avatar="user.avatar"
|
||||
:username="user.username"
|
||||
:width="200"
|
||||
/>
|
||||
</div>
|
||||
<div class="profile-page-header-user-info">
|
||||
@@ -277,7 +278,6 @@ import LevelProgress from '~/components/LevelProgress.vue'
|
||||
import TimelineCommentGroup from '~/components/TimelineCommentGroup.vue'
|
||||
import TimelinePostItem from '~/components/TimelinePostItem.vue'
|
||||
import TimelineTagItem from '~/components/TimelineTagItem.vue'
|
||||
import BaseUserAvatar from '~/components/BaseUserAvatar.vue'
|
||||
import UserList from '~/components/UserList.vue'
|
||||
import { toast } from '~/main'
|
||||
import { authState, getToken } from '~/utils/auth'
|
||||
@@ -657,13 +657,6 @@ watch(selectedTab, async (val) => {
|
||||
.profile-page-header-avatar-img {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.profile-page-header-avatar-img :deep(.base-user-avatar-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.profile-page-header-user-info {
|
||||
@@ -1091,7 +1084,6 @@ watch(selectedTab, async (val) => {
|
||||
.profile-page-header-avatar-img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
:deep(.base-tabs-item) {
|
||||
|
||||
@@ -199,6 +199,8 @@ function createFetchNotifications() {
|
||||
arr.push({
|
||||
...n,
|
||||
src: n.comment.author.avatar,
|
||||
userId: n.comment.author.id,
|
||||
userName: n.comment.author.username,
|
||||
iconClick: () => {
|
||||
markNotificationRead(n.id)
|
||||
navigateTo(`/users/${n.comment.author.id}`, { replace: true })
|
||||
@@ -219,6 +221,8 @@ function createFetchNotifications() {
|
||||
arr.push({
|
||||
...n,
|
||||
src: n.fromUser ? n.fromUser.avatar : null,
|
||||
userId: n.fromUser ? n.fromUser.id : undefined,
|
||||
userName: n.fromUser ? n.fromUser.username : undefined,
|
||||
icon: n.fromUser ? undefined : iconMap[n.type],
|
||||
iconClick: () => {
|
||||
if (n.fromUser) {
|
||||
@@ -231,6 +235,8 @@ function createFetchNotifications() {
|
||||
arr.push({
|
||||
...n,
|
||||
src: n.fromUser ? n.fromUser.avatar : null,
|
||||
userId: n.fromUser ? n.fromUser.id : undefined,
|
||||
userName: n.fromUser ? n.fromUser.username : undefined,
|
||||
icon: n.fromUser ? undefined : iconMap[n.type],
|
||||
iconClick: () => {
|
||||
if (n.fromUser) {
|
||||
@@ -269,6 +275,8 @@ function createFetchNotifications() {
|
||||
arr.push({
|
||||
...n,
|
||||
src: n.comment.author.avatar,
|
||||
userId: n.comment.author.id,
|
||||
userName: n.comment.author.username,
|
||||
iconClick: () => {
|
||||
markNotificationRead(n.id)
|
||||
navigateTo(`/users/${n.comment.author.id}`, { replace: true })
|
||||
@@ -315,6 +323,8 @@ function createFetchNotifications() {
|
||||
arr.push({
|
||||
...n,
|
||||
src: n.fromUser ? n.fromUser.avatar : null,
|
||||
userId: n.fromUser ? n.fromUser.id : undefined,
|
||||
userName: n.fromUser ? n.fromUser.username : undefined,
|
||||
icon: n.fromUser ? undefined : iconMap[n.type],
|
||||
iconClick: () => {
|
||||
if (n.post) {
|
||||
|
||||
Reference in New Issue
Block a user