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

1 line
4.5 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/PCL"],{1619:function(e,t,o){},"40e9":function(e,t,o){"use strict";var i=o("1619"),n=o.n(i);n.a},"515d":function(e,t,o){"use strict";(function(e,t){var i=o("47a9");o("bad8");i(o("3240"));var n=i(o("d47d"));e.__webpack_require_UNI_MP_PLUGIN__=o,t(n.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},"5b75":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=[]},"5ede":function(e,t,o){"use strict";(function(e){var i=o("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,r=i(o("7ca3")),s=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 u(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,r.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 a={data:function(){return{text:"",imp:"",weight:"",height:"",deviceId:"",unit:"kg",Unload:!1,isHeight:!1,isConnection:0,isdevice:!1,stopblue:!0}},computed:u(u({},(0,s.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.stopblue=!0,this.deviceId=e.deviceId,this.height=this.user.height,this.onBluetoothDeviceFound()},watch:{stopblue:function(){this.stopblue||(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.indexOf("PCL")&&-1!=e.deviceId.indexOf(t.deviceId)){clearTimeout(n);var o=t.$tools.ab2hex(e.advertisData,""),i=parseInt(o.substring(4,8),16),r=parseInt(o.substring(16,18),16).toString(2),s=r.substring(5,6),c=r.substring(3,5),u=r.substring(1,3);return"01"==u&&(t.unit="斤"),"10"==u&&(t.unit="lb"),"00"==c&&(i/=10),"10"==c&&("10"==u?(t.unit="lb",i/=10):i/=100),t.text="您的实时体重是:"+i+t.unit,"1"==s?(t.text="您的稳定体重是:"+i+t.unit,t.imp=parseInt(o.substring(8,12),16)/10,t.deviceId=e.deviceId,t.weight=i,void(t.stopblue=!1)):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=a}).call(this,o("df3c")["default"])},"844a":function(e,t,o){"use strict";o.r(t);var i=o("5ede"),n=o.n(i);for(var r in i)["default"].indexOf(r)<0&&function(e){o.d(t,e,(function(){return i[e]}))}(r);t["default"]=n.a},d47d:function(e,t,o){"use strict";o.r(t);var i=o("5b75"),n=o("844a");for(var r in n)["default"].indexOf(r)<0&&function(e){o.d(t,e,(function(){return n[e]}))}(r);o("40e9");var s=o("828b"),c=Object(s["a"])(n["default"],i["b"],i["c"],!1,null,"c6a7b0ba",null,!1,i["a"],void 0);t["default"]=c.exports}},[["515d","common/runtime","common/vendor"]]]);