浏览代码

Merge branch 'dev5.8.0' of Software/android-cloud-H5 into master

guocanfeng 1 年之前
父节点
当前提交
239062f5fd
共有 3 个文件被更改,包括 1939 次插入1954 次删除
  1. 60 7
      static/webRtcYJ/WXdraw.js
  2. 1861 1947
      static/webRtcYJ/WXtrialInterface.html
  3. 18 0
      static/webRtcYJ/timer.js

+ 60 - 7
static/webRtcYJ/WXdraw.js

@@ -1,3 +1,32 @@
+let noOperationSetTimeoutTime = null
+let noOperationSetIntervalTime = null
+let isFiringNoOperationSetTimeout = false
+// 没有任何触碰时会触发该定时器
+function noOperationSetTimeout() {
+  clearTimeout(noOperationSetTimeoutTime)
+  clearTimeout(noOperationSetIntervalTime)
+  noOperationSetTimeoutTime = setTimeout(() => {
+    let index = 10
+    $.modal({
+      text: "由于您长时间未操作,将自动断开视频链接(不影响云手机内应用运行)",
+      buttons: [
+        { text: "继续操作", className: "default", onClick: function () { noOperationSetTimeout() } },
+        { text: "退出(10秒)", className: 'operate-time-exit', onClick: function () { quit() } },
+      ]
+    });
+    noOperationSetIntervalTime = setInterval(() => {
+      if (index <= 0) {
+        $('.operate-time-exit').text(`退出`)
+        clearInterval(noOperationSetIntervalTime)
+        quit()
+        $.closeModal();
+        return
+      }
+      index--
+      $('.operate-time-exit').text(`退出(${index}秒)`)
+    }, 1000)
+  }, 300000)
+}
 // 蒙版
 var canvas_bak = document.getElementById('box');
 
@@ -57,6 +86,22 @@ function doConnectDirectives() {
   wsss.binaryType = 'arraybuffer';
 
   wsss.onopen = function () {
+    $.ajax({
+      url: baseUrl + '/api/public/v5/pushflow/popup',
+      headers: {
+        Authorization: token,
+        versionName: '5.8.0'
+      },
+      type: 'get',
+      dataType: 'json',
+      success: function (res) {
+        let { data } = res
+        if (data) {
+          isFiringNoOperationSetTimeout = data
+          noOperationSetTimeout()
+        }
+      },
+    });
     clearInterval(intervalerPing)
     // 获取虚拟场景状态
     intervalerPing = setInterval(() => {
@@ -65,7 +110,7 @@ function doConnectDirectives() {
       } else {
         clearInterval(intervalerPing);
       }
-      
+
     }, 3000)
     errorTime = 0;
     var pings = { type: 'getVsStatus' };
@@ -98,7 +143,7 @@ function doConnectDirectives() {
   };
   wsss.onerror = function (e) {
     clearInterval(intervalerPing)
-    if(!quitBool) return 
+    if (!quitBool) return
     if (directivesTimeInterval > 7) {
       quit();
       return
@@ -369,9 +414,7 @@ function doConnectDirectives() {
     }
   };
 }
-$('body').on('click', function () {
-  draw_graph('pencil', this);
-});
+draw_graph('pencil', $('body'));
 //剪切板
 $('.upload').on('click', function () {
   var texts = $(this).attr('data-text');
@@ -410,10 +453,17 @@ $('.PictureQuality').on('click', function () {
   decodeWoker.postMessage(cmd); //通知解码器worker切换分辨率
   var buffer = makeSharpness(Number(id));
   webSocketWorker.postMessage(buffer);
+  $('.control-right-img').attr({
+    'data-id': '1',
+  });
+
+  $('.leftmains').css({
+    right: '-4rem',
+  });
 });
 var canDraw = false;
 //画图形
-var draw_graph = function (graphType) {
+function draw_graph(graphType) {
   //把蒙版放于画板上面
   $('#container').css('z-index', 30);
   $('#dedit').css('z-index', 20);
@@ -421,8 +471,8 @@ var draw_graph = function (graphType) {
   //鼠标按下获取 开始xy开始画图
   // var ongoingTouches = [];
   var touchstart = function (e) {
+    if (isFiringNoOperationSetTimeout) noOperationSetTimeout()
     // console.log('🚀 ~ file: WXdraw.js ~ line 244 ~ touchstart ~ e', e);
-
     if (!isControl) {
       return;
     }
@@ -463,6 +513,7 @@ var draw_graph = function (graphType) {
     if (!isControl) {
       return;
     }
+    if (isFiringNoOperationSetTimeout) noOperationSetTimeout()
     const action = 1;
     Array.from(e.originalEvent.changedTouches).forEach(function (item, index) {
       const x = item.clientX - item.target.getBoundingClientRect().x;
@@ -550,6 +601,7 @@ var draw_graph = function (graphType) {
   // 鼠标移动
   var touchmove = function (e) {
     e.preventDefault();
+    if (isFiringNoOperationSetTimeout) noOperationSetTimeout()
     if (!isControl) {
       return;
     }
@@ -630,6 +682,7 @@ var draw_graph = function (graphType) {
 
   //鼠标离开区域以外 除了涂鸦 都清空
   var mouseout = function () {
+    if (isFiringNoOperationSetTimeout) noOperationSetTimeout()
     if (graphType != 'handwriting') {
       clearContext();
     }

文件差异内容过多而无法显示
+ 1861 - 1947
static/webRtcYJ/WXtrialInterface.html


+ 18 - 0
static/webRtcYJ/timer.js

@@ -23,6 +23,13 @@
 // }
 
 function handleQuit(action = "quit") {
+  $('.control-right-img').attr({
+    'data-id': '1',
+  });
+
+  $('.leftmains').css({
+    right: '-4rem',
+  });
   switch (action) {
     case 'quit':
       return exit();
@@ -60,6 +67,17 @@ function downline() {
         decodeWoker.postMessage('close');
         decodeWoker.terminate();
         deleteDB(db, storeName, userCardId)
+        parent.postMessage(
+          {
+            type: 'exit',
+          },
+          '*',
+        );
+        uni.postMessage({
+          data: {
+              type: 'exit'
+          }
+      });
         quit();
       } else {
         $.toast(res.msg, 'text');