@ -1,15 +1,16 @@
< template >
< el -container >
< el -container >
< el -aside width = "80px" class = "navi-bar" >
< div class = "user-head-image" >
< head -image :url ="$store.state.userStore.userInfo.headImageThumb" :size ="60"
@ click . native = "showSettingDialog=true" > < / h e a d - i m a g e >
< head -image :url ="$store.state.userStore.userInfo.headImageThumb" :size ="60" @click.native ="showSettingDialog=true" >
< / h e a d - i m a g e >
< / div >
< el -menu background -color = " # 333333 " text -color = " # ddd " style = "margin-top: 30px;" >
< el -menu -item title = "聊天" >
< router -link v -bind :to ="'/home/chat'" >
< span class = "el-icon-chat-dot-round" > < / span >
< div v-show ="unreadCount>0" class="unread-text" > {{ unreadCount }} < / div >
< / r o u t e r - l i n k >
< / e l - m e n u - i t e m >
< el -menu -item title = "好友" >
@ -35,14 +36,8 @@
< router -view > < / r o u t e r - v i e w >
< / e l - m a i n >
< setting :visible ="showSettingDialog" @close ="closeSetting()" > < / setting >
< user -info v -show = " uiStore.userInfo.show "
: pos = "uiStore.userInfo.pos"
: user = "uiStore.userInfo.user"
@ close = "$store.commit('closeUserInfoBox')" > < / u s e r - i n f o >
< full -image :visible ="uiStore.fullImage.show"
: url = "uiStore.fullImage.url"
@ close = "$store.commit('closeFullImageBox')"
> < / f u l l - i m a g e >
< user -info v-show ="uiStore.userInfo.show" :pos="uiStore.userInfo.pos" :user="uiStore.userInfo.user" @close="$store.commit('closeUserInfoBox')" > < / user -info >
< full -image :visible ="uiStore.fullImage.show" :url ="uiStore.fullImage.url" @close ="$store.commit('closeFullImageBox')" > < / full -image >
< / e l - c o n t a i n e r >
< / template >
@ -51,7 +46,7 @@
import Setting from '../components/setting/Setting.vue' ;
import UserInfo from '../components/common/UserInfo.vue' ;
import FullImage from '../components/common/FullImage.vue' ;
export default {
components : {
HeadImage ,
@ -173,9 +168,26 @@
this . showSettingDialog = false ;
}
} ,
computed : {
uiStore ( ) {
computed : {
uiStore ( ) {
return this . $store . state . uiStore ;
} ,
unreadCount ( ) {
let unreadCount = 0 ;
let chats = this . $store . state . chatStore . chats ;
chats . forEach ( ( chat ) => {
unreadCount += chat . unreadCount
} ) ;
return unreadCount ;
}
} ,
watch : {
unreadCount : {
handler ( newCount , oldCount ) {
let tip = newCount > 0 ? ` ${ newCount } 条未读 ` : "" ;
this . $elm . setTitleTip ( tip ) ;
} ,
immediate : true
}
} ,
mounted ( ) {
@ -209,12 +221,14 @@
flex : 1 ;
. el - menu - item {
margin - top : 20 px ;
margin : 25 px 0 ;
. router - link - exact - active span {
color : white ! important ;
}
span {
font - size : 24 px ! important ;
color : # aaaaaa ;
@ -223,6 +237,21 @@
color : white ! important ;
}
}
. unread - text {
position : absolute ;
line - height : 20 px ;
background - color : # f56c6c ;
left : 36 px ;
top : 7 px ;
color : white ;
border - radius : 30 px ;
padding : 0 5 px ;
font - size : 10 px ;
text - align : center ;
white - space : nowrap ;
border : 1 px solid # f1e5e5 ;
}
}
}