[修复日期传参]

This commit is contained in:
2022-01-14 16:32:11 +08:00
parent dd6c5718b0
commit 750fabdfa3

View File

@@ -1,4 +1,3 @@
<!-- <!--
* @Description: * @Description:
* @Author: Aimee·Zhang * @Author: Aimee·Zhang
@@ -13,91 +12,40 @@
<view class="plan"> <view class="plan">
<view class="plan-1"> <view class="plan-1">
<span>基本信息</span> <span>基本信息</span>
<u-line-progress <u-line-progress :percentage="percentplan1" activeColor="#34ce98" class="line-progress" :showText="false" />
:percentage="percentplan1"
activeColor="#34ce98"
class="line-progress"
:showText="false"
/>
</view> </view>
<view class="plan-2"> <view class="plan-2">
<span>健康目标</span> <span>健康目标</span>
<u-line-progress <u-line-progress :percentage="percentplan2" activeColor="#34ce98" width="200rpx" class="line-progress" :showText="false" />
:percentage="percentplan2"
activeColor="#34ce98"
width="200rpx"
class="line-progress"
:showText="false"
/>
</view> </view>
<view class="plan-3"> <view class="plan-3">
<span>行为习惯</span> <span>行为习惯</span>
<u-line-progress <u-line-progress :percentage="percentplan3" activeColor="#34ce98" width="200rpx" class="line-progress" :showText="false" />
:percentage="percentplan3"
activeColor="#34ce98"
width="200rpx"
class="line-progress"
:showText="false"
/>
</view> </view>
</view> </view>
<!-- 进度1 基本信息 --> <!-- 进度1 基本信息 -->
<view> <view>
<!-- 进度1 基本信息页面展示 性别 --> <!-- 进度1 基本信息页面展示 性别 -->
<view <view class="plan-content" v-if="sexShow">
class="plan-content"
v-if="sexShow"
>
<view class="info-des">生理性别和激素会影响我们的身体代谢食物的方式</view> <view class="info-des">生理性别和激素会影响我们的身体代谢食物的方式</view>
<view class="info-title">您的性别是</view> <view class="info-title">您的性别是</view>
<view class="sex"> <view class="sex">
<view <view class="sex-item" @click="clickSex(1)">
class="sex-item" <u-image class="sex-item-avatar" width="150rpx" height="150rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
@click="clickSex(1)" 男性
>
<u-image
class="sex-item-avatar"
width="150rpx"
height="150rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>男性
</view> </view>
<view <view class="sex-item" @click="clickSex(2)">
class="sex-item" <u-image class="sex-item-avatar" width="150rpx" height="150rpx" :src="require('../../static/imgs/avatar-0.png')" :lazy-load="true" shape="circle" />
@click="clickSex(2)" 女性
>
<u-image
class="sex-item-avatar"
width="150rpx"
height="150rpx"
:src="require('../../static/imgs/avatar-0.png')"
:lazy-load="true"
shape="circle"
/>女性
</view> </view>
</view> </view>
</view> </view>
<!-- 进度1 基本信息页面展示 年龄 --> <!-- 进度1 基本信息页面展示 年龄 -->
<view <view class="plan-content" v-if="birthdayShow">
class="plan-content" <u-image class="sex-item-avatar" width="100rpx" height="100rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
v-if="birthdayShow"
>
<u-image
class="sex-item-avatar"
width="100rpx"
height="100rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>
<view class="age"> <view class="age">
<view class="info-title">你的出生日期是</view> <view class="info-title">你的出生日期是</view>
<view <view class="year" @change="dateShow = true">{{ showBirthday }}</view>
class="year"
@change="dateShow = true"
>{{showBirthday}}</view>
<u-datetime-picker <u-datetime-picker
confirmColor="#34ce98" confirmColor="#34ce98"
ref="datetimePicker" ref="datetimePicker"
@@ -115,78 +63,43 @@
</view> </view>
<!-- 进度1 基本信息页面展示 身高体重 --> <!-- 进度1 基本信息页面展示 身高体重 -->
<view <view class="plan-content weight-content" v-if="heightWeightShow">
class="plan-content weight-content" <u-image class="sex-item-avatar" width="100rpx" height="100rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
v-if="heightWeightShow"
>
<u-image
class="sex-item-avatar"
width="100rpx"
height="100rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>
<view class="info-des">身高体重信息对健康信息有重要参考价值</view> <view class="info-des">身高体重信息对健康信息有重要参考价值</view>
<view class="info-title">您的身高是</view> <view class="info-title">您的身高是</view>
<!-- --> <!-- -->
<view class="weight"> <view class="weight">
<view class='count'><span>{{heightU}}</span>厘米</view> <view class="count">
<vue-scale <span>{{ heightU }}</span>
:min="10" 厘米
:max="100"
:int="false"
:single="10"
:h="80"
:styles="styles"
@scroll="scrollHeight"
:scrollLeft="Number(heightU)"
/>
</view> </view>
<view class=" <vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollHeight" :scrollLeft="Number(heightU)" />
info-title">您的体重是 </view>
<view
class="
info-title"
>
您的体重是
</view> </view>
<view class="weight"> <view class="weight">
<view class='count'><span>{{weightU}}</span>公斤</view> <view class="count">
<vue-scale <span>{{ weightU }}</span>
:min="10" 公斤
:max="100" </view>
:int="false" <vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollWeight" :scrollLeft="Number(weightU)" />
:single="10"
:h="80"
:styles="styles"
@scroll="scrollWeight"
:scrollLeft="Number(weightU)"
/>
</view> </view>
<view class="pre-next"> <view class="pre-next">
<view <view class="pro" @click="weightClick(1)">上一步</view>
class="pro" <view class="next" @click="weightClick(2)">下一步</view>
@click="weightClick(1)"
>上一步</view>
<view
class="next"
@click="weightClick(2)"
>下一步</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 进度2 健康目标 --> <!-- 进度2 健康目标 -->
<view> <view>
<!-- 减脂类型 --> <!-- 减脂类型 -->
<view <view v-if="targetShow" class="plan-content target-content">
v-if="targetShow" <u-image class="sex-item-avatar" width="100rpx" height="100rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
class="plan-content target-content"
>
<u-image
class="sex-item-avatar"
width="100rpx"
height="100rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>
<view class="info-title">您的目标是</view> <view class="info-title">您的目标是</view>
<view class="target-type"> <view class="target-type">
<view class="target-type-item"> <view class="target-type-item">
@@ -198,7 +111,8 @@
:src="activedTarget === '1' ? require('../../static/imgs/ic-w-s.png') : require('../../static/imgs/ic-w-n.png')" :src="activedTarget === '1' ? require('../../static/imgs/ic-w-s.png') : require('../../static/imgs/ic-w-n.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>减肥 />
减肥
</view> </view>
<view class="target-type-item"> <view class="target-type-item">
<u-image <u-image
@@ -209,7 +123,8 @@
:src="activedTarget === '2' ? require('../../static/imgs/ic-b-s.png') : require('../../static/imgs/ic-b-n.png')" :src="activedTarget === '2' ? require('../../static/imgs/ic-b-s.png') : require('../../static/imgs/ic-b-n.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>保持体重 />
保持体重
</view> </view>
<view class="target-type-item"> <view class="target-type-item">
<u-image <u-image
@@ -220,58 +135,31 @@
:src="activedTarget === '3' ? require('../../static/imgs/ic-m-s.png') : require('../../static/imgs/ic-m-n.png')" :src="activedTarget === '3' ? require('../../static/imgs/ic-m-s.png') : require('../../static/imgs/ic-m-n.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>增肌 />
增肌
</view> </view>
</view> </view>
<view class="pre-next"> <view class="pre-next">
<view <view class="pro" @click="targetClick(1)">上一步</view>
class="pro" <view class="next" @click="targetClick(2)">下一步</view>
@click="targetClick(1)"
>上一步</view>
<view
class="next"
@click="targetClick(2)"
>下一步</view>
</view> </view>
</view> </view>
<!-- 减脂体重 --> <!-- 减脂体重 -->
<view <view v-if="targetWeightShow" class="plan-content target-content">
v-if="targetWeightShow" <u-image class="sex-item-avatar" width="100rpx" height="100rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
class="plan-content target-content"
>
<u-image
class="sex-item-avatar"
width="100rpx"
height="100rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>
<view class="info-title">您的打算减脂多少</view> <view class="info-title">您的打算减脂多少</view>
<view class="target-type"> <view class="target-type">
<view class="target-type-item"> <view class="target-type-item">
<view class='count'><span>{{weightTargetU}}</span>公斤</view> <view class="count">
<vue-scale <span>{{ weightTargetU }}</span>
:min="10" 公斤
:max="100" </view>
:int="false" <vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollTargetWeight" :scrollLeft="Number(weightTargetU)" />
:single="10"
:h="80"
:styles="styles"
@scroll="scrollTargetWeight"
:scrollLeft="Number(weightTargetU)"
/>
</view> </view>
</view> </view>
<view class="pre-next"> <view class="pre-next">
<view <view class="pro" @click="targetWeightClick(1)">上一步</view>
class="pro" <view class="next" @click="targetWeightClick(2)">下一步</view>
@click="targetWeightClick(1)"
>上一步</view>
<view
class="next"
@click="targetWeightClick(2)"
>下一步</view>
</view> </view>
</view> </view>
</view> </view>
@@ -279,18 +167,8 @@
<!-- 进度3 行为习惯 --> <!-- 进度3 行为习惯 -->
<!-- 减脂类型 --> <!-- 减脂类型 -->
<view <view v-if="behaviorShow" class="plan-content target-content">
v-if="behaviorShow" <u-image class="sex-item-avatar" width="100rpx" height="100rpx" :src="require('../../static/imgs/avatar-1.png')" :lazy-load="true" shape="circle" />
class="plan-content target-content"
>
<u-image
class="sex-item-avatar"
width="100rpx"
height="100rpx"
:src="require('../../static/imgs/avatar-1.png')"
:lazy-load="true"
shape="circle"
/>
<view class="info-title">您的运动量是</view> <view class="info-title">您的运动量是</view>
<view class="target-type"> <view class="target-type">
<view class="target-type-item"> <view class="target-type-item">
@@ -302,7 +180,8 @@
:src="activedbehaviarTarget === '1' ? require('../../static/imgs/ic-w-01.png') : require('../../static/imgs/ic-w-02.png')" :src="activedbehaviarTarget === '1' ? require('../../static/imgs/ic-w-01.png') : require('../../static/imgs/ic-w-02.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>久坐不动 />
久坐不动
</view> </view>
<view class="target-type-item"> <view class="target-type-item">
<u-image <u-image
@@ -313,7 +192,8 @@
:src="activedbehaviarTarget === '2' ? require('../../static/imgs/ic-w-03.png') : require('../../static/imgs/ic-w-04.png')" :src="activedbehaviarTarget === '2' ? require('../../static/imgs/ic-w-03.png') : require('../../static/imgs/ic-w-04.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>少量运动 />
少量运动
</view> </view>
<view class="target-type-item"> <view class="target-type-item">
<u-image <u-image
@@ -324,7 +204,8 @@
:src="activedbehaviarTarget === '3' ? require('../../static/imgs/ic-w-05.png') : require('../../static/imgs/ic-w-06.png')" :src="activedbehaviarTarget === '3' ? require('../../static/imgs/ic-w-05.png') : require('../../static/imgs/ic-w-06.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>中等运动量 />
中等运动量
</view> </view>
<view class="target-type-item"> <view class="target-type-item">
<u-image <u-image
@@ -335,18 +216,13 @@
:src="activedbehaviarTarget === '4' ? require('../../static/imgs/ic-w-07.png') : require('../../static/imgs/ic-w-08.png')" :src="activedbehaviarTarget === '4' ? require('../../static/imgs/ic-w-07.png') : require('../../static/imgs/ic-w-08.png')"
:lazy-load="true" :lazy-load="true"
shape="circle" shape="circle"
/>超强度运动 />
超强度运动
</view> </view>
</view> </view>
<view class="pre-next"> <view class="pre-next">
<view <view class="pro" @click="targetBehaviorClick(1)">上一步</view>
class="pro" <view class="next" @click="targetBehaviorClick(2)">立即创建</view>
@click="targetBehaviorClick(1)"
>上一步</view>
<view
class="next"
@click="targetBehaviorClick(2)"
>立即创建</view>
</view> </view>
</view> </view>
<u-toast ref="uToast"></u-toast> <u-toast ref="uToast"></u-toast>
@@ -354,12 +230,12 @@
</template> </template>
<script> <script>
import moment from "moment"; import moment from 'moment';
import vueScale from "@/components/vueScale"; // 体重标尺 import vueScale from '@/components/vueScale'; // 体重标尺
import { recordsHealth } from "@/apis/interfaces/essentialInfo.js"; import { recordsHealth } from '@/apis/interfaces/essentialInfo.js';
export default { export default {
components: { components: {
vueScale, vueScale
}, },
data() { data() {
return { return {
@@ -367,12 +243,12 @@ export default {
//#region //#region
percentplan1: 0, percentplan1: 0,
// 性别--start // 性别--start
sex: "1", //1是男生2是女生 sex: '1', //1是男生2是女生
sexShow: true, // 性别展示 sexShow: true, // 性别展示
// 性别 -- end // 性别 -- end
// 年龄 -- start // 年龄 -- start
birthday: Date.parse(new Date()), // 年龄默认是当前时间 birthday: new Date().getTime(), // 年龄默认是当前时间
maxDate: Date.parse(new Date()), // 最大年龄为当前年月日 maxDate: new Date().getTime(), // 最大年龄为当前年月日
dateShow: false, // 显示日期 dateShow: false, // 显示日期
birthdayShow: false, // 显示年龄模块是否显示 birthdayShow: false, // 显示年龄模块是否显示
// 年龄 -- end // 年龄 -- end
@@ -381,12 +257,12 @@ export default {
weight: 11, weight: 11,
height: 180, height: 180,
styles: { styles: {
line: "#dbdbdb", line: '#dbdbdb',
bginner: "#fbfbfb", bginner: '#fbfbfb',
bgoutside: "#ffffff", bgoutside: '#ffffff',
font: "#404040", font: '#404040',
fontColor: "#404040", fontColor: '#404040',
fontSize: 16, fontSize: 16
}, },
weightU: 55, //体重 weightU: 55, //体重
heightU: 160, // 身高 heightU: 160, // 身高
@@ -397,19 +273,20 @@ export default {
//#region //#region
percentplan2: 0, percentplan2: 0,
targetShow: false, // 减脂目标模块 是否显示减脂类型 targetShow: false, // 减脂目标模块 是否显示减脂类型
activedTarget: "", // 减脂 activedTarget: '', // 减脂
targetWeightShow: false, // 目标体重页面展示 targetWeightShow: false, // 目标体重页面展示
weightTargetU: 50, weightTargetU: 50,
//#endregion //#endregion
behaviorShow: false, // 默认行为习惯页面不展示 behaviorShow: false, // 默认行为习惯页面不展示
percentplan3: 0, percentplan3: 0,
activedbehaviarTarget: "", // 默认没有任何运动量 activedbehaviarTarget: '' // 默认没有任何运动量
}; };
}, },
computed: { computed: {
showBirthday() { showBirthday() {
return moment(this.birthday).format("YYYY年MM月DD日"); console.log(moment(this.birthday).format('YYYY年MM月DD日'))
}, return moment(this.birthday).format('YYYY年MM月DD日');
}
}, },
methods: { methods: {
//性别----------- 选择性别 1男2女 //性别----------- 选择性别 1男2女
@@ -439,15 +316,16 @@ export default {
}, },
//年龄------------- 过滤出生年月日 //年龄------------- 过滤出生年月日
formatter(type, value) { formatter(type, value) {
if (type === "year") { if (type === 'year') {
return `${value}`; return `${value}`;
} }
if (type === "month") { if (type === 'month') {
return `${value}`; return `${value}`;
} }
if (type === "day") { if (type === 'day') {
return `${value}`; return `${value}`;
} }
console.log(value)
return value; return value;
}, },
// 体重---------标尺滚动 // 体重---------标尺滚动
@@ -479,10 +357,10 @@ export default {
this.targetShow = false; // 关闭目标页面 减重 塑性 增肌 this.targetShow = false; // 关闭目标页面 减重 塑性 增肌
this.percentplan2 = 0; this.percentplan2 = 0;
} else { } else {
if (this.activedTarget === "") { if (this.activedTarget === '') {
uni.showToast({ uni.showToast({
title: "请选择目标", title: '请选择目标',
icon: "none", icon: 'none'
}); });
return; return;
} }
@@ -514,42 +392,45 @@ export default {
this.targetWeightShow = true; // 目标体重页面展示 this.targetWeightShow = true; // 目标体重页面展示
this.behaviorShow = false; // 关闭运动量选择页面 this.behaviorShow = false; // 关闭运动量选择页面
} else { } else {
if (this.activedbehaviarTarget === "") { if (this.activedbehaviarTarget === '') {
uni.showToast({ uni.showToast({
title: "请选择运动量", title: '请选择运动量',
icon: "none", icon: 'none'
}); });
return; return;
} }
let params = { let params = {
sex: this.sex, // 性别 sex: this.sex, // 性别
birthday: this.birthday, // 年龄 birthday: moment(this.birthday).format('YYYY-MM-DD'), // 年龄
weight: this.weightU, // 体重 weight: this.weightU, // 体重
height: this.heightU, // 身高 height: this.heightU, // 身高
goal_weight: this.weightTargetU, // 目标体重 goal_weight: this.weightTargetU, // 目标体重
exercise: this.activedbehaviarTarget, // 运动量 exercise: this.activedbehaviarTarget, // 运动量
days: 1, days: 1
}; };
recordsHealth(params).then((res) => { console.log(params,'params.....')
recordsHealth(params)
.then(res => {
uni.showModal({ uni.showModal({
title: "提示", title: '提示',
content: "创建成功", content: '创建成功',
showCancel: false, showCancel: false,
success: ModalRes => { success: ModalRes => {
this.percentplan3 = 100; this.percentplan3 = 100;
this.behaviorShow = false; // 关闭运动量页面 this.behaviorShow = false; // 关闭运动量页面
uni.navigateBack({}); uni.navigateBack({});
} }
});
}) })
}).catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon: 'none' icon: 'none'
}) });
}) });
}
}
} }
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -618,8 +499,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
margin-top: $margin * 3; margin-top: $margin * 3;
.sex-item-avatar { .sex-item-avatar {
box-shadow: 0 0 10rpx 4rpx box-shadow: 0 0 10rpx 4rpx rgba($color: $main-color, $alpha: 0.1);
rgba($color: $main-color, $alpha: 0.1);
border-radius: 50%; border-radius: 50%;
} }
} }