examTeamApp/unpackage/dist/build/mp-weixin/pageTwo/business/search.js

1 line
4.7 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/business/search"],{"2c78":function(e,t,o){"use strict";o.d(t,"b",(function(){return n})),o.d(t,"c",(function(){return i})),o.d(t,"a",(function(){}));var n=function(){var e=this.$createElement,t=(this._self._c,this.devices.length);this.$mp.data=Object.assign({},{$root:{g0:t}})},i=[]},"46e3":function(e,t,o){"use strict";var n=o("f503"),i=o.n(n);i.a},"534b":function(e,t,o){"use strict";o.r(t);var n=o("b65d"),i=o.n(n);for(var c in n)["default"].indexOf(c)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(c);t["default"]=i.a},6387:function(e,t,o){"use strict";o.r(t);var n=o("2c78"),i=o("534b");for(var c in i)["default"].indexOf(c)<0&&function(e){o.d(t,e,(function(){return i[e]}))}(c);o("46e3");var r=o("828b"),a=Object(r["a"])(i["default"],n["b"],n["c"],!1,null,"ca7415fe",null,!1,n["a"],void 0);t["default"]=a.exports},b2de:function(e,t,o){"use strict";(function(e,t){var n=o("47a9");o("30b7");n(o("3240"));var i=n(o("6387"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(i.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},b65d:function(e,t,o){"use strict";(function(e,n){var i=o("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var c,r,a=i(o("7ca3")),s=o("8f59");function u(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}var d={data:function(){return{macAddr:"",code:"",deviceId:"",popup:!1,devices:[],id:0}},computed:function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(Object(o),!0).forEach((function(t){(0,a.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({},(0,s.mapState)(["user","isConnected","isBluetoothTyle"])),onLoad:function(t){c=this,c.id=t.id,c.$Bluetooth.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){c.$store.commit("changeBluetooth",e.available)})),console.log("搜索")},onUnload:function(){console.log("onUnload");this.Unload||(e.hideLoading(),this.$Bluetooth.closeBluetoothAdapter(),this.$Bluetooth.stopBluetoothDevicesDiscovery())},methods:{openBluetoothAdapter:function(){var t=this;e.openBluetoothAdapter({success:function(e){console.log("蓝牙初始化成功"),t.startBluetoothDeviceDiscovery()},fail:function(e){console.log("初始化蓝牙失败:"+e.errMsg),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;n.showLoading({title:"设备搜索中"}),e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if(-1!=e.name.indexOf("YPC")){clearTimeout(r);var o=e.name.slice(7,19);return e.macAddr=t.$Bluetooth.str2Num(o),e.deviceId=t.$Bluetooth.str2Num(o),void t.handleDevice(e)}if(-1!=e.name.indexOf("G02")){clearTimeout(r);var n=e.advertisData.slice(3,9);e.mac=new Uint8Array(n);var i=Array.from(e.mac);return i.reverse(),e.macAddr=t.$tools.ab2hex(i,":").toUpperCase(),void t.handleDevice(e)}if(-1!=e.name.indexOf("Yihejia_Lung"))return console.log("肺活量",e,"04:0D:84:48:E0:9B"),e.macAddr=e.deviceId,clearTimeout(r),void t.handleDevice(e)}))})),t.handleMyTime()},handleDevice:function(e){var t=this.devices,o=this.$tools.inArray(t,"deviceId",e.deviceId);this.deviceId=e.deviceId,-1===o?this.devices.push(e):this.devices[o]=e,this.popup=!0},handleMyTime:function(){var t=this;r=setTimeout((function(){t.devices.length||(t.islink=-1,t.$tools.showModal("没有查找到设备")),e.hideLoading(),clearTimeout(r),t.$Bluetooth.stopBluetoothDevicesDiscovery()}),15e3)},createBLEConnection:function(t){var o=this;o.$Bluetooth.stopBluetoothDevicesDiscovery(),o.macAddr=t.macAddr,e.showModal({title:"提示",content:"是否绑定该设备?",cancelText:"取消",confirmText:"确定",success:function(e){e.confirm?o.getActive():o.$tools.msg("您已取消操作")}})},getActive:function(){var t=this;t.$model.getBinding({device_id:t.id,device_mac:t.macAddr}).then((function(o){t.$Bluetooth.closeBluetoothAdapter(),t.devices=[],0==o.code?(t.$tools.msg("绑定成功!"),t.$store.dispatch("getUserDeviceList"),t.$store.dispatch("getUserInfo",{aud_id:e.getStorageSync("userid")}),setTimeout((function(){e.switchTab({url:"/pages/home/home"})}),500)):t.$tools.msg(o.msg)}))}}};t.default=d}).call(this,o("df3c")["default"],o("3223")["default"])},f503:function(e,t,o){}},[["b2de","common/runtime","common/vendor"]]]);