/** * Created by dengbk on 2019/3/27. */ /* * 预警信息提示 * */ layui.define(['layer','vciWebSocket','util'],function(exports){ var Reminder = function(){ this.moduleKey = "vciWebReminder"; this.basePath = path; this.url = { }; this.getContent = function(){ return ''; }; this.init = function(){ var that = this; var socket = layui.vciWebSocket; var userOid = $webUtil.getSystemVar($webUtil.systemValueKey.userOid) socket.init({ wsUrl:"ws://"+that.url,//服务器地址 HeartBeat:'xxx',//发送的心跳数据 防止失活 timeout:300000,//发送心跳数据的间隔时间 onopen:function(){ //握手成功 //console.log("服务连接成功"); socket.send(userOid);//发送数据 }, onmessage:function(data){ //收到消息 that.showWarning(data.msg); that.showTask(data) } }); //socket.close();//断开连接 }; this.showWarning = function(msg){ var that = this; var alertHtmlId = $("#systemReminder_tips"); alertHtmlId.find("span").html(msg); alertHtmlId.show(); window.setTimeout(function(){ alertHtmlId.hide() },10000) }; this.showTask = function(data){ var that = this; var content =[ '