luobisheng
2022-12-09 8561be6f266768316a7866a71d891000e758db32
点位管理视频加载
5个文件已修改
141 ■■■■■ 已修改文件
src/views/intelligentPatrol/studyJudge/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/operate/video/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/device/grid/components/main/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/device/point/index.vue 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/video/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/intelligentPatrol/studyJudge/index.vue
@@ -8,6 +8,7 @@
        <div class="sjm-header-left">
          <span class="moni-name">监控点位名称: {{ currentEvent.name }} </span>
          <span class="moni-area">{{ currentEvent.street }}</span>
          <span>{{ currentEvent.address }}</span>
        </div>
        <div class="sjm-header-right">
          <el-button size="small">实时预览</el-button>
src/views/operate/video/index.vue
@@ -145,6 +145,7 @@
import { CATEGOTY, EVENT_SOURCE } from "@/utils/helper";
export default {
  name: 'video-upload-page',
  components: { updateInterface },
  data() {
    return {
src/views/systemSetting/device/grid/components/main/index.vue
@@ -350,7 +350,7 @@
<style lang="scss" scoped>
.mainContent {
  display: flex;
  justify-content: start;
  justify-content: flex-start;
  flex-wrap: nowrap;
  .grid-content {
src/views/systemSetting/device/point/index.vue
@@ -46,14 +46,16 @@
            {{ item.name }}{{ item.community }}
          </div>
          <video
            id="my-video"
            :src="item.urlAddress"
            class="video-js"
            :id="item.id"
            class="video-js vjs-default-skin"
            controls
            preload="auto"
            width="210px"
            height="150px"
          ></video>
            width="300px"
            height="300px"
            type="video/mp4"
            :src="item.urlAddress"
          >
          </video>
        </div>
      </el-main>
      <el-footer>
@@ -71,6 +73,73 @@
    </el-container>
  </el-container>
</template>
<script>
import departmentAside from "@/views/operate/fivepack/threepack/components/aside";
import videoPoint from "@/api/system/videoPoint";
export default {
  name: 'point',
  components: { departmentAside },
   created() {
    this.hls = new Hls();
    this.getVideoPointList();
  },
  data() {
    return {
      currentPage: 1,
      totalNum: 10,
      pageSize: 10,
      videoData: [],
      searchData: null,
      hls: null
    };
  },
  methods: {
    async getVideoPointList(data) {
      let communityId, streetId;
      if (data) {
        communityId = data.parentId;
        streetId = data.id;
      }
      await videoPoint.getVideoPointList({
            current: this.currentPage,
            size: this.pageSize,
            communityId,
            streetId,
          })
          .then(({ records, total }) => {
            this.videoData = records;
            this.totalNum = total;
          })
          .catch((err) => this.$message.error(err));
      this.setVideo();
    },
    setVideo() {
      if (Hls.isSupported()) {
        this.videoData.forEach(video => {
          const videoPlayer = document.getElementById(video.id);
          this.hls.loadSource(video.urlAddress);
          this.hls.attachMedia(videoPlayer);
        })
      }
    },
    selectedDepartment(data) {
      this.currentPage = 1;
      data.parentId = data.id;
      data.id = null;
      this.searchData = data;
      this.getVideoPointList(data);
    },
    current_change(e) {
      this.currentPage = e;
      this.getVideoPointList(this.searchData);
    },
  },
  beforeDestroy() {
    this.hls = null;
  }
};
</script>
<style lang="scss" scoped>
.button-one {
  height: 40px;
@@ -180,56 +249,4 @@
  line-height: 30px;
  font-size: 14px;
}
</style>
<script>
import departmentAside from "@/views/operate/fivepack/threepack/components/aside";
import videoPoint from "@/api/system/videoPoint";
export default {
  components: { departmentAside },
  created() {
    this.getVideoPointList();
  },
  data() {
    return {
      currentPage: 1,
      totalNum: 10,
      pageSize: 10,
      videoData: [],
      searchData: null,
    };
  },
  methods: {
    getVideoPointList(data) {
      let communityId, streetId;
      if (data) {
        communityId = data.parentId;
        streetId = data.id;
      }
      videoPoint
        .getVideoPointList({
          current: this.currentPage,
          size: this.pageSize,
          communityId,
          streetId,
        })
        .then(({ records, total }) => {
          this.videoData = records;
          this.totalNum = total;
        })
        .catch((err) => this.$message.error(err));
    },
    selectedDepartment(data) {
      this.currentPage = 1;
      data.parentId = data.id;
      data.id = null;
      this.searchData = data;
      this.getVideoPointList(data);
    },
    current_change(e) {
      this.currentPage = e;
      this.getVideoPointList(this.searchData);
    },
  },
};
</script>
</style>
src/views/video/index.vue
@@ -134,7 +134,7 @@
        var hls = new Hls();
        videoPoint.getVideoPointUrl(item.platResourceId).then((res) => {
          
          if (res.code == 0) {
          if (res.code === 0) {
            hls.loadSource(res.data);
            hls.attachMedia(video);
            hls.on(Hls.Events.MANIFEST_PARSED, function () {