Commit 97af6b10 authored by 张杰's avatar 张杰

家长首页数据填充

parent 9307bb35
......@@ -26,6 +26,123 @@ Page({
"wc_pee": "小便",
"wc_poo": "便",
"wc_diaper": "换尿布"
},
eatStates: {
"less": "少",
"normal": "正常",
"more": "多"
},
testData: {
"paging": {
"page": 0,
"pageSize": 15,
"pageCount": 1,
"recordCount": 2
},
"records": [
{
"teacher": null,
"recordDate": "2018-12-25 00:00:00",
"pictures": "4028e38165fac6cb0165fac9d151000a,4028e38165fac6cb0165fac9d314000b,",
"dietRecord": [
{
"id": "4028048267c974b60167c974b6c00000",
"createName": null,
"createBy": null,
"createDate": null,
"updateName": null,
"updateBy": null,
"updateDate": "2018-12-24 14:25:40",
"sysOrgCode": null,
"sysCompanyCode": null,
"recordCategory": "diet",
"recordType": "diet_morning",
"eatState": "more",
"value": null,
"signSummaryId": "4028048267e4213c0167e423f84f0002"
},
{
"id": "4028048267c974b60167c9751bd30001",
"createName": null,
"createBy": null,
"createDate": null,
"updateName": "管理员",
"updateBy": "admin",
"updateDate": "2018-12-20 10:33:20",
"sysOrgCode": null,
"sysCompanyCode": null,
"recordCategory": "diet",
"recordType": "diet_afternoon",
"eatState": "normal",
"value": null,
"signSummaryId": "4028048267e4213c0167e423f84f0002"
},
{
"id": "4028048267c974b60167c97660120002",
"createName": "管理员",
"createBy": "admin",
"createDate": "2018-12-20 10:33:57",
"updateName": null,
"updateBy": null,
"updateDate": null,
"sysOrgCode": "A03",
"sysCompanyCode": "A03",
"recordCategory": "diet",
"recordType": "diet_milk",
"eatState": "normal",
"value": "300",
"signSummaryId": "4028048267e4213c0167e423f84f0002"
}
],
"sleepRecord": [
{
"id": "4028048267c974b60167c976bc210003",
"createName": "管理员",
"createBy": "admin",
"createDate": "2018-12-20 10:34:21",
"updateName": null,
"updateBy": null,
"updateDate": null,
"sysOrgCode": "A03",
"sysCompanyCode": "A03",
"recordCategory": "sleep",
"recordType": "sleep_time",
"eatState": "normal",
"value": "60",
"signSummaryId": "4028048267e4213c0167e423f84f0002"
}
],
"wcRecord": [
{
"id": "4028048267c974b60167c97706930004",
"createName": "管理员",
"createBy": "admin",
"createDate": "2018-12-20 10:34:40",
"updateName": "管理员",
"updateBy": "admin",
"updateDate": "2018-12-20 10:43:55",
"sysOrgCode": "A03",
"sysCompanyCode": "A03",
"recordCategory": "wc",
"recordType": "wc_pee",
"eatState": "normal",
"value": "3",
"signSummaryId": "4028048267e4213c0167e423f84f0002"
}
]
},
{
"teacher": null,
"recordDate": "2018-12-21 00:00:00",
"pictures": null,
"dietRecord": [
],
"sleepRecord": [
],
"wcRecord": [
]
}
]
}
},
......@@ -34,22 +151,27 @@ Page({
*/
onLoad: function(options) {
const that = this
let resData = this.data.testData
request.queryStudentRecord(that.data.page, that.data.pageSize, '4028048267c0236e0167c02b63100004').then(res => {
console.log(res)
var record = res['records']
var record = resData['records']
var templist = this.data.records
for (var i = 0; i < record.length; i++) {
var item = record[i]
var dateStr = item.recordDate.substr(0, 10)
let show_day = new Array('周日', '周一', '周二', '周三', '周四', '周五', '周六');
let date = new Date(dateStr);
var num = date.getDay()
item.recordDate = dateStr + " " + show_day[date.getDay()]
// 饮食
var dietRecords = item['dietRecord']
for (var j = 0; j < dietRecords.length; j++) {
var diet = dietRecords[j]
diet.z_recordType = that.data.recordTypes[diet.recordType]
diet.z_eatState = that.data.eatStates[diet.eatState]
}
// 睡觉
......@@ -57,6 +179,7 @@ Page({
for (var j = 0; j < sleepRecord.length; j++) {
var r = sleepRecord[j]
r.z_recordType = that.data.recordTypes[r.recordType]
}
// wc
......@@ -64,6 +187,7 @@ Page({
for (var j = 0; j < wcRecord.length; j++) {
var r = wcRecord[j]
r.z_recordType = that.data.recordTypes[r.recordType]
}
console.log(item)
......@@ -73,10 +197,52 @@ Page({
this.setData({
records: templist,
page: res['paging']['page']
page: resData['paging']['page']
})
})
// request.queryStudentRecord(that.data.page, that.data.pageSize, '4028048267c0236e0167c02b63100004').then(res => {
// console.log(res)
// let resData = this.data.testData
// var record = resData['records']
// var templist = this.data.records
// for (var i = 0; i < record.length; i++) {
// var item = record[i]
// // 饮食
// var dietRecords = item['dietRecord']
// for (var j = 0; j < dietRecords.length; j++) {
// var diet = dietRecords[j]
// diet.z_recordType = that.data.recordTypes[diet.recordType]
// }
// // 睡觉
// var sleepRecord = item["sleepRecord"]
// for (var j = 0; j < sleepRecord.length; j++) {
// var r = sleepRecord[j]
// r.z_recordType = that.data.recordTypes[r.recordType]
// }
// // wc
// var wcRecord = item["wcRecord"]
// for (var j = 0; j < wcRecord.length; j++) {
// var r = wcRecord[j]
// r.z_recordType = that.data.recordTypes[r.recordType]
// }
// console.log(item)
// templist.push(item)
// }
// this.setData({
// records: templist,
// page: resData['paging']['page']
// })
// })
},
......
......@@ -18,7 +18,7 @@
<view class='kg-quantity-cell timeline-content'>
<view class='kg-flex-row' style='margin-bottom:20rpx;'>
<text class='kg-text-title'>{{item.recordDate}}</text>
<text class='kg-text-normal-gray'>{{item.teacher}}记录</text>
<text class='kg-text-normal-gray'>{{item.teacher ? item.teacher : ""}}记录</text>
</view>
......@@ -29,7 +29,7 @@
</view>
<view class='kg-flex-row timeline-content-detail'>
<text class='kg-text-normal-gray'>{{dietItem.z_recordType}}</text>
<text class='kg-text-normal-gray'>正常</text>
<text class='kg-text-normal-gray'>{{dietItem.z_eatState}}</text>
</view>
</view>
......@@ -59,14 +59,14 @@
</view>
</view>
<view class='kg-separater' style='height:2rpx;margin-left:80rpx;margin-right:0rpx;'></view>
<!-- <view class='kg-separater' style='height:2rpx;margin-left:80rpx;margin-right:0rpx;'></view> -->
<!-- 今日照片 -->
<template is='imgTextView' data="{{img:'today',text:'今日照片'}}"> </template>
<!-- <template is='imgTextView' data="{{img:'today',text:'今日照片'}}"> </template>
<view class='home-student-picture-item' style='margin-left:40rpx;'>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
</view>
</view> -->
</view>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment