Commit 99b03801 authored by Sky's avatar Sky

bug修改

parent d8691416
...@@ -13,11 +13,18 @@ export default { ...@@ -13,11 +13,18 @@ export default {
averHeartRate: "", //平均心率 averHeartRate: "", //平均心率
maxHeartRate: "", //最高心率 maxHeartRate: "", //最高心率
}, },
onInit() {
p2pClient.setPeerPkgName("com.sportq.fit");
p2pClient.setPeerFingerPrint("B1B788A1BBD5F459BC641DA8CE690EA065C96957F58E883764982B5C46E53E06");
},
onReady() { onReady() {
let _this = this; let _this = this;
//获取客户端信息 //获取客户端信息
_this.getMsg(); _this.getMsg();
}, },
onShow() { onShow() {
let _this = this; let _this = this;
//更新页面数据 //更新页面数据
...@@ -34,6 +41,7 @@ export default { ...@@ -34,6 +41,7 @@ export default {
} }
}) })
}, },
onDestroy() { onDestroy() {
//取消接收手机侧第三方应用发过来的消息 //取消接收手机侧第三方应用发过来的消息
console.error("end--onDestroy:unregisterReceiver") console.error("end--onDestroy:unregisterReceiver")
...@@ -42,9 +50,9 @@ export default { ...@@ -42,9 +50,9 @@ export default {
}, },
}); });
}, },
start(msg) { start(msg) {
let _this = this; let _this = this;
let model = msg.acModel;
//训练完成页面,只接收重新开始训练事件 //训练完成页面,只接收重新开始训练事件
if (msg.eventFlg == "17") { if (msg.eventFlg == "17") {
router.replace({ router.replace({
......
...@@ -194,11 +194,11 @@ ...@@ -194,11 +194,11 @@
.train-new-title { .train-new-title {
font-size: 38px; font-size: 38px;
height: 40px; height: 40px;
line-height: 40px;
margin-top: 60px; margin-top: 60px;
width: 350px; width: 350px;
color: #FFFFFF; color: #FFFFFF;
text-align: center; text-align: center;
line-hight: 40px;
} }
.train-time { .train-time {
justify-content: center; justify-content: center;
......
...@@ -37,6 +37,9 @@ export default { ...@@ -37,6 +37,9 @@ export default {
showPrivacy: true, //显示隐私权限页面 showPrivacy: true, //显示隐私权限页面
}, },
onInit() { onInit() {
if (app.setSwipeToDismiss != undefined) {
app.setSwipeToDismiss(true);
}
p2pClient.setPeerPkgName("com.sportq.fit"); p2pClient.setPeerPkgName("com.sportq.fit");
p2pClient.setPeerFingerPrint("B1B788A1BBD5F459BC641DA8CE690EA065C96957F58E883764982B5C46E53E06"); p2pClient.setPeerFingerPrint("B1B788A1BBD5F459BC641DA8CE690EA065C96957F58E883764982B5C46E53E06");
}, },
...@@ -65,7 +68,7 @@ export default { ...@@ -65,7 +68,7 @@ export default {
if (_this.isJumpLoginPage) { if (_this.isJumpLoginPage) {
_this.page = "11"; _this.page = "11";
} }
},1500); }, 1500);
}, },
onShow() { onShow() {
let _this = this; let _this = this;
...@@ -80,7 +83,7 @@ export default { ...@@ -80,7 +83,7 @@ export default {
_this.keepScreenOn(); _this.keepScreenOn();
timer = setInterval(function () { timer = setInterval(function () {
_this.keepScreenOn(); _this.keepScreenOn();
},2 * 60 * 1000); }, 2 * 60 * 1000);
} }
} }
}, },
...@@ -127,7 +130,7 @@ export default { ...@@ -127,7 +130,7 @@ export default {
_this.keepScreenOn(); _this.keepScreenOn();
timer = setInterval(function () { timer = setInterval(function () {
_this.keepScreenOn(); _this.keepScreenOn();
},2 * 60 * 1000); }, 2 * 60 * 1000);
} }
//数据重置 //数据重置
_this.initData(); _this.initData();
...@@ -172,7 +175,7 @@ export default { ...@@ -172,7 +175,7 @@ export default {
if (!_this.dataPageShow) { if (!_this.dataPageShow) {
_this.dataPageShow = true; _this.dataPageShow = true;
} }
_this.tabIndex = 0; _this.tabIndex = 1;
_this.stopFlg = true; _this.stopFlg = true;
//训练数据页面显示的实际数据 //训练数据页面显示的实际数据
if (_this.lastPage != "") { //有可能是手机离开页面的15事件,手表端没有收到,所以导致lastpage没有值,这时候按训练中的页面算 if (_this.lastPage != "") { //有可能是手机离开页面的15事件,手表端没有收到,所以导致lastpage没有值,这时候按训练中的页面算
...@@ -201,111 +204,113 @@ export default { ...@@ -201,111 +204,113 @@ export default {
} }
switch (msg.eventFlg) { switch (msg.eventFlg) {
case "0": //训练准备 case "0": //训练准备
_this.page = "0"; _this.page = "0";
_this.tabIndex = "0"; _this.tabIndex = "0";
break; break;
case "1": //训练准备后的倒计时 case "1": //训练准备后的倒计时
_this.countdownT = model.countdownT; _this.countdownT = model.countdownT;
_this.stopFlg = false; _this.stopFlg = false;
_this.page = "1"; _this.page = "1";
break; break;
case "2": //动作名称 case "2": //动作名称
_this.vibrate(); _this.vibrate();
_this.acName = model.acName; _this.acName = model.acName;
_this.isLast = model.isLast; _this.isLast = model.isLast;
_this.isFirst = model.isFirst; _this.isFirst = model.isFirst;
_this.tabIndex = 0; _this.tabIndex = 0;
_this.stopFlg = false; _this.stopFlg = false;
_this.page = "2"; _this.page = "2";
break; break;
case "3": //动作预览 case "3": //动作预览
_this.acName = model.acName; _this.acName = model.acName;
_this.page = "3"; _this.page = "3";
break; break;
case "4": //动作预览倒计时 case "4": //动作预览倒计时
_this.acName = model.acName; _this.acName = model.acName;
_this.countdownT = model.countdownT;
_this.page = "4";
break;
case "5": //训练动作倒计时
_this.acName = model.acName;
if (model.acType == "0") {
_this.countdownT = model.acCnt + "/" + model.acTotalCnt;
} else {
_this.countdownT = model.countdownT; _this.countdownT = model.countdownT;
} _this.page = "4";
_this.page = "5"; break;
break; case "5": //训练动作倒计时
_this.acName = model.acName;
if (model.acType == "0") {
_this.countdownT = model.acCnt + "/" + model.acTotalCnt;
} else {
_this.countdownT = model.countdownT;
}
_this.page = "5";
break;
case "6": //休息中 case "6": //休息中
_this.acName = model.acName; _this.acName = model.acName;
_this.countdownT = model.countdownT; _this.countdownT = model.countdownT;
_this.page = "6"; _this.page = "6";
break; break;
case "7": //暂停 case "7": //暂停
_this.tabIndex = 1; _this.tabIndex = 1;
_this.stopFlg = true; _this.stopFlg = true;
//如果暂停的时候,正在准备开始训练或倒计时的场合,需要隐藏这个页面 //如果暂停的时候,正在准备开始训练或倒计时的场合,需要隐藏这个页面
if (_this.page == "0") { if (_this.page == "0") {
_this.page = "2"; _this.page = "2";
} }
break; break;
case "8": //继续 case "8": //继续
_this.page = "1"; _this.page = "1";
_this.tabIndex = 0; _this.tabIndex = 0;
_this.countdownT = "3"; _this.countdownT = "3";
_this.stopFlg = false; _this.stopFlg = false;
break; break;
case "9": //完成训练 case "9": //完成训练
_this.vibrate(); _this.vibrate();
sensor.unsubscribeHeartRate(); sensor.unsubscribeHeartRate();
router.replace({ router.replace({
uri: "pages/end/end", uri: "pages/end/end",
params: { params: {
endTotalTime: model.fitTotalDuration, //训练时间 endTotalTime: model.fitTotalDuration, //训练时间
endAverHeartRate: model.averHeartRate, //平均心率 endAverHeartRate: model.averHeartRate, //平均心率
endMaxHeartRate: model.maxHeartRate, //最高心率 endMaxHeartRate: model.maxHeartRate, //最高心率
endCalorie: model.acCalorie, //消耗心率 endCalorie: model.acCalorie, //消耗心率
} }
}); });
break; break;
case "10": //退出训练 case "10": //退出训练
_this.page = "10"; _this.page = "10";
_this.quit(); _this.quit();
break; break;
case "11": //登录中 case "11": //登录中
_this.page = "11"; _this.page = "11";
break; break;
case "12": //退出登录 case "12": //退出登录
_this.page = "11"; _this.page = "11";
_this.quit(); _this.quit();
break; break;
case "13": //进度条 case "13": //进度条
_this.progress = ((model.acProgress / model.maxProgress) * 350); _this.progress = ((model.acProgress / model.maxProgress) * 350);
break; break;
case "14": //训练总时长 case "14": //训练总时长
_this.acCalorie = model.acCalorie ? model.acCalorie : '--'; _this.acCalorie = model.acCalorie ? model.acCalorie : '--';
_this.fitDuration = model.fitDuration; _this.fitDuration = model.fitDuration;
_this.stopFlg = model.stopFlag; //同步状态 _this.stopFlg = model.stopFlag; //同步状态
break; _this.isLast = model.isLast;
_this.isFirst = model.isFirst;
break;
case "15": //离开或者返回训练 case "15": //离开或者返回训练
if (model.rollbackStop == '0') { if (model.rollbackStop == '0') {
//获取心率 //获取心率
_this.getHeartRate(); _this.getHeartRate();
} else { } else {
_this.lastPage = _this.page; _this.lastPage = _this.page;
_this.page = "15"; _this.page = "15";
//移除心率监听 //移除心率监听
sensor.unsubscribeHeartRate() //取消监听心率 sensor.unsubscribeHeartRate() //取消监听心率
} }
break; break;
case "16": //杀掉进程 case "16": //杀掉进程
_this.page = "11"; _this.page = "11";
_this.quit(); _this.quit();
break; break;
case "17": //播放初始化、注册心率 case "17": //播放初始化、注册心率
//获取心率 //获取心率
_this.getHeartRate(); _this.getHeartRate();
break; break;
} }
}, },
...@@ -647,7 +652,9 @@ export default { ...@@ -647,7 +652,9 @@ export default {
*/ */
touchMove: function (e) { touchMove: function (e) {
if (e.direction == "right") { if (e.direction == "right") {
app.terminate(); if (!(this.dataPageShow && !this.showPrivacy)) {
app.terminate();
}
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment