blacklist-item.vue
1.27 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
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
<div class="blacklist-item-wrapper">
<img
class="avatar"
:src="profile.avatar ? profile.avatar : 'http://imgcache.qq.com/open/qcloud/video/act/webim-avatar/avatar-2.png'"
/>
<div class="item">{{profile.nick||profile.userID}}</div>
<el-button type="text" @click="removeFromBlacklist">取消拉黑</el-button>
</div>
</template>
<script>
export default {
name: 'BlacklistItem',
props: {
profile: {
type: Object,
required: true
}
},
methods: {
removeFromBlacklist() {
this.tim
.removeFromBlacklist({ userIDList: [this.profile.userID] })
.then(() => {
this.$store.commit('removeFromBlacklist', this.profile.userID)
})
.catch(error => {
this.$store.commit('showMessage', {
type: 'error',
message: error.message
})
})
}
}
}
</script>
<style lang="stylus" scoped>
.item {
padding-left: 20px;
width: 100%;
color: $white;
box-sizing: border-box;
word-wrap: break-word;
overflow: hidden;
text-overflow: ellipsis;
}
.blacklist-item-wrapper {
padding-bottom: 15px;
display: flex;
align-items: center;
justify-content: flex-start;
}
.avatar {
width: 48px;
height: 48px;
border-radius: 50%;
}
</style>