2022-05-27 17:20:31 +08:00
|
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["BLEPages/adult/F01B"],{4362:function(e,t,o){"use strict";o.r(t);var n=o("d3bd"),i=o.n(n);for(var c in n)"default"!==c&&function(e){o.d(t,e,(function(){return n[e]}))}(c);t["default"]=i.a},7222:function(e,t,o){"use strict";(function(e){o("e568");n(o("66fd"));var t=n(o("ccc0"));function n(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=o,e(t.default)}).call(this,o("543d")["createPage"])},cc52:function(e,t,o){"use strict";var n;o.d(t,"b",(function(){return i})),o.d(t,"c",(function(){return c})),o.d(t,"a",(function(){return n}));var i=function(){var e=this,t=e.$createElement;e._self._c},c=[]},ccc0:function(e,t,o){"use strict";o.r(t);var n=o("cc52"),i=o("4362");for(var c in i)"default"!==c&&function(e){o.d(t,e,(function(){return i[e]}))}(c);var s,r=o("f0c5"),a=Object(r["a"])(i["default"],n["b"],n["c"],!1,null,"5c73fc6e",null,!1,n["a"],s);t["default"]=a.exports},d3bd:function(e,t,o){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=o("26cb");function c(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function s(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?c(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):c(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var a={data:function(){return{textW:"",textH:"",height:"",weight:"",imp:0,type:1,uuid1:"",uuid2:"",uuid3:"",macAddr:"",deviceId:"",serviceId:"",Unload:!1,isConnection:0}},computed:s(s({},(0,i.mapState)(["user","isConnected","isBluetoothTyle","appTheme"])),{},{info:function(){return this.user}}),onUnload:function(){var e=this;e.Unload||(e.stopBluetoothDevicesDiscovery(),clearTimeout(n),e.closeBLEConnection(),e.closeBluetoothAdapter(),console.log("返回上一个页面"))},onLoad:function(t){var o=this;e.setNavigationBarColor({frontColor:"#ffffff",backgroundColor:this.appTheme}),o.textW="",o.textH="",t&&t.deviceId&&(o.deviceId=t.deviceId,o.closeBLEConnection(),o.closeBluetoothAdapter(),o.openBluetoothAdapter()),o.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){o.$store.commit("changeBluetooth",e.available)}))},watch:{isConnected:function(){var e=this;e.isConnected||(e.handleBack(),e.isConnection=2)},isBluetoothTyle:function(){var e=this;e.isBluetoothTyle||(e.handleBack(),e.isConnection=2)}},methods:{openBluetoothAdapter:function(){var t=this;t.type=1,e.openBluetoothAdapter({success:function(e){t.isConnection=0,t.startBluetoothDeviceDiscovery()},fail:function(e){t.isConnection=2,t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!1,interval:500,services:["FFE0"],success:function(e){t.isConnection=0,t.onBluetoothDeviceFound()},fail:function(e){t.isConnection=2,t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},onBluetoothDeviceFound:function(){var t=this;t.isConnection=0,e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if((e.name||e.localName)&&-1!=e.name.indexOf("AiLink_")){clearTimeout(n);var o=e.advertisData.slice(-6);e.mac=new Uint8Array(o);var i=Array.from(e.mac);if(i.reverse(),e.macAddr=t.$tools.ab2hex(i,":").toUpperCase(),-1!=e.deviceId.indexOf(t.deviceId)||-1!=e.macAddr.indexOf(t.deviceId))return t.stopBluetoothDevicesDiscovery(),t.macAddr=e.macAddr,t.deviceId=e.deviceId,void t.createBLEConnection()}}))})),t.handleMyTime()},handleMyTime:function(){var e=this;n=setTimeout((function(){e.macAddr||(clearTimeout(n),e.Unload=!0,e.isConnection=2,e.closeBLEConne
|