var url = null; var videoData = null; var playData =null; var data = { "interfaceId": "5604", "tokenAuth": "", "outId": "56041", "reqDateTime": new Date(), "data": { "deptId": "" } }; var data1 = { "interfaceId": "5605", "tokenAuth": "", "outId": "56051", "reqDateTime": new Date(), "data": { "id": "", "playType": "" } }; function init() { var user = JSON.parse(localStorage.getItem('user')); var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); data.tokenAuth = user.tokenAuth; data1.tokenAuth = user.tokenAuth; data.data.deptId = selectDeptId; url = user.url + "/api-phone/v35/gateway"; getVideoList(); } function getVideoList() { //发送请求获取视频设备 mui.ajax(url, { type: "POST", dataType: "json", crossDomain: true, contentType: "application/json;charset=utf-8", data: JSON.stringify(data), success: function(result) { if (result.code == "0000") { videoData = result.data; console.log(JSON.stringify(videoData)) renderVideo(); } else { renderVideo(); mui.alert(result.msg, '提示', ["确定"], function() {}, "div"); } }, error: function() { renderVideo(); mui.alert('系统繁忙,请重试!', '提示', ["确定"], function() {}, "div"); } }) } //渲染视频监控设备 function renderVideo() { var html = ''; if (videoData) { var videoList = videoData.data; if (videoList && videoList.length > 0) { $.each(videoList, function(index, item) { if (index % 3 == 0) { html += '
  • '; } if (index % 3 == 1) { html += '
  • '; } if (index % 3 == 2) { html += '
  • '; } if (item.type = '02') { html += '
    ' + item.name + ' (球机)
    '; } if (item.type == '01') { html += '
    ' + item.name + ' (枪机)
    '; } html += '
  • '; }) } else { html += '
  • 暂无相关设备
  • '; } }else{ html += '
  • 暂无相关设备
  • '; } $("#recordList").html(html); } function getVideo(cameraId,playType){ data1.data.id = cameraId; data1.data.playType = playType; //发送请求获取视频设备 mui.ajax(url, { type: "POST", dataType: "json", crossDomain: true, contentType: "application/json;charset=utf-8", data: JSON.stringify(data1), success: function(result) { if (result.code == "0000") { playData = result.data; console.log(JSON.stringify(playData)) toVideo(playData.playAddr); } else { toVideo(''); mui.alert(result.msg, '提示', ["确定"], function() {}, "div"); } }, error: function() { toVideo(''); mui.alert('系统繁忙,请重试!', '提示', ["确定"], function() {}, "div"); } }) } function toVideo(playAddr){ var html = ''; html += '' $("#toVideo").html(html); } mui('.mui-scroll-wrapper').scroll({ indicators: false, //是否显示滚动条 deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏 bounce: false, //是否启用回弹 deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006 });