Files
jiapuapp/components/GenealogyCard.vue
T

289 lines
6.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 公共组件G01 已创建已加入家谱的题签列表项保持透明题签框叠在纸纹底图上 -->
<template>
<view
class="genealogy-card"
:class="{ 'genealogy-card--current': selected }"
role="button"
:aria-label="accessibleLabel"
hover-class="genealogy-card--pressed"
@click="$emit('select', genealogy)"
>
<image
class="row-frame"
src="/static/assets/modules/genealogy/transparent/list-slip-frame.png"
mode="scaleToFill"
/>
<view class="surname-seal">
<image
class="surname-seal-frame"
src="/static/assets/modules/genealogy/transparent/row-seal-frame.png"
mode="scaleToFill"
/>
<view class="surname-seal-copy">
<text class="seal-title">家谱</text>
</view>
</view>
<view class="card-main">
<view class="card-title-row">
<text class="card-name">{{ genealogy.name }}</text>
<view class="card-side">
<text class="card-role">{{ role }}</text>
<image
class="card-chevron"
src="/static/assets/foundation/transparent/chevron-right.png"
mode="aspectFit"
/>
</view>
</view>
<view class="card-detail-row">
<view class="card-updated">
<text>更新于 {{ genealogy.updatedAt }}</text>
</view>
<view class="card-metas">
<view class="card-meta-item">
<image
class="card-meta-icon"
src="/static/assets/foundation/transparent/meta-location.png"
mode="aspectFit"
/>
<text class="card-meta">{{ genealogy.location }}</text>
</view>
<view class="card-meta-item">
<image
class="card-meta-icon"
src="/static/assets/foundation/transparent/meta-member.png"
mode="aspectFit"
/>
<text class="card-meta">{{ genealogy.memberCount }} 位成员</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps({
genealogy: { type: Object, required: true },
role: { type: String, required: true },
selected: { type: Boolean, default: false },
});
defineEmits(["select"]);
const accessibleLabel = computed(
() =>
`${props.genealogy.name}${props.role}${props.selected ? ',当前家谱' : ''}${props.genealogy.location}${props.genealogy.memberCount} 位成员`,
);
</script>
<style scoped lang="scss">
.genealogy-card {
--card-padding-x: 24rpx;
--card-padding-y: 18rpx;
display: grid;
grid-template-columns: 72rpx minmax(0, 1fr);
min-height: 178rpx;
align-items: center;
column-gap: 22rpx;
padding: 18rpx 24rpx;
box-sizing: border-box;
background: transparent;
}
.genealogy-card--current {
background: transparent;
}
.genealogy-card--pressed {
opacity: 0.72;
}
.row-frame {
grid-area: 1 / 1 / 2 / -1;
z-index: 1;
width: calc(100% + var(--card-padding-x) + var(--card-padding-x));
height: calc(100% + var(--card-padding-y) + var(--card-padding-y));
margin: calc(-1 * var(--card-padding-y)) calc(-1 * var(--card-padding-x));
pointer-events: none;
}
.surname-seal {
display: grid;
grid-column: 1;
grid-row: 1;
z-index: 2;
width: 72rpx;
height: 112rpx;
place-items: center;
color: #fff5df;
}
.surname-seal-frame {
z-index: 0;
width: 100%;
height: 100%;
}
.surname-seal-frame,
.surname-seal-copy {
grid-area: 1 / 1;
}
.surname-seal-copy {
z-index: 1;
display: flex;
height: 82rpx;
align-items: center;
justify-content: center;
}
.seal-title {
color: #fff5df;
font-family: "STKaiti", "KaiTi", serif;
font-size: 30rpx;
font-weight: 700;
letter-spacing: 2rpx;
line-height: 1;
writing-mode: vertical-rl;
}
.genealogy-card:not(.genealogy-card--current) .surname-seal-frame {
opacity: 0.32;
}
.genealogy-card:not(.genealogy-card--current) .seal-title {
color: $ink-muted;
}
.card-main {
grid-column: 2;
grid-row: 1;
z-index: 2;
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
}
.card-title-row {
display: flex;
min-width: 0;
align-items: flex-start;
justify-content: space-between;
}
.card-name {
min-width: 0;
flex: 1;
color: $ink;
font-family: "STKaiti", "KaiTi", serif;
font-size: 37rpx;
font-weight: 700;
line-height: 1.25;
overflow-wrap: anywhere;
}
.card-detail-row {
display: flex;
min-width: 0;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
margin-top: 8rpx;
}
.card-metas {
display: flex;
min-width: 0;
width: 100%;
flex-wrap: wrap;
align-items: center;
margin-top: 2rpx;
gap: 4rpx 18rpx;
}
.card-meta-item {
display: flex;
min-width: 0;
align-items: center;
margin-right: 0;
}
.card-meta-icon {
width: 46rpx;
height: 46rpx;
flex: 0 0 auto;
margin-right: 6rpx;
opacity: 1;
filter: saturate(1.35) brightness(0.82) contrast(1.15);
}
.card-meta {
min-width: 0;
color: #62584c;
font-size: 26rpx;
font-weight: 500;
overflow-wrap: anywhere;
}
.card-updated {
display: flex;
width: 100%;
flex: 0 0 auto;
align-items: center;
justify-content: flex-end;
margin-top: 0;
margin-left: 0;
color: #62584c;
font-size: 24rpx;
font-weight: 500;
overflow-wrap: anywhere;
}
.card-side {
z-index: 1;
display: flex;
min-width: 0;
flex: 0 1 auto;
flex-direction: row;
align-items: center;
justify-content: flex-end;
margin-left: 20rpx;
}
.card-role {
min-width: 0;
color: #62584c;
font-size: 26rpx;
font-weight: 500;
overflow-wrap: anywhere;
}
.card-chevron {
width: 34rpx;
height: 34rpx;
margin-left: 14rpx;
}
@media screen and (max-width: 340px) {
.genealogy-card {
--card-padding-x: 18rpx;
grid-template-columns: 66rpx minmax(0, 1fr);
column-gap: 16rpx;
min-height: 148rpx;
padding-right: 18rpx;
padding-left: 18rpx;
}
.surname-seal {
width: 66rpx;
height: 100rpx;
}
.card-name {
font-size: 32rpx;
}
.card-meta {
font-size: 22rpx;
}
.card-updated {
display: none;
}
.card-side {
margin-left: 12rpx;
}
.card-chevron {
width: 28rpx;
height: 28rpx;
margin-left: 8rpx;
}
}
</style>