南昌市物联网技防平台-前端
liuyg
2021-05-22 ba55078612c99fd974d6680147471ba53526ff83
Merge branch 'master' of http://192.168.0.105:10010/r/jfpt-Vue
4 files modified
191 ■■■■■ changed files
public/map/index.html 6 ●●●●● patch | view | raw | blame | history
public/realVideo/realtime-view-video.js 21 ●●●● patch | view | raw | blame | history
src/views/Video/video.vue 8 ●●●● patch | view | raw | blame | history
src/views/dataL/dataL.vue 156 ●●●●● patch | view | raw | blame | history
public/map/index.html
@@ -51,9 +51,11 @@
          _framework.onSiderContainerShow();
          _framework.resize();
          _AppEvent = AppEvent;
          //获取设备id
          window.clientID = locationObj.clientID;
          if (locationObj != null){
            //获取设备id
            window.clientID = locationObj.clientID;
          }
          _AppEvent.addAppEventListener("mapLoad", function(map){
            if (locationObj && locationObj != null) {
              map.centerAndZoom(new esri.geometry.Point(locationObj.x,locationObj.y, new esri.SpatialReference({ wkid: 4326 })), 16);
public/realVideo/realtime-view-video.js
@@ -14,14 +14,29 @@
    // 获取设备号,序列号
    var channelNumber = getQueryStringByKey('channelNumber');
    var serialNumber = getQueryStringByKey('serialNumber');
    $.ajax({
    var manufacturer = getQueryStringByKey('manufacturer');
    var deviceNumber = getQueryStringByKey('deviceNumber');
    if (manufacturer == "HK"){
      $.ajax({
        type: 'GET',
        dataType: 'JSON',
        url: "/api/blade-jfpts/equipment/equipment/selectEquimentPlayInfo?number=" + deviceNumber + "&bmp=" + "m3u8" + "&manufacturer=" + manufacturer,
        success: function (data) {
          realStartVideo($('.realtime-view-video-box video')[0], data.data.address)
        }
      })
    }else {
      $.ajax({
        type: 'GET',
        dataType: 'JSON',
        url: "https://web.byisf.com:18000/GetPlayUrl?deviceCode=" + serialNumber + "&chl=" + channelNumber,
        success: function (data) {
            realStartVideo($('.realtime-view-video-box video')[0], data.data.m3u8)
          realStartVideo($('.realtime-view-video-box video')[0], data.data.m3u8)
        }
    })
      })
    }
src/views/Video/video.vue
@@ -20,6 +20,8 @@
      reportUrl: "",
      channelNumber: null,
      serialNumber: null,
      manufacturers: null,
      deviceNumber: null,
    };
  },
  methods: {
@@ -28,7 +30,11 @@
        "./realVideo/realtime-view-videos.html?channelNumber=" +
        this.$route.query.channelNumber +
        "&serialNumber=" +
        this.$route.query.serialNumber;
        this.$route.query.serialNumber +
        "&manufacturer=" +
        this.$route.query.manufacturers +
        "&deviceNumber=" +
        this.$route.query.deviceNumber;
    },
  },
};
src/views/dataL/dataL.vue
@@ -1186,65 +1186,107 @@
      // console.log(this.$store.state)
    },
    //获取视频
    openRealVideoBox(serialNumber, channelNumber) {
    openRealVideoBox(serialNumber, channelNumber,deviceNumber,manufacturer) {
      var that = this;
      var newAxios = axios.create({
        baseURL: "https://web.byisf.com:18000",
        withCredentials: false,
        headers: {
          "Content-type": "application/x-www-form-urlencoded",
        },
      });
      newAxios
        .post(
          "/api_control",
          {},
          {
            params: {
              param: JSON.stringify({ PktType: "GetAccessToken" }),
            },
          }
        )
        .then((res) => {
          newAxios
            .get(
              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${serialNumber}&chl=${channelNumber}`
            )
            .then((result) => {
              that.videoSource = result.data.data.m3u8;
              if (Hls.isSupported()) {
                var dom = document.getElementById(
                  "real_video_conversationDataL"
                );
                that.hls = new Hls();
                var m3u8Url = decodeURIComponent(that.videoSource);
                that.hls.loadSource(m3u8Url);
                that.hls.attachMedia(dom);
                that.hls.on(Hls.Events.MANIFEST_PARSED, function () {
                  dom.play();
                });
                that.hls.on(Hls.Events.ERROR, function (event, data) {
                  // console.log(data, 4566824159, "视频播放有问题!!!");
                  if (data.fatal) {
                    switch (data.type) {
                      case Hls.ErrorTypes.NETWORK_ERROR:
                        console.log(
                          "fatal network error encountered, try to recover"
                        );
                        that.hls.startLoad();
                        break;
                      case Hls.ErrorTypes.MEDIA_ERROR:
                        console.log(
                          "fatal media error encountered, try to recover"
                        );
                        that.hls.recoverMediaError();
                        break;
                    }
      if (manufacturer == "HK"){
        axios
          .get(
            `/api/blade-jfpts/equipment/equipment/selectEquimentPlayInfo?number=${deviceNumber}&bmp=m3u8&manufacturer=${manufacturer}`
          )
          .then((result) => {
            that.videoSource = result.data.data.address;
            if (Hls.isSupported()) {
              var dom = document.getElementById(
                "real_video_conversationDataL"
              );
              that.hls = new Hls();
              var m3u8Url = decodeURIComponent(that.videoSource);
              that.hls.loadSource(m3u8Url);
              that.hls.attachMedia(dom);
              that.hls.on(Hls.Events.MANIFEST_PARSED, function () {
                dom.play();
              });
              that.hls.on(Hls.Events.ERROR, function (event, data) {
                // console.log(data, 4566824159, "视频播放有问题!!!");
                if (data.fatal) {
                  switch (data.type) {
                    case Hls.ErrorTypes.NETWORK_ERROR:
                      console.log(
                        "fatal network error encountered, try to recover"
                      );
                      that.hls.startLoad();
                      break;
                    case Hls.ErrorTypes.MEDIA_ERROR:
                      console.log(
                        "fatal media error encountered, try to recover"
                      );
                      that.hls.recoverMediaError();
                      break;
                  }
                });
              }
            });
                }
              });
            }
          });
      }else{
        var newAxios = axios.create({
          baseURL: "https://web.byisf.com:18000",
          withCredentials: false,
          headers: {
            "Content-type": "application/x-www-form-urlencoded",
          },
        });
        newAxios
          .post(
            "/api_control",
            {},
            {
              params: {
                param: JSON.stringify({ PktType: "GetAccessToken" }),
              },
            }
          )
          .then((res) => {
            newAxios
              .get(
                `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${serialNumber}&chl=${channelNumber}`
              )
              .then((result) => {
                that.videoSource = result.data.data.m3u8;
                if (Hls.isSupported()) {
                  var dom = document.getElementById(
                    "real_video_conversationDataL"
                  );
                  that.hls = new Hls();
                  var m3u8Url = decodeURIComponent(that.videoSource);
                  that.hls.loadSource(m3u8Url);
                  that.hls.attachMedia(dom);
                  that.hls.on(Hls.Events.MANIFEST_PARSED, function () {
                    dom.play();
                  });
                  that.hls.on(Hls.Events.ERROR, function (event, data) {
                    // console.log(data, 4566824159, "视频播放有问题!!!");
                    if (data.fatal) {
                      switch (data.type) {
                        case Hls.ErrorTypes.NETWORK_ERROR:
                          console.log(
                            "fatal network error encountered, try to recover"
                          );
                          that.hls.startLoad();
                          break;
                        case Hls.ErrorTypes.MEDIA_ERROR:
                          console.log(
                            "fatal media error encountered, try to recover"
                          );
                          that.hls.recoverMediaError();
                          break;
                      }
                    }
                  });
                }
              });
          });
      }
    },
  },
  created() {
@@ -1288,7 +1330,7 @@
    activeName() {
      if (this.activeName == "third") {
        this.i++;
        this.openRealVideoBox(this.a.serialNumber, this.a.channelNumber);
        this.openRealVideoBox(this.a.serialNumber, this.a.channelNumber,this.a.deviceNumber,this.a.manufacturers);
      } else {
        var dom = document.getElementById("real_video_conversationDataL");
        if (dom.getAttribute("src") != "") {