profile-card.vue
1.25 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
<div class="profile-card-wrapper">
<div class="content">
<avatar :src="profile.avatar" />
<div class="basic">
<span class="nick text-ellipsis">{{ profile.nick || profile.userID }}</span>
<span class="iconfont" :class="genderClass"></span>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'ProfileCard',
props: {
profile: {
type: Object,
required: true
}
},
computed: {
genderClass() {
switch (this.profile.gender) {
case this.TIM.TYPES.GENDER_MALE:
return 'icon-male'
case this.TIM.TYPES.GENDER_FEMALE:
return 'icon-female'
default:
return '暂无'
}
}
}
}
</script>
<style lang="stylus" scpoed>
.profile-header {
display: flex;
margin-bottom: 12px;
}
.profile-card-wrapper {
.content {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.avatar {
width: 70px;
height: 70px;
}
}
.basic {
display: flex;
align-items: center;
margin-top: 12px;
}
.icon-male {
color: $primary;
}
.icon-female {
color: #ff8096;
}
.nick {
font-size: 18px;
margin-right: 8px;
max-width: 100px;
display: inline-block;
}
</style>