xzw 4 năm trước cách đây
mục cha
commit
89f18c1c41
2 tập tin đã thay đổi với 115 bổ sung109 xóa
  1. 2 2
      index.html
  2. 113 107
      js/main_2020_show.js

+ 2 - 2
index.html

@@ -143,8 +143,8 @@
                 <div class="mvideo">
                     <video id="monitor" controls></video>
                 </div>
-                <div id="calendar"></div>
-                <div class="histcon">
+                <div id="calendar" class='hide'></div>
+                <div class="histcon hide"   >
                     <h3>当前日期历史视频时间片段</h3>
                     <ul id="hislist">
                     </ul>

+ 113 - 107
js/main_2020_show.js

@@ -7,10 +7,114 @@ hardwareHotList = {}
 
 
 //热点  设备控制
+var showCalendar = function(hardware){
+    hardware = hardware || window.hotNeedUpdatePannel.infoAttribute.hardware
+    if($("#hotPannel>.m-con #calendar").hasClass('hide')) return;
+    $("#hotPannel .m-con .historyBtn").addClass('hide')
+    window.loadHistoryList()//clear
+    
+    var calendar;
+    var getCalendar = function(year,month) {//回放
+       
+        if (month.toString().length == 1) {
+            month = "0" + month;
+        } 
+        
+        getAjax(`/api/device/camera/queryVideoList`, 
+            {
+                "channelId": hardware.code,
+                "time": year + '-' + month, //"2012-01" 
+                "type": "month"
+            } ,
+            (data2)=>{
+                if (data2.code == 0) { 
+                    console.log(data2.data) // [{date: "1", status: "2"}, {date: "2", status: "2"},
+                    var hasMonitorDays = data2.data.filter(e=>e.status == '1');
+                    hasMonitorDays = hasMonitorDays.map(e=>{
+                        var day = e.date
+                        if (day.toString().length == 1) {
+                            day = "0" + day;
+                        }
+                        return {startDate:year + '-' + month + '-' + day, id:day}
+                    })//有监控的日期 
+                    
+                    calendar = loadCalendar({
+                        data: hasMonitorDays,
+                        /* [{
+                            'startDate': "2021-5-18",//有监控的日期 
+                            id: '传对应的id'
+                        }], */ 
+                        cellCb: (item)=>{//点击日期
+                            console.log(item);
+                            if (item) {  
+                                getAjax(`/api/device/camera/queryVideoList`, 
+                                    {
+                                        "channelId": hardware.code,
+                                        "time": item.startDate,
+                                        "type": "day"
+                                    }, 
+                                    (data3)=>{
+                                        console.log(data3) 
+                                        if(data3.code == 0){ 
+                                            var timeList = data3.data;
+                                            if(timeList){ 
+                                                window.loadHistoryList({ 
+                                                    data:timeList, 
+                                                    clickItem:(item)=>{//点击时间
+                                                        console.log(item);
+                                                        getAjax(`/api/device/camera/playBack`, {
+                                                            "channelId": hardware.code,
+                                                            "endTime": item.endTime,//"2021-05-13 13:00:01",
+                                                            "startTime": item.startTime,//"2021-05-13 12:00:01"
+                                                        },(data4)=>{
+                                                            if (data4.code == 0) {
+                                                                loadMonitor({
+                                                                    id: "monitor",
+                                                                    url: data4.data.external.hls //'http://14.215.216.123:18080/rtp/00A153DF/hls.m3u8'
+                                                                })
+                                                            }
+                                                    
+                                                        }, "获取视频回放地址失败", 'POST')
+                                                    }
+                                                }) 
+                                                
+                                            }
+                                        }     
+                                    
+                                    }, '获取视频日历day失败', 'POST'
+                                )
+                                 
+                            }else{//clear
+                                window.loadHistoryList()
+                                //loadMonitor({id: "monitor", url:null })
+                            }
+                        }
+                        ,
+                        monthCb: (month)=>{
+                            console.log(month); 
+                            //console.log(calendar.options.currentDate)
+                            getCalendar(year, month) 
+                        },
+                        yearSelect: (yearText)=> {
+                            console.log(yearText);
+                            //console.log(calendar.options.currentDate)
+                            getCalendar(yearText, month) 
+                        },
+                    })
+                }
+            }, "获取视频日历month失败", 'POST')
+    }
+    var date = new Date(); 
+    getCalendar(date.getFullYear(), date.getMonth()+1)
+ 
+}
+
+
 
 $("#hotPannel .close, #hotPannel .iconquxiao").on('click',(e)=>{//关闭
     $("#hotPannel>div").css("display","");
     loadMonitor({id: "monitor", url:null })
+    $("#hotPannel>.m-con #calendar, #hotPannel>.m-con .histcon").addClass("hide");
     window.hotNeedUpdatePannel = null;
     //$(".hardware-list .hard-body").css("display",'block')//展开列表
 })
@@ -22,6 +126,13 @@ $("#hotPannel input.mui-switch").on('change',(e)=>{//灯
     })
 })
 
