Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
huaweiWatchClient
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sky
huaweiWatchClient
Commits
99b03801
Commit
99b03801
authored
May 24, 2021
by
Sky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修改
parent
d8691416
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
94 deletions
+109
-94
end.js
entry/src/main/js/default/pages/end/end.js
+9
-1
index.css
entry/src/main/js/default/pages/index/index.css
+1
-1
index.js
entry/src/main/js/default/pages/index/index.js
+99
-92
No files found.
entry/src/main/js/default/pages/end/end.js
View file @
99b03801
...
...
@@ -13,11 +13,18 @@ export default {
averHeartRate
:
""
,
//平均心率
maxHeartRate
:
""
,
//最高心率
},
onInit
()
{
p2pClient
.
setPeerPkgName
(
"com.sportq.fit"
);
p2pClient
.
setPeerFingerPrint
(
"B1B788A1BBD5F459BC641DA8CE690EA065C96957F58E883764982B5C46E53E06"
);
},
onReady
()
{
let
_this
=
this
;
//获取客户端信息
_this
.
getMsg
();
},
onShow
()
{
let
_this
=
this
;
//更新页面数据
...
...
@@ -34,6 +41,7 @@ export default {
}
})
},
onDestroy
()
{
//取消接收手机侧第三方应用发过来的消息
console
.
error
(
"end--onDestroy:unregisterReceiver"
)
...
...
@@ -42,9 +50,9 @@ export default {
},
});
},
start
(
msg
)
{
let
_this
=
this
;
let
model
=
msg
.
acModel
;
//训练完成页面,只接收重新开始训练事件
if
(
msg
.
eventFlg
==
"17"
)
{
router
.
replace
({
...
...
entry/src/main/js/default/pages/index/index.css
View file @
99b03801
...
...
@@ -194,11 +194,11 @@
.train-new-title
{
font-size
:
38px
;
height
:
40px
;
line-height
:
40px
;
margin-top
:
60px
;
width
:
350px
;
color
:
#FFFFFF
;
text-align
:
center
;
line-hight
:
40px
;
}
.train-time
{
justify-content
:
center
;
...
...
entry/src/main/js/default/pages/index/index.js
View file @
99b03801
...
...
@@ -37,6 +37,9 @@ export default {
showPrivacy
:
true
,
//显示隐私权限页面
},
onInit
()
{
if
(
app
.
setSwipeToDismiss
!=
undefined
)
{
app
.
setSwipeToDismiss
(
true
);
}
p2pClient
.
setPeerPkgName
(
"com.sportq.fit"
);
p2pClient
.
setPeerFingerPrint
(
"B1B788A1BBD5F459BC641DA8CE690EA065C96957F58E883764982B5C46E53E06"
);
},
...
...
@@ -65,7 +68,7 @@ export default {
if
(
_this
.
isJumpLoginPage
)
{
_this
.
page
=
"11"
;
}
},
1500
);
},
1500
);
},
onShow
()
{
let
_this
=
this
;
...
...
@@ -80,7 +83,7 @@ export default {
_this
.
keepScreenOn
();
timer
=
setInterval
(
function
()
{
_this
.
keepScreenOn
();
},
2
*
60
*
1000
);
},
2
*
60
*
1000
);
}
}
},
...
...
@@ -127,7 +130,7 @@ export default {
_this
.
keepScreenOn
();
timer
=
setInterval
(
function
()
{
_this
.
keepScreenOn
();
},
2
*
60
*
1000
);
},
2
*
60
*
1000
);
}
//数据重置
_this
.
initData
();
...
...
@@ -172,7 +175,7 @@ export default {
if
(
!
_this
.
dataPageShow
)
{
_this
.
dataPageShow
=
true
;
}
_this
.
tabIndex
=
0
;
_this
.
tabIndex
=
1
;
_this
.
stopFlg
=
true
;
//训练数据页面显示的实际数据
if
(
_this
.
lastPage
!=
""
)
{
//有可能是手机离开页面的15事件,手表端没有收到,所以导致lastpage没有值,这时候按训练中的页面算
...
...
@@ -201,111 +204,113 @@ export default {
}
switch
(
msg
.
eventFlg
)
{
case
"0"
:
//训练准备
_this
.
page
=
"0"
;
_this
.
tabIndex
=
"0"
;
break
;
_this
.
page
=
"0"
;
_this
.
tabIndex
=
"0"
;
break
;
case
"1"
:
//训练准备后的倒计时
_this
.
countdownT
=
model
.
countdownT
;
_this
.
stopFlg
=
false
;
_this
.
page
=
"1"
;
break
;
_this
.
countdownT
=
model
.
countdownT
;
_this
.
stopFlg
=
false
;
_this
.
page
=
"1"
;
break
;
case
"2"
:
//动作名称
_this
.
vibrate
();
_this
.
acName
=
model
.
acName
;
_this
.
isLast
=
model
.
isLast
;
_this
.
isFirst
=
model
.
isFirst
;
_this
.
tabIndex
=
0
;
_this
.
stopFlg
=
false
;
_this
.
page
=
"2"
;
break
;
_this
.
vibrate
();
_this
.
acName
=
model
.
acName
;
_this
.
isLast
=
model
.
isLast
;
_this
.
isFirst
=
model
.
isFirst
;
_this
.
tabIndex
=
0
;
_this
.
stopFlg
=
false
;
_this
.
page
=
"2"
;
break
;
case
"3"
:
//动作预览
_this
.
acName
=
model
.
acName
;
_this
.
page
=
"3"
;
break
;
_this
.
acName
=
model
.
acName
;
_this
.
page
=
"3"
;
break
;
case
"4"
:
//动作预览倒计时
_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
.
acName
=
model
.
acName
;
_this
.
countdownT
=
model
.
countdownT
;
}
_this
.
page
=
"5"
;
break
;
_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
.
page
=
"5"
;
break
;
case
"6"
:
//休息中
_this
.
acName
=
model
.
acName
;
_this
.
countdownT
=
model
.
countdownT
;
_this
.
page
=
"6"
;
break
;
_this
.
acName
=
model
.
acName
;
_this
.
countdownT
=
model
.
countdownT
;
_this
.
page
=
"6"
;
break
;
case
"7"
:
//暂停
_this
.
tabIndex
=
1
;
_this
.
stopFlg
=
true
;
//如果暂停的时候,正在准备开始训练或倒计时的场合,需要隐藏这个页面
if
(
_this
.
page
==
"0"
)
{
_this
.
page
=
"2"
;
}
break
;
_this
.
tabIndex
=
1
;
_this
.
stopFlg
=
true
;
//如果暂停的时候,正在准备开始训练或倒计时的场合,需要隐藏这个页面
if
(
_this
.
page
==
"0"
)
{
_this
.
page
=
"2"
;
}
break
;
case
"8"
:
//继续
_this
.
page
=
"1"
;
_this
.
tabIndex
=
0
;
_this
.
countdownT
=
"3"
;
_this
.
stopFlg
=
false
;
break
;
_this
.
page
=
"1"
;
_this
.
tabIndex
=
0
;
_this
.
countdownT
=
"3"
;
_this
.
stopFlg
=
false
;
break
;
case
"9"
:
//完成训练
_this
.
vibrate
();
sensor
.
unsubscribeHeartRate
();
router
.
replace
({
uri
:
"pages/end/end"
,
params
:
{
endTotalTime
:
model
.
fitTotalDuration
,
//训练时间
endAverHeartRate
:
model
.
averHeartRate
,
//平均心率
endMaxHeartRate
:
model
.
maxHeartRate
,
//最高心率
endCalorie
:
model
.
acCalorie
,
//消耗心率
}
});
break
;
_this
.
vibrate
();
sensor
.
unsubscribeHeartRate
();
router
.
replace
({
uri
:
"pages/end/end"
,
params
:
{
endTotalTime
:
model
.
fitTotalDuration
,
//训练时间
endAverHeartRate
:
model
.
averHeartRate
,
//平均心率
endMaxHeartRate
:
model
.
maxHeartRate
,
//最高心率
endCalorie
:
model
.
acCalorie
,
//消耗心率
}
});
break
;
case
"10"
:
//退出训练
_this
.
page
=
"10"
;
_this
.
quit
();
break
;
_this
.
page
=
"10"
;
_this
.
quit
();
break
;
case
"11"
:
//登录中
_this
.
page
=
"11"
;
break
;
_this
.
page
=
"11"
;
break
;
case
"12"
:
//退出登录
_this
.
page
=
"11"
;
_this
.
quit
();
break
;
_this
.
page
=
"11"
;
_this
.
quit
();
break
;
case
"13"
:
//进度条
_this
.
progress
=
((
model
.
acProgress
/
model
.
maxProgress
)
*
350
);
break
;
_this
.
progress
=
((
model
.
acProgress
/
model
.
maxProgress
)
*
350
);
break
;
case
"14"
:
//训练总时长
_this
.
acCalorie
=
model
.
acCalorie
?
model
.
acCalorie
:
'--'
;
_this
.
fitDuration
=
model
.
fitDuration
;
_this
.
stopFlg
=
model
.
stopFlag
;
//同步状态
break
;
_this
.
acCalorie
=
model
.
acCalorie
?
model
.
acCalorie
:
'--'
;
_this
.
fitDuration
=
model
.
fitDuration
;
_this
.
stopFlg
=
model
.
stopFlag
;
//同步状态
_this
.
isLast
=
model
.
isLast
;
_this
.
isFirst
=
model
.
isFirst
;
break
;
case
"15"
:
//离开或者返回训练
if
(
model
.
rollbackStop
==
'0'
)
{
//获取心率
_this
.
getHeartRate
();
}
else
{
_this
.
lastPage
=
_this
.
page
;
_this
.
page
=
"15"
;
//移除心率监听
sensor
.
unsubscribeHeartRate
()
//取消监听心率
}
break
;
if
(
model
.
rollbackStop
==
'0'
)
{
//获取心率
_this
.
getHeartRate
();
}
else
{
_this
.
lastPage
=
_this
.
page
;
_this
.
page
=
"15"
;
//移除心率监听
sensor
.
unsubscribeHeartRate
()
//取消监听心率
}
break
;
case
"16"
:
//杀掉进程
_this
.
page
=
"11"
;
_this
.
quit
();
break
;
_this
.
page
=
"11"
;
_this
.
quit
();
break
;
case
"17"
:
//播放初始化、注册心率
//获取心率
_this
.
getHeartRate
();
break
;
_this
.
getHeartRate
();
break
;
}
},
...
...
@@ -647,7 +652,9 @@ export default {
*/
touchMove
:
function
(
e
)
{
if
(
e
.
direction
==
"right"
)
{
app
.
terminate
();
if
(
!
(
this
.
dataPageShow
&&
!
this
.
showPrivacy
))
{
app
.
terminate
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment