消息修改

This commit is contained in:
fengachen
2021-09-26 11:12:04 +08:00
parent d49c133db4
commit 9f534e2381
3 changed files with 44 additions and 7 deletions
+3
View File
@@ -0,0 +1,3 @@
import Vue from 'vue'
export const Bus = new Vue()
+21 -3
View File
@@ -43,6 +43,7 @@
// import ShowAnnouncement from './ShowAnnouncement' // import ShowAnnouncement from './ShowAnnouncement'
import store from '@/store/' import store from '@/store/'
import DynamicNotice from './DynamicNotice' import DynamicNotice from './DynamicNotice'
import {Bus} from '@comp/tools/Bus'
export default { export default {
@@ -85,8 +86,15 @@
this.initWebSocket() this.initWebSocket()
// this.heartCheckFun(); // this.heartCheckFun();
}, },
created() {
Bus.$on('notice-change', () => {
// console.log('notice-change')
this.loadData()
})
},
destroyed: function () { // 离开页面生命周期函数 destroyed: function () { // 离开页面生命周期函数
this.websocketOnclose() this.websocketOnclose()
Bus.$off('notice-change')
}, },
methods: { methods: {
timerFun() { timerFun() {
@@ -136,15 +144,25 @@
putAction(this.url.editCementSend,{anntId:record.id}).then((res)=>{ putAction(this.url.editCementSend,{anntId:record.id}).then((res)=>{
if(res.success){ if(res.success){
this.loadData() this.loadData()
Bus.$emit('header-notice-change')
} }
}) })
this.hovered = false this.hovered = false
const param = JSON.parse(record.busId)
if(record.openType==='component'){ if(record.openType==='component'){
this.openPath = record.openPage this.openPath = record.openPage
this.formData = {id:record.busId} this.formData = param
this.$refs.showDynamNotice.detail(record.openPage) this.$refs.showDynamNotice.detail(record.openPage)
}else{ }else if(record.openType === 'url') {
// this.$refs.ShowAnnouncement.detail(record); console.log(record.openPage,'url')
const param = JSON.parse(record.busId)
// 如果是url 跳转页面
this.$router.push({
path:record.openPage,
query:param
})
}else {
this.$refs.ShowAnnouncement.detail(record)
} }
}, },
toMyAnnouncement(){ toMyAnnouncement(){
+20 -4
View File
@@ -90,6 +90,7 @@ import '@/assets/less/TableExpand.less'
import JDate from '@comp/tools/JDate' import JDate from '@comp/tools/JDate'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle' import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconImg from '@/assets/imgs/icon/icon_message.png' import IconImg from '@/assets/imgs/icon/icon_message.png'
import {Bus} from '@comp/tools/Bus'
export default { export default {
name: 'UserAnnouncementList', name: 'UserAnnouncementList',
@@ -159,6 +160,14 @@ export default {
formData: '' formData: ''
} }
}, },
created() {
Bus.$on('header-notice-change', () => {
this.loadData()
})
},
destroyed: function() { // 离开页面生命周期函数
Bus.$off('header-notice-change')
},
methods: { methods: {
handleDetail: function (record) { handleDetail: function (record) {
this.$refs.sysAnnouncementModal.detail(record) this.$refs.sysAnnouncementModal.detail(record)
@@ -169,6 +178,7 @@ export default {
if (res.success) { if (res.success) {
this.loadData() this.loadData()
this.syncHeadNotic(record.anntId) this.syncHeadNotic(record.anntId)
Bus.$emit('notice-change')
} }
}) })
const param = JSON.parse(record.busId) const param = JSON.parse(record.busId)
@@ -178,8 +188,8 @@ export default {
this.formData = param this.formData = param
this.$refs.showDynamNotice.detail() this.$refs.showDynamNotice.detail()
} else if(record.openType === 'url') { } else if(record.openType === 'url') {
console.log(JSON.parse(record.busId)) console.log(record.openPage,'url')
const param = {id: record.busId} const param = JSON.parse(record.busId)
// 如果是url 跳转页面 // 如果是url 跳转页面
this.$router.push({ this.$router.push({
path:record.openPage, path:record.openPage,
@@ -208,8 +218,14 @@ export default {
} }
}) })
}, },
haveRead() { haveRead(record) {
console.log('已读') putAction(this.url.editCementSend, {anntId: record.anntId}).then((res) => {
if (res.success) {
this.loadData()
this.syncHeadNotic(record.anntId)
Bus.$emit('notice-change')
}
})
}, },
/* /*
* 字符串截取 * 字符串截取