examTeamApp/unpackage/dist/build/mp-weixin/pageTwo/devices/PCV02.js

1 line
9.2 KiB
JavaScript
Raw Normal View History

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/PCV02"],{"5d72":function(e,t,n){"use strict";n.r(t);var i=n("aa6c"),o=n.n(i);for(var c in i)["default"].indexOf(c)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(c);t["default"]=o.a},"61a8":function(e,t,n){"use strict";(function(e,t){var i=n("47a9");n("30b7");i(n("3240"));var o=i(n("9b8c"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(o.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"65f7":function(e,t,n){},"921e":function(e,t,n){"use strict";var i=n("65f7"),o=n.n(i);o.a},"9b8c":function(e,t,n){"use strict";n.r(t);var i=n("d6f9"),o=n("5d72");for(var c in o)["default"].indexOf(c)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(c);n("921e");var s=n("828b"),r=Object(s["a"])(o["default"],i["b"],i["c"],!1,null,"dcbb8bce",null,!1,i["a"],void 0);t["default"]=r.exports},aa6c:function(e,t,n){"use strict";(function(e){var i=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,c=i(n("7ca3")),s=n("8f59");function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){(0,c.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=0,l=0,d=null,f={data:function(){return{isEnd:!1,isstart:!1,number1:0,number2:0,number3:0,level1:"",level2:"",level3:"",average:"",averageS:"",text:0,LiuS:"",macAddr:"",serviceId:"",deviceId:"",Unload:!1,notify:"",write:"",second:5,standard:"",offset:0,listS:[]}},computed:a(a({},(0,s.mapState)(["user","isConnected","isBluetoothTyle","lungLevel"])),{},{info:function(){return this.user},list:function(){var e="";return this.lungLevel.forEach((function(t){"及格"==t.text&&(e=t.min_val)})),this.standard=e,this.lungLevel}}),onUnload:function(){this.Unload||(clearTimeout(o),this.stopBluetoothDevicesDiscovery(),this.closeBLEConnection(),this.closeBluetoothAdapter(),console.log("页面返回onUnload"))},onLoad:function(t){var n=this;t&&t.deviceId&&(n.deviceId=t.deviceId,n.openBluetoothAdapter()),n.openBluetoothAdapter(),n.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){n.$store.commit("changeBluetooth",e.available)}))},watch:{isConnected:function(){this.isConnected||this.handleBack()},isBluetoothTyle:function(){this.isBluetoothTyle||this.handleBack()},second:function(){this.second<=0&&(u++,this.isstart=!0,this.sendData("FA02A29E"),this.offset=0,this.text=0)},isEnd:function(){if(console.log("结束测量",this.isEnd),this.isEnd){console.log("结束测量2",this.isEnd),this.isstart=!1,this.sendData("FA02A39F"),this.level3=this.handlelenver(this.number2),this.average=(Number(this.number3)+Number(this.number2)+Number(this.number1))/3;for(var e=0,t=0;t<this.listS.length;t++)e+=Number(this.listS[t]);this.averageS=(e/this.listS.length).toFixed(2),console.log(e/this.listS.length)}}},methods:{openBluetoothAdapter:function(){var t=this;u=0,l=0,d=null,t.isEnd=!1,t.text=0,t.number1=0,t.number2=0,t.number3=0,t.level1="",t.level2="",t.level3="",t.average="",t.LiuS="",t.second=5,t.standard="",t.offset=0,e.openBluetoothAdapter({success:function(e){console.log("初始化设备"),t.startBluetoothDeviceDiscovery()},fail:function(e){t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!0,success:function(e){console.log("开始搜索"),t.onBluetoothDeviceFound()},fail:function(e){t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if(e.name||e.localNam