| | |
| | | var Constant = require('../../utils/constant.js'); |
| | | var app = getApp(); |
| | | import Request from "../../utils/api" |
| | | import Request from "../../utils/api" |
| | | let Utils = require('../../utils/util'); |
| | | /** |
| | | * ifRotate:是否可旋转 |
| | |
| | | Page({ |
| | | data: { |
| | | list: { |
| | | Code:"", |
| | | Name:"", |
| | | SeriesNO:"", |
| | | IsRotateAble:true, |
| | | IsZoomble:false, |
| | | TokenInfo:{ |
| | | LiveUrl:"", |
| | | ViewToken:"at.cbyr6wyr12q4av8b35ha4zrs8e8xzzuk-26knzphnzo-10wmjk6-kyxbisivp", |
| | | } |
| | | Code: "", |
| | | Name: "", |
| | | SeriesNO: "", |
| | | IsRotateAble: true, |
| | | IsZoomble: false, |
| | | TokenInfo: { |
| | | LiveUrl: "", |
| | | ViewToken: "at.cbyr6wyr12q4av8b35ha4zrs8e8xzzuk-26knzphnzo-10wmjk6-kyxbisivp", |
| | | }, |
| | | }, |
| | | Name:"", |
| | | Name: "", |
| | | moreVideo: [], |
| | | fullScreen: false, // 操作是否显示 |
| | | btnCmd:"",//当前操作的cmd按钮 |
| | | videoTabBarIndex:1, //当前的tabbar索引 |
| | | isLoadingDeviceAlarmList:false,//是否加载了设备告警记录 |
| | | deviceAlarmList:[],//设备告警列表 |
| | | btnCmd: "", //当前操作的cmd按钮 |
| | | videoTabBarIndex: 1, //当前的tabbar索引 |
| | | isLoadingDeviceAlarmList: false, //是否加载了设备告警记录 |
| | | deviceAlarmList: [], //设备告警列表 |
| | | alarmPageIndex: 0, |
| | | alarmPageSize: 10, |
| | | isLoadingAllDeviceAlarmListData: false, //是否加载了全部的告警列表数据 |
| | | isLoad:false,//列表加载状态 |
| | | isShowLoadItem:true, //是否显示加载框 |
| | | alarmDate:Utils.getDay("",new Date()) , |
| | | currentDate:Utils.getDay("",new Date()), |
| | | startTime:Date.parse(new Date(new Date(Utils.getDay("",new Date())).setHours(0, 0, 0, 0))), |
| | | endTime: Date.parse(new Date()) |
| | | }, |
| | | onLoad(options) { |
| | | this.videoContext = wx.createVideoContext('myVideo') |
| | |
| | | title: videoInfo.Name, |
| | | }) |
| | | that.setData({ |
| | | Name:videoInfo.Name |
| | | Name: videoInfo.Name |
| | | }) |
| | | } |
| | | if (options.more == 'CA') { |
| | |
| | | return; |
| | | } |
| | | that.setData({ |
| | | list:videoInfo |
| | | list: videoInfo |
| | | }) |
| | | console.log(videoInfo,"videoInfo") |
| | | // console.log(videoInfo,"videoInfo") |
| | | that.getVideoAddressSrc(videoInfo); |
| | | |
| | | }, |
| | |
| | | } |
| | | }, |
| | | |
| | | //获取所有的视频列表的播放路径 |
| | | getVideoAddressSrc(videoInfo){ |
| | | let that = this |
| | | // console.log(token,deviceNo + ":" + channelNo,132) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/live/address/get", |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | method: 'POST', |
| | | data: { |
| | | accessToken : videoInfo.ViewToken, |
| | | source:videoInfo.SeriesNO + ":" + videoInfo.ChannelNo |
| | | }, |
| | | success: function (res) { |
| | | console.log(res, '摄像头播放地址') |
| | | let m_allVideoAddressInfo = res.data.data; |
| | | var m_caremaList = that.data.list; |
| | | m_caremaList.LiveUrl = m_allVideoAddressInfo[0].hlsHd |
| | | // console.log(m_caremaList,140) |
| | | //获取所有的视频列表的播放路径 |
| | | getVideoAddressSrc(videoInfo) { |
| | | let that = this |
| | | // console.log(token,deviceNo + ":" + channelNo,132) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/live/address/get", |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | method: 'POST', |
| | | data: { |
| | | accessToken: videoInfo.ViewToken, |
| | | source: videoInfo.SeriesNO + ":" + videoInfo.ChannelNo |
| | | }, |
| | | success: function (res) { |
| | | // console.log(res, '摄像头播放地址') |
| | | let m_allVideoAddressInfo = res.data.data; |
| | | var m_caremaList = that.data.list; |
| | | m_caremaList.LiveUrl = m_allVideoAddressInfo[0].hlsHd |
| | | // console.log(m_caremaList,140) |
| | | |
| | | m_caremaList.Code = m_allVideoAddressInfo[0].deviceName |
| | | m_caremaList.Name= that.data.Name |
| | | m_caremaList.SeriesNO = m_allVideoAddressInfo[0].deviceSerial |
| | | m_caremaList.IsRotateAble= true |
| | | m_caremaList.IsZoomble= false |
| | | m_caremaList.Code = m_allVideoAddressInfo[0].deviceName |
| | | m_caremaList.Name = that.data.Name |
| | | m_caremaList.SeriesNO = m_allVideoAddressInfo[0].deviceSerial |
| | | m_caremaList.IsRotateAble = true |
| | | m_caremaList.IsZoomble = false |
| | | |
| | | that.setData({ |
| | | list: m_caremaList |
| | | }) |
| | | // that.getVideoPalyBackSrc() |
| | | // console.log(that.data.list,"list") |
| | | |
| | | }, |
| | | fail: function (res) { |
| | | console.log('失败') |
| | | }, |
| | | }) |
| | | }, |
| | | //获取视频回放路径 |
| | | getVideoPalyBackSrc(){ |
| | | let that = this |
| | | let m_caremaInfo = that.data.list |
| | | console.log(m_caremaInfo,181181) |
| | | // console.log(token,deviceNo + ":" + channelNo,132) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/v2/live/address/get", |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | method: 'POST', |
| | | data: { |
| | | accessToken : m_caremaInfo.TokenInfo.ViewToken, |
| | | deviceSerial:m_caremaInfo.SeriesNO, |
| | | protocol:1, |
| | | startTime:"2022-10-13 00:00:00", |
| | | stopTime:"2022-10-18 00:00:00", |
| | | type:2 |
| | | }, |
| | | success: function (res) { |
| | | console.log(res, '摄像头回放地址') |
| | | }, |
| | | fail: function (res) { |
| | | console.log('失败') |
| | | }, |
| | | }) |
| | | }, |
| | | //获取设备告警信息列表 |
| | | getAlarmByDeviceList(){ |
| | | let _this = this |
| | | // console.log(_this.data.list,175) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL +'api/lapp/alarm/device/list', |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | that.setData({ |
| | | list: m_caremaList |
| | | }) |
| | | // that.getVideoPalyBackSrc() |
| | | // console.log(that.data.list,"list") |
| | | |
| | | }, |
| | | fail: function (res) { |
| | | console.log('失败') |
| | | }, |
| | | }) |
| | | }, |
| | | method: 'POST', |
| | | data:{ |
| | | accessToken:_this.data.list.ViewToken, |
| | | deviceSerial:_this.data.list.SeriesNO, |
| | | //获取视频回放路径 |
| | | getVideoPalyBackSrc() { |
| | | let that = this |
| | | let m_caremaInfo = that.data.list |
| | | // console.log(m_caremaInfo,181181) |
| | | // console.log(token,deviceNo + ":" + channelNo,132) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/v2/live/address/get", |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | method: 'POST', |
| | | data: { |
| | | accessToken: m_caremaInfo.TokenInfo.ViewToken, |
| | | deviceSerial: m_caremaInfo.SeriesNO, |
| | | protocol: 1, |
| | | startTime: "2022-10-13 00:00:00", |
| | | stopTime: "2022-10-18 00:00:00", |
| | | type: 2 |
| | | }, |
| | | success: function (res) { |
| | | // console.log(res, '摄像头回放地址') |
| | | }, |
| | | fail: function (res) { |
| | | console.log('失败') |
| | | }, |
| | | }) |
| | | }, |
| | | success:res=>{ |
| | | console.log(res,188) |
| | | if(res.data.code==200){ |
| | | let arr= [] |
| | | res.data.data.forEach(item=>{ |
| | | item.alarmTime = Utils.formatDay(new Date(item.alarmTime)) |
| | | arr.push(item) |
| | | }) |
| | | _this.setData({ |
| | | deviceAlarmList:arr, |
| | | isLoadingDeviceAlarmList:true |
| | | }) |
| | | //当报警列表加载到底部的时候刷新数据 |
| | | toLowerLoadAlarmList(){ |
| | | this.getAlarmByDeviceList() |
| | | }, |
| | | //获取设备告警信息列表 |
| | | getAlarmByDeviceList() { |
| | | let _this = this |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + 'api/lapp/alarm/device/list', |
| | | header: { |
| | | 'content-type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | method: 'POST', |
| | | data: { |
| | | accessToken: _this.data.list.ViewToken, |
| | | deviceSerial: _this.data.list.SeriesNO, |
| | | pageStart: _this.data.alarmPageIndex, |
| | | pageSize: _this.data.alarmPageSize, |
| | | startTime:_this.data.startTime, |
| | | endTime: _this.data.endTime |
| | | }, |
| | | success: res => { |
| | | console.log(res, 188) |
| | | _this.setData({ |
| | | isLoad:true, |
| | | isShowLoadItem:false |
| | | }) |
| | | if (res.data.code == 200) { |
| | | if(res.data.data.length == 0){ |
| | | _this.setData({ |
| | | isShowLoadItem:true |
| | | }) |
| | | return |
| | | } |
| | | let arr = [] |
| | | if (_this.data.deviceAlarmList.length < res.data.page.total) { |
| | | res.data.data.forEach(item => { |
| | | item.alarmTime = Utils.formatTime(new Date(item.alarmTime)) |
| | | item.alarmType = _this.getAlarmTypeEnum(item.alarmType) |
| | | arr.push(item) |
| | | }) |
| | | _this.setData({ |
| | | alarmPageIndex: ++ _this.data.alarmPageIndex, |
| | | deviceAlarmList: _this.data.deviceAlarmList.concat(arr), |
| | | isLoadingDeviceAlarmList: true |
| | | }) |
| | | } |
| | | if (_this.data.deviceAlarmList.length == res.data.page.total) { |
| | | _this.setData({ |
| | | isLoadingAllDeviceAlarmListData: true, |
| | | // isShowLoadItem:true |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | }, |
| | | fail: err => { |
| | | console.log(err, 191) |
| | | } |
| | | }) |
| | | }, |
| | | // 获取警告类型枚举 |
| | | getAlarmTypeEnum(type){ |
| | | if(type == 10002){ |
| | | return type = "移动侦测告警" |
| | | } |
| | | }, |
| | | fail:err=>{ |
| | | console.log(err,191) |
| | | } |
| | | }) |
| | | }, |
| | | //监控功能tabBar切换 |
| | | videoTabBarChange(e){ |
| | | // console.log(e,173) |
| | | if(e.currentTarget.dataset.id == 2 && !this.data.isLoadingDeviceAlarmList){ |
| | | //监控功能tabBar切换 |
| | | videoTabBarChange(e) { |
| | | // console.log(e,173) |
| | | if (e.currentTarget.dataset.id == 2 && !this.data.isLoadingDeviceAlarmList) { |
| | | this.getAlarmByDeviceList() |
| | | } |
| | | this.setData({ |
| | | videoTabBarIndex:e.currentTarget.dataset.id |
| | | }) |
| | | }, |
| | | } |
| | | this.setData({ |
| | | videoTabBarIndex: e.currentTarget.dataset.id |
| | | }) |
| | | }, |
| | | //告警查询日期选择 |
| | | alarmDateChange(e){ |
| | | // console.log(e,258) |
| | | let startTime = "" |
| | | let endTime = "" |
| | | let selectDate = Date.parse(new Date(e.detail.value)) |
| | | let currentDate = Date.parse(new Date()) |
| | | //判断选择的日期与今天是不是同一天 |
| | | if(selectDate == currentDate){ |
| | | startTime = Date.parse(new Date(new Date(Utils.getDay("",new Date())).setHours(0, 0, 0, 0))) |
| | | endTime = Date.parse(new Date()) |
| | | }else { |
| | | startTime = Date.parse(new Date(new Date(e.detail.value).setHours(0, 0, 0, 0))) |
| | | endTime = Date.parse(new Date(new Date(e.detail.value).setHours(23, 59, 0, 0))) |
| | | } |
| | | |
| | | // console.log(selectDate,currentDate,266) |
| | | this.setData({ |
| | | deviceAlarmList:[], |
| | | alarmDate:e.detail.value, |
| | | alarmPageIndex:0, |
| | | alarmPageSize:10, |
| | | startTime:startTime, |
| | | endTime:endTime, |
| | | }) |
| | | this.getAlarmByDeviceList() |
| | | }, |
| | | fullScreenStart(e) { |
| | | var that = this; |
| | | var m_caremaList = that.data.list; |
| | | var i = 1; |
| | | var cmd = e.currentTarget.dataset.cmd; |
| | | that.setData({ |
| | | btnCmd:e.currentTarget.dataset.direction |
| | | btnCmd: e.currentTarget.dataset.direction |
| | | }) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/device/ptz/start", |
| | |
| | | var i = 1; |
| | | var cmd = e.currentTarget.dataset.cmd; |
| | | that.setData({ |
| | | btnCmd:"" |
| | | btnCmd: "" |
| | | }) |
| | | wx.request({ |
| | | url: Constant.YING_SHI_URL + "api/lapp/device/ptz/stop", |
| | |
| | | speed: 1, |
| | | }, |
| | | success: function (res) { |
| | | // console.log(res, i, cmd,'成功fullScreenEnd') |
| | | // console.log(res, i, cmd,'成功fullScreenEnd') |
| | | }, |
| | | fail: function (res) { |
| | | console.log('失败') |
| | |
| | | var videoTime = e.detail |
| | | this.setData({ |
| | | videoTime: { |
| | | currentTime: videoTime.currentTime?videoTime.currentTime:0, |
| | | duration: videoTime.duration?videoTime.duration:0 |
| | | currentTime: videoTime.currentTime ? videoTime.currentTime : 0, |
| | | duration: videoTime.duration ? videoTime.duration : 0 |
| | | } |
| | | }) |
| | | }, |
| | | toPlayBack(){ |
| | | console.log(this.data.moreVideo,305) |
| | | toPlayBack() { |
| | | // console.log(this.data.moreVideo,305) |
| | | wx.navigateTo({ |
| | | url: '../playBack/index', |
| | | }) |
| | | }, |
| | | |
| | | }) |