1 line
4.5 KiB
JavaScript
1 line
4.5 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/PCL22S"],{"0987":function(e,t,o){"use strict";(function(e){var i=o("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,s=i(o("7ca3")),r=o("8f59");function c(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 a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?c(Object(o),!0).forEach((function(t){(0,s.default)(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):c(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var u={data:function(){return{text:"",imp:"",weight:"",height:"",deviceId:"",unit:"kg",Unload:!1,isHeight:!1,isConnection:0,isdevice:!1,stopblue:!1,typeInfo:-1}},computed:a(a({},(0,r.mapState)(["user"])),{},{info:function(){return this.user}}),onUnload:function(){if(!this.Unload){clearTimeout(n),this.closeBluetoothAdapter(),this.stopBluetoothDevicesDiscovery();var e=getCurrentPages();e[e.length-2].$vm.getBlereload(),console.log("页面返回onUnload",e,e[e.length-2])}},onLoad:function(e){this.text="",this.typeInfo=-1,this.stopblue=!1,this.deviceId=e.deviceId,this.height=this.user.height,this.onBluetoothDeviceFound()},watch:{stopblue:function(){if(!this.stopblue)return clearTimeout(n),void(this.isHeight=!1);this.stopblue&&"1"==this.typeInfo&&(clearTimeout(n),this.isHeight=!0)}},methods:{onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if(e.advertisData=e.advertisData?e.advertisData:"",-1!==e.name.toLowerCase().indexOf("da")){clearTimeout(n);var o=t.$tools.ab2hex(e.advertisData,""),i=o.substring(0,1),s=o.substring(1,2),r=parseInt(o.substring(2,6),16)/100;return console.log("VALUE",o,i,isNaN(s),r),"d"==i&&(t.typeInfo=0,t.stopblue=!1,t.text="您的实时体重是:"+r+"kg"),"e"==i?(t.typeInfo=1,t.text="您的稳定体重是:"+r+"kg",t.imp=isNaN(s)?"":parseInt(o.substring(6,10),16),t.weight=r,void(t.stopblue=!0)):void 0}}))}))},handleMyTime:function(){var e=this;n=setTimeout((function(){e.macAddr||(clearTimeout(n),e.text="",e.Unload=!0,e.isHeight=!1,e.startBluetoothDeviceDiscovery(),e.closeBluetoothAdapter())}),3e4)},stopBluetoothDevicesDiscovery:function(){e.stopBluetoothDevicesDiscovery({success:function(e){console.log("停止搜索蓝牙设备",e)}})},handleGetMeasure:function(){var t=this;t.height?t.$model.getmeasurefunit({adc:t.imp,weight:t.weight+t.unit,height:t.height,aud_id:t.info.id}).then((function(o){t.isHeight=!1,console.log("res",o,t.imp),0==o.code?(t.$store.dispatch("getUserInfo",{aud_id:e.getStorageSync("userid")}),t.$store.dispatch("getResult",{aud_id:e.getStorageSync("userid")}),t.$tools.msg("测量成功")):t.$tools.msg("测量失败"),t.Unload=!0,setTimeout((function(){t.stopBluetoothDevicesDiscovery();var o=getCurrentPages();o[o.length-2].$vm.getBlereload(),e.switchTab({url:"/pages/home/home"})}),200)})):this.$tools.msg("请输入身高")},handleBack:function(){this.text="",this.Unload=!0,this.stopBluetoothDevicesDiscovery();var t=getCurrentPages();console.log("页面返回onUnload",t,t[t.length-2]),t[t.length-2].$vm.getBlereload(),e.switchTab({url:"/pages/home/home"})},closeBluetoothAdapter:function(){e.closeBluetoothAdapter({success:function(e){console.log("蓝牙模块关闭成功")}})}}};t.default=u}).call(this,o("df3c")["default"])},3289:function(e,t,o){"use strict";o.r(t);var i=o("0987"),n=o.n(i);for(var s in i)["default"].indexOf(s)<0&&function(e){o.d(t,e,(function(){return i[e]}))}(s);t["default"]=n.a},7483: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=[]},8410:function(e,t,o){"use strict";o.r(t);var i=o("7483"),n=o("3289");for(var s in n)["default"].indexOf(s)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(s);o("a524");var r=o("828b"),c=Object(r["a"])(n["default"],i["b"],i["c"],!1,null,"e48c696e",null,!1,i["a"],void 0);t["default"]=c.exports},a524:function(e,t,o){"use strict";var i=o("a705"),n=o.n(i);n.a},a705:function(e,t,o){},cb4b:function(e,t,o){"use strict";(function(e,t){var i=o("47a9");o("bad8");i(o("3240"));var n=i(o("8410"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(n.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])}},[["cb4b","common/runtime","common/vendor"]]]); |