Browse Source

修改消息实时显示

master
lihenian 6 years ago
parent
commit
fff6dd36f7
  1. 44
      src/views/main-sidebar.vue

44
src/views/main-sidebar.vue

@ -45,24 +45,44 @@ export default {
this.filterRoute(item.children, selectRoute)
} else {
if (item.menuCode === selectRoute.menuCode) {
item.num = selectRoute.num
this.pid = item.pid
if (selectRoute.num !== 0) {
item.num = selectRoute.num
this.pid = `true${item.pid}`
} else {
item.num = selectRoute.num
this.pid = `false${item.pid}`
}
}
}
})
routeList.forEach(item => {
if (item.children && item.children.length >= 1) {
if (item.id === this.pid) {
item.redPoint = true
if (parseInt(item.pid) !== 0) {
this.parentPid = item.pid
if (this.pid.indexOf('true') > -1) {
if (item.id === this.pid.substring(4)) {
item.redPoint = true
if (parseInt(item.pid) !== 0) {
this.parentPid = `true${item.pid}`
}
}
} else if (this.pid.indexOf('false') > -1) {
if (item.id === this.pid.substring(5)) {
item.redPoint = false
if (parseInt(item.pid) !== 0) {
this.parentPid = `false${item.pid}`
}
}
}
}
})
routeList.forEach(item => {
if (item.id === this.parentPid) {
item.redPoint = true
if (this.parentPid.indexOf('true') > -1) {
if (item.id === this.parentPid.substring(4)) {
item.redPoint = true
}
} else if (this.parentPid.indexOf('false') > -1) {
if (item.id === this.parentPid.substring(5)) {
item.redPoint = false
}
}
})
return routeList
@ -99,13 +119,16 @@ export default {
console.log('Connected: ' + frame)
let topic = '/userMenuNotice/menuNoticeQueue/menu/getResponse'
this.stompClient.subscribe(topic, this.onSubscribe)
if (window.sessionStorage.getItem('routeList')) {
this.routeList = JSON.parse(window.sessionStorage.getItem('routeList'))
}
//
this.$http.get('/events/epdcevents/initMenuNotice').then(({ data: res }) => {}).catch(() => {
})
},
onSubscribe (value) {
this.pid = 0
this.parentPid = 0
this.pid = ''
this.parentPid = ''
const selectRoute = JSON.parse(value.body)
const list = JSON.parse(JSON.stringify(this.$store.state.sidebarMenuList))
if (Object.prototype.toString.call(selectRoute) === '[object Array]') {
@ -116,6 +139,7 @@ export default {
this.$store.state.sidebarMenuList = this.filterRoute(list, selectRoute)
}
this.routeList = JSON.parse(JSON.stringify(this.$store.state.sidebarMenuList))
window.sessionStorage.setItem('routeList', JSON.stringify(this.$store.state.sidebarMenuList))
},
onFailed (frame) {
console.log('Failed: ' + frame)

Loading…
Cancel
Save