diff --git a/src/manifest.json b/src/manifest.json index d955d7e..9de3ab4 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "id" : "H5E705637", "name" : "718友晟", - "appid" : "__UNI__4C459F4", + "appid" : "__UNI__0B682E1", "description" : "", "versionName" : "1.0.2", "versionCode" : "100", @@ -62,7 +62,8 @@ "", "", "", - "" + "", + "" ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ], "minSdkVersion" : 23, @@ -86,15 +87,22 @@ "unipush" : { "version" : "2", "offline" : true, - "icons" : { - "small" : { - "ldpi" : "/static/images/icon.png", - "mdpi" : "/static/images/icon.png", - "hdpi" : "/static/images/icon.png", - "xhdpi" : "/static/images/icon.png", - "xxhdpi" : "/static/images/icon.png" - } - } + "icons" : { + "push" : { + "ldpi" : "/static/images/icon.png", + "mdpi" : "/static/images/icon.png", + "hdpi" : "/static/images/icon.png", + "xhdpi" : "/static/images/icon.png", + "xxhdpi" : "/static/images/icon.png" + }, + "small" : { + "ldpi" : "/static/images/icon_small.png", + "mdpi" : "/static/images/icon_small.png", + "hdpi" : "/static/images/icon_small.png", + "xhdpi" : "/static/images/icon_small.png", + "xxhdpi" : "/static/images/icon_small.png" + } + } } } } diff --git a/src/pages/business/business.vue b/src/pages/business/business.vue index edc33a8..9a38cf6 100644 --- a/src/pages/business/business.vue +++ b/src/pages/business/business.vue @@ -85,7 +85,7 @@ onShow(()=>{ try { showLoading("加载中...") getList(); - getTaskCount(); + // getTaskCount(); hideLoading(); } catch (error) { hideLoading(); @@ -164,7 +164,7 @@ const downOption = ref({ const downCallback = async (mescroll) => { try { setTimeout(async ()=>{ - getTaskCount(); + // getTaskCount(); getList(); mescroll.resetUpScroll(); },500); diff --git a/src/pages/business/polling/nfcTest/ouu-nfc.js b/src/pages/business/polling/nfcTest/ouu-nfc.js index ada5176..1baca23 100644 --- a/src/pages/business/polling/nfcTest/ouu-nfc.js +++ b/src/pages/business/polling/nfcTest/ouu-nfc.js @@ -75,6 +75,8 @@ export default { let ndef = new IntentFilter("android.nfc.action.TECH_DISCOVERED"); ndef.addDataType("*/*"); let intentFiltersArray = [ndef]; + + console.log('newintent running==>',intentFiltersArray); plus.globalEvent.addEventListener('newintent',function() { console.log('newintent running'); diff --git a/src/pages/home/home.vue b/src/pages/home/home.vue index 7e17c23..862b744 100644 --- a/src/pages/home/home.vue +++ b/src/pages/home/home.vue @@ -202,7 +202,7 @@ const initLoad =()=>{ getSalesTask(); getCommonServices(); getNewsList(); - getTaskCount(); + // getTaskCount(); hideLoading(); } catch (error) { hideLoading(); diff --git a/src/pages/loading/loading.vue b/src/pages/loading/loading.vue index 91990a8..f410a94 100644 --- a/src/pages/loading/loading.vue +++ b/src/pages/loading/loading.vue @@ -55,6 +55,9 @@ onLoad(async(opt) => { // uni.preloadPage({url: "/pages/home/home"}); // #ifdef APP-PLUS + //手机通知授权 + noticMsgTool(); + // 查询版本接口 await getOSVesion(); @@ -91,9 +94,9 @@ onLoad(async(opt) => { // #endif // 内网才有minio参数 - if(networkEnv.value==1){ - getMinioParam(); - } + // if(networkEnv.value==1){ + // getMinioParam(); + // } }); @@ -216,6 +219,78 @@ const handleClose=()=>{ selectDeviceId() } } + +//通知授权 +const noticMsgTool=()=>{ + if (uni.getSystemInfoSync().platform == "ios") { + // iOS: 使用 iOS API 检查通知权限 + plus.ios.import('UserNotifications'); + var UNNotificationSettings = plus.ios.invoke('UNUserNotificationCenter', 'currentNotificationCenter'); + plus.ios.invoke(UNNotificationSettings, 'getNotificationSettingsWithCompletionHandler', function(settings) { + var authorizationStatus = plus.ios.invoke(settings, 'authorizationStatus'); + if (authorizationStatus !== 3) { // 3表示已授权 + //苹果打开对应的通知栏 + uni.showModal({ + title: '通知权限开启提醒', + content: '您还没有开启通知权限,无法接受到消息通知,请前往设置!', + showCancel: false, + confirmText: '去设置', + success: function(res) { + if (res.confirm) { + var app = plus.ios.invoke('UIApplication', 'sharedApplication'); + var setting = plus.ios.invoke('NSURL', 'URLWithString:','app-settings:'); + plus.ios.invoke(app, 'openURL:', setting); + plus.ios.deleteObject(setting); + plus.ios.deleteObject(app); + } + } + }); + } + }); + + } else { + //android打开对应的通知栏 + var main = plus.android.runtimeMainActivity(); + var pkName = main.getPackageName(); + var uid = main.getApplicationInfo().plusGetAttribute("uid"); + var context = main.getApplicationContext(); + var NotificationManager = plus.android.importClass('android.app.NotificationManager'); + var notificationManager = context.getSystemService(context.NOTIFICATION_SERVICE); + var areNotificationsEnabled = notificationManager.areNotificationsEnabled(); + + if (!areNotificationsEnabled) { + // 提示用户开启通知权限 + uni.showModal({ + title: '通知权限开启提醒', + content: '您还没有开启通知权限,无法接受到消息通知,请前往设置!', + showCancel: false, + confirmText: '去设置', + success: function(res) { + if (res.confirm) { + var Intent = plus.android.importClass('android.content.Intent'); + var Build = plus.android.importClass("android.os.Build"); + //android 8.0引导 + if (Build.VERSION.SDK_INT >= 26) { + var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS'); + intent.putExtra('android.provider.extra.APP_PACKAGE', pkName); + } else if (Build.VERSION.SDK_INT >= 21) { //android 5.0-7.0 + var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS'); + intent.putExtra("app_package", pkName); + intent.putExtra("app_uid", uid); + } else { //(<21)其他--跳转到该应用管理的详情页 + intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); + intent.setData(uri); + } + // 跳转到该应用的系统通知设置页 + main.startActivity(intent); + } + } + }); + } + + } +}