123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- 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 = `<video width="100%" controls autobuffer autoplay>
- <source src="${_row.url}" type="video/mp4"></source>
- </video>`
- },
- 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();
- }
- }
- }
- })
|