diff --git a/littleApp_child/pages/diet/measuret.js b/littleApp_child/pages/diet/measuret.js
index 7a50cae..737e32b 100644
--- a/littleApp_child/pages/diet/measuret.js
+++ b/littleApp_child/pages/diet/measuret.js
@@ -17,7 +17,7 @@ Page({
"蛋黄泥",
"蔬菜泥",
"水果泥",
- "食用油",
+ "食用油",//
"稠粥、烂面条",
"肝泥",
"蛋黄碎",
@@ -183,11 +183,48 @@ Page({
love:0,
},
],
+ foodList1:[],
+ foodList2:[],
+ foodList3:[],
+ foodList4:[],
+ foodListNames1:[
+ "铁强化米粉",
+ "蔬菜泥",
+ "水果泥",
+ "蛋黄泥",
+ "肉泥",
+ "稠粥、烂面条",
+ ],
+ foodListNames2:[
+ "稠粥、烂面条",
+ "蔬菜末",
+ "水果末",
+ "蛋黄羹",
+ "肉末",
+ "食用油",
+ "肝泥",
+ "豆腐"
+ ],
+ foodListNames3:[
+ "稠粥、烂面条",
+ "蔬菜碎",
+ "水果碎",
+ "蛋黄碎",
+ "肉碎",
+ "肝泥",
+ "豆腐"
+ ],
+ foodListNames4:[
+ "稠粥、烂面条",
+ "蔬菜碎",
+ "水果碎"
+ ],
hospitalId: "",
toDay:"",
pid:"",
show:false,
array:[],
+ yl:0
},
foodClick(e) {
@@ -219,15 +256,109 @@ Page({
// this.foodList[i].love = 0;
// }
},
+ foodClick1(e) {
+ let Names = this.data.foodListNames;
+ let items = this.data.foodList;
+ const values = e.detail.value;
+ console.log('哈哈哈',values);
+ const yf=this.getLeadingNumbers1(values[0])
+ console.log('yf',yf);
+ if(yf=='11'||yf=='21'){
+ Names = this.data.foodListNames1;
+ items = this.data.foodList1;
+ }else if(yf=='12'||yf=='22'){
+ Names = this.data.foodListNames2;
+ items = this.data.foodList2;
+ }else if(yf=='13'||yf=='23'){
+ Names = this.data.foodListNames3;
+ items = this.data.foodList3;
+ }else if(yf=='14'||yf=='24'){
+ Names = this.data.foodListNames4;
+ items = this.data.foodList4;
+ }
+ for (let i = 0, lenI = items.length; i < lenI; ++i) {
+ items[i].add = 0;
+ items[i].love = 0;
+
+ for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
+ if(yf=='11'||yf=='21'){
+ if (Names[i]+'11' === values[j]) {
+ items[i].add = 1;
+ }else if (Names[i]+'21' === values[j]) {
+ items[i].love = 1;
+ }
+ }else if(yf=='12'||yf=='22'){
+ if (Names[i]+'12' === values[j]) {
+ items[i].add = 1;
+ }else if (Names[i]+'22' === values[j]) {
+ items[i].love = 1;
+ }
+ }else if(yf=='13'||yf=='23'){
+ if (Names[i]+'13' === values[j]) {
+ items[i].add = 1;
+ }else if (Names[i]+'23' === values[j]) {
+ items[i].love = 1;
+ }
+ }else if(yf=='14'||yf=='24'){
+ if (Names[i]+'14' === values[j]) {
+ items[i].add = 1;
+ }else if (Names[i]+'24' === values[j]) {
+ items[i].love = 1;
+ }
+ }
+ }
+ // if (Names[i]+yf === values[j]) {
+ // items[i].add = 1;
+ // }else if (Names[i]+yf === values[j]) {
+ // items[i].love = 1;
+ // }
+ if(items[i].add === 0){
+ items[i].love = 0;
+ }
+ }
+ if(yf=='11'||yf=='21'){
+ this.setData({
+ foodList1:items
+ })
+ console.log('list1',this.data.foodList1);
+ }else if(yf=='12'||yf=='22'){
+ this.setData({
+ foodList2:items
+ })
+ console.log('list2',this.data.foodList2);
+ }else if(yf=='13'||yf=='23'){
+ this.setData({
+ foodList3:items
+ })
+ console.log('list3',this.data.foodList3);
+ }else if(yf=='14'||yf=='24'){
+ this.setData({
+ foodList4:items
+ })
+ console.log('list4',this.data.foodList4);
+ }
+ console.log('list');
+ // if(this.foodList[i].add == 0){
+ // this.foodList[i].love = 0;
+ // }
+ },
saveFoodlist(){
var that = this;
+ let listss=that.data.foodList
+ if(that.data.hospitalId==666668&&(that.data.yl<5||that.data.yl>23)){
+ networkUtil.showErrorToast('孩子目前还未到六月龄')
+ return
+ }
this.setData({
show : true
})
+ if(that.data.hospitalId==666668){
+ listss=[...that.data.foodList1,...that.data.foodList2,...that.data.foodList3,...that.data.foodList4]
+ }
networkUtil._post(api.setFootList,{
hospitalId:this.data.hospitalId,
pid:this.data.pid,
- diets:this.data.foodList
+ diets:listss
},(res) => {
if(0 == res.data.errorcode){
this.getList();
@@ -268,6 +399,17 @@ Page({
item.createTime = exchgeDate.getYearMD(item.createTime )
});
console.log(data)
+ let ss=[]
+ if(res.data.data.length>0){
+ ss=res.data.data
+ ss.forEach((item,index)=>{
+ item.diets1=item.diets.slice(0,6)
+ item.diets2=item.diets.slice(6,14)
+ item.diets3=item.diets.slice(14,21)
+ item.diets4=item.diets.slice(21,24)
+ })
+ }
+ console.log('sss',ss);
this.setData({
array: res.data.data
})
@@ -296,9 +438,36 @@ Page({
hospitalId: app.globalData.userInfo.hospitalId,
pid:app.globalData.userInfo.pid,
})
+ var list1=this.data.foodList.slice(0,6)
+ var list2=this.data.foodList.slice(6,14)
+ var list3=this.data.foodList.slice(14,21)
+ var list4=this.data.foodList.slice(21,24)
+ this.setData({
+ foodList1:list1,
+ foodList2:list2,
+ foodList3:list3,
+ foodList4:list4
+ })
+ if(app.globalData.userInfo.hospitalId==666668){
+ if(app.globalData.userInfo.monthage.includes("月")){
+ let yl=this.getLeadingNumbers(app.globalData.userInfo.monthage)
+ console.log('月龄',yl);
+ this.setData({
+ yl:yl
+ })
+ }
+ }
this.getList();
},
-
+ getLeadingNumbers(str) {
+ // const match = str.match(/\d+$/);
+ const match = str.match(/^\d+/);
+ return match ? match[0] : null;
+ },
+ getLeadingNumbers1(str) {
+ const match = str.match(/\d+$/);
+ return match ? match[0] : null;
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/littleApp_child/pages/diet/measuret.wxml b/littleApp_child/pages/diet/measuret.wxml
index e0bd8f7..df66279 100644
--- a/littleApp_child/pages/diet/measuret.wxml
+++ b/littleApp_child/pages/diet/measuret.wxml
@@ -14,7 +14,7 @@
表示爱吃
-
+
@@ -25,13 +25,100 @@
+
+ 六月龄膳食调查
+
+
+
+
+
+
+ {{foodListNames1[$index]}}
+
+
+ 七月龄膳食调查
+
+
+
+
+
+
+ {{foodListNames2[$index]}}
+
+
+ 八月龄膳食调查
+
+
+
+
+
+
+ {{foodListNames3[$index]}}
+
+
+ 1
+ 九月龄膳食调查
+
+
+
+
+
+
+ {{foodListNames4[$index]}}
+
+
+
查看历史报告
-
+
+
+
+ 录入时间:{{item.createTime||yyyy/mm/dd}}
+
+
+ 六月龄膳食调查
+
+
+
+
+
+ {{foodListNames1[$index]}}
+
+ 七月龄膳食调查
+
+
+
+
+
+ {{foodListNames2[$index]}}
+
+ 1
+ 八月龄膳食调查
+
+
+
+
+
+ {{foodListNames3[$index]}}
+
+ 1
+ 九月龄膳食调查
+
+
+
+
+
+ {{foodListNames4[$index]}}
+
+
+
+
+
+
录入时间:{{item.createTime||yyyy/mm/dd}}