|
|
@@ -3,10 +3,10 @@
|
|
|
<div class="right-bar">
|
|
|
<ul class="right-bar-center">
|
|
|
<li class="right-bar-item">
|
|
|
- <a href="/user#/cart" class="title" target="_blank">
|
|
|
+ <a @click="goCart" class="title" target="_blank">
|
|
|
<i class="iconfont icon-shopping-cart icon-xlg"></i>
|
|
|
</a>
|
|
|
- <div class="sidebar-menu"><a href="/user#/cart" title="我的购物车" target="_blank">我的购物车<em><span>(<span v-text="cartCount.count || 0"></span>)</span></em></a></div>
|
|
|
+ <div class="sidebar-menu"><a @click="goCart" title="我的购物车" target="_blank">我的购物车<em><span>(<span v-text="cartCount.count || 0"></span>)</span></em></a></div>
|
|
|
</li>
|
|
|
<li class="right-bar-item">
|
|
|
<el-button type="text" @click="dialogVisible = true">
|
|
|
@@ -29,11 +29,11 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="right-bar-item contact-menu">
|
|
|
- <a href="javascript:void(0)" class="title" @click="goWebChat">
|
|
|
+ <a href="javascript:void(0)" class="title" @click="goWebChat" @mouseenter="getChatCount">
|
|
|
<i class="fa fa-comments-o" aria-hidden="true" style="font-size: 18px;color: #FFFFFF;">
|
|
|
</i>
|
|
|
</a>
|
|
|
- <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联</a><em><!-- ngIf: userInfo --></em></div>
|
|
|
+ <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联<span v-if="user.logged">({{chatCount}})</span></a></div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<ul class="right-bar-bottom">
|
|
|
@@ -86,7 +86,8 @@
|
|
|
dialogImageUrl: '',
|
|
|
page: 1,
|
|
|
count: 3,
|
|
|
- currentPage: 1
|
|
|
+ currentPage: 1,
|
|
|
+ chatCount: -1
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
@@ -152,8 +153,19 @@
|
|
|
this.$store.dispatch('user/deleteHistory', {id: id})
|
|
|
this.loadHistorys()
|
|
|
},
|
|
|
+ goCart: function () {
|
|
|
+ if (!this.user.logged) {
|
|
|
+ this.$http.get('/login/page').then(response => {
|
|
|
+ if (response.data) {
|
|
|
+ this.$router.push('/auth/login')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ window.location.href = '/user#/cart'
|
|
|
+ }
|
|
|
+ },
|
|
|
goWebChat: function () {
|
|
|
- if (!this.$store.state.option.user.logged) {
|
|
|
+ if (!this.user.logged) {
|
|
|
this.$http.get('/login/page').then(response => {
|
|
|
if (response.data) {
|
|
|
this.$router.push('/auth/login')
|
|
|
@@ -182,6 +194,14 @@
|
|
|
console.log(err)
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ getChatCount: function () {
|
|
|
+ if (this.user.logged) {
|
|
|
+ axios.get('http://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})
|
|
|
+ .then(response => {
|
|
|
+ this.chatCount = response.data.count
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|