mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-28 00:50:46 +08:00
Compare commits
6 Commits
codex/crea
...
codex/impr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
229439aa05 | ||
|
|
6e4fbc3c42 | ||
|
|
779264623c | ||
|
|
a1eccb3b1e | ||
|
|
0f75a95dbe | ||
|
|
efbb83924b |
@@ -1,28 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-if="isLink"
|
|
||||||
:to="resolvedLink"
|
:to="resolvedLink"
|
||||||
class="base-user-avatar"
|
class="base-user-avatar"
|
||||||
:class="wrapperClass"
|
:class="wrapperClass"
|
||||||
:style="wrapperStyle"
|
:style="wrapperStyle"
|
||||||
v-bind="wrapperAttrs"
|
v-bind="wrapperAttrs"
|
||||||
>
|
>
|
||||||
<img :src="currentSrc" :alt="altText" class="base-user-avatar-img" @error="onError" />
|
<BaseImage :src="currentSrc" :alt="altText" class="base-user-avatar-img" @error="onError" />
|
||||||
</NuxtLink>
|
</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>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { useAttrs } from 'vue'
|
import { useAttrs } from 'vue'
|
||||||
|
import BaseImage from './BaseImage.vue'
|
||||||
|
|
||||||
const DEFAULT_AVATAR = '/default-avatar.svg'
|
const DEFAULT_AVATAR = '/default-avatar.svg'
|
||||||
|
|
||||||
@@ -76,8 +67,6 @@ const resolvedLink = computed(() => {
|
|||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
const isLink = computed(() => !props.disableLink && Boolean(resolvedLink.value))
|
|
||||||
|
|
||||||
const altText = computed(() => props.alt || '用户头像')
|
const altText = computed(() => props.alt || '用户头像')
|
||||||
|
|
||||||
const sizeStyle = computed(() => {
|
const sizeStyle = computed(() => {
|
||||||
@@ -108,11 +97,33 @@ function onError() {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.base-user-avatar {
|
.base-user-avatar {
|
||||||
|
--base-avatar-ring-width: var(--avatar-ring-width, 1.5px);
|
||||||
|
--base-avatar-ring: var(--avatar-ring, linear-gradient(135deg, #6366f1, #ec4899));
|
||||||
|
--base-avatar-surface: var(
|
||||||
|
--avatar-surface,
|
||||||
|
var(--avatar-placeholder-color, rgba(255, 255, 255, 0.88))
|
||||||
|
);
|
||||||
|
--base-avatar-shadow: var(--avatar-shadow, 0 12px 30px -18px rgba(15, 23, 42, 0.55));
|
||||||
|
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: var(--avatar-placeholder-color, #f0f0f0);
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: inherit;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: var(--base-avatar-ring-width) solid transparent;
|
||||||
|
background:
|
||||||
|
var(--base-avatar-surface) padding-box,
|
||||||
|
var(--base-avatar-ring) border-box;
|
||||||
|
background-clip: padding-box, border-box;
|
||||||
|
background-origin: border-box;
|
||||||
|
box-shadow: var(--base-avatar-shadow);
|
||||||
|
transition:
|
||||||
|
transform 0.25s ease,
|
||||||
|
box-shadow 0.25s ease,
|
||||||
|
filter 0.25s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.base-user-avatar.is-rounded {
|
.base-user-avatar.is-rounded {
|
||||||
@@ -120,7 +131,7 @@ function onError() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.base-user-avatar:not(.is-rounded) {
|
.base-user-avatar:not(.is-rounded) {
|
||||||
border-radius: 0;
|
border-radius: var(--avatar-square-radius, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.base-user-avatar-img {
|
.base-user-avatar-img {
|
||||||
@@ -128,5 +139,51 @@ function onError() {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
display: block;
|
display: block;
|
||||||
|
border-radius: inherit;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
transition:
|
||||||
|
transform 0.25s ease,
|
||||||
|
filter 0.25s ease;
|
||||||
|
backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:hover,
|
||||||
|
.base-user-avatar:focus-visible {
|
||||||
|
transform: translateY(-1px) scale(1.02);
|
||||||
|
box-shadow: 0 18px 35px -20px rgba(15, 23, 42, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:focus-visible {
|
||||||
|
outline: 2px solid rgba(96, 165, 250, 0.6);
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:active {
|
||||||
|
transform: translateY(0) scale(0.99);
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:hover .base-user-avatar-img,
|
||||||
|
.base-user-avatar:focus-visible .base-user-avatar-img {
|
||||||
|
transform: scale(1.03);
|
||||||
|
filter: saturate(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.base-user-avatar,
|
||||||
|
.base-user-avatar-img {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:hover,
|
||||||
|
.base-user-avatar:focus-visible,
|
||||||
|
.base-user-avatar:active {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-user-avatar:hover .base-user-avatar-img,
|
||||||
|
.base-user-avatar:focus-visible .base-user-avatar-img {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="user-list">
|
<div class="user-list">
|
||||||
<BasePlaceholder v-if="users.length === 0" text="暂无用户" icon="inbox" />
|
<BasePlaceholder v-if="users.length === 0" text="暂无用户" icon="inbox" />
|
||||||
<div v-for="u in users" :key="u.id" class="user-item" @click="handleUserClick(u)">
|
<div v-for="u in users" :key="u.id" class="user-item">
|
||||||
<BaseUserAvatar :src="u.avatar" :user-id="u.id" alt="avatar" class="user-avatar" />
|
<BaseUserAvatar :src="u.avatar" :user-id="u.id" alt="avatar" class="user-avatar" />
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div class="user-name">{{ u.username }}</div>
|
<div class="user-name">{{ u.username }}</div>
|
||||||
|
|||||||
@@ -85,20 +85,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="article-member-avatars-container">
|
<div class="article-member-avatars-container">
|
||||||
<NuxtLink
|
<div v-for="member in article.members">
|
||||||
v-for="member in article.members"
|
|
||||||
:key="`${article.id}-${member.id}`"
|
|
||||||
class="article-member-avatar-item"
|
|
||||||
:to="`/users/${member.id}`"
|
|
||||||
>
|
|
||||||
<BaseUserAvatar
|
<BaseUserAvatar
|
||||||
class="article-member-avatar-item-img"
|
class="article-member-avatar-item-img"
|
||||||
:src="member.avatar"
|
:src="member.avatar"
|
||||||
:user-id="member.id"
|
:user-id="member.id"
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
:disable-link="true"
|
:disable-link="true"
|
||||||
|
:width="25"
|
||||||
/>
|
/>
|
||||||
</NuxtLink>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="article-comments main-info-text">
|
<div class="article-comments main-info-text">
|
||||||
@@ -634,13 +630,6 @@ watch([selectedCategory, selectedTags], ([newCategory, newTags]) => {
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-member-avatar-item {
|
|
||||||
width: 25px;
|
|
||||||
height: 25px;
|
|
||||||
border-radius: 50%;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-member-avatar-item-img {
|
.article-member-avatar-item-img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -703,6 +692,7 @@ watch([selectedCategory, selectedTags], ([newCategory, newTags]) => {
|
|||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
gap: 0px;
|
gap: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-main-container,
|
.article-main-container,
|
||||||
.header-item.main-item {
|
.header-item.main-item {
|
||||||
width: calc(70% - 20px);
|
width: calc(70% - 20px);
|
||||||
|
|||||||
Reference in New Issue
Block a user