sgw 1 рік тому
батько
коміт
837f2ac9d3
1 змінених файлів з 58 додано та 44 видалено
  1. 58 44
      src/views/taskScreen.vue

+ 58 - 44
src/views/taskScreen.vue

@@ -218,7 +218,7 @@
 
                 </div>
                 </div> -->
-             <!-- </div>    -->
+                <!-- </div>    -->
               </div>
               <div class="commandMonitoring_task">
                 <div class="map_more_box">
@@ -461,7 +461,7 @@ export default {
 
         this.wholeOutTaskId = data[0].taskId;
         this.processInstanceId = this.wholeOutTaskId;
-         let param = {taskId: this.processInstanceId};
+        let param = {taskId: this.processInstanceId};
         const res1 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
         this.processDefinitionId = res1.data;
         this.initWebsoketBpmn();
@@ -490,12 +490,12 @@ export default {
       this.currentTaskGrade = this.taskList.find((item) => item.taskId == this.wholeOutTaskId).syntheticTaskScore;
       // 获取任务的课目信息
       this.processInstanceId = this.wholeOutTaskId;
-     
-        let param = {taskId: this.processInstanceId};
-        const res2 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
-        console.log('res2 :>> ', res2.data);
-        this.processDefinitionId = res2.data;
-        this.isReady = true;
+
+      let param = {taskId: this.processInstanceId};
+      const res2 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
+      console.log('res2 :>> ', res2.data);
+      this.processDefinitionId = res2.data;
+      this.isReady = true;
       this.getSubjectList(this.wholeOutTaskId);
       // 获取任务的指令信息
       this.getinstructList(this.wholeOutTaskId);
@@ -522,12 +522,12 @@ export default {
     // 获取任务的课目信息
     async getSubjectList(taskId){
       let params={}
-      const res = await request(`/dt_screen/rest/v1/subject/list/${taskId}`, 'get', params, false)
+      const res = await request(`/dt_screen/rest/v2/subject/list/${taskId}`, 'get', params, false)
       const { errorCode, errorMessage, success,data } = res.data;
       if (success) {
         console.log('获取任务的课目信息', data);
         this.subjectDatas=data
-
+        this.initUrl(this.subjectDatas[0].subjectName)
       } else {
         this.$message.error(errorMessage)
       }
@@ -608,7 +608,7 @@ export default {
       console.log('ws 连接关闭');
       this.initWebsoket();//重新建立连接
     },
-        // 建立websocket 链接 任务
+    // 建立websocket 链接 任务
     initWebsoketBpmn(){
       this.websocketBpmn = new WebSocket(`ws://${this.$store.state.webSocketIp}:${this.$store.state.webSocketPort}/websocket/bpmn`);//这里将http替换成ws
       switch (this.websocketBpmn.readyState) {
@@ -782,7 +782,9 @@ export default {
 
     },
 
-    async initUrl(subjectName = "步坦协同课目") {
+    async initUrl(subjectName) {
+      if (subjectName == '')
+        return;
       //     		if(this.playerList.length){
       // 	this.playerList.forEach((item)=>{
       // 		item.dispose()
@@ -801,37 +803,49 @@ export default {
       }
     },
 
-    changeVideo(subjectName) {
+    async changeVideo(subjectName) {
+      if (subjectName == '')
+        return;
       // if(this.playerList.length){
       // 	this.playerList.forEach((item)=>{
       // 		item.dispose()
       // 	})
       // }
-      if(subjectName+"课目" != this.currentSubject){
-        this.currentSubject = subjectName + "课目";
-         let params = {};
-       request("/dt_screen/video/videos/videoClose", "get", params, false);
-      
-      // const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
-     
-       setTimeout(() => {
-    this.initUrl(subjectName + "课目");
-      }, 1000);
-      setTimeout(() => {
-        let index = 0;
-
-        this.playerList.forEach((item) => {
-          item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
-          item.load();
-          item.play();
-        });
-      }, 6000);
+      if(subjectName != this.currentSubject) {
+        this.currentSubject = subjectName;
+        let params = {};
+        const res = await request("/dt_screen/video/videos/videoClose", "get", params, false);
+        const { errorCode, errorMessage, success,data } = res.data;
+        if (success) {
+          setTimeout(() => {
+            let index = 0;
+            this.playerList.forEach((item) => {
+              item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
+              item.load();
+              item.play();
+            });
+          }, 5000);
+        }
+
+        // const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
+
+        // setTimeout(() => {
+        //   this.initUrl(subjectName);
+        // }, 1000);
+        // setTimeout(() => {
+        //   let index = 0;
+        //   this.playerList.forEach((item) => {
+        //     item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
+        //     item.load();
+        //     item.play();
+        //   });
+        // }, 5000);
       }
-     
+
     }
   },
   mounted() {
-   
+
     // let url = "rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream";
     // url = url.split("/");
     // url = url[2];
@@ -851,16 +865,16 @@ export default {
     // 建立任务的weksocket链接
     this.initWebsoket();
 
-    this.initUrl()
-    this.currentSubject = "步坦协同课目";
-
-    //     // 过14秒调用
-    setTimeout(() => {
-      for (let index = 0; index < this.dataSrc.length; index++) {
-        console.log('object :>> ',this.dataSrc[index]);
-        this.initVideo(this.dataSrc[index], this.videoList[index]);
-      }
-    }, 5000);
+    // this.initUrl()
+    // this.currentSubject = "步坦协同课目";
+    //
+    // //     // 过14秒调用
+    // setTimeout(() => {
+    //   for (let index = 0; index < this.dataSrc.length; index++) {
+    //     console.log('object :>> ',this.dataSrc[index]);
+    //     this.initVideo(this.dataSrc[index], this.videoList[index]);
+    //   }
+    // }, 5000);
   },
   beforeDestroy() {
     if (this.playerList.length) {