friend-item.vue
1.22 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
<template>
<div class="friend-item-container" @click="handleFriendClick">
<el-row class="friend-list" type="flex" align="middle" justify="center" :gutter="16">
<el-col :span="6">
<avatar class="friend-avatar" :src="friend.avatar"/>
</el-col>
<el-col :span="18">
<div class="friend-name">{{ friend.name }}</div>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
props: {
friend: {
type: Object,
required: true
}
},
methods: {
handleFriendClick() {
this.tim.getConversationProfile(`C2C${this.friend.esm_id}`)
.then(({data}) => {
this.$store.commit('updateCurrentConversation', data)
this.$store.commit('setActiveMenu', 'conversation-list')
this.$store.dispatch('checkoutConversation', data.conversation.conversationID)
})
.catch(error => this.$store.commit('showMessage', {type: 'error', message: error.message}))
}
}
}
</script>
<style lang="stylus" scoped>
.avatar
height 48px
width 48px
.friend-item-container
color #f7f7f8
padding 10px 15px
:hover
background-color #404953
cursor pointer
.friend-avatar
height 48px
width 48px
</style>