feat: 作品页支持模块化编排与自定义内容模块

This commit is contained in:
Nixevol
2026-07-20 17:03:14 +08:00
parent 467c5a1de5
commit 733829eca0
37 changed files with 3714 additions and 1362 deletions
@@ -0,0 +1,93 @@
<template>
<section class="card image-text-card">
<h2 class="section-title">{{ title }}</h2>
<div class="image-text-layout" :class="`position-${position.toLowerCase()}`">
<img
v-if="config.image?.url || config.image?.key"
class="image-text-image"
:src="traceMediaUrl(config.image)"
:alt="config.image.name || config.heading || title"
loading="lazy"
@click="openImage"
/>
<div v-if="config.heading || config.body" class="image-text-copy">
<h3 v-if="config.heading">{{ config.heading }}</h3>
<p v-if="config.body">{{ config.body }}</p>
</div>
</div>
</section>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { openTraceViewer, traceMediaUrl, type PublicMediaItem } from './media';
const props = defineProps<{
title: string;
config: {
image?: PublicMediaItem;
heading?: string;
body?: string;
imagePosition?: 'TOP' | 'BOTTOM' | 'LEFT' | 'RIGHT';
};
}>();
const position = computed(() => props.config.imagePosition || 'TOP');
function openImage() {
if (props.config.image) openTraceViewer([props.config.image], 0);
}
</script>
<style scoped>
.image-text-layout {
display: flex;
flex-direction: column;
gap: 14px;
}
.image-text-image {
order: 0;
width: 100%;
max-height: 480px;
object-fit: contain;
border-radius: 10px;
background: var(--soft-bg);
cursor: zoom-in;
}
.image-text-copy {
order: 1;
min-width: 0;
}
.image-text-copy h3 {
margin: 0 0 8px;
font-size: 17px;
line-height: 1.45;
}
.image-text-copy p {
margin: 0;
color: var(--trace-desc);
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
word-break: break-word;
}
.position-bottom .image-text-image {
order: 1;
}
.position-bottom .image-text-copy {
order: 0;
}
@media (min-width: 521px) {
.position-left,
.position-right {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
align-items: center;
}
.position-right .image-text-image {
order: 1;
}
.position-right .image-text-copy {
order: 0;
}
}
</style>