refactor(stargalaxy): move PODIUM_SIZES/POSITIONS into PodiumCard for self-contained layout

This commit is contained in:
zheng020 2026-06-10 17:18:35 +08:00
parent 6231295e36
commit 7f831c4fbe
2 changed files with 37 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<view
class="podium-card"
:class="['podium-' + rank]"
:style="cardStyle"
:style="[cardStyle, internalPosition]"
@click="handleClick"
>
<!-- 相框最底层 -->
@ -28,11 +28,30 @@ import { computed } from "vue";
const props = defineProps({
item: { type: Object, required: true },
rank: { type: Number, required: true, validator: (v) => v >= 4 && v <= 6 },
size: { type: Object, default: () => ({ width: 120, height: 130 }) },
});
const emit = defineEmits(["cardClick"]);
// 3 ScatteredRanks rpx
const PODIUM_SIZES = {
4: { width: 240, height: 260 }, // TOP 1
5: { width: 200, height: 200 }, // TOP 2
6: { width: 192, height: 192 }, // TOP 3
};
const PODIUM_POSITIONS = {
4: {
position: "absolute",
top: "400rpx",
left: "50%",
transform: "translateX(-50%)",
},
5: { position: "absolute", top: "120rpx", left: "60rpx" },
6: { position: "absolute", top: "150rpx", right: "60rpx" },
};
const internalSize = computed(() => PODIUM_SIZES[props.rank]);
const internalPosition = computed(() => PODIUM_POSITIONS[props.rank]);
// rank 4/5/6 1/2/3TOP 1/2/3
const displayRank = computed(() => props.rank - 3);
@ -55,10 +74,10 @@ const labelSizes = {
6: { w: 78, h: 18, font: 11 },
};
const cardStyle = {
width: props.size.width + "rpx",
height: props.size.height + "rpx",
};
const cardStyle = computed(() => ({
width: internalSize.value.width + "rpx",
height: internalSize.value.height + "rpx",
}));
const labelStyle = {
width: labelSizes[props.rank].w + "rpx",

View File

@ -35,8 +35,6 @@
:key="item.id || i"
:item="item"
:rank="i + 4"
:size="PODIUM_SIZES[i + 4]"
:style="PODIUM_POSITIONS[i + 4]"
@cardClick="handleCardClick"
/>
<!-- </view> -->
@ -64,23 +62,6 @@ import { getAssetCoverRealUrl } from "@/utils/assetImageHelper.js";
const emit = defineEmits(["cardClick"]);
// 3 ScatteredRanks rpx
const PODIUM_SIZES = {
4: { width: 240, height: 260 }, // TOP 1
5: { width: 200, height: 200 }, // TOP 2
6: { width: 192, height: 192 }, // TOP 3
};
const PODIUM_POSITIONS = {
4: {
position: "absolute",
top: "400rpx",
left: "50%",
transform: "translateX(-50%)",
},
5: { position: "absolute", top: "120rpx", left: "60rpx" },
6: { position: "absolute", top: "150rpx", right: "60rpx" },
};
const items = ref([]);
const loading = ref(true);
const error = ref(false);
@ -138,25 +119,32 @@ onUnmounted(() => {
width: 750rpx;
min-height: 1440rpx;
padding-bottom: 200rpx;
overflow: hidden;
top: -128rpx;
// [3] bj.png opacity
&::before {
content: "";
position: absolute;
inset: 0;
background: url("/static/square/galaxy/bj.png") center / cover no-repeat;
background: url("/static/square/galaxy/bj.png") center no-repeat;
background-size: 115% 100%;
pointer-events: none;
z-index: 0;
bottom: 512rpx;
// StarGalaxy 20%
// header/ bj.png
// 700rpx 0-20%(0-140rpx) 20-40%(140-280rpx)
mask-image: linear-gradient(to bottom, transparent 0%, transparent 20%, #000 40%, #000 100%);
mask-image: linear-gradient(
to bottom,
transparent 0%,
transparent 0%,
#000 14%,
#000 100%
);
-webkit-mask-image: linear-gradient(
to bottom,
transparent 0%,
transparent 20%,
#000 40%,
transparent 0%,
#000 14%,
#000 100%
);
}