| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <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/red.png" mode="aspectFit" style="width:100%"></image>
- </view>
- <view class="content">
- <view class="result-area">
- <view class="border">
- <image class="item-logo" src="../../static/home/dayCalorieLogo.png" mode=""></image>
- <view class="">
- {{resultStr}}千卡
- </view>
- <!-- <view class="">
- 基础代谢率
- </view> -->
- </view>
- </view>
-
- <!-- <button class="help" @click="onHelp(0, $event)">宁哥笔记</button> -->
-
- <view class="select-area">
- <view :class="(selected != index)?'block':'block-selected'":style="{background:backList[index%6]}" v-for="(option,index) in optionArr" @click="onClick(index, $event)">{{option}}</view>
- </view>
-
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- resultStr:'0',
- optionArr:[
- '办公室久坐没有什么运动',
- '每周轻松1-3次运动',
- '每周中等强度3-5次',
- '每周大强度运动5-7次以上',
- '大强度训练每周8次以上',
- ],
- backList:['#F2CDB7', '#F1F1EC','#E9F2F1','#FDEFEE','#FBF0EA'],
- selected:0,
- }
- },
- onLoad() {
- if(getApp().globalData.bmr !=undefined)
- {
- let calorie = getApp().globalData.bmr * 1.2;
- this.resultStr = '每天消耗的总热量: ' + Math.round(calorie);
- }
- else
- {
- uni.navigateBack({
- delta:1,
- animationType: 'slide-in-left',
- animationDuration: 2000,
- success: res => {
- alert('清先测量基础代谢');
- },
- fail: () => {},
- complete: () => {}
- });
- }
- },
- methods: {
- onBack: function(id,e) {
- //uni.navigateBack()//默认delta:1
- uni.navigateBack({
- delta:1,//返回层数,2则上上页
- })
- },
- onHelp: function(id,e) {
- uni.navigateTo({
- url: '/pages/dayCalorie/help',
- animationType: 'slide-in-left',
- animationDuration: 2000,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- onClick: function(id,e) {
- // console.log(id);
- this.selected = id;
-
- let calorie = -1;
-
- switch (id){
- case 0:
- calorie = getApp().globalData.bmr * 1.2;
- break;
-
- case 1:
- calorie = getApp().globalData.bmr * 1.375;
- break;
-
- case 2:
- calorie = getApp().globalData.bmr * 1.5;
- break;
-
- case 3:
- calorie = getApp().globalData.bmr * 1.725;
- break;
-
- case 4:
- calorie = getApp().globalData.bmr * 1.9;
- break;
- default:
- break;
- }
- getApp().globalData.calorie = calorie;
- this.resultStr = '每天消耗的总热量: ' + Math.round(calorie) + '千卡';
- },
- }
- }
- </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: #FABAB9;
- }
-
- .item-logo
- {
- z-index: 4;
- height: 20%;
- width: 11%;
- }
- .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%;
- //testing
- // border: 1px solid rgb(255,0,0);
- }
-
- .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:90%;
- height:30%;
- margin: 1%;
- border-radius: 25rpx;
- background-color: #FABAB9;
- text-align: center;
- font-size: 44rpx;
- font-weight: 700;
- color: #4D857C;
- image{
- margin-top: 10%;
- }
- .border{
- border: 2rpx solid #F4F4F4;
- height: 90%;
- width: 90%;
- border-radius: 25rpx;
- view{
- margin-top: 5%;
- }
- }
- }
-
-
- .help{
- color: azure;
- background-color: rgb(0,0,0);
- }
-
- .select-area{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width:90%;
- height:60%;
- margin: 1%;
- view{
- height: 142rpx;
- }
- }
- .block{
- width:100%;
- margin: 1%;
- font-size: 30rpx;
- font-weight: bold;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: rgb(115,164,164);
- }
- .block-selected{
- width:100%;
- margin: 1%;
- font-weight: bold;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: rgb(115,164,164);
- box-shadow: 0rpx 12rpx 16rpx 0rpx rgba(0, 0, 0, 0.22);
- }
- .confirm{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width:90%;
- height:7%;
- margin: 1%;
- background: #FABAB9;
- border-radius: 24rpx;
- color: #C65E5C;
- font-weight: bold;
- font-size: 49rpx;
- }
- </style>
|