|
|
@@ -19,7 +19,7 @@
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</div>
|
|
|
- <el-badge :value="12" class="item">
|
|
|
+ <el-badge :value="unreadNum" class="item">
|
|
|
<el-button @click="openDrawer" style="margin:0 15px"><i style="font-size:14px; color:#5399F5;"
|
|
|
class="el-icon-chat-dot-square"> </i>消息中心
|
|
|
</el-button>
|
|
|
@@ -47,8 +47,21 @@
|
|
|
options: ['在线', '隐身', '休息'],
|
|
|
value: '隐身',
|
|
|
user_info: '',//
|
|
|
+ userID:null,
|
|
|
+ unreadNum:null, // 未读数量
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ get_drawer() {
|
|
|
+ return this.$store.getters.get_drawer;
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ get_drawer(data) {
|
|
|
+ this.unreadnotice();
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
openDrawer() {
|
|
|
this.$store.dispatch("SET_DRAWER", true);
|
|
|
@@ -85,12 +98,33 @@
|
|
|
websocketsend(Data) {
|
|
|
this.$websocket.send(Data);
|
|
|
},
|
|
|
+ // 未读信息
|
|
|
+ unreadnotice(){
|
|
|
+ let str = "unreadnotice" + "customer-service" + "index" + this.time + "service";
|
|
|
+ let obj = {
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded",
|
|
|
+ apiToken: this.$md5(str),
|
|
|
+ userToken: this.token
|
|
|
+ },
|
|
|
+ user_id: this.userID
|
|
|
+ };
|
|
|
+ this.post("api/service/index/unreadnotice", obj).then(res => {
|
|
|
+ if(res.data.code === 1){
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.unreadNum = res.data.data.length;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
+
|
|
|
mounted() {
|
|
|
if (this.$store.getters.get_stateValue) {
|
|
|
this.value = this.$store.getters.get_stateValue;
|
|
|
}
|
|
|
this.user_info = this.$store.getters.get_user_info;
|
|
|
+ this.userID = this.$store.getters.get_user_info.id;
|
|
|
+ this.unreadnotice();
|
|
|
}
|
|
|
}
|
|
|
</script>
|