123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- var _this, screenWidth, timeId;
- new Vue({
- el: '#app',
- data: function() {
- return {
- gutter: 5,
- fontS: 128,
- toolBtn: 0,
- shipLi: [],
- tabDiv: 39,
- nowTab: {},
- leiLi:["1行 x 1行", "2行 x 2行", "3行 x 3行"],
- leiBar: 1,
- leiShow: false
- }
- },
- created() {
- _this = this;
- _this.init(0);
- // timeId = setInterval(()=>{
- // _this.init(1);
- // },60*1000)
- },
-
- mounted() {
- let screenWidth = 1920;
- // let screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body
- // .clientWidth;
- _this.gutter = Math.ceil(screenWidth / 320);
- _this.fontS = (screenWidth / 1440) * 16;
- console.log(_this.$refs.toolBtn.offsetHeight)
- screenfull.toggle()
- },
- destroyed(){
- clearInterval(timeId);
- },
- methods: {
- init(num) {
- let loading = null;
- if(num == 0){
- loading = this.$loading({
- background: 'rgba(0, 0, 0, 0.4)'
- })
- }
- $.ajax({
- url: "http://121.37.6.200:8088/SelHswsSn?user_id=109",
- type: "GET",
- traditional: true,
- dataType: "json",
- async: false,
- data: {
- "euser_idnc": 109
- },
- headers:{
- "Authorization": localStorage.getItem("ylToken")
- },
- error: function() { },
- success: function(res) {
- if(res.code == 200){
- let _obj = res.data, _arr = [];
- for(let i=0;i<_obj.length;i++){
- let item = _obj[i];
- if(item.dev_ver == 2){
- let _onli = item.online == undefined ?{lon:0,lat:0,speed:0,time:1639449590}:item.online;
- item.status = _this.changeTime((_onli.time+"")>10?parseInt(_onli.time):parseInt(_onli.time)*1000);
- _arr.push(item);
- }
- }
- _this.shipLi = _arr;
- }
- if(num == 0){loading.close();}
- }
- })
-
- },
- changeTime(time) {
- let date3 = new Date().getTime() - (parseInt(time));
- let str = 1;
- if (date3 > (5 * 60 * 1000)) {
- str = 0;
- }
- return str;
- },
- changeShow(){
- _this.vidWid = (_this.vidWid>0?0:_this.gutter*14);
- },
- changeLei(key){
- // let eleList = document.getElementsByClassName('videoBg');
- // if(key < _this.leiBar){
- // for(let i = eleList.length-1; i>=0; i--){
- // eleList[i].parentNode.removeChild(eleList[i]);
- // }
- // }
- _this.leiBar = key;
- _this.leiShow = false;
- },
- changCarm(key){
- let _ind = _this.caremLi.findIndex((item,index)=>{
- return key == item.cameraid;
- });
- _this.carmAct = _this.caremLi[_ind];
- if(_this.carmAct.alive == 0){
- _this.$message({
- showClose: true,
- message: '设备离线中!!!',
- type: 'warning'
- });
- }
- }
- }
- })
|