postCountModel.vue 1.43 KB
<!--
 * @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>