This commit is contained in:
linfso 2025-01-03 11:31:26 +08:00
parent 00ae1a03a3
commit e675021267

View File

@ -126,19 +126,12 @@ export default {
} }
}, },
initXDNoticSdk(){ initXDNoticSdk(){
console.log("===>initXDNoticSdk==>")
this.xdNoticSdk = this.$xdNoticeSdk; this.xdNoticSdk = this.$xdNoticeSdk;
const userId=this.$store.getters.userId; const userId=this.$store.getters.userId;
// const token=getToken();
// console.log("===>userId==>",userId);
// this.xdNoticSdk.init(userId);
this.xdNoticSdk.initWsPlus(userId); this.xdNoticSdk.initWsPlus(userId);
this.xdNoticSdk.setOnOpen(this.onNoticeOpen); this.xdNoticSdk.setOnOpen(this.onNoticeOpen);
this.xdNoticSdk.setOnClose(this.onNoticeClose); this.xdNoticSdk.setOnClose(this.onNoticeClose);
this.xdNoticSdk.setOnError(this.onNoticeError); this.xdNoticSdk.setOnError(this.onNoticeError);
this.xdNoticSdk.setOnMessage(this.onMessage); this.xdNoticSdk.setOnMessage(this.onMessage);
}, },
@ -191,6 +184,10 @@ export default {
that.setAddReadTimes(noticeId); that.setAddReadTimes(noticeId);
}, },
}); });
// 加载通知消息
this.initUserNotice();
}, },
setAddReadTimes(noticeId){ setAddReadTimes(noticeId){
addReadTimes({"noticeId":noticeId}).then(response => { addReadTimes({"noticeId":noticeId}).then(response => {
@ -224,30 +221,8 @@ export default {
}, },
showNotice(item){ showNotice(item){
console.log("==showNotice===>xxx===>",item);
this.setAddReadTimes(item.noticeId); this.setAddReadTimes(item.noticeId);
}, },
// notificationInfo(messageBody) {
// // this.speech.speak({ text: messageBody }).then(() => {
// // console.log("读取成功");
// // });
// Notification.info({
// title: "通知",
// dangerouslyUseHTMLString: true,
// message: messageBody.noticeContent,
// position: 'bottom-right',
// onClick: function () {
// //self.warnDetailByWarnid(messageBody.warnId); //自定义回调,message为传的参数
// // 点击跳转的页面
// },
// });
// },
// join() {
//
// },
exit() { exit() {
if (this.ws) { if (this.ws) {
this.ws.close(); this.ws.close();