NavBar.vue 2.59 KB
<template>
  <!--<tab class="g-header">-->
    <!--<tab-item class="vux-tab">-->
      <!--<router-link :to="{name:'contacts'}">-->
        <!--&lt;!&ndash;系统通知&ndash;&gt;-->
        <!--<span class="contacts-icon"></span>-->
        <!--&lt;!&ndash;<span class="dot"></span>&ndash;&gt;-->
      <!--</router-link>-->
    <!--</tab-item>-->
    <!--<tab-item class="vux-tab" :line-width="0">-->
      <!--<router-link :to="{name:'session'}">-->
        <!--&lt;!&ndash;最近会话&ndash;&gt;-->
        <!--<span class="session-icon"></span>-->
        <!--<span v-if="unreadArr.length !=0 " class="dot"></span>-->
      <!--</router-link>-->
    <!--</tab-item>-->
  <!--</tab>-->
</template>

<script>

import {Tab,TabItem,Loading,ViewBox,XHeader} from 'vux'

export default {
  components:{
    Tab,
    TabItem,
    Loading,
    ViewBox,
    XHeader
  },
  data(){
    return {
    }
  },
  computed: {
    route () {
      return this.$store.getters.route
    },
    unreadArr(){
        let allSession = this.$store.state.sessionlist;
        let enableSession = [];
        for(let i=0;i<allSession.length;i++){
            if( allSession[i].scene == 'p2p' && allSession[i].lastMsg){
                if(allSession[i].lastMsg.content){
                    let content = JSON.parse(allSession[i].lastMsg.content);
                    if(allSession[i].lastMsg.type == 'custom' && content.type == 10){
                        continue;
                    }else{
                        enableSession.push(allSession[i]);
                    }
                }else{
                    enableSession.push(allSession[i]);
                }
            }
        }
        let unreadArr = [];
        for(let i=0;i<enableSession.length;i++){
            if(enableSession[i].unread != 0){
                unreadArr.push(enableSession[i])
            }
        }
        return unreadArr
    }
  },
  methods: {

  }
}
</script>

<style type="text/css">
  .dot{
    display:inline-block;
    width:8px;
    height:8px;
    border-radius:4px;
    background-color:#f00;
    margin-left:-11.5px;
    vertical-align:top;
    margin-top:4.5px;
  }
  .session-icon,.contacts-icon{
    display:inline-block;
    width:30px;
    height:30px;
    background-size:contain;
    margin-top:5.2px;
  }
  .session-icon{
    background-image:url('/yunxin/res/im/msg_N.png')
  }
  .router-link-active .session-icon{
    background-image:url('/yunxin/res/im/msg_H.png')
  }
  .contacts-icon{
    background-image:url('/yunxin/res/im/sysMsg_N.png')
  }
  .router-link-active .contacts-icon{
    background-image:url('/yunxin/res/im/sysMsg_H.png')
  }
</style>