记录模块接口对接
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @Author: Aimee·Zhang
|
||||
* @Date: 2022-01-10 10:29:17
|
||||
* @LastEditors: Aimee·Zhang
|
||||
* @LastEditTime: 2022-01-10 17:23:37
|
||||
* @LastEditTime: 2022-01-12 14:29:12
|
||||
-->
|
||||
|
||||
<template>
|
||||
@@ -82,7 +82,7 @@
|
||||
<!-- 进度1 基本信息页面展示 年龄 -->
|
||||
<view
|
||||
class="plan-content"
|
||||
v-if="ageShow"
|
||||
v-if="birthdayShow"
|
||||
>
|
||||
<u-image
|
||||
class="sex-item-avatar"
|
||||
@@ -97,19 +97,19 @@
|
||||
<view
|
||||
class="year"
|
||||
@change="dateShow = true"
|
||||
>{{age}}</view>
|
||||
>{{showBirthday}}</view>
|
||||
<u-datetime-picker
|
||||
confirmColor="#34ce98"
|
||||
ref="datetimePicker"
|
||||
v-model="age"
|
||||
v-model="birthday"
|
||||
mode="date"
|
||||
:show="dateShow"
|
||||
:formatter="formatter"
|
||||
:minDate="-302688000"
|
||||
:maxDate="maxDate"
|
||||
:closeOnClickOverlay="true"
|
||||
@confirm="confirmAge"
|
||||
@cancel="camcelAge"
|
||||
@confirm="confirmBirthday"
|
||||
@cancel="camcelBirthday"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -140,7 +140,7 @@
|
||||
:h="80"
|
||||
:styles="styles"
|
||||
@scroll="scrollHeight"
|
||||
:scrollLeft="160"
|
||||
:scrollLeft="Number(heightU)"
|
||||
/>
|
||||
</view>
|
||||
<view class="
|
||||
@@ -156,7 +156,7 @@
|
||||
:h="80"
|
||||
:styles="styles"
|
||||
@scroll="scrollWeight"
|
||||
:scrollLeft="55"
|
||||
:scrollLeft="Number(weightU)"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
:h="80"
|
||||
:styles="styles"
|
||||
@scroll="scrollTargetWeight"
|
||||
:scrollLeft="50"
|
||||
:scrollLeft="Number(weightTargetU)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -354,7 +354,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from "moment";
|
||||
import vueScale from "@/components/vueScale"; // 体重标尺
|
||||
import { recordsHealth } from "@/apis/interfaces/essentialInfo.js";
|
||||
export default {
|
||||
components: {
|
||||
vueScale,
|
||||
@@ -369,10 +371,10 @@ export default {
|
||||
sexShow: true, // 性别展示
|
||||
// 性别 -- end
|
||||
// 年龄 -- start
|
||||
age: Date.parse(new Date()), // 年龄默认是当前时间
|
||||
birthday: Date.parse(new Date()), // 年龄默认是当前时间
|
||||
maxDate: Date.parse(new Date()), // 最大年龄为当前年月日
|
||||
dateShow: false, // 显示日期
|
||||
ageShow: false, // 显示年龄模块是否显示
|
||||
birthdayShow: false, // 显示年龄模块是否显示
|
||||
// 年龄 -- end
|
||||
// 身高体重 -- start
|
||||
heightWeightShow: false, // 身高体重模块展示
|
||||
@@ -386,8 +388,8 @@ export default {
|
||||
fontColor: "#404040",
|
||||
fontSize: 16,
|
||||
},
|
||||
weightU: "", //体重
|
||||
heightU: "", // 身高
|
||||
weightU: 55, //体重
|
||||
heightU: 160, // 身高
|
||||
// 身高体重 -- end
|
||||
//#endregion
|
||||
// 第一部分基本信息 end
|
||||
@@ -404,6 +406,11 @@ export default {
|
||||
activedbehaviarTarget: "", // 默认没有任何运动量
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showBirthday() {
|
||||
return moment(this.birthday).format("YYYY年MM月DD日");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
//性别----------- 选择性别 1男2女
|
||||
clickSex(sex) {
|
||||
@@ -411,22 +418,22 @@ export default {
|
||||
this.sex = sex;
|
||||
this.percentplan1 = uni.$u.range(0, 100, this.percentplan1 + 33.33);
|
||||
this.sexShow = false;
|
||||
this.ageShow = true;
|
||||
this.birthdayShow = true;
|
||||
this.dateShow = true;
|
||||
console.log(this.percentplan1, this.sex);
|
||||
},
|
||||
|
||||
// 年龄-------------确认选择了出生年月日
|
||||
confirmAge(e) {
|
||||
this.age = e.value;
|
||||
this.ageShow = false; // 年龄页面弹窗不显示
|
||||
confirmBirthday(e) {
|
||||
this.birthday = e.value;
|
||||
this.birthdayShow = false; // 年龄页面弹窗不显示
|
||||
this.dateShow = false; // 关闭时间弹窗
|
||||
this.percentplan1 = uni.$u.range(0, 100, this.percentplan1 + 33.33); // 增加进度
|
||||
this.heightWeightShow = true; // 展示身高体重模块
|
||||
},
|
||||
// 年龄 ----- 取消选择年龄
|
||||
camcelAge() {
|
||||
this.ageShow = false; // // 年龄页面弹窗不显示
|
||||
camcelBirthday() {
|
||||
this.birthdayShow = false; // // 年龄页面弹窗不显示
|
||||
this.dataShow = false; // 关闭时间弹窗
|
||||
this.percentplan1 = 0; // 进度为0
|
||||
this.sexShow = true; // 显示性别页面
|
||||
@@ -457,7 +464,7 @@ export default {
|
||||
if (type === 1) {
|
||||
this.percentplan1 = 33.33;
|
||||
this.heightWeightShow = false; // 关闭当前体重页面
|
||||
this.ageShow = true;
|
||||
this.birthdayShow = true;
|
||||
this.dateShow = true;
|
||||
} else {
|
||||
this.percentplan1 = 100; // 第一个进度为100
|
||||
@@ -474,7 +481,14 @@ export default {
|
||||
this.targetShow = false; // 关闭目标页面 减重 塑性 增肌
|
||||
this.percentplan2 = 0;
|
||||
} else {
|
||||
console.log(2);
|
||||
console.log(this.activedTarget);
|
||||
if (this.activedTarget === "") {
|
||||
uni.showToast({
|
||||
title: "请选择目标",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.percentplan2 = 50;
|
||||
this.targetShow = false; // 目标页面不展示 展示下一面目标体重
|
||||
this.targetWeightShow = true; // 目标体重页面展示
|
||||
@@ -506,20 +520,36 @@ export default {
|
||||
this.targetWeightShow = true; // 目标体重页面展示
|
||||
this.behaviorShow = false; // 关闭运动量选择页面
|
||||
} else {
|
||||
console.log(2);
|
||||
|
||||
console.log("创建成功了。。。");
|
||||
this.$refs.uToast.show({
|
||||
type: "success",
|
||||
title: "创建成功",
|
||||
message: "创建成功啦",
|
||||
iconUrl:
|
||||
"https://cdn.uviewui.com/uview/demo/toast/success.png",
|
||||
complete() {
|
||||
this.percentplan3 = 100;
|
||||
this.behaviorShow = false; // 关闭运动量页面
|
||||
uni.navigateBack({});
|
||||
},
|
||||
if (this.activedbehaviarTarget === "") {
|
||||
uni.showToast({
|
||||
title: "请选择运动量",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
sex: this.sex, // 性别
|
||||
birthday: this.birthday, // 年龄
|
||||
weight: this.weightU, // 体重
|
||||
height: this.heightU, // 身高
|
||||
goal_weight: this.weightTargetU, // 目标体重
|
||||
exercise: this.activedbehaviarTarget, // 运动量
|
||||
days: 1,
|
||||
};
|
||||
console.log(params);
|
||||
recordsHealth(params).then((res) => {
|
||||
this.$refs.uToast.show({
|
||||
type: "success",
|
||||
title: "创建成功",
|
||||
message: "创建成功啦",
|
||||
iconUrl:
|
||||
"https://cdn.uviewui.com/uview/demo/toast/success.png",
|
||||
complete() {
|
||||
this.percentplan3 = 100;
|
||||
this.behaviorShow = false; // 关闭运动量页面
|
||||
uni.navigateBack({});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user