From 0ab4bf8f3982bdee9962076f29c5664185328517 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 21 十月 2022 17:02:10 +0800
Subject: [PATCH] 1.消息全局化2.消息响应静态页面实现

---
 unpackage/cache/wgt/H5EDA0853/pages/adgl/adhj.html |  141 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 96 insertions(+), 45 deletions(-)

diff --git a/unpackage/cache/wgt/H5EDA0853/pages/adgl/adhj.html b/unpackage/cache/wgt/H5EDA0853/pages/adgl/adhj.html
index ae4a279..10c7da5 100644
--- a/unpackage/cache/wgt/H5EDA0853/pages/adgl/adhj.html
+++ b/unpackage/cache/wgt/H5EDA0853/pages/adgl/adhj.html
@@ -21,9 +21,14 @@
 		<script type="text/javascript" src="../../js/global.js"></script>
 
 
-		<script src="http://121.196.36.24:8001/Scripts/jquery-3.4.1.min.js"></script>
-		<script src="http://121.196.36.24:8001/Scripts/jquery.signalR-2.2.2.min.js"></script>
-		<script src="http://121.196.36.24:8001/SignalR/Hubs"></script>
+		<!-- <script src="http://121.196.36.24:8001/Scripts/jquery-3.4.1.min.js"></script> -->
+		<!-- <script src="http://121.196.36.24:8001/Scripts/jquery.signalR-2.2.2.min.js"></script> -->
+		<!-- <script src="http://121.196.36.24:8001/SignalR/Hubs"></script> -->
+
+		<script src="../../js/jquery-3.4.1.min.js"></script>
+		<script src="../../js/jquery.signalR-2.2.2.min.js"></script>
+		<script src="../../js/Hubs.js"></script>
+
 
 		<script type="text/javascript">
 			var pushServer = "http://demo.dcloud.net.cn/push/?";
@@ -183,15 +188,61 @@
 
 
 
