video.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. var _this, screenWidth, timeId;
  2. new Vue({
  3. el: '#app',
  4. data: function() {
  5. return {
  6. gutter: 5,
  7. fontS: 128,
  8. toolBtn: 0,
  9. shipLi: [],
  10. tabDiv: 39,
  11. nowTab: {},
  12. leiLi:["1行 x 1行", "2行 x 2行", "3行 x 3行"],
  13. leiBar: 1,
  14. leiShow: false
  15. }
  16. },
  17. created() {
  18. _this = this;
  19. _this.init(0);
  20. // timeId = setInterval(()=>{
  21. // _this.init(1);
  22. // },60*1000)
  23. },
  24. mounted() {
  25. let screenWidth = 1920;
  26. // let screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body
  27. // .clientWidth;
  28. _this.gutter = Math.ceil(screenWidth / 320);
  29. _this.fontS = (screenWidth / 1440) * 16;
  30. console.log(_this.$refs.toolBtn.offsetHeight)
  31. screenfull.toggle()
  32. },
  33. destroyed(){
  34. clearInterval(timeId);
  35. },
  36. methods: {
  37. init(num) {
  38. let loading = null;
  39. if(num == 0){
  40. loading = this.$loading({
  41. background: 'rgba(0, 0, 0, 0.4)'
  42. })
  43. }
  44. $.ajax({
  45. url: "http://121.37.6.200:8088/SelHswsSn?user_id=109",
  46. type: "GET",
  47. traditional: true,
  48. dataType: "json",
  49. async: false,
  50. data: {
  51. "euser_idnc": 109
  52. },
  53. headers:{
  54. "Authorization": localStorage.getItem("ylToken")
  55. },
  56. error: function() { },
  57. success: function(res) {
  58. if(res.code == 200){
  59. let _obj = res.data, _arr = [];
  60. for(let i=0;i<_obj.length;i++){
  61. let item = _obj[i];
  62. if(item.dev_ver == 2){
  63. let _onli = item.online == undefined ?{lon:0,lat:0,speed:0,time:1639449590}:item.online;
  64. item.status = _this.changeTime((_onli.time+"")>10?parseInt(_onli.time):parseInt(_onli.time)*1000);
  65. _arr.push(item);
  66. }
  67. }
  68. _this.shipLi = _arr;
  69. }
  70. if(num == 0){loading.close();}
  71. }
  72. })
  73. },
  74. changeTime(time) {
  75. let date3 = new Date().getTime() - (parseInt(time));
  76. let str = 1;
  77. if (date3 > (5 * 60 * 1000)) {
  78. str = 0;
  79. }
  80. return str;
  81. },
  82. changeShow(){
  83. _this.vidWid = (_this.vidWid>0?0:_this.gutter*14);
  84. },
  85. changeLei(key){
  86. // let eleList = document.getElementsByClassName('videoBg');
  87. // if(key < _this.leiBar){
  88. // for(let i = eleList.length-1; i>=0; i--){
  89. // eleList[i].parentNode.removeChild(eleList[i]);
  90. // }
  91. // }
  92. _this.leiBar = key;
  93. _this.leiShow = false;
  94. },
  95. changCarm(key){
  96. let _ind = _this.caremLi.findIndex((item,index)=>{
  97. return key == item.cameraid;
  98. });
  99. _this.carmAct = _this.caremLi[_ind];
  100. if(_this.carmAct.alive == 0){
  101. _this.$message({
  102. showClose: true,
  103. message: '设备离线中!!!',
  104. type: 'warning'
  105. });
  106. }
  107. }
  108. }
  109. })