md
This commit is contained in:
parent
cdd405bb82
commit
666131a42c
@ -9,7 +9,18 @@ export function listNotice(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户自己通知或公告列表
|
||||||
|
* @param query
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getUserNoticeList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/notice/getUserNoticeList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询用户公告列表
|
// 查询用户公告列表
|
||||||
export function getTopNoticeListByUserId(query) {
|
export function getTopNoticeListByUserId(query) {
|
||||||
@ -73,3 +84,13 @@ export function delNotice(noticeId) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除记录
|
||||||
|
*/
|
||||||
|
export function clearNotice(noticeId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/notice/clearNotice/' + noticeId,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
popper-class="xd-notice-pop">
|
popper-class="xd-notice-pop">
|
||||||
<div slot="reference" >
|
<div slot="reference" >
|
||||||
<div>
|
<div>
|
||||||
<el-badge :value="allNum" :hidden="!newNotice">
|
<!-- :hidden="!newNotice" -->
|
||||||
|
<el-badge :value="allNum" >
|
||||||
<i class="el-icon-bell"></i>
|
<i class="el-icon-bell"></i>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</div>
|
</div>
|
||||||
@ -38,9 +39,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="alertList.length" class="ele-cell xd-notice-actions">
|
<div v-if="alertList.length" class="ele-cell xd-notice-actions">
|
||||||
<div class="xd-item-content" @click="clear('notice')">清空通知</div>
|
<div class="xd-item-content" @click="clear('alert')">清空通知</div>
|
||||||
<el-divider direction="vertical" class="line-color-light"/>
|
<el-divider direction="vertical" class="line-color-light"/>
|
||||||
<div class="xd-item-content" @click="more('notice')">查看更多</div>
|
<div class="xd-item-content" @click="more('alert')">查看更多</div>
|
||||||
</div>
|
</div>
|
||||||
<el-empty v-if="!alertList.length" description="没有最新消息" />
|
<el-empty v-if="!alertList.length" description="没有最新消息" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -76,7 +77,7 @@
|
|||||||
|
|
||||||
import {Notification} from "element-ui";
|
import {Notification} from "element-ui";
|
||||||
import Speech from 'speak-tts'
|
import Speech from 'speak-tts'
|
||||||
import {getTopNoticeListByUserId,addReadTimes,getPublicNoticeList} from "@/api/system/notice";
|
import {getTopNoticeListByUserId,addReadTimes,getPublicNoticeList,clearNotice} from "@/api/system/notice";
|
||||||
export default {
|
export default {
|
||||||
name: 'TopNotice',
|
name: 'TopNotice',
|
||||||
data() {
|
data() {
|
||||||
@ -86,6 +87,7 @@ export default {
|
|||||||
active: 'alertTab',
|
active: 'alertTab',
|
||||||
isPlay:false,
|
isPlay:false,
|
||||||
alertList:[],
|
alertList:[],
|
||||||
|
noReadNoticeCount:0,
|
||||||
noticeList: [],
|
noticeList: [],
|
||||||
|
|
||||||
xdNoticSdk:null,
|
xdNoticSdk:null,
|
||||||
@ -95,11 +97,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 所有消息数量
|
// 所有消息数量
|
||||||
allNum() {
|
allNum() {
|
||||||
return this.alertList.length;
|
return this.noReadNoticeCount;
|
||||||
},
|
},
|
||||||
newNotice(){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener("click", this.setCanPlayTone);
|
window.addEventListener("click", this.setCanPlayTone);
|
||||||
@ -153,8 +153,12 @@ export default {
|
|||||||
onMessage(evtStr){
|
onMessage(evtStr){
|
||||||
|
|
||||||
let that=this;
|
let that=this;
|
||||||
|
|
||||||
|
if(evtStr==null||evtStr==undefined){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let evt= JSON.parse(evtStr);
|
let evt= JSON.parse(evtStr);
|
||||||
console.log("===>onMessage==>",evt)
|
|
||||||
if(evt==null||evt==undefined){
|
if(evt==null||evt==undefined){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -197,6 +201,7 @@ export default {
|
|||||||
// 获取通知信息
|
// 获取通知信息
|
||||||
getTopNoticeListByUserId().then(response => {
|
getTopNoticeListByUserId().then(response => {
|
||||||
this.alertList=response.rows;
|
this.alertList=response.rows;
|
||||||
|
this.calcNoReadNoticeCount();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取公告信息
|
// 获取公告信息
|
||||||
@ -206,6 +211,17 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
calcNoReadNoticeCount(){
|
||||||
|
this.noReadNoticeCount = 0;
|
||||||
|
this.alertList.forEach(item=>{
|
||||||
|
|
||||||
|
if(item.blRead == 0) {
|
||||||
|
this.noReadNoticeCount=this.noReadNoticeCount+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
showNotice(item){
|
showNotice(item){
|
||||||
console.log("==showNotice===>xxx===>",item);
|
console.log("==showNotice===>xxx===>",item);
|
||||||
this.setAddReadTimes(item.noticeId);
|
this.setAddReadTimes(item.noticeId);
|
||||||
@ -256,8 +272,12 @@ export default {
|
|||||||
|
|
||||||
/* 清空消息 */
|
/* 清空消息 */
|
||||||
clear(type) {
|
clear(type) {
|
||||||
if (type === 'notice') {
|
if (type === 'alert') {
|
||||||
this.notice = [];
|
let noticeIds=this.alertList.map(item=>item.id).join(',');
|
||||||
|
clearNotice(noticeIds).then(response => {
|
||||||
|
console.log("清除成功");
|
||||||
|
this.alertList = [];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 查看更多 */
|
/* 查看更多 */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user