(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/bluetooth_food"],{"18e1":function(t,e,i){"use strict";(function(t){var o=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=o(i("7eb4")),s=o(i("ee10")),c=o(i("7ca3")),a=i("8f59");function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}var h={data:function(){return{dw:"g",kcal:0,weight:"",weightALL:"",unit:"",weight0:0,bleTipsText:"蓝牙搜索中",stopblue:!1,isConnection:0,units:["kg","斤","st:lb","lb","g","ml","Waterml","milkml","oz","floz","lboz"]}},props:{weightKcal:{type:Number,default:0},weightType:{type:Number,default:-1},isLast:{type:Boolean,default:!1}},computed:function(t){for(var e=1;e1?l.substring(1,2):l,g=parseInt(l.substring(0,1),16).toString(8),d=g.toString().substring(0,1),f=0;g.toString().length>1&&(d=g.toString().substring(1,2),f=g.toString().substring(0,1)),"0"==u&&(e.dw="g"),"7"==u&&(e.dw="ml"),"3"==u&&(e.dw="oz"),"2"==u&&(e.dw="lb'oz"),"1"==d&&(h/=10),"2"==d&&(h/=100),"0"==f&&(h=h),"1"==f&&(h="-"+h),e.weight=h,e.kcal=(Number(e.weightKcal)/100*h).toFixed(2),e.$emit("realTimeWeight",h,e.dw)}}else-1==t.name.indexOf("Chipsea-BLE")&&-1==t.localName.indexOf("Chipsea-BLE")&&"a5fe"!=o||(e.stopBluetoothDevicesDiscovery(),e.connectDevice(t.deviceId))}))}))},connectDevice:function(e){var i=this;return(0,s.default)(n.default.mark((function o(){var s;return n.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:s=i,t.createBLEConnection({deviceId:e,success:function(t){setTimeout((function(){s.getBLEDeviceServices(e)}),200)},fail:function(t){console.log("设备连接失败,请重新连接",t)}});case 2:case"end":return o.stop()}}),o)})))()},getBLEDeviceServices:function(e){var i=[],o=this;t.getBLEDeviceServices({deviceId:e,success:function(t){console.log("获取设备的UUID成功",t),i=t.services;for(var n=0;n>4,c=15&n,a=o/Math.pow(10,s);i&&(a=-a),this.weight=a,this.dw=this.units[c]||"g",this.kcal=(Number(this.weightKcal)/100*a).toFixed(2),this.$emit("realTimeWeight",a,this.dw)},handlesub:function(){console.log("weight",this.weight),Number(this.weight)>0?this.$emit("handleBle",this.weight,this.dw,this.kcal):this.$tools.msg("数据异常,请清零后重新测量!")},handleDetailSub:function(){1==this.weightType?(this.weight0=Number((Number(this.weight)-Number(this.weightALL)).toFixed(2)),this.weight0>0?this.weightALL=this.weight:this.$tools.msg("数据异常,请清零后重新测量!")):this.weight0=this.weight,Number(this.weight0)>0?(this.$emit("handleDetailSub",this.weight0,this.dw,this.kcal),this.weight=0,this.weight0=0):this.$tools.msg("数据异常,请重新测量!")},handleDetailNext:function(){1==this.weightType?(console.log("weight:"+this.weight),console.log("weight0:"+this.weight0),console.log("weightALL:"+this.weightALL),this.weight0=Number((Number(this.weight)-Number(this.weightALL)).toFixed(2)),this.weight0>0?this.weightALL=this.weight:this.$tools.msg("数据异常,请清零后重新测量!")):this.weight0=this.weight,Number(this.weight0)>0?(this.$emit("handleDetailNext",this.weight0,this.dw,this.kcal),this.weight=0,this.weight0=0):this.$tools.msg("数据异常,请清零后重新测量!")},handlechongzhi:function(t){console.log("当前总重:"+this.weightALL),console.log("重置重量:"+t),1==this.weightType&&(this.weightALL=Number((Number(this.weightALL)-Number(t)).toFixed(2)),console.log("剩余重量:"+this.weightALL))},handleBack:function(){this.isConnection=1,this.stopBluetoothDevicesDiscovery(),this.closeBLEConnection(),this.closeBluetoothAdapter()},closeBluetoothAdapter:function(){t.closeBluetoothAdapter({success:function(t){console.log("蓝牙模块关闭成功")}})},closeBLEConnection:function(){t.closeBLEConnection({deviceId:this.deviceId,success:function(t){console.log("断开蓝牙连接成功")}})},unitConversion:function(t){return"kcal"==t?"千卡":"g"==t?"克":"lb"==t?"磅":"oz"==t?"盎司":t}}};e.default=h}).call(this,i("df3c")["default"])},4433:function(t,e,i){"use strict";i.d(e,"b",(function(){return o})),i.d(e,"c",(function(){return n})),i.d(e,"a",(function(){}));var o=function(){var t=this.$createElement,e=(this._self._c,this.unitConversion(this.dw));this.$mp.data=Object.assign({},{$root:{m0:e}})},n=[]},"4ef7":function(t,e,i){"use strict";var o=i("e9ed"),n=i.n(o);n.a},6777:function(t,e,i){"use strict";i.r(e);var o=i("18e1"),n=i.n(o);for(var s in o)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return o[t]}))}(s);e["default"]=n.a},d025:function(t,e,i){"use strict";i.r(e);var o=i("4433"),n=i("6777");for(var s in n)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(s);i("4ef7");var c=i("828b"),a=Object(c["a"])(n["default"],o["b"],o["c"],!1,null,"3be1db68",null,!1,o["a"],void 0);e["default"]=a.exports},e9ed:function(t,e,i){}}]); ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([ 'components/bluetooth_food-create-component', { 'components/bluetooth_food-create-component':(function(module, exports, __webpack_require__){ __webpack_require__('df3c')['createComponent'](__webpack_require__("d025")) }) }, [['components/bluetooth_food-create-component']] ]);