Browse Source

4.0.73 消息推送去除声音确认框,改为页面鼠标移动后自动开启声音

liuyanpeng 1 year ago
parent
commit
ae0f54ed19
2 changed files with 18 additions and 8 deletions
  1. 1 1
      package.json
  2. 17 7
      src/common/pushMessage.js

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.72",
+  "version": "4.0.73",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 17 - 7
src/common/pushMessage.js

@@ -267,15 +267,25 @@ export default {
   // 弹出打开声音提示框
   messageModal: function () {
     const _self = this;
-    Modal.warning({
-      okText: '确认',
-      title: '温馨提示',
-      content: '您的浏览器设置,提示音无法自动播放,请您点击【确认】按钮,可以自动播放提示音。',
-      onOk() {
+    const play = () => {
+      let allowSound = localStorage.getItem('allowSound');
+      if (allowSound && allowSound == 'false') {
         _self.playSound(false);
         localStorage.setItem('allowSound', true);
-      },
-    });
+      }
+      window.removeEventListener('mousemove', play);
+    };
+    window.addEventListener('mousemove', play);
+
+    // Modal.warning({
+    //   okText: '确认',
+    //   title: '温馨提示',
+    //   content: '您的浏览器设置,提示音无法自动播放,请您点击【确认】按钮,可以自动播放提示音。',
+    //   onOk() {
+    //     _self.playSound(false);
+    //     localStorage.setItem('allowSound', true);
+    //   },
+    // });
   },
   // 触发仪表盘数量更新事件
   executionEvent: function () {