1 line
4.6 KiB
JavaScript
1 line
4.6 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/search"],{"5c11":function(e,t,o){"use strict";o.r(t);var i=o("80c7"),n=o("8829");for(var c in n)["default"].indexOf(c)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(c);o("c770");var r=o("828b"),s=Object(r["a"])(n["default"],i["b"],i["c"],!1,null,"6bfd374d",null,!1,i["a"],void 0);t["default"]=s.exports},"80c7":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=[]},8829:function(e,t,o){"use strict";o.r(t);var i=o("e0b8"),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},9467:function(e,t,o){},b3dc:function(e,t,o){"use strict";(function(e,t){var i=o("47a9");o("30b7");i(o("3240"));var n=i(o("5c11"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(n.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},c770:function(e,t,o){"use strict";var i=o("9467"),n=o.n(i);n.a},e0b8:function(e,t,o){"use strict";(function(e){var i=o("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,c,r=i(o("7ca3")),s=o("8f59");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}var d={data:function(){return{Unload:!1,issearch:!1,isdevTip:!1,devicesList:[],devList:[],id:0,isdevice:!0}},computed:function(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,r.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}({},(0,s.mapState)(["user","isConnected","isBluetoothTyle"])),onLoad:function(t){n=this,n.id=t?t.id:0,n.isdevice=t.device,n.openBluetoothAdapter(),n.$Bluetooth.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){n.$store.commit("changeBluetooth",e.available)}))},onBackPress:function(){console.log("onUnload",this.Unload),this.Unload||(this.$Bluetooth.closeBluetoothAdapter(),this.$Bluetooth.stopBluetoothDevicesDiscovery())},watch:{isBluetoothTyle:function(){this.isBluetoothTyle||(this.issearch=!0,this.isdevTip=!0,this.devList=[],clearTimeout(c)),console.log("蓝牙是否打开",this.isBluetoothTyle)}},methods:{openBluetoothAdapter:function(){var t=this;e.openBluetoothAdapter({success:function(e){console.log("蓝牙初始化成功"),t.issearch=!1,t.isdevTip=!1,t.devList=[],t.startBluetoothDeviceDiscovery()},fail:function(e){t.$Bluetooth.getBluetoothAdapter(e)}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!0,success:function(e){t.onBluetoothDeviceFound()},fail:function(e){}})},onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if(-1!=e.name.indexOf("G02")){console.log("G02",e),clearTimeout(c);var o=e.advertisData.slice(3,9);e.mac=new Uint8Array(o);var i=Array.from(e.mac);return i.reverse(),e.macAddr=t.$tools.ab2hex(i,":").toUpperCase(),t.deviceId=e.macAddr,void t.handleDevice(e)}if(-1!=e.name.indexOf("Yihejia_Lung"))return console.log("肺活量PCV02",e),clearTimeout(c),e.macAddr=e.deviceId,t.deviceId=e.deviceId,void t.handleDevice(e);if(-1!=e.name.indexOf("YPC")){console.log("跳绳PCT02",e.name,e),clearTimeout(c);var n=e.name.slice(7,19);return e.macAddr=t.$tools.str2Num(n),e.deviceId=t.$tools.str2Num(n),t.deviceId=t.$tools.str2Num(n),void(""!=e.macAddr&&t.handleDevice(e))}}))})),t.handleMyTime()},handleDevice:function(e){var t=this.devicesList,o=this.$tools.inArray(t,"deviceId",e.deviceId);console.log("device",e,o),-1===o&&(this.devicesList.push(e),""!=e.macAddr&&this.handleDevType(e.macAddr))},handleMyTime:function(){var e=this;c=setTimeout((function(){e.devList.length||(e.isdevTip=!0,e.devList=[]),e.issearch=!0,clearTimeout(c),e.$Bluetooth.stopBluetoothDevicesDiscovery()}),15e3)},handleDevType:function(e){n=this,n.$model.getdevdetail({mac:e,acd_id:n.id}).then((function(t){console.log("排查返回",t,e,n.id),0==t.code&&(t.data.deviceId=e,n.devList.push(t.data))}))},handleWeight:function(t){clearTimeout(c),this.Unload=!0,console.log("跳转测量",t),"透传"==t.bluetooth_type&&this.$Bluetooth.stopBluetoothDevicesDiscovery(),e.redirectTo({url:t.page_measure+"?deviceId="+this.deviceId+"&isdevice="+this.isdevice})}}};t.default=d}).call(this,o("df3c")["default"])}},[["b3dc","common/runtime","common/vendor"]]]); |