杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { BellOutlined, ClockCircleOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
title?: string
|
||||
content?: string
|
||||
imageUrl?: string
|
||||
imageAlt?: string
|
||||
meta?: string
|
||||
badge?: string
|
||||
auxiliaryBadge?: string
|
||||
surface?: 'modal' | 'preview'
|
||||
footerAlign?: 'between' | 'end'
|
||||
}>(), {
|
||||
title: '系统消息',
|
||||
content: '',
|
||||
imageUrl: '',
|
||||
imageAlt: '消息图片',
|
||||
meta: '',
|
||||
badge: '',
|
||||
auxiliaryBadge: '',
|
||||
surface: 'preview',
|
||||
footerAlign: 'between'
|
||||
})
|
||||
|
||||
const hasImage = computed(() => Boolean(props.imageUrl))
|
||||
const displayTitle = computed(() => props.title?.trim() || '系统消息')
|
||||
const displayContent = computed(() => props.content?.trim() || (hasImage.value ? '' : '你收到了一条新的系统消息。'))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article
|
||||
class="system-message-card"
|
||||
:class="[
|
||||
`system-message-card--${surface}`,
|
||||
`system-message-card--footer-${footerAlign}`,
|
||||
{ 'system-message-card--with-image': hasImage }
|
||||
]"
|
||||
>
|
||||
<div v-if="hasImage" class="system-message-card__media">
|
||||
<img :src="imageUrl" :alt="imageAlt" />
|
||||
</div>
|
||||
|
||||
<div v-else class="system-message-card__icon">
|
||||
<BellOutlined />
|
||||
</div>
|
||||
|
||||
<section class="system-message-card__main">
|
||||
<div v-if="badge || auxiliaryBadge" class="system-message-card__badges">
|
||||
<span v-if="auxiliaryBadge" class="system-message-card__badge system-message-card__badge--soft">{{ auxiliaryBadge }}</span>
|
||||
<span v-if="badge" class="system-message-card__badge">{{ badge }}</span>
|
||||
</div>
|
||||
|
||||
<h2 class="system-message-card__title">{{ displayTitle }}</h2>
|
||||
|
||||
<div v-if="meta" class="system-message-card__meta">
|
||||
<ClockCircleOutlined />
|
||||
<span>{{ meta }}</span>
|
||||
</div>
|
||||
|
||||
<p v-if="displayContent" class="system-message-card__content">{{ displayContent }}</p>
|
||||
</section>
|
||||
|
||||
<footer v-if="$slots.footer" class="system-message-card__footer">
|
||||
<slot name="footer" />
|
||||
</footer>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.system-message-card {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--theme-border);
|
||||
border-radius: 8px;
|
||||
background: var(--theme-card-bg);
|
||||
}
|
||||
|
||||
.system-message-card--preview {
|
||||
box-shadow: 0 20px 54px rgba(77, 50, 62, 0.16);
|
||||
}
|
||||
|
||||
.system-message-card--modal {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.system-message-card__media {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
padding: 12px 12px 0;
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.system-message-card__media img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.system-message-card__icon {
|
||||
display: grid;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
margin: 28px auto 0;
|
||||
place-items: center;
|
||||
border-radius: 8px;
|
||||
color: #ffffff;
|
||||
font-size: 20px;
|
||||
background: var(--theme-gradient);
|
||||
box-shadow: var(--theme-button-shadow);
|
||||
}
|
||||
|
||||
.system-message-card__main {
|
||||
padding: 20px 30px 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.system-message-card--with-image .system-message-card__main {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.system-message-card__badges {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.system-message-card__badge {
|
||||
display: inline-flex;
|
||||
min-height: 24px;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
border-radius: 8px;
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
background: var(--theme-gradient);
|
||||
}
|
||||
|
||||
.system-message-card__badge--soft {
|
||||
color: var(--theme-primary);
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.system-message-card__title {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
line-height: 1.35;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.system-message-card__meta {
|
||||
display: inline-flex;
|
||||
max-width: 100%;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.system-message-card__content {
|
||||
margin: 20px 0 0;
|
||||
color: var(--text-primary);
|
||||
font-size: 15px;
|
||||
line-height: 1.75;
|
||||
text-align: left;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.system-message-card__footer {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 18px 30px;
|
||||
border-top: 1px solid var(--theme-border);
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
background: var(--theme-card-bg);
|
||||
}
|
||||
|
||||
.system-message-card--footer-end .system-message-card__footer {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.system-message-card {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.system-message-card__main,
|
||||
.system-message-card__footer {
|
||||
padding-left: 22px;
|
||||
padding-right: 22px;
|
||||
}
|
||||
|
||||
.system-message-card__title {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.system-message-card__footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user