1 line
8.8 KiB
JavaScript
1 line
8.8 KiB
JavaScript
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["BLEPages/child/J01"],{"3cce":function(e,t,o){},"678d":function(e,t,o){"use strict";(function(e,t){var i=o("4ea4");o("6808");i(o("66fd"));var n=i(o("8bef"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(n.default)}).call(this,o("bc2e")["default"],o("543d")["createPage"])},"87d8":function(e,t,o){"use strict";o.d(t,"b",(function(){return i})),o.d(t,"c",(function(){return n})),o.d(t,"a",(function(){}));var i=function(){var e=this.$createElement;this._self._c},n=[]},"8bef":function(e,t,o){"use strict";o.r(t);var i=o("87d8"),n=o("d6fe");for(var c in n)["default"].indexOf(c)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(c);o("a75e6");var s=o("f0c5"),a=Object(s["a"])(n["default"],i["b"],i["c"],!1,null,"133ce4ab",null,!1,i["a"],void 0);t["default"]=a.exports},a75e6:function(e,t,o){"use strict";var i=o("3cce"),n=o.n(i);n.a},d6fe:function(e,t,o){"use strict";o.r(t);var i=o("dd8e"),n=o.n(i);for(var c in i)["default"].indexOf(c)<0&&function(e){o.d(t,e,(function(){return i[e]}))}(c);t["default"]=n.a},dd8e:function(e,t,o){"use strict";(function(e){var i=o("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,c=i(o("9523")),s=o("26cb");function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)}return o}function r(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?a(Object(o),!0).forEach((function(t){(0,c.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):a(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var d=requirePlugin("sdkPlugin").AiLink,l={data:function(){return{textW:"",textH:"",height:"",weight:"",imp:0,macAddr:"",deviceId:"",serviceId:"",readId:"",writeId:"",notifyId:"",Unload:!1,devicesList:[],isConnection:0,data01:{},data02:{},BLEResult:{}}},computed:r(r({},(0,s.mapState)(["user","isConnected","isBluetoothTyle","appTheme"])),{},{info:function(){return this.user}}),onUnload:function(){this.Unload||(this.stopBluetoothDevicesDiscovery(),clearTimeout(n),this.closeBLEConnection(),this.closeBluetoothAdapter(),e.switchTab({url:"/pages/index/index"}),console.log("页面返回onUnload"))},watch:{isConnected:function(){this.isConnected||(this.handleBack(),this.isConnection=2)},isBluetoothTyle:function(){this.isBluetoothTyle||(this.handleBack(),this.isConnection=2)}},onLoad:function(t){var o=this;o.textW="",o.textH="",o.imp=0,e.setNavigationBarColor({frontColor:"#ffffff",backgroundColor:this.appTheme}),console.log("options",t),t&&t.deviceId&&(o.macAddr=t.deviceId,o.deviceId=t.deviceId,o.closeBLEConnection(),o.closeBluetoothAdapter(),o.openBluetoothAdapter()),o.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){o.$store.commit("changeBluetooth",e.available)}))},methods:{openBluetoothAdapter:function(){var t=this;e.openBluetoothAdapter({success:function(e){t.isConnection=0,t.startBluetoothDeviceDiscovery(),console.log("初始化蓝牙成功:"+e.errMsg)},fail:function(e){t.isConnection=2,t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("蓝牙连接状态",JSON.stringify(e)),e.connected||(t.Unload=!0,t.isConnection=2,clearTimeout(n),t.closeBLEConnection(),t.closeBluetoothAdapter()),t.$store.commit("changeConnected",e.connected)}))},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!1,interval:500,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!=
|