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", canWork:true, }, // 下拉刷新回调接口 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, pid:app.globalData.userInfo.pid, }) if(this.data.pid == ""||this.data.pid== undefined){ this.setData({ canWork:false }); } this.getList(); networkUtil._get(api.checkList, { patientId: getApp().globalData.currentId}, function (res) { console.log(res) }) }, getList() { networkUtil._post(api.getCheckUpHistory, { keyword: this.data.pid, sort: this.data.hospitalId, }, res => { console.log(res) if (res.statusCode == 200 && res.data.errorcode == 0) { var data = res.data.data; this.setData({ array: res.data.data[0].babyInfos }) } }, err => { }, 'application/json') }, inputtemperature(e) { var temperature = this.data.temperature; var data = e.detail.value; if (data.indexOf('.') > -1 && data.indexOf('.')= 0) { this.setData({ temperature: data }) }else{ this.setData({ temperature:temperature }) } }, inputheight(e) { var height = this.data.height; var data = e.detail.value; if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) { data = data.slice(0,-1) } if (data <= 200 && data >= 0) { this.setData({ height: data }) }else{ this.setData({ height:height }) } }, inputweight(e) { var weight = this.data.weight; var data = e.detail.value; if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) { data = data.slice(0, -1) } if (data <= 50 && data >= 0) { this.setData({ weight: data }) }else{ this.setData({ weight:weight }) } }, inputheadWidth(e) { var headWidth = this.data.headWidth; var data = e.detail.value; if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) { data = data.slice(0, -1) } if (data <= 100 && data >= 0) { this.setData({ headWidth: data }) }else{ this.setData({ headWidth:headWidth }) } }, inputbust(e) { var bust = this.data.bust; var data = e.detail.value; if (data.indexOf('.') > -1 && data.indexOf('.') < data.length - 2) { data = data.slice(0, -1) } if (data <= 100 && data >= 0) { this.setData({ bust: data }) }else{ this.setData({ bust:bust }) } }, bindPickerChange: function (e) { this.setData({ fhrLength: e.detail.value, }) }, toMyApport() { if (!this.data.canWork) { wx.showModal({ title: '提示', content: "游客用户不能录入产检信息!", showCancel: false, }); return; }; 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.showModal({ title: '成功提交', content: '检查信息已提交!', showCancel: false }); }, (err) => { isRefresh = false }, 'application/json') } })