postCountModel.vue
1.43 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
47
48
49
<!--
* @Date: 2025-12-11 17:26:25
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2026-01-22 17:00:53
* @FilePath: /mlaj/src/components/count/postCountModel.vue
* @Description: 发布作业统计模型(包括感恩次数和感恩对象)
-->
<template>
<div v-if="postData && postData.gratitude_count" class="post-count-model">
<div class="flex justify-between items-center mb-2">
<div class="text-gray-500">感恩次数: </div>
<div class="font-bold text-gray-600">{{ postData.gratitude_count }} 次</div>
</div>
<div class="flex justify-between items-center">
<div class="text-gray-500">感恩对象: </div>
<div class="font-bold text-gray-600">
{{ Array.isArray(postData.gratitude_form_list) ? postData.gratitude_form_list.map(item => item.name).join('、') : '' }}
</div>
</div>
</div>
</template>
<script setup>
import { defineProps } from 'vue'
const props = defineProps({
/**
* 帖子数据对象
* @property {number} gratitude_count - 感恩次数
* @property {Array} gratitude_form_list - 感恩对象列表 [{name: string}]
*/
postData: {
type: Object,
default: () => ({})
}
})
</script>
<style lang="less">
.post-count-model {
color: #4caf50;
padding: 0.5rem 1rem;
// border: 1px solid #eaeaea;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
border-radius: 10px;
font-size: 0.85rem;
margin-bottom: 1rem;
}
</style>