|
@@ -326,6 +326,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
+ clearInterval(this.timer)
|
|
|
this.getUserInfo()
|
|
|
this.redDot()
|
|
|
},
|
|
@@ -370,56 +371,60 @@ export default {
|
|
|
},
|
|
|
//获取最新消息并弹窗
|
|
|
getMessageTips(){
|
|
|
+ console.log(111)
|
|
|
const that = this
|
|
|
- request({
|
|
|
- url: `/notice/list/out`,
|
|
|
- method: 'get',
|
|
|
- params: {
|
|
|
- num: 20,
|
|
|
- }
|
|
|
- }).then(res=>{
|
|
|
- res.data.forEach(item=>{
|
|
|
- this.$notify({
|
|
|
- title: '新消息',
|
|
|
- position: 'bottom-right',
|
|
|
- duration: 3000,
|
|
|
- message: that.$createElement(
|
|
|
- "div",
|
|
|
- {
|
|
|
- style: 'cursor: pointer;',
|
|
|
- on: {
|
|
|
- click: that.toDetail.bind(that,item.adminNoticeType,item.paidType,(item.adminNoticeType=='NOTICE'?item.noticeId:item.orderId),item.id)
|
|
|
- },
|
|
|
- },[
|
|
|
- that.$createElement(
|
|
|
- "span",
|
|
|
- null,
|
|
|
- that.statusFilter(item.adminNoticeType) + ' '
|
|
|
- ),
|
|
|
- that.$createElement(
|
|
|
- "span",
|
|
|
- {
|
|
|
- style: 'color: #409EFF;',
|
|
|
+ this.timer = setInterval(()=>{
|
|
|
+ request({
|
|
|
+ url: `/notice/list/out`,
|
|
|
+ method: 'get',
|
|
|
+ params: {
|
|
|
+ num: 20,
|
|
|
+ }
|
|
|
+ }).then(res=>{
|
|
|
+ res.data.forEach(item=>{
|
|
|
+ this.$notify({
|
|
|
+ title: '新消息',
|
|
|
+ position: 'bottom-right',
|
|
|
+ duration: 3000,
|
|
|
+ message: that.$createElement(
|
|
|
+ "div",
|
|
|
+ {
|
|
|
+ style: 'cursor: pointer;',
|
|
|
+ on: {
|
|
|
+ click: that.toDetail.bind(that,item.adminNoticeType,item.paidType,(item.adminNoticeType=='NOTICE'?item.noticeId:item.orderId),item.id)
|
|
|
},
|
|
|
- ' ' + item.adminNoticeType=='NOTICE'?item.title:item.orderId
|
|
|
- ),
|
|
|
- that.$createElement(
|
|
|
- "span",
|
|
|
- null,
|
|
|
- item.adminNoticeType=='NOTICE'?'':item.content
|
|
|
- ),
|
|
|
- // that.$createElement(
|
|
|
- // "el-checkbox",
|
|
|
- // {
|
|
|
- // on: {
|
|
|
- // change: that.updateIsNotice.bind(that)
|
|
|
- // },
|
|
|
- // }, '不再弹窗新消息'
|
|
|
- // )
|
|
|
- ])
|
|
|
- });
|
|
|
+ },[
|
|
|
+ that.$createElement(
|
|
|
+ "span",
|
|
|
+ null,
|
|
|
+ that.statusFilter(item.adminNoticeType) + ' '
|
|
|
+ ),
|
|
|
+ that.$createElement(
|
|
|
+ "span",
|
|
|
+ {
|
|
|
+ style: 'color: #409EFF;',
|
|
|
+ },
|
|
|
+ ' ' + item.adminNoticeType=='NOTICE'?item.title:item.orderId
|
|
|
+ ),
|
|
|
+ that.$createElement(
|
|
|
+ "span",
|
|
|
+ null,
|
|
|
+ item.adminNoticeType=='NOTICE'?'':item.content
|
|
|
+ ),
|
|
|
+ // that.$createElement(
|
|
|
+ // "el-checkbox",
|
|
|
+ // {
|
|
|
+ // on: {
|
|
|
+ // change: that.updateIsNotice.bind(that)
|
|
|
+ // },
|
|
|
+ // }, '不再弹窗新消息'
|
|
|
+ // )
|
|
|
+ ])
|
|
|
+ });
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ },20000)
|
|
|
+
|
|
|
},
|
|
|
getCount(){
|
|
|
request({
|
|
@@ -456,6 +461,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
getUserInfo(){
|
|
|
+ const that = this
|
|
|
request({
|
|
|
url: `/admin/user/detail`,
|
|
|
method: 'get',
|
|
@@ -464,11 +470,11 @@ export default {
|
|
|
}
|
|
|
}).then(res=>{
|
|
|
this.isOpen = res.data.isNotice=='YES'?true:false
|
|
|
- clearInterval(this.timer)
|
|
|
- if(res.data.isNotice=='YES'){
|
|
|
- this.timer = setInterval(()=>{
|
|
|
- this.getMessageTips()
|
|
|
- },20000)
|
|
|
+ if(res.data.isNotice=='NO'){
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }else{
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.getMessageTips()
|
|
|
}
|
|
|
})
|
|
|
},
|