From 40711118c33369ccad7ceda0fdd729bd9f117f65 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 22 十月 2022 14:03:11 +0800
Subject: [PATCH] 1.安灯响应静态实现
---
pages/adgl/adhj.html | 119 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 84 insertions(+), 35 deletions(-)
diff --git a/pages/adgl/adhj.html b/pages/adgl/adhj.html
index ae4a279..ff7528a 100644
--- a/pages/adgl/adhj.html
+++ b/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)
};
@@ -204,12 +255,10 @@
$.connection.hub.url = 'http://121.196.36.24:8001/signalr'
//hub杩炴帴寮�鍚�
$.connection.hub.start().done(function() {
-
+ // $.connection.serverTimeoutInMilliseconds = 1000 * 60 * 30
var username = localStorage.getItem('username');
-
//鍙戦�佷笂绾夸俊鎭�
work.server.sendLogin(username);
-
// const aaa = [{
// "code": "Q",
// "name": "鍛煎彨璐ㄩ噺",
@@ -218,9 +267,7 @@
// "username": "妤煎厛鐢�"
// }]
// }]
-
// work.server.sendByGroupList('妤煎厛鐢�', 'CJ002', 'SB001', aaa)
-
$('#submit').click(function() {
// vant.Notify('鐐瑰嚮浜�')
// const data = {
@@ -270,10 +317,13 @@
// })
// }
// })
+
})
});
+
+
});
@@ -331,6 +381,8 @@
falseArray.push({
id: '1'
})
+ } else {
+ topContentClick(topContent[0].code, topContent[0].wksp_code)
}
})
@@ -588,7 +640,7 @@
})
if (topContent.length >= 1) {
radioValue = topContent[0].code
- topContentClick(radioValue, topContent.find(i => i.code ===
+ this.topContentClick(radioValue, topContent.find(i => i.code ===
radioValue).wksp_code)
}
@@ -599,33 +651,30 @@
}, 100)
},
- // topContentClick(code, wksp_code) {
- // radioValue = code
- // this.$forceUpdate()
+ topContentClick(code, wksp_code) {
+ radioValue = code
+ const data = {
+ eqpcode: code,
+ wkshpcode: wksp_code
+ }
+ post('AppDeviceManage/AppDeviceAnDengCallItemSearch' + formatParams(data)).then(res => {
+ if (res.code === '200') {
+ centerContent = res.data
- // const data = {
- // eqpcode: code,
- // wkshpcode: wksp_code
- // }
- // post('AppDeviceManage/AppDeviceAnDengCallItemSearch' + formatParams(data)).then(res => {
- // if (res.code === '200') {
- // centerContent = res.data
+ currentValue = centerContent.map(r => {
+ if (r.flag === 'Y') {
+ return r.code
+ }
+ })
- // currentValue = centerContent.map(r => {
- // if (r.flag === 'Y') {
- // return r.code
- // }
- // })
- // centerContent.forEach(i => {
- // i.isTrue = i.flag === 'Y'
- // })
+ centerContent.forEach(i => {
+ i.isTrue = i.flag === 'Y'
+ })
- // this.$forceUpdate()
-
- // }
- // })
-
- // },
+ this.$forceUpdate()
+ }
+ })
+ },
topScanClick() {
--
Gitblit v1.9.3