Quellcode durchsuchen

1.1.36 消息推送

liuyanpeng vor 2 Jahren
Ursprung
Commit
5a88d21775
2 geänderte Dateien mit 20 neuen und 3 gelöschten Zeilen
  1. 2 2
      package.json
  2. 18 1
      src/main.js

+ 2 - 2
package.json

@@ -1,7 +1,7 @@
 {
   "name": "prodog-pc-client",
   "description": "Leanwo Prodog Client",
-  "version": "1.1.35",
+  "version": "1.1.36",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",
@@ -18,7 +18,7 @@
     "ant-design-vue": "^3.2.15",
     "axios": "^0.19.2",
     "click-outside-vue3": "^4.0.1",
-    "client-base-v4": "3.0.89",
+    "client-base-v4": "3.0.90",
     "client-dic-v3": "^3.0.22",
     "client-eam-v3": "^3.0.48",
     "client-role-v3": "^3.0.14",

+ 18 - 1
src/main.js

@@ -43,7 +43,7 @@ import { store } from './store.js';
 import { i18n } from './lang.js';
 import { router } from './routes/index.js';
 
-import { App, Common } from 'client-base-v4/dist/client-base-v4.js';
+import { App, Common, PushMessage } from 'client-base-v4/dist/client-base-v4.js';
 import { Notify } from 'pc-component-v3/dist/pc-component-v3.js';
 window.Common = Common;
 window.Notify = Notify;
@@ -62,12 +62,29 @@ app.mount('#app');
 
 window.app = app;
 
+
+if (window.performance.navigation.type == 1) {
+  localStorage.setItem('allowSound',false)
+ }
+
+
 /**
  * 路由钩子
  * @param  {[type]} (to, from,         next [description]
  * @return {[type]}      [description]
  */
 router.beforeEach((to, from, next) => {
+
+  let allowSound = localStorage.getItem('allowSound')
+  if(to.fullPath !== '/login'){
+    PushMessage.openWebSocket()
+    if(allowSound && allowSound == 'false'){
+      PushMessage.messageModal()
+    } 
+  } else {
+    PushMessage.closeWebsocket()
+  }
+
   let funtionAccessDtos = [];
   if (to.matched.some(function (item) {