批量报警、批量发送消息,分供应商处理

This commit is contained in:
liub
2026-03-10 14:07:13 +08:00
parent 4cacdbe7f7
commit 2be522977c
15 changed files with 1273 additions and 1011 deletions

84
App.vue
View File

@ -30,43 +30,41 @@
//以上代码仅在开发时使用,否则会出现不可预知的问题。
// #ifdef APP|APP-PLUS
bleTool.getBleTool();
var appid = plus.runtime.appid;
console.log('应用的 appid 为:' + appid);
if (plus.runtime.isAgreePrivacy()) {
bleTool.getBleTool();
uni.getPushClientId({
success(res) {
console.log("推送信息:", res);
uni.setStorageSync('push_cid', res.cid);
},
fail(err) {
console.error(err)
uni.getPushClientId({
success(res) {
console.log("推送信息:", res);
uni.setStorageSync('push_cid', res.cid);
},
fail(err) {
console.error(err)
}
});
if (!uni.setAppBadgeNumber) { //兼容鸿蒙的写法
uni.setAppBadgeNumber = plus.runtime.setBadgeNumber;
}
});
if(!uni.setAppBadgeNumber){//兼容鸿蒙的写法
uni.setAppBadgeNumber=plus.runtime.setBadgeNumber;
}
uni.onPushMessage((res) => {
console.log("收到推送消息:", res); //监听推送消息
if(res.type=='click'){
//将App角标设置为0清空app在消息中心的所有消息
uni.setAppBadgeNumber(0);
plus.push.clear();
return;
}
uni.createPushMessage({
title: res.data.title,
content: res.data.content,
payload:res.data.payload
uni.onPushMessage((res) => {
console.log("收到推送消息:", res); //监听推送消息
if (res.type == 'click') {
//将App角标设置为0清空app在消息中心的所有消息
uni.setAppBadgeNumber(0);
plus.push.clear();
return;
}
uni.createPushMessage({
title: res.data.title,
content: res.data.content,
payload: res.data.payload
});
});
});
}
// #endif
},
@ -74,18 +72,15 @@
console.log('App Show');
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
uni.getSystemInfo({
success: function(res) {
if (res.uniPlatform == 'app') {
let appid = plus.runtime.appid;
if (appid !== 'HBuilder') {
console.log("appid=", appid);
upgrade.checkAndUpdateWgt();
}
}
}
});
// #ifdef APP|APP-PLUS
let appid = plus.runtime.appid;
console.log("appid=", appid);
if (appid !== 'HBuilder') {
upgrade.checkAndUpdateWgt();
}
// #endif
},
onHide: function() {
console.log('App Hide');
@ -212,5 +207,4 @@
font-family: "PingFangBold";
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
}
</style>