jiangshuai
2024-07-24 9d94fd9277cc985f1c86b41e646e176cdf78004a
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
<template>
  <div :class="['chat-item', itemData.isCollect ? 'chat-item-collected' : '']">
    <a-space :size="4" direction="vertical" fill>
      <a-typography-text type="warning">
        {{ itemData.username }}
      </a-typography-text>
      <a-typography-text>{{ itemData.content }}</a-typography-text>
      <div class="chat-item-footer">
        <div class="chat-item-time">
          <a-typography-text type="secondary">
            {{ itemData.time }}
          </a-typography-text>
        </div>
        <div class="chat-item-actions">
          <div class="chat-item-actions-item">
            <icon-command />
          </div>
          <div class="chat-item-actions-item chat-item-actions-collect">
            <icon-star />
          </div>
        </div>
      </div>
    </a-space>
  </div>
</template>
 
<script lang="ts" setup>
  import { PropType } from 'vue';
  import { ChatRecord } from '@/api/message';
 
  defineProps({
    itemData: {
      type: Object as PropType<ChatRecord>,
      default() {
        return {};
      },
    },
  });
</script>
 
<style scoped lang="less">
  .chat-item {
    padding: 8px;
    font-size: 12px;
    line-height: 20px;
    border-radius: 2px;
 
    &-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
 
    &-actions {
      display: flex;
      opacity: 0;
 
      &-item {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        margin-right: 4px;
        color: var(--color-text-3);
        font-size: 14px;
        border-radius: 50%;
        cursor: pointer;
 
        &:hover {
          background-color: rgb(var(--gray-3));
        }
 
        &:last-child {
          margin-right: 0;
        }
      }
    }
 
    &-collected {
      .chat-item-actions-collect {
        color: rgb(var(--gold-6));
      }
    }
 
    &:hover {
      background-color: rgb(var(--gray-2));
 
      .chat-item-actions {
        opacity: 1;
      }
    }
  }
</style>