var _this, dataObj = [],heAnth = null; new Vue({ el: '#app', filters: { getNew(key){ let _sf = getDTime(new Date((key+"").length>10?parseInt(key):parseInt(key)*1000)); return _sf[0] + _sf[1]; }, getLong(key){ let _min = Math.floor(parseInt(key)/60); let _sed = parseInt(key) % 60; return "00:"+(_min > 9?_min:"0"+_min)+":"+(_sed > 9?_sed:"0"+_sed); } }, data: function() { return { dataLi: [], nowTab: {}, backLi: [], nowDate: "", vidSrc: "", dialogVisible: false } }, created() { _this = this; heAnth = JSON.parse(localStorage.getItem("nowShip")); _this.initAjax(); _this.nowDate = getDTime(new Date())[0]; }, mounted(){ window.addEventListener('message',(data)=>{ if(data.data.cmd == undefined){ heAnth = JSON.parse(localStorage.getItem("nowShip")); _this.initAjax(); _this.nowDate = getDTime(new Date())[0]; } }) }, methods: { initAjax(){ if(heAnth !=null && heAnth != "null"&&heAnth.other_info !=null && heAnth.other_info != ""){ var dsd = heAnth.other_info.split(","); const loading = this.$loading({ background: 'rgba(0, 0, 0, 0.4)' }) let _opts = { url: helUrl+"/index.php?ctl=bruce&act=get_group_member_list", type:"POST" }; let _data = { admin_id: 7903, udid: "11111111", g_id: dsd[0] }; let _head = { // Cookie: "PHPSESSID=pt03up13chlkpd15u2leac51gd" } postAxios(_opts, _data, _head).then((res) =>{ if(res.status){ let _obj = res.data; _this.dataLi = _obj.filter(item => item.device_id == dsd[1]); _this.nowTab = _this.dataLi[0]; _this.getPlay(); }else{ _this.dataLi = []; } loading.close(); }) }else{ _this.dataLi = []; } }, getPlay(){ let _tiem = _this.nowDate.split("-"); const sfdsg = this.$loading({ background: 'rgba(0, 0, 0, 0.4)' }) setTimeout(()=>{ let _opts = { url: helUrl+"/index.php?ctl=video&act=get_video_list_v1", type:"POST" }; let _data = { admin_id: 7903, uid: _this.nowTab.user_id, year:_tiem[0], month: _tiem[1], day: _tiem[2], content: "", token: getCookie("hemlTok") }; postAxios(_opts, _data, {}).then((res) =>{ if(res.status){ _this.backLi = res.data; }else{ _this.backLi = []; } sfdsg.close(); }) },200) }, changTab(id){ let ind = _this.dataLi.findIndex((it,ind) => {return id == it.device_id}); if(ind != -1){ if(_this.dataLi[ind].device_id != _this.nowTab.device_id){ _this.nowTab = _this.dataLi[ind]; _this.getPlay(); } } }, Detail(_row){ _this.dialogVisible = true; _this.vidSrc = `` }, handleClose(done) { _this.vidSrc = ""; _this.dialogVisible = false; }, Dwonload(_row){ let _sf = getDTime(new Date(parseInt(_row.ctime)*1000)); fetch(_row.url).then(res => res.blob()).then(blob => { const a = document.createElement('a'); document.body.appendChild(a) a.style.display = 'none' const url = window.URL.createObjectURL(blob); a.href = url; a.download = (_sf[0]+_sf[1])+'.mp4'; a.click(); document.body.removeChild(a) window.URL.revokeObjectURL(url); }); }, prenDay(nu){ if(_this.nowDate != null){ let _dat = dayChange(_this.nowDate, parseInt(nu)); if(_dat != undefined){ _this.nowDate = getDTime(_dat)[0]; _this.getPlay(); } }else{ _this.$message({ message: '请先选择时间!', type: 'warning' }); } }, pickCli(ev){ if(ev != null){ _this.getPlay(); } } } })