<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">
|
<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>
|
</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: 260rpx;
|
}
|
|
.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: 24rpx;
|
background-color: #121212;
|
}
|
|
.title {
|
font-size: 16px;
|
color: #ffffff;
|
font-weight: 500;
|
margin-bottom: 12rpx;
|
line-height: 1.4;
|
}
|
|
.subtitle {
|
font-size: 14px;
|
color: rgba(255, 255, 255, 0.8);
|
margin-bottom: 20rpx;
|
}
|
|
.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;
|
}
|
</style>
|
|