1 line
4.8 KiB
JavaScript
1 line
4.8 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/PCL22"],{"0941":function(t,e,o){"use strict";(function(t){var n=o("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i,s=n(o("7ca3")),r=o("8f59");function u(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function c(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?u(Object(o),!0).forEach((function(e){(0,s.default)(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var a={data:function(){return{text:"",imp:"",weight:"",height:"",deviceId:"",unit:"kg",Unload:!1,isHeight:!1,isConnection:0,isdevice:!1,stopblue:!1,typeInfo:-1}},computed:c(c({},(0,r.mapState)(["user"])),{},{info:function(){return this.user}}),onUnload:function(){if(!this.Unload){clearTimeout(i),this.closeBluetoothAdapter(),this.stopBluetoothDevicesDiscovery();var t=getCurrentPages();t[t.length-2].$vm.getBlereload(),console.log("页面返回onUnload",t,t[t.length-2])}},onLoad:function(t){this.text="",this.typeInfo=-1,this.stopblue=!1,this.deviceId=t.deviceId,this.height=this.user.height,this.onBluetoothDeviceFound()},watch:{stopblue:function(){if(!this.stopblue)return clearTimeout(i),void(this.isHeight=!1);this.stopblue&&1==this.typeInfo&&(clearTimeout(i),this.isHeight=!0)}},methods:{onBluetoothDeviceFound:function(){var e=this;t.onBluetoothDeviceFound((function(t){t.devices.forEach((function(t){t.advertisData=t.advertisData?t.advertisData:"";var o=e.$tools.ab2hex(t.advertisData,""),n=o.substring(0,2);if("c0"==n.toLowerCase()){clearTimeout(i);var s=parseInt(o.substring(16,18),16).toString(2),r=s.substring(0,1),u=s.substring(1,3),c=s.substring(3,5),a=parseInt(o.substring(4,8),16),l=s.substring(5,6);return console.log("value",o,"状态:",l,"类型:",r),console.log("体重:",a,"小数点:",c,"单位:",u),"10"==u&&(e.unit="lb"),"00"==c&&(a/=10),"10"==c&&("10"==u?(e.unit="lb",a/=10):a/=100),"0"==l&&(e.typeInfo=0,e.stopblue=!1,e.text="您的实时体重是:"+a+e.unit),void("1"==l&&("1"==r&&(e.imp=parseInt(o.substring(8,12),16)/10),e.typeInfo=1,e.text="您的稳定体重是:"+a+e.unit,e.weight=a,e.stopblue=!0,console.log("测量完成",e.weight)))}}))}))},handleMyTime:function(){var t=this;i=setTimeout((function(){t.macAddr||(clearTimeout(i),t.text="",t.Unload=!0,t.isHeight=!1,t.startBluetoothDeviceDiscovery(),t.closeBluetoothAdapter())}),3e4)},stopBluetoothDevicesDiscovery:function(){t.stopBluetoothDevicesDiscovery({success:function(t){console.log("停止搜索蓝牙设备",t)}})},handleGetMeasure:function(){var e=this;e.height?e.$model.getmeasurefunit({adc:e.imp,weight:e.weight+e.unit,height:e.height,aud_id:e.info.id}).then((function(o){e.isHeight=!1,console.log("res",o,e.imp),0==o.code?(e.$store.dispatch("getUserInfo",{aud_id:t.getStorageSync("userid")}),e.$store.dispatch("getResult",{aud_id:t.getStorageSync("userid")}),e.$tools.msg("测量成功")):e.$tools.msg("测量失败"),e.Unload=!0,setTimeout((function(){e.stopBluetoothDevicesDiscovery();var o=getCurrentPages();o[o.length-2].$vm.getBlereload(),t.switchTab({url:"/pages/home/home"})}),200)})):this.$tools.msg("请输入身高")},handleBack:function(){this.text="",this.Unload=!0,this.stopBluetoothDevicesDiscovery();var e=getCurrentPages();console.log("页面返回onUnload",e,e[e.length-2]),e[e.length-2].$vm.getBlereload(),t.switchTab({url:"/pages/home/home"})},closeBluetoothAdapter:function(){t.closeBluetoothAdapter({success:function(t){console.log("蓝牙模块关闭成功")}})}}};e.default=a}).call(this,o("df3c")["default"])},6321:function(t,e,o){"use strict";var n=o("ca82"),i=o.n(n);i.a},"7bce":function(t,e,o){"use strict";o.r(e);var n=o("8621"),i=o("9af5");for(var s in i)["default"].indexOf(s)<0&&function(t){o.d(e,t,(function(){return i[t]}))}(s);o("6321");var r=o("828b"),u=Object(r["a"])(i["default"],n["b"],n["c"],!1,null,"1d868224",null,!1,n["a"],void 0);e["default"]=u.exports},8621:function(t,e,o){"use strict";o.d(e,"b",(function(){return n})),o.d(e,"c",(function(){return i})),o.d(e,"a",(function(){}));var n=function(){var t=this.$createElement;this._self._c},i=[]},9235:function(t,e,o){"use strict";(function(t,e){var n=o("47a9");o("bad8");n(o("3240"));var i=n(o("7bce"));t.__webpack_require_UNI_MP_PLUGIN__=o,e(i.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},"9af5":function(t,e,o){"use strict";o.r(e);var n=o("0941"),i=o.n(n);for(var s in n)["default"].indexOf(s)<0&&function(t){o.d(e,t,(function(){return n[t]}))}(s);e["default"]=i.a},ca82:function(t,e,o){}},[["9235","common/runtime","common/vendor"]]]); |