初始化参股
This commit is contained in:
154
前端/components/case-card/case-card.uvue
Normal file
154
前端/components/case-card/case-card.uvue
Normal file
@@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<view class="case-card" @click="handleClick">
|
||||
<!-- 封面图 -->
|
||||
<view class="card-image-wrapper">
|
||||
<image
|
||||
class="card-image"
|
||||
:src="caseData.coverImage"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view class="card-category">{{ caseData.categoryName }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<view class="card-content">
|
||||
<text class="card-title">{{ caseData.title }}</text>
|
||||
<view class="card-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">材质:</text>
|
||||
<text class="info-value">{{ caseData.material }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">工期:</text>
|
||||
<text class="info-value">{{ caseData.duration }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-footer">
|
||||
<text class="card-price">{{ caseData.price }}</text>
|
||||
<view class="card-stats">
|
||||
<text class="stat-item">👁 {{ caseData.views }}</text>
|
||||
<text class="stat-item">❤ {{ caseData.likes }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
// 定义Props类型
|
||||
type CaseItem = {
|
||||
id : string
|
||||
title : string
|
||||
category : string
|
||||
categoryName : string
|
||||
coverImage : string
|
||||
material : string
|
||||
duration : string
|
||||
price : string
|
||||
views : number
|
||||
likes : number
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
caseData : CaseItem
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e : 'click', id : string) : void
|
||||
}>()
|
||||
|
||||
const handleClick = () => {
|
||||
emit('click', props.caseData.id)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.case-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.card-image-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 360rpx;
|
||||
}
|
||||
|
||||
.card-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.card-category {
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
left: 16rpx;
|
||||
background-color: rgba(212, 165, 116, 0.9);
|
||||
color: #ffffff;
|
||||
font-size: 22rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
margin-bottom: 16rpx;
|
||||
lines: 1;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
flex-direction: row;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 26rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 16rpx;
|
||||
padding-top: 16rpx;
|
||||
border-top-width: 1rpx;
|
||||
border-top-style: solid;
|
||||
border-top-color: #EBEEF5;
|
||||
}
|
||||
|
||||
.card-price {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #D4A574;
|
||||
}
|
||||
|
||||
.card-stats {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
font-size: 24rpx;
|
||||
color: #909399;
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user