70 lines
1.4 KiB
JavaScript
70 lines
1.4 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
baseState : false, // 建议每日饮水量弹出
|
|
drinkNeed : '', // 建议每日饮水量
|
|
recordnum1: 160, // 身高
|
|
recordnum2: 65, // 体重
|
|
dateValue : '请选择' // 生日选择
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生日选择
|
|
*/
|
|
birthdayChange(e) {
|
|
this.setData({
|
|
dateValue: e.detail.value
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 提交信息
|
|
*/
|
|
submitBtn() {
|
|
let birthday = this.data.dateValue,
|
|
height = this.selectComponent('#ctrlmill1').data.number,
|
|
weight = this.selectComponent('#ctrlmill2').data.number
|
|
wx.$api.water.Store({
|
|
birthday: birthday,
|
|
height : height,
|
|
weight : weight
|
|
}).then(res => {
|
|
console.log(res)
|
|
this.setData({
|
|
drinkNeed: res.data.drink.need,
|
|
baseState: true
|
|
})
|
|
}).catch(err => {})
|
|
},
|
|
|
|
/**
|
|
* 关闭弹窗-并跳走
|
|
*/
|
|
perfect() {
|
|
wx.switchTab({
|
|
url: '/pages/record/index'
|
|
})
|
|
}
|
|
}) |