helmetBack.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. var _this, dataObj = [],heAnth = null;
  2. new Vue({
  3. el: '#app',
  4. filters: {
  5. getNew(key){
  6. let _sf = getDTime(new Date((key+"").length>10?parseInt(key):parseInt(key)*1000));
  7. return _sf[0] + _sf[1];
  8. },
  9. getLong(key){
  10. let _min = Math.floor(parseInt(key)/60);
  11. let _sed = parseInt(key) % 60;
  12. return "00:"+(_min > 9?_min:"0"+_min)+":"+(_sed > 9?_sed:"0"+_sed);
  13. }
  14. },
  15. data: function() {
  16. return {
  17. dataLi: [],
  18. nowTab: {},
  19. backLi: [],
  20. nowDate: "",
  21. vidSrc: "",
  22. dialogVisible: false
  23. }
  24. },
  25. created() {
  26. _this = this;
  27. heAnth = JSON.parse(localStorage.getItem("nowShip"));
  28. _this.initAjax();
  29. _this.nowDate = getDTime(new Date())[0];
  30. },
  31. mounted(){
  32. window.addEventListener('message',(data)=>{
  33. if(data.data.cmd == undefined){
  34. heAnth = JSON.parse(localStorage.getItem("nowShip"));
  35. _this.initAjax();
  36. _this.nowDate = getDTime(new Date())[0];
  37. }
  38. })
  39. },
  40. methods: {
  41. initAjax(){
  42. if(heAnth !=null && heAnth != "null"&&heAnth.other_info !=null && heAnth.other_info != ""){
  43. var dsd = heAnth.other_info.split(",");
  44. const loading = this.$loading({
  45. background: 'rgba(0, 0, 0, 0.4)'
  46. })
  47. let _opts = {
  48. url: helUrl+"/index.php?ctl=bruce&act=get_group_member_list",
  49. type:"POST"
  50. };
  51. let _data = {
  52. admin_id: 7903,
  53. udid: "11111111",
  54. g_id: dsd[0]
  55. };
  56. let _head = {
  57. // Cookie: "PHPSESSID=pt03up13chlkpd15u2leac51gd"
  58. }
  59. postAxios(_opts, _data, _head).then((res) =>{
  60. if(res.status){
  61. let _obj = res.data;
  62. _this.dataLi = _obj.filter(item => item.device_id == dsd[1]);
  63. _this.nowTab = _this.dataLi[0];
  64. _this.getPlay();
  65. }else{
  66. _this.dataLi = [];
  67. }
  68. loading.close();
  69. })
  70. }else{
  71. _this.dataLi = [];
  72. }
  73. },
  74. getPlay(){
  75. let _tiem = _this.nowDate.split("-");
  76. const sfdsg = this.$loading({
  77. background: 'rgba(0, 0, 0, 0.4)'
  78. })
  79. setTimeout(()=>{
  80. let _opts = {
  81. url: helUrl+"/index.php?ctl=video&act=get_video_list_v1",
  82. type:"POST"
  83. };
  84. let _data = {
  85. admin_id: 7903,
  86. uid: _this.nowTab.user_id,
  87. year:_tiem[0],
  88. month: _tiem[1],
  89. day: _tiem[2],
  90. content: "",
  91. token: getCookie("hemlTok")
  92. };
  93. postAxios(_opts, _data, {}).then((res) =>{
  94. if(res.status){
  95. _this.backLi = res.data;
  96. }else{
  97. _this.backLi = [];
  98. }
  99. sfdsg.close();
  100. })
  101. },200)
  102. },
  103. changTab(id){
  104. let ind = _this.dataLi.findIndex((it,ind) => {return id == it.device_id});
  105. if(ind != -1){
  106. if(_this.dataLi[ind].device_id != _this.nowTab.device_id){
  107. _this.nowTab = _this.dataLi[ind];
  108. _this.getPlay();
  109. }
  110. }
  111. },
  112. Detail(_row){
  113. _this.dialogVisible = true;
  114. _this.vidSrc = `<video width="100%" controls autobuffer autoplay>
  115. <source src="${_row.url}" type="video/mp4"></source>
  116. </video>`
  117. },
  118. handleClose(done) {
  119. _this.vidSrc = "";
  120. _this.dialogVisible = false;
  121. },
  122. Dwonload(_row){
  123. let _sf = getDTime(new Date(parseInt(_row.ctime)*1000));
  124. fetch(_row.url).then(res => res.blob()).then(blob => {
  125. const a = document.createElement('a');
  126. document.body.appendChild(a)
  127. a.style.display = 'none'
  128. const url = window.URL.createObjectURL(blob);
  129. a.href = url;
  130. a.download = (_sf[0]+_sf[1])+'.mp4';
  131. a.click();
  132. document.body.removeChild(a)
  133. window.URL.revokeObjectURL(url);
  134. });
  135. },
  136. prenDay(nu){
  137. if(_this.nowDate != null){
  138. let _dat = dayChange(_this.nowDate, parseInt(nu));
  139. if(_dat != undefined){
  140. _this.nowDate = getDTime(_dat)[0];
  141. _this.getPlay();
  142. }
  143. }else{
  144. _this.$message({
  145. message: '请先选择时间!',
  146. type: 'warning'
  147. });
  148. }
  149. },
  150. pickCli(ev){
  151. if(ev != null){
  152. _this.getPlay();
  153. }
  154. }
  155. }
  156. })