mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
feat: 优化ViewerLayout和QuestionBoxView组件
- 在ViewerLayout.vue中添加过渡模式以增强动画效果 - 更新QuestionBoxView.vue,调整问题头部间距,优化图片展示逻辑,修改上传图片网格样式,提升用户体验
This commit is contained in:
@@ -476,6 +476,7 @@
|
|||||||
<RouterView v-slot="{ Component }">
|
<RouterView v-slot="{ Component }">
|
||||||
<Transition
|
<Transition
|
||||||
name="fade-slide"
|
name="fade-slide"
|
||||||
|
mode="out-in"
|
||||||
:appear="true"
|
:appear="true"
|
||||||
>
|
>
|
||||||
<KeepAlive>
|
<KeepAlive>
|
||||||
@@ -676,19 +677,7 @@
|
|||||||
// --- 路由过渡动画 ---
|
// --- 路由过渡动画 ---
|
||||||
.fade-slide-enter-active,
|
.fade-slide-enter-active,
|
||||||
.fade-slide-leave-active {
|
.fade-slide-leave-active {
|
||||||
transition: opacity 0.25s ease, transform 0.25s ease;
|
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||||
// 关键: 相对于 content-layout-container 定位
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%; // 让过渡元素也撑满容器高度
|
|
||||||
// 关键: 保持内边距和盒模型一致
|
|
||||||
padding: var(--vtsuru-content-padding);
|
|
||||||
box-sizing: border-box;
|
|
||||||
// 关键: 背景色防止透视
|
|
||||||
background-color: var(--n-card-color); // 使用内容区的背景色
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-slide-enter-from {
|
.fade-slide-enter-from {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import {
|
|||||||
NSpin,
|
NSpin,
|
||||||
NIcon,
|
NIcon,
|
||||||
useMessage,
|
useMessage,
|
||||||
|
NCarousel,
|
||||||
|
NCarouselItem,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { AddCircle24Regular, DismissCircle24Regular } from '@vicons/fluent'
|
import { AddCircle24Regular, DismissCircle24Regular } from '@vicons/fluent'
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
@@ -706,44 +708,10 @@ onUnmounted(() => {
|
|||||||
<!-- 问题头部 -->
|
<!-- 问题头部 -->
|
||||||
<template #header>
|
<template #header>
|
||||||
<NSpace
|
<NSpace
|
||||||
:size="0"
|
:size="5"
|
||||||
align="center"
|
align="center"
|
||||||
class="question-header"
|
class="question-header"
|
||||||
>
|
>
|
||||||
<NTooltip v-if="!item.isAnonymous">
|
|
||||||
<template #trigger>
|
|
||||||
<NAvatar
|
|
||||||
v-if="item.sender?.id"
|
|
||||||
:src="getUserAvatarUrl(item.sender.id)"
|
|
||||||
round
|
|
||||||
size="small"
|
|
||||||
class="sender-avatar"
|
|
||||||
:img-props="{ referrerpolicy: 'no-referrer' }"
|
|
||||||
/>
|
|
||||||
<NAvatar
|
|
||||||
v-else
|
|
||||||
round
|
|
||||||
size="small"
|
|
||||||
class="sender-avatar"
|
|
||||||
>
|
|
||||||
?
|
|
||||||
</NAvatar>
|
|
||||||
</template>
|
|
||||||
{{ item.sender?.name || '未知用户' }}
|
|
||||||
</NTooltip>
|
|
||||||
<NTooltip v-else>
|
|
||||||
<template #trigger>
|
|
||||||
<NAvatar
|
|
||||||
round
|
|
||||||
size="small"
|
|
||||||
class="sender-avatar"
|
|
||||||
>
|
|
||||||
匿
|
|
||||||
</NAvatar>
|
|
||||||
</template>
|
|
||||||
匿名用户
|
|
||||||
</NTooltip>
|
|
||||||
|
|
||||||
<NText
|
<NText
|
||||||
depth="3"
|
depth="3"
|
||||||
class="time-text"
|
class="time-text"
|
||||||
@@ -782,23 +750,20 @@ onUnmounted(() => {
|
|||||||
>
|
>
|
||||||
{{ item.question.message }}
|
{{ item.question.message }}
|
||||||
</div>
|
</div>
|
||||||
|
<NDivider style="margin: 0;" />
|
||||||
<div
|
<div
|
||||||
v-if="item.questionImages && item.questionImages.length > 0"
|
v-if="item.questionImages && item.questionImages.length > 0"
|
||||||
class="question-image-container"
|
class="question-image-container"
|
||||||
>
|
|
||||||
<NSpace
|
|
||||||
vertical
|
|
||||||
align="center"
|
|
||||||
>
|
>
|
||||||
<NImage
|
<NImage
|
||||||
v-for="(img, index) in item.questionImages"
|
v-for="(img, index) in item.questionImages"
|
||||||
:key="index"
|
:key="index"
|
||||||
:src="img.path"
|
:src="img.path"
|
||||||
class="question-image"
|
class="question-image"
|
||||||
|
:img-props="{ height: '100px' }"
|
||||||
lazy
|
lazy
|
||||||
object-fit="contain"
|
object-fit="contain"
|
||||||
/>
|
/>
|
||||||
</NSpace>
|
|
||||||
</div>
|
</div>
|
||||||
</NCard>
|
</NCard>
|
||||||
|
|
||||||
@@ -925,7 +890,8 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.image-upload-card {
|
.image-upload-card {
|
||||||
width: 50%;
|
max-width: 500px;
|
||||||
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
@@ -954,14 +920,17 @@ onUnmounted(() => {
|
|||||||
/* 已登录用户图片上传网格 */
|
/* 已登录用户图片上传网格 */
|
||||||
.upload-images-grid {
|
.upload-images-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-image-item, .upload-add-item {
|
.upload-image-item, .upload-add-item {
|
||||||
height: 60px;
|
aspect-ratio: 1 / 1;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-add-item {
|
.upload-add-item {
|
||||||
@@ -973,23 +942,10 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.add-icon {
|
.add-icon {
|
||||||
font-size: 20px;
|
font-size: 24px;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 图片预览样式 */
|
|
||||||
.image-preview-wrapper {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload-preview-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.remove-image-btn {
|
.remove-image-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
@@ -1159,19 +1115,13 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.question-image-container {
|
.question-image-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
.question-image {
|
|
||||||
max-height: 200px;
|
|
||||||
max-width: 100%;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-image:hover {
|
|
||||||
transform: scale(1.02);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 回答区域 */
|
/* 回答区域 */
|
||||||
|
|||||||
Reference in New Issue
Block a user