| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <template>
- <view class="container">
- <view class="navigation-bar">有氧运动心率</view>
- <view class="back" @click="onBack(0, $event)">
- <image src="/static/backArrow.png" mode="aspectFit" style="width:100%"></image>
- </view>
-
- <view class="blue" @click="onHelp(0, $event)">
- <image src="/static/home/blue.png" mode="aspectFit" style="width:100%"></image>
- </view>
- <view class="content">
- <!-- <text class="result-area">{{result}}</text> -->
- <view class="result-area">
- <view class="border">
- <image class="item-logo" src="../../static/home/heartRhythmsLogo.png" mode=""></image>
- <view class="">
- {{result1}}
- </view>
- <view class="">
- {{result2}}
- </view>
- <!-- <view class="">
- 最低有氧心率/最高有氧心率
- </view> -->
- </view>
- </view>
- <!-- <button class="help" @click="onHelp(0, $event)">宁哥笔记</button> -->
-
- <view class="input-area">
- <view class="age">
- <view class="input-title">年龄 : </view>
- <input class="input" type="number" placeholder="请输入年龄" v-model="age" />
- <text class="Company">岁</text>
- </view>
-
- <view class="static-heart-rate">
- <view class="" style="color: #DD9E00;width: 90%;">
- 如何测:早晨起床做起来第一件事,掐脉搏一分钟的心跳次数 = 你的静态心率
- </view>
- <view class="input-block">
- <view class="input-title">静态 <br/> 心率</view>
- <input class="input" type="number" placeholder="请输入静态心率" v-model="heartRate" />
- <!-- <button class="heart-rate-help" @click="onClickHelp(0, $event)">?</button> -->
- <text class="Company">次/分</text>
- </view>
-
- </view>
- </view>
-
- <button class="confirm" @click="onClick(0, $event)">确定</button>
-
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- age:-1,
- heartRate:-1,
- result1:'',
- result2:'',
- }
- },
- onLoad() {
- this.heartRate = 0;
- this.age = 0;
-
- // console.log('heartRate=',getApp().globalData.heartRate);
- // console.log('age=',getApp().globalData.age);
-
- if(getApp().globalData.heartRate != undefined)
- {
- this.heartRate = getApp().globalData.heartRate;
- }
-
- if(getApp().globalData.age != undefined)
- {
- this.age = getApp().globalData.age;
- }
- },
- methods: {
- onBack: function(id,e) {
- //uni.navigateBack()//默认delta:1
- uni.navigateBack({
- delta:1,//返回层数,2则上上页
- })
- },
- onHelp: function(id,e) {
- uni.navigateTo({
- url: '/pages/heartRhythms/help',
- animationType: 'slide-in-left',
- animationDuration: 2000,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- onClickHelp: function(id,e) {
- uni.navigateTo({
- url: '/pages/heartRhythms/staticHeartRateHelp',
- animationType: 'slide-in-left',
- animationDuration: 2000,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- onClick: function(id,e) {
-
- if(this.heartRate != -1 && this.age != -1)
- {
- getApp().globalData.heartRate = this.heartRate;
- getApp().globalData.age = this.age;
-
- let lowestHeartRate = ((220 - this.age-this.heartRate)*0.55 + Number(this.heartRate));
- let highestHeartRate = ((220 - this.age-this.heartRate)*0.75 + Number(this.heartRate));
-
- this.result1 = '你的最低有氧心率: '+ Math.round(lowestHeartRate) + '(次/分)';
- this.result2 = '最高有氧心率: '+ Math.round(highestHeartRate)+ '(次/分)';
-
- getApp().globalData.lowestHeartRate = this.lowestHeartRate;
- getApp().globalData.highestHeartRate = this.highestHeartRate;
- }
- else
- {
- switch (id)
- {
- case 0:
- alert('请输入体重');
- break;
-
- case 1:
- alert('请输入身高');
- break;
-
- case 2:
- alert('请输入年龄');
- break;
-
- default:
- break;
- }
-
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .container {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-
- width:100%;
- height: 100vh;
- }
-
- .navigation-bar
- {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 8%;
-
- font-weight: 700;
- color: white;
- font-size: 37rpx;
- background-color: #F2CDB7;
- }
-
- .item-logo
- {
- z-index: 4;
- height: 18%;
- width: 15%;
- // margin: 1%;
- }
- .back{
- position: absolute;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 3%;
- height: 3%;
- top: 2%;
- left: 3%;
- //testing
- // border: 1px solid rgb(255,0,0);
- }
-
- .blue{
- position: absolute;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 7%;
- height: 7%;
- top: -1%;
- right: 3%;
- }
-
- .content{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width:100%;
- height:100%;
- }
-
- .result-area{
- display: flex;
- align-items: center;
- justify-content: center;
- width:95%;
- height:30%;
- margin: 1%;
- border-radius: 25rpx;
- background-color: #F2CDB7;
- text-align: center;
- font-size: 44rpx;
- font-weight: 700;
- color: #BE7F59;
- image{
- margin-top: 10%;
- }
- .border{
- border: 4rpx solid #F4F4F4;
- height: 90%;
- width: 90%;
- border-radius: 25rpx;
- view{
- margin-top: 5%;
- }
- }
- }
-
- .help{
- color: azure;
- background-color: rgb(0,0,0);
- }
-
- .input-area{
- height:60%;
- margin: 1%;
-
- .static-heart-rate{
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- width:100%;
- height:300rpx;
- margin-top: 3%;
- border-radius: 25rpx;
- color: #7B784E;
- font-weight: bold;
- font-size: 30rpx;
- flex-wrap: wrap;
- background: #FDEFEE;
- .input-block
- {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- width:100%;
- }
- .heart-rate-help
- {
- // position: absolute;
- // right: 40%;
- //testing
- // border: 1px solid rgb(255,0,0);
- }
- input{
- width: 75%;
- background: #D8D7C5;
- border-radius: 20rpx;
- }
- }
-
- .age{
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- width:100%;
- height:220rpx;
- border-radius: 25rpx;
- background-color: #EFEEE7;
- font-size: 30rpx;
- color: #7B784E;
- font-weight: bold;
- input{
- height: 120rpx;
- }
- }
-
- .input-title{
- margin-right: 1%;
- //testing
- // border: 1px solid rgb(255,0,0);
- }
- .input{
- display: flex;
- justify-content: center;
- align-items: center;
- background: #F4F4F4;
- border-radius: 4upx;
- font-size: 28upx;
- line-height: 70upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #848484;
- text-align:center;
- margin: 1%;
- width: 75%;
- height: 120rpx;
- background: #D8D7C5;
- border-radius: 20rpx;
- font-size: 46rpx;
- }
- }
-
- .confirm{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width:95%;
- height:7%;
- margin: 1%;
- background: #F2CDB7;
- border-radius: 24rpx;
- font-size: 49rpx;
- font-weight: bold;
- color: #BE7F59;
- }
- .Company{
- position: absolute;
- right: 13%;
- }
- </style>
|