var networkUtil = require('../../utils/network_util.js') var api = require('../../utils/apiFile.js') var networkUtil = require('../../utils/network_util.js') var api = require('../../utils/apiFile.js') var page var isRefresh = false; // 是否有更多 var app = getApp() Page({ data: { array: [], hospitalId: "", pid:"", toDay: "", temperature: "", height: "", weight: "", headWidth: "", bust: "", feedArray:["母乳喂养","混合喂养","人工喂养"], feed: "0", }, // 下拉刷新回调接口 onPullDownRefresh() {}, onLoad(e) { var d = new Date(); var toDay = d.getFullYear() + "-" + ("00" + (d.getMonth() + 1)).substr(-2) + "-" + ("00" + d.getDate()).substr(-2); this.setData({ toDay: toDay, }) this.setData({ hospitalId:app.globalData.userInfo.hospitalId, }) this.getList(); networkUtil._get(api.checkList, { patientId: getApp().globalData.currentId}, function (res) { console.log(res) }) }, getList() { networkUtil._post(api.getCheckUpHistory, { pid: this.data.pid, hospitalId: this.data.hospitalId, }, res => { console.log(res) if (res.statusCode == 200 && res.data.errorcode == 0) { var data = res.data.data; for (let o of data) { o.fhr = JSON.parse(o.fhr); } this.setData({ array: res.data.data }) } }, err => { }) }, inputtemperature(e) { var temperature = this.data.temperature; var data = e.detail.value; if (data <= 50 && data >= 0) { this.setData({ temperature: e.detail.value }) }else{ this.setData({ temperature:temperature }) } }, inputheight(e) { var height = this.data.height; var data = e.detail.value; if (data <= 200 && data >= 0) { this.setData({ height: e.detail.value }) }else{ this.setData({ height:height }) } }, inputweight(e) { var weight = this.data.weight; var data = e.detail.value; if (data <= 50 && data >= 0) { this.setData({ weight: e.detail.value }) }else{ this.setData({ weight:weight }) } }, inputheadWidth(e) { var headWidth = this.data.headWidth; var data = e.detail.value; if (data <= 100 && data >= 0) { this.setData({ headWidth: e.detail.value }) }else{ this.setData({ headWidth:headWidth }) } }, inputbust(e) { var bust = this.data.bust; var data = e.detail.value; if (data <= 100 && data >= 0) { this.setData({ bust: e.detail.value }) }else{ this.setData({ bust:bust }) } }, bindPickerChange: function (e) { this.setData({ fhrLength: e.detail.value, }) }, toMyApport() { if (isRefresh) { return; } isRefresh = true; networkUtil._post(api.setCheckUp, { babyInfos: [ { temperature: this.data.temperature, height: this.data.height, weight: this.data.weight, headWidth: this.data.headWidth, bust: this.data.bust, feed: this.data.feed, } ], pid: this.data.pid, hospitalId: this.data.hospitalId, }, (res) => { isRefresh = false this.getList(); wx.showToast({ title: '产检信息已成功提交', icon: 'success', duration: 1000 }); }, (err) => { isRefresh = false }, 'application/json') } })