+$("#hotPannel .m-con .historyBtn").on('click',(e)=>{//摄像头  查看历史
+    $("#hotPannel>.m-con #calendar, #hotPannel>.m-con .histcon").removeClass("hide");
+    
+    showCalendar()
+})
+
+ 
 
 var deviceBtnBind = function($elem, paramCode, paramValue){
     $elem.on('click',(e)=>{
@@ -15710,7 +15821,7 @@ window.Modernizr = function(n, e, t) {
 
                                 } else if (devType == "摄像头") {
                                     $("#hotPannel>.m-con").removeClass("hide")
- 
+                                    $("#hotPannel .m-con .historyBtn").removeClass("hide")
                                     getAjax(`/api/device/getLive/${hardware.code}`, null, (data2)=>{
                                         if (data2.code == 0) {
                                             loadMonitor({
@@ -15721,112 +15832,7 @@ window.Modernizr = function(n, e, t) {
                                     }
                                     , "获取视频地址失败")
                                     
-                                    window.loadHistoryList()//clear
-                                    
-                                    var calendar;
-                                    var getCalendar = function(year,month) {//回放
-                                       
-                                        if (month.toString().length == 1) {
-                                            month = "0" + month;
-                                        }
-                                        
-                                        
-                                        getAjax(`/api/device/camera/queryVideoList`, 
-                                            {
-                                                "channelId": hardware.code,
-                                                "time": year + '-' + month, //"2012-01" 
-                                                "type": "month"
-                                            } ,
-                                            (data2)=>{
-                                                if (data2.code == 0) { 
-                                                    console.log(data2.data) // [{date: "1", status: "2"}, {date: "2", status: "2"},
-                                                    var hasMonitorDays = data2.data.filter(e=>e.status == '1');
-                                                    hasMonitorDays = hasMonitorDays.map(e=>{
-                                                        var day = e.date
-                                                        if (day.toString().length == 1) {
-                                                            day = "0" + day;
-                                                        }
-                                                        return {startDate:year + '-' + month + '-' + day, id:day}
-                                                    })//有监控的日期 
-                                                    
-                                                    calendar = loadCalendar({
-                                                        data: hasMonitorDays,
-                                                        /* [{
-                                                            'startDate': "2021-5-18",//有监控的日期 
-                                                            id: '传对应的id'
-                                                        }], */ 
-                                                        cellCb: (item)=>{//点击日期
-                                                            console.log(item);
-                                                            if (item) {  
-                                                                getAjax(`/api/device/camera/queryVideoList`, 
-                                                                    {
-                                                                        "channelId": hardware.code,
-                                                                        "time": item.startDate,
-                                                                        "type": "day"
-                                                                    }, 
-                                                                    (data3)=>{
-                                                                        console.log(data3) 
-                                                                        if(data3.code == 0){ 
-                                                                            var timeList = data3.data;
-                                                                            if(timeList){ 
-                                                                                window.loadHistoryList({ 
-                                                                                    data:timeList, 
-                                                                                    clickItem:(item)=>{//点击时间
-                                                                                        console.log(item);
-                                                                                        getAjax(`/api/device/camera/playBack`, {
-                                                                                            "channelId": hardware.code,
-                                                                                            "endTime": item.endTime,//"2021-05-13 13:00:01",
-                                                                                            "startTime": item.startTime,//"2021-05-13 12:00:01"
-                                                                                        },(data4)=>{
-                                                                                            if (data4.code == 0) {
-                                                                                                loadMonitor({
-                                                                                                    id: "monitor",
-                                                                                                    url: data4.data.external.hls //'http://14.215.216.123:18080/rtp/00A153DF/hls.m3u8'
-                                                                                                })
-                                                                                            }
-                                                                                    
-                                                                                        }, "获取视频回放地址失败", 'POST')
-                                                                                    }
-                                                                                }) 
-                                                                                
-                                                                            }
-                                                                        }     
-                                                                    
-                                                                    }, '获取视频日历day失败', 'POST'
-                                                                )
-                                                                 
-                                                            }else{//clear
-                                                                window.loadHistoryList()
-                                                                //loadMonitor({id: "monitor", url:null })
-                                                            }
-                                                        }
-                                                        ,
-                                                        monthCb: (month)=>{
-                                                            console.log(month); 
-                                                            //console.log(calendar.options.currentDate)
-                                                            getCalendar(year, month) 
-                                                        },
-                                                        yearSelect: (yearText)=> {
-                                                            console.log(yearText);
-                                                            //console.log(calendar.options.currentDate)
-                                                            getCalendar(yearText, month) 
-                                                        },
-                                                    })
-                                                }
-                                            }, "获取视频日历month失败", 'POST')
-                                    }
-                                    var date = new Date(); 
-                                    getCalendar(date.getFullYear(), date.getMonth()+1)
-
-
-
-
-
-
-
-
-
-
+                                    window.showCalendar(hardware)
 
 
                                 } else if (devType == "空调") {