|
@@ -86,7 +86,8 @@
|
|
|
<view style="margin-bottom: 20rpx; font-weight: bold; font-size: 18px; color: #606162;">
|
|
<view style="margin-bottom: 20rpx; font-weight: bold; font-size: 18px; color: #606162;">
|
|
|
{{item.cname}}
|
|
{{item.cname}}
|
|
|
</view>
|
|
</view>
|
|
|
- <view v-if="item.bRatio" style="font-size: 12px; white-space:pre-wrap;" class="make-text-bPurple">
|
|
|
|
|
|
|
+ <view v-if="item.bRatio" style="font-size: 12px; white-space:pre-wrap;"
|
|
|
|
|
+ class="make-text-bPurple">
|
|
|
已连接
|
|
已连接
|
|
|
</view>
|
|
</view>
|
|
|
<view v-else style="color: #8D8D8D;">未连接</view>
|
|
<view v-else style="color: #8D8D8D;">未连接</view>
|
|
@@ -94,8 +95,9 @@
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
<view class="position-absolute-right-top">
|
|
<view class="position-absolute-right-top">
|
|
|
- <image style="width: 239rpx;height: 173rpx;" :src="item.bRatio?'/static/heart/radio-r@2x.png':'/static/heart/radio-g@2x.png'"
|
|
|
|
|
- mode="aspectFit" @tap="_onRadio(item,$event)"></image>
|
|
|
|
|
|
|
+ <image style="width: 239rpx;height: 173rpx;"
|
|
|
|
|
+ :src="item.bRatio?'/static/heart/radio-r@2x.png':'/static/heart/radio-g@2x.png'"
|
|
|
|
|
+ mode="aspectFit" @tap="_onRadio(item,$event)"></image>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- <image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;"
|
|
<!-- <image style="margin-right: 60rpx; width: 60rpx;height: 60rpx;"
|
|
|
:src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
|
|
:src="item.bRatio?'/static/devicesOther/radio-b.png':'/static/devicesOther/radio-g.png'"
|
|
@@ -113,11 +115,11 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="position-absolute-right-top">
|
|
<view class="position-absolute-right-top">
|
|
|
<image style="width: 495rpx ;height: 173rpx;" src="../../static/heart/b_start@2x.png"></image>
|
|
<image style="width: 495rpx ;height: 173rpx;" src="../../static/heart/b_start@2x.png"></image>
|
|
|
- <view v-if="timer" class="position-absolute-center flex text-18px text-bold" @click="pauseTime()">
|
|
|
|
|
|
|
+ <view v-if="timer" class="position-absolute-center flex text-18px text-bold" @click="pauseTime()">
|
|
|
<image style="width: 53rpx;height: 53rpx;" src="../../static/heart/pause@2x.png"></image>
|
|
<image style="width: 53rpx;height: 53rpx;" src="../../static/heart/pause@2x.png"></image>
|
|
|
<view style="color: #4D857C;width: 150rpx;margin-left: 30rpx;">暂停计时</view>
|
|
<view style="color: #4D857C;width: 150rpx;margin-left: 30rpx;">暂停计时</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view v-else class="position-absolute-center flex text-18px text-bold" @click="startTimer()">
|
|
|
|
|
|
|
+ <view v-else class="position-absolute-center flex text-18px text-bold" @click="startTimer()">
|
|
|
<image style="width: 53rpx;height: 53rpx;" src="../../static/heart/play@2x.png"></image>
|
|
<image style="width: 53rpx;height: 53rpx;" src="../../static/heart/play@2x.png"></image>
|
|
|
<view style="color: #4D857C;width: 150rpx;margin-left: 30rpx;">开始计时</view>
|
|
<view style="color: #4D857C;width: 150rpx;margin-left: 30rpx;">开始计时</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -131,8 +133,19 @@
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <!-- <button class="margin-xl" @click="B_OnReadBLECharacteristicValue">B_OnReadBLECharacteristicValue</button>
|
|
|
|
|
+ <button class="margin-xl" @click="B_WriteBLECharacteristicValueFromArray">ValueFromArray</button> -->
|
|
|
|
|
+ <!-- <button class="margin-xl" @click="HeartBLE_Init">HeartBLE_Init</button> -->
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_StartScan">HeartBLE_StartScan</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_StopScan">HeartBLE_StopScan</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_DisConnect">HeartBLE_DisConnect</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_Normal">HeartBLE_Normal</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_SetLightEnable">HeartBLE_SetLightEnable</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_SetLightRGB">HeartBLE_SetLightRGB</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_GetLightStatus">HeartBLE_GetLightStatus</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_SetLightBrightness">HeartBLE_SetLightBrightness</button>
|
|
|
|
|
+ <button class="margin-xl" @click="HeartBLE_Shutdown">HeartBLE_Shutdown</button>
|
|
|
|
|
+ <view class="margin-bottom-xl"></view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -317,6 +330,11 @@
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
//初始化语音
|
|
//初始化语音
|
|
|
this.initTextToSpeech();
|
|
this.initTextToSpeech();
|
|
|
|
|
+
|
|
|
|
|
+ //初始化蓝牙
|
|
|
|
|
+ this.HeartBLE_Init();
|
|
|
|
|
+ plus.globalEvent.addEventListener("WearManagerCallbacks", this.WearManagerCallbacks);
|
|
|
|
|
+
|
|
|
this.$set(this.treatmentStatu, 'checked', true);
|
|
this.$set(this.treatmentStatu, 'checked', true);
|
|
|
//如果没有开启麦克风。可能导致唤醒失败
|
|
//如果没有开启麦克风。可能导致唤醒失败
|
|
|
//轮询检测麦克风权限
|
|
//轮询检测麦克风权限
|
|
@@ -350,7 +368,9 @@
|
|
|
'onGetRSSITransDistance',
|
|
'onGetRSSITransDistance',
|
|
|
'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice', 'B_GetBondedDevices',
|
|
'addBLEDevice', 'onWriteBLEConnectionValue', 'deleteBLEDevice', 'B_GetBondedDevices',
|
|
|
'B_OpenBLESetting', 'setGuideUnlockState', 'switchLevelList', 'onSetLocationGameUrl',
|
|
'B_OpenBLESetting', 'setGuideUnlockState', 'switchLevelList', 'onSetLocationGameUrl',
|
|
|
- 'onGetLocationGameUrl', 'onTestEmit', 'B_CloseBLEConnection', 'B_OnSetMTU'
|
|
|
|
|
|
|
+ 'onGetLocationGameUrl', 'onTestEmit', 'B_CloseBLEConnection', 'B_OnSetMTU',
|
|
|
|
|
+ 'B_OnReadBLECharacteristicValue',
|
|
|
|
|
+ 'B_WriteBLECharacteristicValueFromArray'
|
|
|
]),
|
|
]),
|
|
|
onEmit() {
|
|
onEmit() {
|
|
|
this.onTestEmit();
|
|
this.onTestEmit();
|
|
@@ -708,9 +728,9 @@
|
|
|
// console.log("onBluetoothDeviceFound:", res); Fitcent_
|
|
// console.log("onBluetoothDeviceFound:", res); Fitcent_
|
|
|
res.devices.forEach(device => {
|
|
res.devices.forEach(device => {
|
|
|
if (
|
|
if (
|
|
|
- // device.name.indexOf('CL809') > -1 ||
|
|
|
|
|
- // device.name.indexOf('CL806') > -1 ||
|
|
|
|
|
- // device.name.indexOf('CL831') > -1 ||
|
|
|
|
|
|
|
+ // device.name.indexOf('CL809') > -1 ||
|
|
|
|
|
+ // device.name.indexOf('CL806') > -1 ||
|
|
|
|
|
+ // device.name.indexOf('CL831') > -1 ||
|
|
|
//CL838
|
|
//CL838
|
|
|
device.name.indexOf('CL') > -1
|
|
device.name.indexOf('CL') > -1
|
|
|
) {
|
|
) {
|
|
@@ -956,7 +976,7 @@
|
|
|
// console.log(ret);
|
|
// console.log(ret);
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: "releaseToSpeech",
|
|
title: "releaseToSpeech",
|
|
|
- icon:'none'
|
|
|
|
|
|
|
+ icon: 'none'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
playSpeak(text) {
|
|
playSpeak(text) {
|
|
@@ -975,7 +995,7 @@
|
|
|
console.log(ret);
|
|
console.log(ret);
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: "stopSpeak",
|
|
title: "stopSpeak",
|
|
|
- icon:'none'
|
|
|
|
|
|
|
+ icon: 'none'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -1010,6 +1030,131 @@
|
|
|
// })
|
|
// })
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_Init() {
|
|
|
|
|
+ // 调用同步方法
|
|
|
|
|
+ var ret = testModule.HeartBLE_Init();
|
|
|
|
|
+ console.log("HeartBLE_Init:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_StartScan() {
|
|
|
|
|
+ // 调用同步方法
|
|
|
|
|
+ var ret = testModule.HeartBLE_StartScan();
|
|
|
|
|
+ console.log("HeartBLE_StartScan:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+ HeartBLE_StopScan() {
|
|
|
|
|
+ // 调用同步方法
|
|
|
|
|
+ var ret = testModule.HeartBLE_StopScan();
|
|
|
|
|
+ console.log("HeartBLE_StopScan:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+ HeartBLE_DisConnect() {
|
|
|
|
|
+ // 调用同步方法
|
|
|
|
|
+ var ret = testModule.HeartBLE_DisConnect();
|
|
|
|
|
+ console.log("HeartBLE_DisConnect:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_Normal() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_Normal();
|
|
|
|
|
+ console.log("HeartBLE_Normal:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_SetLightEnable() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_SetLightEnable({
|
|
|
|
|
+ enable: false
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log("HeartBLE_SetLightEnable:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_SetLightRGB() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_SetLightRGB({
|
|
|
|
|
+ red: Math.random() * 255,
|
|
|
|
|
+ green: Math.random() * 255,
|
|
|
|
|
+ blue: Math.random() * 255
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log("HeartBLE_SetLightRGB:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_GetLightStatus() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_GetLightStatus();
|
|
|
|
|
+ console.log("HeartBLE_GetLightStatus:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_SetLightBrightness() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_SetLightBrightness({
|
|
|
|
|
+ brightness: Math.random() * 100
|
|
|
|
|
+ }); //0-100
|
|
|
|
|
+ console.log("HeartBLE_SetLightBrightness:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ HeartBLE_Shutdown() {
|
|
|
|
|
+ var ret = testModule.HeartBLE_Shutdown();
|
|
|
|
|
+ console.log("HeartBLE_Shutdown:", ret);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ WearManagerCallbacks(data) {
|
|
|
|
|
+ console.log("WearManagerCallbacks:" + JSON.stringify(data));
|
|
|
|
|
+ switch (data.type) {
|
|
|
|
|
+ case "onBatteryLevelChanged":
|
|
|
|
|
+ this.onBatteryLevelChangedCallback(data);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "onKeyEventCallback":
|
|
|
|
|
+ this.onKeyEventCallback(data);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "onHeartRateMeasurementReceived":
|
|
|
|
|
+ this.onHeartRateMeasurementReceivedCallback(data);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "onConnecting":
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onBatteryLevelChangedCallback(data) {
|
|
|
|
|
+
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '电量:' + data.batteryLevel + '%',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ onKeyEventCallback(data) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: data.name,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ if (data.isKeyDown) {
|
|
|
|
|
+ this.playSpeak('当前心率' + this.heartRate);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ onHeartRateMeasurementReceivedCallback(data) {
|
|
|
|
|
+ this.heartRate = data.heartRate;
|
|
|
|
|
+ if (this.heartRate != 0) {
|
|
|
|
|
+ if (!this.bLoading) {
|
|
|
|
|
+ this.bLoading = true;
|
|
|
|
|
+ this.loadingCount = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.bReach) {
|
|
|
|
|
+ if (this.heartRate >= this.rateMin && this.heartRate <= this.rateMax) {
|
|
|
|
|
+ this.playSpeak("达到运动心率" + this.heartRate);
|
|
|
|
|
+ // console.log("达到运动心率");
|
|
|
|
|
+ //达到一次目标后播报
|
|
|
|
|
+ this.bReach = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (this.heartRate < this.rateMin || this.heartRate > this.rateMax) {
|
|
|
|
|
+ this.playSpeak("当前心率" + this.heartRate);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (this.bTimerPlay) {
|
|
|
|
|
+ this.bLoading = false;
|
|
|
|
|
+ //暂停心率
|
|
|
|
|
+ this.pauseTime();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 计时器
|
|
* 计时器
|
|
|
*/
|
|
*/
|
|
@@ -1202,10 +1347,10 @@
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
<style>
|
|
|
- page{
|
|
|
|
|
|
|
+ page {
|
|
|
background-color: #FFFFFF;
|
|
background-color: #FFFFFF;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
.hardware-border {
|
|
.hardware-border {
|
|
|
border: 1rpx solid #9898FF;
|
|
border: 1rpx solid #9898FF;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|