diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index e5a582a..426163d 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -6,7 +6,8 @@ "type" : "uni-app:app-ios" }, { - "playground" : "standard", + "customPlaygroundType" : "local", + "playground" : "custom", "type" : "uni-app:app-android" } ] diff --git a/androidPrivacy.json b/androidPrivacy.json index 0d726ca..6e900af 100644 --- a/androidPrivacy.json +++ b/androidPrivacy.json @@ -1,3 +1,29 @@ { - "prompt" : "template" + "version" : "1", + "prompt" : "template", + "title" : "服务协议和隐私政策", + "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
  你可阅读《服务协议》《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", + "buttonAccept" : "同意并接受", + "buttonRefuse" : "暂不同意", + "hrefLoader" : "system", + "backToExit" : "false", + "disagreeMode" : { + "support" : false, + "loadNativePlugins" : false, + "visitorEntry" : false, + "showAlways" : true + }, + "styles" : { + "backgroundColor" : "#FFFFFF", + "borderRadius" : "5px", + "title" : { + "color" : "#FFFFFF" + }, + "buttonAccept" : { + "color" : "#b9e203" + }, + "buttonRefuse" : { + "color" : "#555555" + } + } } diff --git a/manifest.json b/manifest.json index 9058167..d36339b 100644 --- a/manifest.json +++ b/manifest.json @@ -57,7 +57,8 @@ ], "minSdkVersion" : 21, "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], - "schemes" : "" + "schemes" : "", + "targetSdkVersion" : 30 }, /* ios打包配置 */ "ios" : { @@ -139,7 +140,8 @@ } }, "splashscreen" : { - "useOriginalMsgbox" : true + "useOriginalMsgbox" : true, + "androidStyle" : "common" } } }, diff --git a/pages.json b/pages.json index 80fb6e9..ce41a16 100644 --- a/pages.json +++ b/pages.json @@ -348,6 +348,13 @@ { "navigationBarTitleText" : "HBY102" } + }, + { + "path" : "pages/common/user/logOff", + "style" : + { + "navigationBarTitleText" : "注销账号" + } } diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue index 825a758..ac72311 100644 --- a/pages/4877/BJQ4877.vue +++ b/pages/4877/BJQ4877.vue @@ -108,7 +108,7 @@ @@ -382,7 +382,7 @@ latitude: null, longitude: null, alarmStatus: null, - detailPageUrl: "/pages/650/HBY650", + detailPageUrl: "/pages/4877/BJQ4877", showConfirm: false }, } @@ -419,7 +419,7 @@ eventChannel.on('detailData', function(data) { - console.log("收到父页面的参数:" + JSON.stringify(data)); + // console.log("收到父页面的参数:" + JSON.stringify(data)); let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id); if (checkIds && checkIds.length) { @@ -474,6 +474,8 @@ these.formData.bleStatu = false; these.formData.deviceId = f.deviceId; + these.formData.warnTime=null; + these.formData.sta_SOSType='sos_off'; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { these.formData.bleStatu = true; }); @@ -511,6 +513,15 @@ these.dic.groups = groups; + let checks = groups.map(item => { + return item.id + }); + + uni.setStorage({ + key: "4877CheckColor_" + this.device.id, + data: checks + }); + }catch(err){ @@ -704,6 +715,21 @@ } groupSet(); }, + SOSEvt(){ + if (this.formData.sta_SOSType == 'sos') { + this.formData.sta_ArrowType='arrow_off'; + this.formData.warnTime = 0; + clearInterval(interval); + interval = setInterval(() => { + this.formData.warnTime += 1; + }, 1000) + }else{ + clearInterval(interval); + interval=null; + this.formData.warnTime = 0; + } + }, + sosSetting(item, index) { let f = this.getDevice(); @@ -724,14 +750,8 @@ ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => { this.formData.sta_GroupType = -1; this.formData.sta_SOSType = json.ins_SOSType - if (this.formData.sta_SOSType == 'sos') { - this.formData.warnTime = 0; - clearInterval(interval); - interval = setInterval(() => { - this.formData.warnTime += 1; - }, 1000) - } - + + these.SOSEvt(); }) .catch(ex => { @@ -902,9 +922,15 @@ this.formData[key] = data[key]; } }); + + let msg = []; if (data.sta_SOSType == 'sos') { msg.push("设备声光报警中"); + + } + if('sta_SOSType' in data){ + these.SOSEvt(); } if (data.sta_PowerPercent <= 20) { msg.push("设备电量低"); diff --git a/pages/common/forgotPassword/index.vue b/pages/common/forgotPassword/index.vue index cdffbe7..2e3445e 100644 --- a/pages/common/forgotPassword/index.vue +++ b/pages/common/forgotPassword/index.vue @@ -43,8 +43,8 @@ 为了更好的保障您的合法权益,请您阅读并同意以下协议 - 《用户服务协议》 - 《隐私政策》 + 《用户服务协议》 + 《隐私政策》 diff --git a/pages/common/login/index.vue b/pages/common/login/index.vue index df87d80..66a234b 100644 --- a/pages/common/login/index.vue +++ b/pages/common/login/index.vue @@ -49,8 +49,8 @@ 为了更好的保障您的合法权益,请您阅读并同意以下协议 - 《用户服务协议》 - 《隐私政策》 + 《用户服务协议》 + 《隐私政策》 @@ -78,7 +78,7 @@ agreed: false, isCounting: false, countdown: 0, - isChecked: true, + isChecked: false, showAgreement: false, // 控制弹窗显示 isCodeLogin: false, } diff --git a/pages/common/privacyAgreement/index.vue b/pages/common/privacyAgreement/index.vue index 029b2ca..0cd534f 100644 --- a/pages/common/privacyAgreement/index.vue +++ b/pages/common/privacyAgreement/index.vue @@ -1,7 +1,107 @@ @@ -16,10 +116,41 @@ min-height: 100vh; background-color: rgb(18, 18, 18); padding: 30rpx; - } - .deviceTitle{ - color: rgba(255, 255, 255, 0.87); + color:#ffffffde; line-height: 45mnrpx; font-size: 28rpx; } + + .deviceTitle { + margin-bottom: 20rpx; + text-indent: 50rpx; + } + + .title { + text-align: center; + } + + .smalltitle { + font-size: 14px; + } + + .marginBottom { + margin-bottom: 30px; + ; + } + + .table { + border-collapse: collapse; + width: 100%; + } + + .th, .td { + border: 1px solid #ddd; + padding: 8px; + text-align: left; + } + + .th { + background-color: #f2f2f2; + } \ No newline at end of file diff --git a/pages/common/register/index.vue b/pages/common/register/index.vue index e34303c..1777522 100644 --- a/pages/common/register/index.vue +++ b/pages/common/register/index.vue @@ -46,8 +46,8 @@ 为了更好的保障您的合法权益,请您阅读并同意以下协议 - 《用户服务协议》 - 《隐私政策》 + 《用户服务协议》 + 《隐私政策》 diff --git a/pages/common/user/index.vue b/pages/common/user/index.vue index d8fd6c3..6895939 100644 --- a/pages/common/user/index.vue +++ b/pages/common/user/index.vue @@ -32,6 +32,11 @@ 关于我们 + + + 注销账号 + + 账号安全 @@ -153,6 +158,11 @@ url: '/pages/common/privacyAgreement/index' }) }, + logOff(){ + uni.navigateTo({ + url:'/pages/common/user/logOff' + }) + }, // 关于我们 aboutUs() { uni.navigateTo({ diff --git a/pages/common/user/logOff.vue b/pages/common/user/logOff.vue new file mode 100644 index 0000000..bc1fc4a --- /dev/null +++ b/pages/common/user/logOff.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/pages/common/userAgreement/index.vue b/pages/common/userAgreement/index.vue index 029b2ca..1c6db0b 100644 --- a/pages/common/userAgreement/index.vue +++ b/pages/common/userAgreement/index.vue @@ -1,7 +1,127 @@ @@ -16,10 +136,38 @@ min-height: 100vh; background-color: rgb(18, 18, 18); padding: 30rpx; - } - .deviceTitle{ color: rgba(255, 255, 255, 0.87); line-height: 45mnrpx; - font-size: 28rpx; + font-size: 26rpx; + } + + .deviceTitle {} + + .title { + font-size: 50rpx; + text-align: center + } + + .secondTitle { + font-size: 35rpx; + + } + + .threeTitle { + font-size: 30rpx; + } + + .marginBottom { + margin-bottom: 30px; + ; + } + + .textLeft{ + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-content: center; + align-items: center; + justify-content: flex-start; } \ No newline at end of file diff --git a/utils/BleHelper.js b/utils/BleHelper.js index 55ac5ce..aef0516 100644 --- a/utils/BleHelper.js +++ b/utils/BleHelper.js @@ -36,13 +36,13 @@ class BleHelper { linkedDevices = uni.getStorageSync(this.StorageKey); } if (linkedDevices && linkedDevices.length && linkedDevices.length > 0) { - // console.log("111111", linkedDevices); + console.log("111111", linkedDevices); linkedDevices = linkedDevices.filter((v) => { if (v) { v.Linked = false; v.notifyState = false; } - return v ? true : false; + return v.device ? true : false; }); } @@ -51,12 +51,7 @@ class BleHelper { - setTimeout(() => { - this.OpenBlue().then(() => { - this.linkAllDevices(); - }); - - }, 10); + this.data = { isOpenBlue: false, //蓝牙模块是否开启 available: false, //蓝牙状态是否可用 @@ -64,7 +59,8 @@ class BleHelper { searchList: [], //已搜索到的设备列表, isSubscribe: false, //是否开启了订阅 LinkedList: linkedDevices, //已连接的设备列表 - platform: systemInfo.uniPlatform + platform: systemInfo.uniPlatform, + Disconnect:[]//主动断开的设备 } this.cfg = { onDeviceFound: [], //发现新设备的事件 @@ -77,6 +73,14 @@ class BleHelper { this.addReceiveCallback((receive, f, path, recArr) => { recei.ReceiveData(receive, f, path, recArr); }, "BleReceiveData"); + + setTimeout(() => { + this.OpenBlue().then(() => { + this.linkAllDevices(); + }); + + }, 10); + this.dic = { errRemarks: [{ key: '10000', @@ -505,8 +509,7 @@ class BleHelper { console.log("开始订阅各类变化消息"); this.data.isSubscribe = true; - // 保存每个设备的连接状态 - let bleDeviceStates = {}; + var bytesToHexString = (bytes) => { @@ -514,14 +517,14 @@ class BleHelper { '0')); } let adapterStateTime=null; - uni.onBluetoothAdapterStateChange((state) => { + uni.onBluetoothAdapterStateChange((state) => { + if(this.data.discovering === state.discovering && this.data.available===state.available){ + console.error("专业给Uniapp填坑,适配器状态重复回调"); + return; + } + clearTimeout(adapterStateTime); - setTimeout(()=>{ - - if(this.data.discovering === state.discovering && this.data.available===state.available){ - console.error("专业给Uniapp填坑,适配器状态错误"); - return; - } + setTimeout(()=>{ console.log('蓝牙模块状态发生变化:' + JSON.stringify(state)); this.data.discovering = state.discovering; @@ -558,10 +561,7 @@ class BleHelper { return true; }); - // let keys = Object.keys(bleDeviceStates) - // keys.filter(v => { - // bleDeviceStates[v] = false; - // }); + this.cfg.stateBreakCallback.forEach(f => { try { @@ -585,14 +585,17 @@ class BleHelper { uni.onBLEConnectionStateChange((res) => { console.log("蓝牙连接状态变化了", res); // 检查状态是否真的发生了变化 - if (bleDeviceStates[res.deviceId] === res.connected) { - console.error('专业给Uniapp填坑,连接状态重复回调'); - return; + let ble=this.data.LinkedList.find(dev=>{ + return res.deviceId===dev.deviceId; + }); + if(ble){ + if(ble.Linked===res.connected){ + return; + } } + - // 更新状态记录 - bleDeviceStates[res.deviceId] = res.connected; - + setTimeout(() => { if (!res.connected) { console.error("蓝牙已断开", res); @@ -608,16 +611,23 @@ class BleHelper { }); this.updateCache(); if (f && f.device && f.device.id && this.data.available) { - console.log("蓝牙状态可用,尝试5次恢复连接,", f - .deviceId); - this.LinkBlue(res.deviceId, f - .writeServiceId, f - .wirteCharactId, f - .notifyCharactId, 5); + let fdis=this.data.Disconnect.find(dis=>{ + return dis===res.deviceId + });//用户主动断开的,不再重连 + if(!fdis){ + res.device=f.device; + console.log("蓝牙状态可用,尝试5次恢复连接,", f + .deviceId); + this.LinkBlue(res.deviceId, f + .writeServiceId, f + .wirteCharactId, f + .notifyCharactId, 5); + } + } - if (this.cfg.bleDisposeCallback.length > - 0) { + if (this.cfg.bleDisposeCallback.length >0) { + this.cfg.bleDisposeCallback.forEach( (c) => { try { @@ -816,22 +826,24 @@ class BleHelper { str: str, hexs: hexs }; - console.log("监听到特征值:" + JSON.stringify(recData)); + // console.log("监听到特征值:" + JSON.stringify(recData)); if (this.cfg.receivDataCallback) { if (this.cfg.receivDataCallback.length > 0) { let path = this.getCurrentPagePath(); - // console.log("有人订阅消息") + // console.log("有人订阅消息") this.cfg.receivDataCallback.forEach(( rec) => { - // console.log("有人订阅消息111", ) + // console.log("有人订阅消息111", ) if (rec.callback) { try { + // console.log("正在处理订阅消息",rec); rec.callback(recData, f, path, this.cfg .receivDataCallback ); + // console.log("处理订阅消息完毕"); } catch (err) { console.error( "订阅消息出现异常", @@ -1500,6 +1512,13 @@ class BleHelper { } this.updateCache(); + //主动连接某个设备时,从主动断开中删除 + this.data.Disconnect.find((c,index)=>{ + if(c===deviceId){ + this.data.Disconnect.splice(index,1); + return true; + } + }) // console.log("LinkedList=", this.data // .LinkedList); @@ -1654,6 +1673,7 @@ class BleHelper { success: (res) => { console.log("用户主动断开了蓝牙:" + id); this.subScribe(id, false); + this.data.Disconnect.push(id); resolve(); }, fail: (ex) => { @@ -1845,7 +1865,7 @@ class BleHelper { Promise.race([timeOut(ms), promise]).then(resolve).catch((ex) => { // console.error("ex=", ex); if (ex.code == -1) { - console.error('专业给Uniapp填坑,发送消息永无回调'); + // console.error('专业给Uniapp填坑,发送消息永无回调'); resolve(ex); } else { reject(ex);