<template>
|
<view class="card">
|
<view class="image-wrapper">
|
<image class="image" :src="imageUrl" mode="aspectFill" />
|
<view class="tag">{{ tag }}</view>
|
</view>
|
<view class="content">
|
<view class="title">{{ title }}</view>
|
<view class="subtitle">{{ subtitle }}</view>
|
<view class="footer">
|
<view class="rating-more">
|
<view class="rating-group"> <!-- 新增包裹层 -->
|
<up-icon class="star" name="star-fill" size="14" color="#FFD700" />
|
<text class="score">{{ score }}</text>
|
</view>
|
<view class="more" @click="goToDetail">
|
查看详情 ->
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup lang="ts">
|
|
interface Props {
|
tag?: string;
|
title?: string;
|
subtitle?: string;
|
score?: string | number;
|
imageUrl: string;
|
detailUrl: string;
|
}
|
|
const props = defineProps<Props>();
|
|
function goToDetail() {
|
uni.navigateTo({
|
url: props.detailUrl,
|
});
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.card {
|
margin-top: 20rpx;
|
border-radius: 24rpx;
|
overflow: hidden;
|
background: #ffffff;
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
}
|
|
.image-wrapper {
|
position: relative;
|
width: 100%;
|
height: 400rpx; // 从260rpx增加到360rpx
|
}
|
|
.image {
|
width: 100%;
|
height: 100%;
|
}
|
|
.tag {
|
position: absolute;
|
bottom: 20rpx;
|
left: 20rpx;
|
padding: 6rpx 16rpx;
|
background: rgba(0, 0, 0, 0.6);
|
border-radius: 6rpx;
|
color: #ffffff;
|
font-size: 12px;
|
}
|
|
.content {
|
padding: 10rpx; // 上下padding从24rpx减到20rpx
|
background-color: #121212;
|
}
|
|
.title {
|
font-size: 15px; // 从16px减小
|
color: #ffffff;
|
font-weight: 500;
|
margin-bottom: 8rpx; // 从12rpx减小
|
line-height: 1.4;
|
}
|
|
.subtitle {
|
font-size: 13px; // 从14px减小
|
color: rgba(255, 255, 255, 0.8);
|
margin-bottom: 16rpx; // 从20rpx减小
|
line-height: 1.3; // 添加行高控制
|
}
|
|
.footer {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.rating {
|
display: flex;
|
align-items: center;
|
}
|
|
.star {
|
margin-right: 8rpx;
|
}
|
|
.score {
|
color: #ffffff;
|
font-size: 14px;
|
}
|
|
.more {
|
color: #ffffff;
|
font-size: 14px;
|
user-select: none;
|
cursor: pointer;
|
}
|
.rating-more {
|
display: flex;
|
align-items: center;
|
width: 100%; // 添加宽度
|
justify-content: space-between; // 改为两端对齐
|
}
|
.rating-group { /* 新增样式 */
|
display: flex;
|
align-items: center;
|
gap: 8rpx; /* 图标和分数之间的间距 */
|
}
|
</style>
|
|