zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
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
<template>
  <div class="invite-message">
    <div v-if="invite.type == 1 || invite.type == 3" class="system-msg">
      <a @click="toUser(invite.operate_user.id)">
        {{ invite.operate_user.nickname }}
      </a>
      <span>{{ invite.type == 1 ? '邀请了' : '将' }}</span>
      <template v-for="(user, uidx) in invite.users">
        <a @click="toUser(user.id)">{{ user.nickname }}</a>
        <em v-show="uidx < invite.users.length - 1">、</em>
      </template>
      <span>{{ invite.type == 1 ? '加入了群聊' : '踢出了群聊' }}</span>
    </div>
 
    <div v-else-if="invite.type == 2" class="system-msg">
      <a @click="toUser(invite.operate_user.id)">
        {{ invite.operate_user.nickname }}
      </a>
      <span>退出了群聊</span>
    </div>
  </div>
</template>
<script>
export default {
  name: 'InviteMessage',
  props: {
    invite: {
      type: Object,
      required: true,
    },
  },
  methods: {
    toUser(user_id) {
      this.$emit('cat', user_id)
    },
  },
}
</script>
<style lang="less" scoped>
.invite-message {
  display: flex;
  justify-content: center;
}
 
.system-msg {
  margin: 10px auto;
  background-color: #f5f5f5;
  font-size: 11px;
  line-height: 30px;
  padding: 0 8px;
  word-break: break-all;
  word-wrap: break-word;
  color: #979191;
  user-select: none;
  font-weight: 300;
  display: inline-block;
  border-radius: 3px;
 
  span {
    margin: 0 5px;
  }
 
  a {
    color: #939596;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
 
    &:hover {
      color: black;
    }
  }
}
</style>