liwei19941102 hace 1 año
padre
commit
cb3840dcdb
Se han modificado 1 ficheros con 31 adiciones y 7 borrados
  1. 31 7
      src/views/statics/index.vue

+ 31 - 7
src/views/statics/index.vue

@@ -115,6 +115,10 @@
             <div style="margin-top: 20px"></div>
           </div>
         </div>
+        <ArrowRightBold v-if="videoList.length > 1 && videoIndex == 0" style="width: 20px; height: 20px; margin-left: 800px"
+          @click="playVideo(1)"></ArrowRightBold>
+        <ArrowLeftBold v-if="videoList.length > 1  && videoIndex == 1" style="width: 20px; height: 20px; margin-left: 800px"
+          @click="playVideo(0)"></ArrowLeftBold>
         <div id="container" style="margin-top: 20px; width: 100%; height: 80vh"></div>
       </div>
     </div>
@@ -138,6 +142,8 @@ const deptOptions = ref([]);
 
 const deptId = ref([]);
 const keys = ref();
+const videoList = ref([]);
+const videoIndex =ref(0)
 
 const gettreeheight = () => {
   return document.body.clientHeight - 300;
@@ -251,15 +257,33 @@ const filterNode = (node, value) => {
 const currentdata = ref(null);
 
 const treeclick = (data, node) => {
-  if (data.deviceInfos) {
-    JSON.parse(data.deviceInfos).forEach((item) => {
-      if (item.type == "camera") {
-        currenturl.value = item.code;
-        jessibuca.play(currenturl.value);
+    videoList.value = []
+    if (data.deviceInfos) {
+      // JSON.parse(data.deviceInfos).forEach((item) => {
+      //   if (item.type == "camera") {
+      //     currenturl.value = item.code;
+      //     jessibuca.play(currenturl.value);
+      //   }
+      // });
+      var deviceData = JSON.parse(data.deviceInfos)
+      for (var index in deviceData) {
+        var item = deviceData[index]
+        if (item.type == "camera") {
+          currenturl.value = item.code;
+          videoList.value.push(currenturl.value)
+        }
       }
-    });
+      if (videoList.value.length > 0) {
+        jessibuca.play(videoList.value[0]);
+      }
+    }
+  };
+
+  const playVideo = (index) => {
+    videoIndex.value = index
+    jessibuca.play(videoList.value[index]);
   }
-};
+
 
 const data = ref([]);
 var jessibuca = null;