You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< template >
< div class = "com-user-card" >
< div class = "user-card-avatar" >
<!-- 如果是用户自己 , 则点击头像可以更换头像 -- >
< nuxt -link : to = "'/user/' + user.id" >
< UserAvatar :user ="user" / >
< / n u x t - l i n k >
< / div >
< div class = "user-card-username" >
< strong > { { user . username } } < / strong >
< / div >
< div class = "user-card-stat" >
< el -row class = "help-block" >
< el -col :span ="8" >
< div > 文档 < / div >
< div class = "el-link el-link--primary" > { { user . doc _count || 0 } } < / div >
< / e l - c o l >
< el -col :span ="8" >
< div > 收藏 < / div >
< div class = "el-link el-link--primary" >
{ { user . favorite _count || 0 } }
< / div >
< / e l - c o l >
< el -col :span ="8"
> < div > { { settings . system . credit _name || '魔豆' } } < / div >
< div class = "el-link el-link--primary" >
{ { user . credit _count || 0 } }
< / div >
< / e l - c o l >
< / e l - r o w >
< / div >
< div v-if ="!hideSignature" class="user-card-signature">
<div><small>个性签名</small></div>
<div class="help-block" >
{{ user.signature | | ' 暂 无 个 性 签 名 ' }}
< / div >
< / div >
< / div >
< / template >
< script >
import { mapGetters } from 'vuex'
// 用户信息卡片
export default {
name : 'UserCard' ,
props : {
user : {
type : Object ,
default : ( ) => {
return {
id : 0 ,
name : '' ,
avatar : '' ,
signature : '' ,
doc _count : 0 ,
favorite _count : 0 ,
credit _count : 0 ,
}
} ,
} ,
hideActions : {
type : Boolean ,
default : false ,
} ,
hideSignature : {
type : Boolean ,
default : false ,
} ,
} ,
data ( ) {
return { }
} ,
async created ( ) { } ,
computed : {
... mapGetters ( 'setting' , [ 'settings' ] ) ,
} ,
methods : { } ,
}
< / script >
< style lang = "scss" scoped >
. com - user - card {
text - align : center ;
. el - avatar {
border : 2 px solid # ddd ;
padding : 3 px ;
background - color : # fff ;
width : 80 px ;
height : 80 px ;
& : hover {
border : 2 px solid # 409 eff ;
}
img {
border - radius : 50 % ;
}
}
. user - card - username {
margin : 10 px 0 ;
font - size : 16 px ;
small {
font - size : 13 px ;
}
}
. user - card - stat {
margin : 20 px 0 ;
. help - block {
font - size : 12 px ;
. el - link {
font - size : 14 px ;
margin - top : 5 px ;
}
. el - col {
border - right : 1 px solid # ddd ;
& : first - child {
border - left : 1 px solid # ddd ;
}
}
}
}
. user - card - signature {
text - align : left ;
. help - block {
margin - top : 10 px ;
font - size : 13 px ;
text - indent : 2 em ;
}
}
}
< / style >