2024-12-14 09:42:21 +08:00
|
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/devices/PCT01"],{"0514":function(t,e,n){"use strict";(function(t){var o=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=o(n("7ca3")),a=n("8f59");function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}var c=null,r={data:function(){return{bpm:0,isend:!1,weight:0,Ycount:0,time_m:"",time_s:"",time:0,kcal:0,Bcount:0,continuous:0,info:{},isToggle:!1,isEnd:!1,iswrapper:!1,isStart:!1}},computed:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){(0,i.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,a.mapState)(["isConnected","isBluetoothTyle"])),onLoad:function(e){var n=this;if(c=t.createInnerAudioContext(),e&&e.info){var o=e.info;n.info=JSON.parse(o),n.notifyBLECharacteristicValue(),setTimeout((function(){n.handleStart("开始")}),900),setTimeout((function(){n.handleStart("连续")}),1200)}n.handleAudioStart(),n.$Bluetooth.onBLEConnectionStateChange(),t.onBluetoothAdapterStateChange((function(t){n.$store.commit("changeBluetooth",t.available)}))},onUnload:function(){c&&c.destroy(),this.handleEnd(),console.log("PCT01返回onUnload")},watch:{isConnected:function(){var e=this;e.isConnected||(t.showModal({title:"连接已断开",content:"训练过程中已与设备连接中断,请重新连接设备再开始训练",showCancel:!1,success:function(t){t.confirm&&e.handleTarget()}}),console.log("蓝牙是否连接",e.isConnected))},isBluetoothTyle:function(){this.isBluetoothTyle||console.log("蓝牙是否打开",this.isBluetoothTyle)},isStart:function(){this.isStart&&this.handleAudio()},isToggle:function(){var e=this;e.isToggle&&t.showModal({title:"友情提示",content:"训练过程中请勿切换训练,返回训练",showCancel:!1,success:function(t){t.confirm&&(setTimeout((function(){e.handleStart("结束")}),400),setTimeout((function(){e.handleTarget()}),600))}})},isEnd:function(){var t=this;t.isEnd&&(setTimeout((function(){t.handleStart("停止")}),200),setTimeout((function(){t.handleGetMeasure()}),400))},weight:function(){var t=this;if(1==t.info.active&&t.$video.video.forEach((function(e){Number(e.name)==t.weight&&(c.autoplay=!0,c.loop=!1,c.src=e.video,c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),3e3))})),2==t.info.active){var e=60*t.time_m+t.time_s;t.$video.video.forEach((function(n){Number(n.name)==t.weight&&Number(e)>10&&(c.autoplay=!0,c.loop=!1,c.src=n.video,c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),3e3))})),"00"==t.time_m&&"10"==t.time_s&&(c.autoplay=!0,c.loop=!1,c.src="/pageTwo/static/time.mp3",c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),3e3))}3==t.info.active&&(t.$video.video.forEach((function(e){Number(e.name)==Number(t.Ycount)-Number(t.weight)&&0!=Number(t.weight)&&(c.autoplay=!0,c.loop=!1,c.src=e.video,c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),3e3))})),10==Number(t.weight)&&(c.autoplay=!0,c.loop=!1,c.src="/pageTwo/static/number.mp3",c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),3e3)))}},methods:{handleAudioStart:function(){var t=this;c.autoplay=!0,c.loop=!1,c.src="/pageTwo/static/Start.mp3",c.play(),setTimeout((function(){c.stop(),t.handleAudio()}),5e3)},handleAudio:function(){c.autoplay=!0,c.loop=!0,c.src="/pageTwo/static/flight.mp3",c.play()},notifyBLECharacteristicValue:function(){var e=this;t.notifyBLECharacteristicValueChange({state:!0,deviceId:e.info.deviceId,serviceId:e.info.serviceId,characteristicId:e.info.notify,success:function(n){t.onBLECharacteristicValueChange((function(t){var n=e.$tools.ab2hex(t.value,""),o=parseInt(n.substring(8,12),16),i=parseInt(n.substring(12,16),16),a=parseInt(n.substring(16,20),16),s
|