+			function CreateNotification(msg, n) {
+				console.log(msg, n)
+
+				vant.Notify(msg, n, 9999999999)
+
+				var NotifyID = n;
+				var Context = plus.android.importClass("android.content.Context");
+				var main = plus.android.runtimeMainActivity();
+				var Noti = plus.android.importClass("android.app.Notification");
+				var NotificationManager = plus.android.importClass("android.app.NotificationManager");
+				var nm = main.getSystemService(Context.NOTIFICATION_SERVICE)
+				var Notification = plus.android.importClass("android.app.Notification");
+				var mNotification = new Notification.Builder(main);
+				var pending = plus.android.importClass("android.app.PendingIntent");
+				var intent = plus.android.importClass("android.content.Intent");
+
+				//mNotification.setOngoing(true);
+				mNotification.setContentTitle("鎮ㄦ湁涓�鏉℃湭璇绘秷鎭�"); //鏍囬
+				mNotification.setContentText(msg); //鍐呭
+				mNotification.setSmallIcon(17301620); //鍥炬爣
+				mNotification.setTicker("First Time"); //閫氱煡棣栨鍑虹幇鍦ㄩ�氱煡鏍忔椂鐨勬晥鏋�
+				mNotification.setNumber(5); //閫氱煡闆嗗悎鐨勬暟閲�
+				//var str = dateToStr(new Date());
+				//mNotification.setWhen(str);//閫氱煡浜х敓鏃堕棿
+				//mNotification.setContentIntent();//閫氱煡鏍忕偣鍑讳簨浠�
+				mNotification.setDefaults(Noti.DEFAULT_VIBRATE); //澹伴煶銆侀棯鐏�侀渿鍔ㄦ晥鏋滐紝鍙彔鍔�
+				mNotification.setPriority(Noti.PRIORITY_DEFAULT); //閫氱煡浼樺厛绾�
+				mNotification.flags = Notification.FLAG_ONLY_ALERT_ONCE; //鍙戣捣閫氱煡鏃堕渿鍔�
+				var mNb = mNotification.build()
+				nm.notify(NotifyID, mNb);
+			}
+
+			// wakeLock()
+			// var g_wakelock = null;
+			// //鍏佽绋嬪簭鍚庡彴杩愯锛屼互鎸佺画鑾峰彇GPS浣嶇疆
+			// function wakeLock() {
+			// 	//Android
+			// 	var main = plus.android.runtimeMainActivity();
+			// 	var Context = plus.android.importClass("android.content.Context");
+			// 	var PowerManager = plus.android.importClass("android.os.PowerManager");
+			// 	var pm = main.getSystemService(Context.POWER_SERVICE);
+			// 	g_wakelock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ANY_NAME");
+			// 	g_wakelock.acquire();
+			// }
 
 			$(function() {
 				//鍓嶇Hub鐨勪娇鐢紝娉ㄦ剰鐨勬槸锛孒ub鐨勫悕瀛楁槸ChatHub锛岃繖閲屼娇鐢ㄦ椂棣栧瓧姣嶅皬鍐�
 				var work = $.connection.chatHub;
-
+				// work
+				console.log(work, 1)
 				//瀵瑰簲鍚庣鐨凷endMessage鍑芥暟锛屾秷鎭帴鏀跺嚱鏁�
 				// console.log(work.client.sendMessage)
 				work.client.sendMessage = function(msg) {
-					console.log(msg, 1)
+					// console.log(msg, 1)
+					// CreateNotification(msg, Math.random())
 					createLocalPushMsg(msg)
 				};
 
@@ -555,48 +606,48 @@
 					this.$forceUpdate()
 				},
 				submit() {
-					setTimeout(() => {
-						const data = {
-							username: localStorage.getItem('username'),
-							eqpcode: topContent.find(i => i.code === radioValue).code,
-							wkshpcode: topContent.find(i => i.code === radioValue).wksp_code
-						}
-						const DATA = []
-						centerContent.forEach(i => {
-							if (i.isTrue && !currentValue.includes(i.code)) {
-								i.flag = i.isTrue ? 'Y' : 'N'
-								DATA.push(i)
-							}
-						})
+					// setTimeout(() => {
+					// 	const data = {
+					// 		username: localStorage.getItem('username'),
+					// 		eqpcode: topContent.find(i => i.code === radioValue).code,
+					// 		wkshpcode: topContent.find(i => i.code === radioValue).wksp_code
+					// 	}
+					// 	const DATA = []
+					// 	centerContent.forEach(i => {
+					// 		if (i.isTrue && !currentValue.includes(i.code)) {
+					// 			i.flag = i.isTrue ? 'Y' : 'N'
+					// 			DATA.push(i)
+					// 		}
+					// 	})
 
-						submitIsDisabled = true
-						// falseArray.push({
-						// 	id: '1'
-						// })
-						this.$forceUpdate()
-						post('AppDeviceManage/AppDeviceAnDengCallSave' + formatParams(data), DATA).then(
-							res => {
-								if (res.code === '200') {
-									vant.Notify({
-										type: 'primary',
-										message: '鎻愪氦鎴愬姛锛�'
-									})
-									topContent.forEach((r, i) => {
-										if (r.code === radioValue) {
-											topContent.splice(i, 1)
-										}
-									})
-									if (topContent.length >= 1) {
-										radioValue = topContent[0].code
-										topContentClick(radioValue, topContent.find(i => i.code ===
-											radioValue).wksp_code)
-									}
+					// 	submitIsDisabled = true
+					// 	// falseArray.push({
+					// 	// 	id: '1'
+					// 	// })
+					// 	this.$forceUpdate()
+					// 	post('AppDeviceManage/AppDeviceAnDengCallSave' + formatParams(data), DATA).then(
+					// 		res => {
+					// 			if (res.code === '200') {
+					// 				vant.Notify({
+					// 					type: 'primary',
+					// 					message: '鎻愪氦鎴愬姛锛�'
+					// 				})
+					// 				topContent.forEach((r, i) => {
+					// 					if (r.code === radioValue) {
+					// 						topContent.splice(i, 1)
+					// 					}
+					// 				})
+					// 				if (topContent.length >= 1) {
+					// 					radioValue = topContent[0].code
+					// 					topContentClick(radioValue, topContent.find(i => i.code ===
+					// 						radioValue).wksp_code)
+					// 				}
 
-									submitIsDisabled = false
-									this.$forceUpdate()
-								}
-							})
-					}, 100)
+					// 				submitIsDisabled = false
+					// 				this.$forceUpdate()
+					// 			}
+					// 		})
+					// }, 100)
 
 				},
 				// topContentClick(code, wksp_code) {

--
Gitblit v1.9.3