1 line
4.7 KiB
JavaScript
1 line
4.7 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/G02"],{"0d8f":function(e,t,n){},4385:function(e,t,n){"use strict";n.r(t);var o=n("af4c"),i=n.n(o);for(var c in o)["default"].indexOf(c)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(c);t["default"]=i.a},"473e":function(e,t,n){"use strict";(function(e,t){var o=n("47a9");n("30b7");o(n("3240"));var i=o(n("8a6f"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"8a6f":function(e,t,n){"use strict";n.r(t);var o=n("cc03"),i=n("4385");for(var c in i)["default"].indexOf(c)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(c);n("ef38");var s=n("828b"),a=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,"a138e1a6",null,!1,o["a"],void 0);t["default"]=a.exports},af4c:function(e,t,n){"use strict";(function(e){var o=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n("7ca3")),c=n("8f59");function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var r={data:function(){return{text:"",weight:"",height:"",deviceId:"",macAddr:"",unit:"cm",Unload:!1,isHeight:!1,isConnection:0,isdevice:!1,info:{}}},computed:a(a({},(0,c.mapState)(["user","isConnected","isBluetoothTyle"])),{},{userInfo:function(){return this.user}}),onUnload:function(){this.Unload||(clearTimeout(void 0),this.closeBLEConnection(),this.closeBluetoothAdapter(),console.log("页面返回onUnload"))},onLoad:function(t){var n=this,o=t.info;n.info=JSON.parse(o),n.weight=n.userInfo.weight,n.notifyBLECharacteristicValue(),n.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){n.$store.commit("changeBluetooth",e.available)}))},watch:{isConnected:function(){this.isConnected||e.showModal({title:"连接已断开",content:"测量过程中已与设备连接中断,请重新连接设备再开始测量",showCancel:!1,success:function(t){t.confirm&&e.switchTab({url:"/pages/home/home"})}})},isBluetoothTyle:function(){this.isBluetoothTyle||e.showModal({title:"连接已断开",content:"蓝牙已关闭,请重新打开蓝牙后再开始测量",showCancel:!1,success:function(t){t.confirm&&e.switchTab({url:"/pages/home/home"})}})}},methods:{notifyBLECharacteristicValue:function(){var t=this;e.notifyBLECharacteristicValueChange({state:!0,deviceId:t.info.deviceId,serviceId:t.info.serviceId,characteristicId:t.info.notify,success:function(n){e.onBLECharacteristicValueChange((function(e){var n=t.$tools.ab2hex(e.value,""),o=parseInt(n.substring(7,10),16),i=parseInt(n.substring(10,12)),c=parseInt(n.substring(12,14));"1"==i&&(t.unit="inch"),"2"==i&&(t.unit="ft:in"),"1"==c&&(o/=10),"2"==c&&(o/=100),Number(o)<20?t.text="操作错误,请重新测量":(t.height=o,t.text="您的身高是:"+o+t.unit,t.isHeight=!0),console.log("G02",n,o)}))},fail:function(e){console.log("测量失败",e.value)}})},handleGetMeasure:function(){var t=this;t.weight?t.$model.getmeasurefunit({adc:0,weight:t.weight,height:t.height,aud_id:t.user.id}).then((function(n){t.isHeight=!1,0==n.code?(t.$store.dispatch("getResult",{aud_id:e.getStorageSync("userid")}),t.$store.dispatch("getUserInfo",{aud_id:e.getStorageSync("userid")}),t.$tools.msg("测量成功")):t.$tools.msg("测量失败"),t.Unload=!0,e.switchTab({url:"/pages/home/home"}),setTimeout((function(){t.closeBLEConnection(),t.closeBluetoothAdapter()}),500)})):this.$tools.msg("请输入体重")},handleHeight:function(){this.isHeight=!1,this.height="",this.text=""},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("监听蓝牙连接状态",e.connected),t.$store.commit("changeConnected",e.connected)}))},closeBluetoothAdapter:function(){e.closeBluetoothAdapter({success:function(e){console.log("蓝牙模块关闭成功")}})},closeBLEConnection:function(){var t=this;e.closeBLEConnection({deviceId:t.info.deviceId,success:function(e){console.log("断开蓝牙连接成功"),t.$store.commit("changeConnected",!1)}})}}};t.default=r}).call(this,n("df3c")["default"])},cc03:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){}));var o=function(){var e=this.$createElement;this._self._c},i=[]},ef38:function(e,t,n){"use strict";var o=n("0d8f"),i=n.n(o);i.a}},[["473e","common/runtime","common/vendor"]]]); |