CourseCard.vue
1.32 KB
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
<!--
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-04-29 14:12:16
* @FilePath: /mlaj/src/components/ui/CourseCard.vue
* @Description: 文件描述
-->
<template>
<router-link :to="linkTo || `/courses/${course.id}`" class="flex bg-white rounded-lg overflow-hidden shadow-sm">
<div class="w-1/3 h-28">
<img
:src="course.cover || 'https://cdn.ipadbiz.cn/mlaj/images/default_block.png'"
:alt="course.title"
class="w-full h-full object-cover"
/>
</div>
<div class="flex-1 p-3 flex flex-col justify-between">
<div>
<h3 class="font-medium text-sm mb-1 line-clamp-2">{{ course.title }}</h3>
<div class="text-gray-500 text-xs">{{ course.subtitle }}</div>
</div>
<div class="flex justify-between items-end mt-1">
<div class="text-orange-500 font-semibold">¥{{ course.price }}</div>
<div class="text-gray-400 text-xs">
{{ course.buy_count }}人订阅
</div>
</div>
<div class="text-gray-400 text-xs">
已更新{{ course.count }}期 | {{ course.buy_count }}人订阅
</div>
</div>
</router-link>
</template>
<script setup>
defineProps({
course: {
type: Object,
required: true
},
linkTo: {
type: String,
default: ''
}
})
</script>