3
tj
2025-05-22 14764dd7679369a650ad1d60be62aacc863755a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
  <view class="card-container">
    <!-- 卡片图片区域,如果有视频则显示播放图标 -->
    <view class="card-image-container">
      <image class="card-image" :src="item.image" mode="widthFix"></image>
      <view class="video-icon" v-if="item.hasVideo">
        <u-icon name="play-right-fill" color="#ffffff" size="40"></u-icon>
      </view>
    </view>
    
    <!-- 卡片内容区域 -->
    <view class="card-content">
      <!-- 标题 -->
      <view class="card-title">{{ item.title }}</view>
      
      <!-- 描述文字 -->
      <view class="card-desc" v-if="item.desc">{{ item.desc }}</view>
      
      <!-- 作者信息和点赞 -->
      <view class="card-footer">
        <view class="author-info">
          <image class="author-avatar" :src="item.author.avatar" mode="aspectFill"></image>
          <text class="author-name">{{ item.author.name }}</text>
        </view>
        <view class="like-info">
          <u-icon name="heart" color="#999999" size="16"></u-icon>
          <text class="like-count">{{ item.likes }}</text>
        </view>
      </view>
    </view>
  </view>
</template>
 
<script>
export default {
  name: 'CardItem',
  props: {
    item: {
      type: Object,
      required: true
    }
  }
}
</script>
 
<style lang="scss" scoped>
.card-container {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
 
.card-image-container {
  position: relative;
  width: 100%;
}
 
.card-image {
  width: 100%;
  height: auto;
  display: block;
}
 
.video-icon {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}
 
.card-content {
  padding: 10px;
}
 
.card-title {
  font-size: 14px;
  font-weight: bold;
  color: #333333;
  line-height: 1.4;
  margin-bottom: 6px;
}
 
.card-desc {
  font-size: 12px;
  color: #666666;
  line-height: 1.4;
  margin-bottom: 10px;
}
 
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
 
.author-info {
  display: flex;
  align-items: center;
}
 
.author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 6px;
}
 
.author-name {
  font-size: 12px;
  color: #666666;
}
 
.like-info {
  display: flex;
  align-items: center;
}
 
.like-count {
  font-size: 12px;
  color: #999999;
  margin-left: 4px;
}
</style>