home.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="container">
  3. <view class="navigation-bar">燃脂功能训练帮手</view>
  4. <view class="back" @click="onBack(0, $event)">
  5. <image src="/static/backArrow.png" mode="aspectFit" style="width:100%"></image>
  6. </view>
  7. <view class="content">
  8. <view class="row">
  9. <view class="block" style="background-color: #EBF3F2;">
  10. <view class="item-bg" style="background-color: #B6D4CF ;">
  11. <view class="item" style="background-color: #B6D4CF ;" @click="onClick(0, $event)">
  12. <image class="item-logo" src="/static/home/basalMetabolismLogo.png" mode="aspectFit"></image>
  13. <view class="item-title" style="color: #4D857C;">基础代谢率</view>
  14. <image class="item-unlock-logo" src="/static/home/basalMetabolismUnlock.png" mode="aspectFit"></image>
  15. </view>
  16. </view>
  17. <view class="label" style="background-color: #D8E8E5 ; color: #4D857C;">基础代谢: {{bmr}}</view>
  18. </view>
  19. <view class="block" style="background-color: #FEECEC;">
  20. <view class="item-bg" style="background-color: #FABAB9;">
  21. <view class="item" style="background-color: #FABAB9;" @click="onClick(1, $event)">
  22. <image class="item-logo" src="/static/home/dayCalorieLogo.png" mode="aspectFit"></image>
  23. <view class="item-title" style="color: #C65E5C;">每天消耗总热量</view>
  24. <image class="item-unlock-logo" src="/static/home/dayCalorieUnlock.png" mode="aspectFit"></image>
  25. </view>
  26. </view>
  27. <view class="label" style="background-color: #FCD9D9 ; color: #C65E5C;">每日消耗总热量: {{calorie}}</view>
  28. </view>
  29. </view>
  30. <view class="row">
  31. <view class="block" style="background-color: #FCF1EB;">
  32. <view class="item-bg" style="background-color: #F2CDB7;">
  33. <view class="item" style="background-color: #F2CDB7;" @click="onClick(2, $event)">
  34. <image class="item-logo" src="/static/home/heartRhythmsLogo.png" mode="aspectFit"></image>
  35. <view class="item-title" style="color: #BE7F59;">有氧运动心律</view>
  36. <image class="item-unlock-logo" src="/static/home/heartRhythmsUnlock.png" mode="aspectFit"></image>
  37. </view>
  38. </view>
  39. <view class="label" style="background-color: #F8E3D8; color: #BE7F59;">最低有氧心率:{{lowestHeartRate}}</view>
  40. <view class="label" style="background-color: #F8E3D8; color: #BE7F59;">最高有氧心率:{{highestHeartRate}}</view>
  41. </view>
  42. <view class="block" style="background-color: #F0F0E9;">
  43. <view class="item-bg" style="background-color: #C9C7AF;">
  44. <view class="item" style="background-color: #C9C7AF;" @click="onClick(3, $event)">
  45. <image class="item-logo" src="/static/home/bodyFatRatioLogo.png" mode="aspectFit"></image>
  46. <view class="item-title" style="color: #7B784E;">体脂率</view>
  47. <image class="item-unlock-logo" src="/static/home/bodyFatRatioUnlock.png" mode="aspectFit"></image>
  48. </view>
  49. </view>
  50. <view class="label" style="background-color: #E2E1D3; color: #7B784E;">脂肪总重量:{{fatWeight}}</view>
  51. <view class="label" style="background-color: #E2E1D3; color: #7B784E;">体脂率:{{fatRate}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. gender:0,
  62. weight:0,
  63. high:0,
  64. age:0,
  65. waist:0,
  66. bmr:0,
  67. calorie:0,
  68. heartRate:0,
  69. lowestHeartRate:0,
  70. highestHeartRate:0,
  71. fatWeight:0,
  72. fatRate:0,
  73. }
  74. },
  75. onShow() {
  76. if(getApp().globalData.bmr != undefined)
  77. {
  78. this.bmr = Math.round(getApp().globalData.bmr);
  79. }
  80. if(getApp().globalData.calorie != undefined)
  81. {
  82. this.calorie = Math.round(getApp().globalData.calorie);
  83. }
  84. if(getApp().globalData.lowestHeartRate != undefined)
  85. {
  86. this.lowestHeartRate = Math.round(getApp().globalData.lowestHeartRate);
  87. }
  88. if(getApp().globalData.highestHeartRate != undefined)
  89. {
  90. this.highestHeartRate = Math.round(getApp().globalData.highestHeartRate);
  91. }
  92. if(getApp().globalData.fatWeight != undefined)
  93. {
  94. this.fatWeight = Math.round(getApp().globalData.fatWeight);
  95. }
  96. if(getApp().globalData.fatRate != undefined)
  97. {
  98. this.fatRate = Math.round(getApp().globalData.fatRate);
  99. }
  100. },
  101. methods: {
  102. onBack: function(id,e) {
  103. //uni.navigateBack()//默认delta:1
  104. uni.navigateBack({
  105. delta:1,//返回层数,2则上上页
  106. })
  107. },
  108. onClick: function(id,e) {
  109. // console.log(id); // 1
  110. // console.log(e); // 事件对象
  111. switch (id){
  112. case 0:
  113. {
  114. uni.navigateTo({
  115. url: "/pages/basalMetabolism/basalMetabolism",
  116. });
  117. }
  118. break;
  119. case 1:
  120. {
  121. uni.navigateTo({
  122. url: "/pages/dayCalorie/dayCalorie",
  123. });
  124. }
  125. break;
  126. case 2:
  127. {
  128. uni.navigateTo({
  129. url: "/pages/heartRhythms/heartRhythms",
  130. });
  131. }
  132. break;
  133. case 3:
  134. {
  135. uni.navigateTo({
  136. url: "/pages/bodyFatRatio/bodyFatRatio",
  137. });
  138. }
  139. break;
  140. default:
  141. break;
  142. }
  143. },
  144. }
  145. }
  146. </script>
  147. <style lang="scss">
  148. .container {
  149. display: flex;
  150. flex-direction: column;
  151. align-items: center;
  152. justify-content: center;
  153. width:100%;
  154. height: 100vh;
  155. // 测试
  156. // border: 1px solid rgb(255,0,0);
  157. // box-shadow: 3px 0px 6px 0px rgba(0, 0, 0, 1);
  158. // border-bottom: 1px solid #DDDDDD;
  159. }
  160. .navigation-bar
  161. {
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. width:100%;
  166. height: 6%;
  167. font-weight: 700;
  168. color: black;
  169. font-size: 75rpx;
  170. background-color: white;
  171. // testing
  172. // border: 1px solid rgb(255,0,0);
  173. // background-color: rgb(253,222,157);
  174. }
  175. .back{
  176. position: absolute;
  177. display: flex;
  178. align-items: center;
  179. justify-content: center;
  180. width: 2%;
  181. height: 2%;
  182. top: 2.5%;
  183. left: 3%;
  184. //testing
  185. // border: 1px solid rgb(255,0,0);
  186. }
  187. .content{
  188. display: flex;
  189. flex-direction: column;
  190. align-items: center;
  191. justify-content: center;
  192. width:100%;
  193. height:100%;
  194. // border: 3px solid rgb(144,238,144);
  195. }
  196. .row{
  197. display: flex;
  198. flex-direction: row;
  199. align-items: center;
  200. justify-content: center;
  201. width:100%;
  202. height: 50%;
  203. // 测试
  204. // margin: 10rpx;
  205. // border: 3px solid rgb(144,238,144);
  206. }
  207. .block{
  208. display: flex;
  209. flex-direction: column;
  210. align-items: center;
  211. justify-content: center;
  212. width:100%;
  213. height:100%;
  214. }
  215. .item-bg{
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. width:90%;
  220. height:70%;
  221. margin: 5%;
  222. }
  223. .item{
  224. display: flex;
  225. flex-direction: column;
  226. align-items: center;
  227. justify-content: center;
  228. height: 80%;
  229. width: 80%;
  230. border: 3px solid #FFFFFF;
  231. // 测试
  232. // margin: 10rpx;
  233. // border: 1px solid rgb(0,0,255);
  234. }
  235. .item-logo
  236. {
  237. z-index: 4;
  238. height: 30%;
  239. width: 30%;
  240. // margin: 1%;
  241. }
  242. .item-title
  243. {
  244. font-size: 100rpx;
  245. font-weight: 700;
  246. margin: 2%;
  247. }
  248. .item-unlock-logo
  249. {
  250. height: 40%;
  251. width: 40%;
  252. }
  253. .label
  254. {
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. font-size: 80rpx;
  259. font-weight: 700;
  260. width:90%;
  261. height:10%;
  262. margin: 5%;
  263. // 测试
  264. // margin: 10rpx;
  265. // border: 1px solid rgb(0,0,255);
  266. }
  267. /* 解决⼩程序和app滚动条的问题 */
  268. /* #ifdef MP-WEIXIN || APP-PLUS */
  269. ::-webkit-scrollbar {
  270. display: none;
  271. width: 0 !important;
  272. height: 0 !important;
  273. -webkit-appearance: none;
  274. background: transparent;
  275. color: transparent;
  276. }
  277. /* #endif */
  278. /* 解决H5 的问题 */
  279. /* #ifdef H5 */
  280. uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
  281. /* 隐藏滚动条,但依旧具备可以滚动的功能 */
  282. display: none;
  283. width: 0 !important;
  284. height: 0 !important;
  285. -webkit-appearance: none;
  286. background: transparent;
  287. color: transparent;
  288. }
  289. /* #endif */
  290. </style>