From 036d461cfa946c252ef22d1d1ec7e78cca52a9ee Mon Sep 17 00:00:00 2001 From: duqingquan Date: Mon, 5 Dec 2022 14:46:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=B5=E9=87=8Fapi=20?= =?UTF-8?q?=E6=8C=89=E7=85=A7uni-error=20=E8=A7=84=E8=8C=83=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 13 +++---------- .../uni-getbatteryinfo/utssdk/app-android/index.uts | 4 ++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index a22e3ea..5bac7fa 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -36,23 +36,15 @@ }, testConnnectWifi(){ - // uni.connectWifi({ - // maunal:false, - // SSID:"Xiaomi_20D0", - // password:"BBBB", - // complete:(res)=>{ - // console.log(res); - // } - // }); uni.connectWifi({ maunal:false, - partialInfo:false, SSID:"Xiaomi_20D0", - password:"streamApp!2016", + password:"BBBB", complete:(res)=>{ console.log(res); } }); + }, testGetConnnectWifi(){ uni.getConnectedWifi({ @@ -190,6 +182,7 @@ testGetBatteryInfo() { uni.getBatteryInfo({ success(res) { + console.log(res); uni.showToast({ title: "当前电量:" + res.level + '%', icon: 'none' diff --git a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts index bde4e50..1f734f0 100644 --- a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts +++ b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts @@ -19,6 +19,8 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) { BatteryManager.BATTERY_PROPERTY_CAPACITY ); const res = { + errSubject: "uni-getBatteryInfo", + errCode: 0, errMsg: 'getBatteryInfo:ok', level, isCharging: manager.isCharging() @@ -27,6 +29,8 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) { options.complete?.(res) } else { const res = { + errSubject: "uni-getBatteryInfo", + errCode: 1001, errMsg: 'getBatteryInfo:fail getAppContext is null' } options.fail?.(res) -- GitLab