From bd06e91920bf4d72b74ecc6aa710b4a0ad19d38e Mon Sep 17 00:00:00 2001 From: Penny <2500338766@qq.com> Date: Mon, 11 Sep 2023 12:56:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- androidPrivacy.json | 3 + js_sdk/wa-permission/permission.js | 296 ++++++++++++++++++++ manifest.json | 73 +++-- pages.json | 35 +++ pages/history/History.vue | 197 +++++++------- pages/policy/Policy.vue | 119 ++++++++ pages/rights/RightsOpen.vue | 75 ++++++ pages/rights/RightsSetting.vue | 100 +++++++ pages/scan/Barcode.vue | 65 ++--- pages/scan/Calendar.vue | 124 ++++++--- pages/scan/Contacts.vue | 67 ++--- pages/scan/Email.vue | 64 ++--- pages/scan/Location.vue | 77 +++--- pages/scan/Product.vue | 73 ++--- pages/scan/Scan.nvue | 92 +++++-- pages/scan/Sms.vue | 72 +++-- pages/scan/Tel.vue | 60 ++--- pages/scan/Text.vue | 83 +++--- pages/scan/Url.vue | 62 +++-- pages/scan/Wifi.vue | 62 ++--- pages/setting/Setting.vue | 418 +++++++++++++++++------------ static/album.png | Bin 3425 -> 3516 bytes static/flashLightOff.png | Bin 5176 -> 968 bytes static/flashLightOn.png | Bin 3464 -> 863 bytes uni_modules/vv-schedule/index.js | 186 +++++++++++++ uni_modules/vv-schedule/readme.md | 13 + 26 files changed, 1765 insertions(+), 651 deletions(-) create mode 100644 androidPrivacy.json create mode 100644 js_sdk/wa-permission/permission.js create mode 100644 pages/policy/Policy.vue create mode 100644 pages/rights/RightsOpen.vue create mode 100644 pages/rights/RightsSetting.vue create mode 100644 uni_modules/vv-schedule/index.js create mode 100644 uni_modules/vv-schedule/readme.md diff --git a/androidPrivacy.json b/androidPrivacy.json new file mode 100644 index 0000000..a78485c --- /dev/null +++ b/androidPrivacy.json @@ -0,0 +1,3 @@ +{ + "prompt" : "none" +} diff --git a/js_sdk/wa-permission/permission.js b/js_sdk/wa-permission/permission.js new file mode 100644 index 0000000..ee694f2 --- /dev/null +++ b/js_sdk/wa-permission/permission.js @@ -0,0 +1,296 @@ +/** + * 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启 + */ + +var isIos +// #ifdef APP-PLUS +isIos = (plus.os.name == "iOS") +// #endif + +// 判断推送权限是否开启 +function judgeIosPermissionPush() { + var result = false; + var UIApplication = plus.ios.import("UIApplication"); + var app = UIApplication.sharedApplication(); + var enabledTypes = 0; + if (app.currentUserNotificationSettings) { + var settings = app.currentUserNotificationSettings(); + enabledTypes = settings.plusGetAttribute("types"); + console.log("enabledTypes1:" + enabledTypes); + if (enabledTypes == 0) { + console.log("推送权限没有开启"); + } else { + result = true; + console.log("已经开启推送功能!") + } + plus.ios.deleteObject(settings); + } else { + enabledTypes = app.enabledRemoteNotificationTypes(); + if (enabledTypes == 0) { + console.log("推送权限没有开启!"); + } else { + result = true; + console.log("已经开启推送功能!") + } + console.log("enabledTypes2:" + enabledTypes); + } + plus.ios.deleteObject(app); + plus.ios.deleteObject(UIApplication); + return result; +} + +// 判断定位权限是否开启 +function judgeIosPermissionLocation() { + var result = false; + var cllocationManger = plus.ios.import("CLLocationManager"); + var status = cllocationManger.authorizationStatus(); + result = (status != 2) + console.log("定位权限开启:" + result); + // 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation + /* var enable = cllocationManger.locationServicesEnabled(); + var status = cllocationManger.authorizationStatus(); + console.log("enable:" + enable); + console.log("status:" + status); + if (enable && status != 2) { + result = true; + console.log("手机定位服务已开启且已授予定位权限"); + } else { + console.log("手机系统的定位没有打开或未给予定位权限"); + } */ + plus.ios.deleteObject(cllocationManger); + return result; +} + +// 判断麦克风权限是否开启 +function judgeIosPermissionRecord() { + var result = false; + var avaudiosession = plus.ios.import("AVAudioSession"); + var avaudio = avaudiosession.sharedInstance(); + var permissionStatus = avaudio.recordPermission(); + console.log("permissionStatus:" + permissionStatus); + if (permissionStatus == 1684369017 || permissionStatus == 1970168948) { + console.log("麦克风权限没有开启"); + } else { + result = true; + console.log("麦克风权限已经开启"); + } + plus.ios.deleteObject(avaudiosession); + return result; +} + +// 判断相机权限是否开启 +function judgeIosPermissionCamera() { + var result = false; + var AVCaptureDevice = plus.ios.import("AVCaptureDevice"); + var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide'); + console.log("authStatus:" + authStatus); + if (authStatus == 3) { + result = true; + console.log("相机权限已经开启"); + } else { + console.log("相机权限没有开启"); + } + plus.ios.deleteObject(AVCaptureDevice); + return result; +} + +// 判断相册权限是否开启 +function judgeIosPermissionPhotoLibrary() { + var result = false; + var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary"); + var authStatus = PHPhotoLibrary.authorizationStatus(); + console.log("authStatus:" + authStatus); + if (authStatus == 3) { + result = true; + console.log("相册权限已经开启"); + } else { + console.log("相册权限没有开启"); + } + plus.ios.deleteObject(PHPhotoLibrary); + return result; +} + +// 判断通讯录权限是否开启 +function judgeIosPermissionContact() { + var result = false; + var CNContactStore = plus.ios.import("CNContactStore"); + var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0); + if (cnAuthStatus == 3) { + result = true; + console.log("通讯录权限已经开启"); + } else { + console.log("通讯录权限没有开启"); + } + plus.ios.deleteObject(CNContactStore); + return result; +} + +// 判断日历权限是否开启 +function judgeIosPermissionCalendar() { + var result = false; + var EKEventStore = plus.ios.import("EKEventStore"); + var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0); + if (ekAuthStatus == 3) { + result = true; + console.log("日历权限已经开启"); + } else { + console.log("日历权限没有开启"); + } + plus.ios.deleteObject(EKEventStore); + return result; +} + +// 判断备忘录权限是否开启 +function judgeIosPermissionMemo() { + var result = false; + var EKEventStore = plus.ios.import("EKEventStore"); + var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1); + if (ekAuthStatus == 3) { + result = true; + console.log("备忘录权限已经开启"); + } else { + console.log("备忘录权限没有开启"); + } + plus.ios.deleteObject(EKEventStore); + return result; +} + +// Android权限查询 +function requestAndroidPermission(permissionID) { + return new Promise((resolve, reject) => { + plus.android.requestPermissions( + [permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装 + function(resultObj) { + var result = 0; + for (var i = 0; i < resultObj.granted.length; i++) { + var grantedPermission = resultObj.granted[i]; + console.log('已获取的权限:' + grantedPermission); + result = 1 + } + for (var i = 0; i < resultObj.deniedPresent.length; i++) { + var deniedPresentPermission = resultObj.deniedPresent[i]; + console.log('拒绝本次申请的权限:' + deniedPresentPermission); + result = 0 + } + for (var i = 0; i < resultObj.deniedAlways.length; i++) { + var deniedAlwaysPermission = resultObj.deniedAlways[i]; + console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); + result = -1 + } + resolve(result); + // 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限 + // if (result != 1) { + // gotoAppPermissionSetting() + // } + }, + function(error) { + console.log('申请权限错误:' + error.code + " = " + error.message); + resolve({ + code: error.code, + message: error.message + }); + } + ); + }); +} + +//权限设置专用检查(解决onShow循环问题) +function queryRightsSettingPermission(permissionID){ + plus.android.requestPermissions([permissionID], function(e){ + if(e.granted.length>0){ //权限被允许 + //调用依赖获取定位权限的代码 + console.log('granted!!! '+e.granted.toString()); + return 1; + } + if(e.deniedAlways.length>0){ //权限被永久拒绝 + // 弹出提示框解释为何需要定位权限,引导用户打开设置页面开启 + console.log('Always Denied!!! '+e.deniedAlways.toString()); + return -1; + } + if(e.deniedPresent.length>0){ //权限被临时拒绝 + // 弹出提示框解释为何需要定位权限,可再次调用plus.android.requestPermissions申请权限 + console.log('Present Denied!!! '+e.deniedPresent.toString()); + return 0; + } + }, function(e){ + console.log('Request Permissions error:'+JSON.stringify(e)); + }); +} + +// 使用一个方法,根据参数判断权限 +function judgeIosPermission(permissionID) { + if (permissionID == "location") { + return judgeIosPermissionLocation() + } else if (permissionID == "camera") { + return judgeIosPermissionCamera() + } else if (permissionID == "photoLibrary") { + return judgeIosPermissionPhotoLibrary() + } else if (permissionID == "record") { + return judgeIosPermissionRecord() + } else if (permissionID == "push") { + return judgeIosPermissionPush() + } else if (permissionID == "contact") { + return judgeIosPermissionContact() + } else if (permissionID == "calendar") { + return judgeIosPermissionCalendar() + } else if (permissionID == "memo") { + return judgeIosPermissionMemo() + } + return false; +} + +// 跳转到**应用**的权限页面 +function gotoAppPermissionSetting() { + if (isIos) { + var UIApplication = plus.ios.import("UIApplication"); + var application2 = UIApplication.sharedApplication(); + var NSURL2 = plus.ios.import("NSURL"); + // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES"); + var setting2 = NSURL2.URLWithString("app-settings:"); + application2.openURL(setting2); + + plus.ios.deleteObject(setting2); + plus.ios.deleteObject(NSURL2); + plus.ios.deleteObject(application2); + } else { + // console.log(plus.device.vendor); + var Intent = plus.android.importClass("android.content.Intent"); + var Settings = plus.android.importClass("android.provider.Settings"); + var Uri = plus.android.importClass("android.net.Uri"); + var mainActivity = plus.android.runtimeMainActivity(); + var intent = new Intent(); + intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); + intent.setData(uri); + mainActivity.startActivity(intent); + } +} + +// 检查系统的设备服务是否开启 +// var checkSystemEnableLocation = async function () { +function checkSystemEnableLocation() { + if (isIos) { + var result = false; + var cllocationManger = plus.ios.import("CLLocationManager"); + var result = cllocationManger.locationServicesEnabled(); + console.log("系统定位开启:" + result); + plus.ios.deleteObject(cllocationManger); + return result; + } else { + var context = plus.android.importClass("android.content.Context"); + var locationManager = plus.android.importClass("android.location.LocationManager"); + var main = plus.android.runtimeMainActivity(); + var mainSvr = main.getSystemService(context.LOCATION_SERVICE); + var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER); + console.log("系统定位开启:" + result); + return result + } +} + +module.exports = { + judgeIosPermission: judgeIosPermission, + requestAndroidPermission: requestAndroidPermission, + checkSystemEnableLocation: checkSystemEnableLocation, + gotoAppPermissionSetting: gotoAppPermissionSetting, + queryRightsSettingPermission: queryRightsSettingPermission +} diff --git a/manifest.json b/manifest.json index 2d99cf2..fcbc3f2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { - "name" : "scanCode", + "name" : "QR Scanner", "appid" : "__UNI__44D25EC", - "description" : "", + "description" : "扫码工具", "versionName" : "1.0.0", "versionCode" : 101, "transformPx" : false, @@ -12,7 +12,7 @@ "compilerVersion" : 3, "splashscreen" : { "alwaysShowBeforeRender" : true, - "waiting" : true, + "waiting" : false, "autoclose" : true, "delay" : 0 }, @@ -21,11 +21,7 @@ "SQLite" : {}, "Barcode" : {}, "Camera" : {}, - "Share" : {}, - "Contacts" : {}, - "Geolocation" : {}, - "Maps" : {}, - "Messaging" : {} + "Share" : {} }, /* 应用发布信息 */ "distribute" : { @@ -34,36 +30,30 @@ "permissions" : [ "", "", - "", - "", "", "", - "", "", "", "", "", - "", "", - "", "", "", - "", "", - "", "", "", - "", + "", "", - "", "" ], "minSdkVersion" : 21, - "targetSdkVersion" : 32 + "targetSdkVersion" : 32, + "abiFilters" : [ "armeabi-v7a" ] }, /* ios打包配置 */ "ios" : { - "dSYMs" : false + "dSYMs" : false, + "idfa" : false }, /* SDK配置 */ "sdkConfigs" : { @@ -76,6 +66,48 @@ } }, "maps" : {} + }, + "icons" : { + "android" : { + "xhdpi" : "unpackage/res/icons/96x96.png", + "hdpi" : "unpackage/res/icons/72x72.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "", + "ipad" : { + "app" : "", + "app@2x" : "", + "notification" : "", + "notification@2x" : "", + "proapp@2x" : "", + "settings" : "", + "settings@2x" : "", + "spotlight" : "", + "spotlight@2x" : "" + }, + "iphone" : { + "app@2x" : "", + "app@3x" : "", + "notification@2x" : "", + "notification@3x" : "", + "settings@2x" : "", + "settings@3x" : "", + "spotlight@2x" : "", + "spotlight@3x" : "" + } + } + }, + "splashscreen" : { + "androidStyle" : "default", + "android" : { + "hdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-480x762.png", + "xhdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-720x1242.png", + "xxhdpi" : "F:/次元节点doc/扫码项目文件/icon/splash-1080x1882.png" + }, + "useOriginalMsgbox" : false, + "iosStyle" : "common" } }, "nativePlugins" : { @@ -117,5 +149,6 @@ "uniStatistics" : { "enable" : false }, - "vueVersion" : "2" + "vueVersion" : "2", + "locale" : "en" } diff --git a/pages.json b/pages.json index a15b766..c22ece1 100644 --- a/pages.json +++ b/pages.json @@ -24,6 +24,27 @@ "enablePullDownRefresh": false } }, + { + "path": "pages/policy/Policy", + "style": { + "navigationBarTitleText": "Policy", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/rights/RightsSetting", + "style": { + "navigationBarTitleText": "RightsSetting", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/rights/RightsOpen", + "style": { + "navigationBarTitleText": "RightsOpen", + "enablePullDownRefresh": false + } + }, // { // "path": "pages/create/Create", // "style": { @@ -166,6 +187,20 @@ "iconPath": "static/setting-default.png", "selectedIconPath": "static/setting-select.png", "text": "Setting" + }, + { + "pagePath": "pages/rights/RightsOpen", + "iconPath": "static/setting-default.png", + "selectedIconPath": "static/setting-select.png", + "text": "RightsOpen", + "visible": false + }, + { + "pagePath": "pages/rights/RightsSetting", + "iconPath": "static/setting-default.png", + "selectedIconPath": "static/setting-select.png", + "text": "RightsSetting", + "visible": false } ] } diff --git a/pages/history/History.vue b/pages/history/History.vue index 833fc4c..432bf16 100644 --- a/pages/history/History.vue +++ b/pages/history/History.vue @@ -29,7 +29,7 @@ - + {{ item.category }} {{ item.content }} @@ -48,7 +48,8 @@ @@ -229,18 +246,18 @@ display: flex; flex-direction: column; align-items: center; - justify-content: center; + justify-content: start; background-color: #1F222B; // height:1400rpx; height: 100vh; overflow: scroll; .headLine{ - color: royalblue; - font-size: 36rpx; + color: #fff; + font-size: 48rpx; //padding-top:30px; //margin-right:200px; - margin-top:60rpx; + margin-top:30rpx; //border: 2px solid purple; } @@ -249,12 +266,12 @@ width: 660rpx; //height:300px; height: auto; - //margin-top: 10px; + margin-top: 60rpx; //background-color: #141b29; .listItem{ //border: 2px solid yellow; - height: 100rpx; + height: 200rpx; //margin-top: 30px; background-color: #141b29; color: #fff; @@ -275,13 +292,13 @@ .list-left-text{ width: 420rpx; .list-left-text-one{ - font-size: 30rpx; + font-size: 36rpx; //border: 2px solid blue; } .list-left-text-two{ color: grey; - font-size:26rpx; + font-size: 36rpx; //border: 2px solid lightsalmon; } } @@ -289,50 +306,50 @@ .list-left-feedback-text{ width: 480rpx; .list-left-feedback-text-one{ - font-size: 30rpx; + font-size: 36rpx; //border: 2px solid blue; } .list-left-feedback-text-two{ color: grey; - font-size: 26rpx; + font-size: 30rpx; //border: 2px solid lightsalmon; } } - .list-left-icon{ - //border: 2px solid blueviolet; - margin-right: 20rpx; - font-size: 50rpx; - } + // .list-left-icon{ + // //border: 2px solid blueviolet; + // margin-right: 20rpx; + // font-size: 100rpx; + // } .list-left-select-text{ width: 320rpx; .list-left-select-text-one{ - font-size: 30rpx; + font-size: 36rpx; //border: 2px solid blue; } } } - .list-right{ - //border: 2px solid pink; - color: royalblue; - font-size: 40rpx; + // .list-right{ + // //border: 2px solid pink; + // color: royalblue; + // font-size: 36rpx; - .list-right-icon{ - //border: 2px solid gainsboro; - font-size: 50rpx; - margin-left: 30rpx; - } + // .list-right-icon{ + // //border: 2px solid gainsboro; + // font-size: 36rpx; + // margin-left: 30rpx; + // } - .list-right-text{ - //border: 2px solid green; - //margin-right: 30px; - //padding-right: 30px; - } - } + // .list-right-text{ + // //border: 2px solid green; + // //margin-right: 30px; + // //padding-right: 30px; + // } + // } } } } diff --git a/pages/policy/Policy.vue b/pages/policy/Policy.vue new file mode 100644 index 0000000..e8e0d69 --- /dev/null +++ b/pages/policy/Policy.vue @@ -0,0 +1,119 @@ + + + + + \ No newline at end of file diff --git a/pages/rights/RightsOpen.vue b/pages/rights/RightsOpen.vue new file mode 100644 index 0000000..34e5930 --- /dev/null +++ b/pages/rights/RightsOpen.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/pages/rights/RightsSetting.vue b/pages/rights/RightsSetting.vue new file mode 100644 index 0000000..aaa0208 --- /dev/null +++ b/pages/rights/RightsSetting.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/pages/scan/Barcode.vue b/pages/scan/Barcode.vue index 34cdfd4..520598a 100644 --- a/pages/scan/Barcode.vue +++ b/pages/scan/Barcode.vue @@ -1,33 +1,30 @@