Commit 3fdca63e authored by SmileFei's avatar SmileFei

合并冲突

parents bff2c303 f9b785b5
...@@ -24,10 +24,10 @@ module.exports = { ...@@ -24,10 +24,10 @@ module.exports = {
classId: classId, classId: classId,
studentIds: studentIds studentIds: studentIds
} }
return request.post('/preschool/wxsite/teacher/signin.do', params) return request.post('/preschool/wxsite/teacher/signin.do', params)
}, },
//根据签到表Id获取记录明细 //根据签到表Id获取记录明细
getRecordDetailForSignId(signSummaryId) { getRecordDetailForSignId(signSummaryId) {
var params = { var params = {
...@@ -36,6 +36,16 @@ module.exports = { ...@@ -36,6 +36,16 @@ module.exports = {
return request.get('/preschool/wxsite/teacher/getRecordDetailForSignId.do', params) return request.get('/preschool/wxsite/teacher/getRecordDetailForSignId.do', params)
}, },
//根据记录类型查询记录流水, 在记录的时候是否需要先查询下当天的之前的记录
queryRecordList(recordCategory, recordType, signSummaryIds) {
var params = {
recordCategory: recordCategory,
recordType: recordType,
signSummaryIds: signSummaryIds
}
return request.post('/preschool/wxsite/teacher/queryRecordList.do', params)
},
//审核签到汇总表 //审核签到汇总表
auditSignSummary(signSummaryId) { auditSignSummary(signSummaryId) {
return request.post('/preschool/wxsite/teacher/auditSignSummary.do?signSummaryId=' + signSummaryId) return request.post('/preschool/wxsite/teacher/auditSignSummary.do?signSummaryId=' + signSummaryId)
......
...@@ -36,7 +36,20 @@ App({ ...@@ -36,7 +36,20 @@ App({
globalData: { globalData: {
userInfo: null, userInfo: null,
//一些默认值 //一些默认值
operate_btn_height: 80 operate_btn_height: 80,
recordTypes: {
"diet_morning": '早餐',
"diet_afternoon": "午餐",
"diet_evening": "晚餐",
"diet_morning_more": "上午加餐",
"diet_afternoon_more": "下午加餐",
"diet_water": "喝水",
"diet_milk": "饮用牛奶",
"sleep_time": "睡觉时间",
"wc_pee": "小便",
"wc_poo": "便",
"wc_diaper": "换尿布"
},
} }
}) })
\ No newline at end of file
// pages/add_record/index.js // pages/add_record/index.js
Page({
const req = require('../../api/teacher.js')
const app = getApp()
Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
radioValues: [ radioValues: [{
{ 'value': '饮食', 'selected': true }, 'value': '饮食',
{ 'value': '睡觉', 'selected': false }, 'code': 'diet',
{ 'value': 'WC', 'selected': false }, 'selected': true
},
{
'value': '睡觉',
'code': 'sleep',
'selected': false
},
{
'value': 'WC',
'code': 'wc',
'selected': false
},
], ],
clazz: [], clazz: [],
controlIndex:0, studentIds:[],
categorys: ['早餐', '午餐', '晚餐', '上午加餐', '下午加餐', '喝水', '牛奶'], controlIndex: 0,
selectIndex:0, categoryCode: ['diet_morning', 'diet_afternoon', 'diet_evening', 'diet_morning_more', 'diet_afternoon_more', 'diet_water', 'diet_milk'],
categorys: [],
typeIndex: 0,
inputModel: [ inputModel: [
], ],
selectPic: [] selectPic: [],
recordTypes: app.globalData.recordTypes,
eatCellTags: {},
//获取到的数据
eatRecord:[],
sleepRecord:[],
wcRecord:[]
}, },
//添加图片 //添加图片
...@@ -28,7 +51,7 @@ Page({ ...@@ -28,7 +51,7 @@ Page({
wx.chooseImage({ wx.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) { success: function(res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
for (var i in res.tempFilePaths) { for (var i in res.tempFilePaths) {
that.data.selectPic.push(res.tempFilePaths[i]) that.data.selectPic.push(res.tempFilePaths[i])
...@@ -40,7 +63,7 @@ Page({ ...@@ -40,7 +63,7 @@ Page({
}) })
}, },
previewPic:function(e) { previewPic: function(e) {
var current = this.data.selectPic[e.target.dataset.index] var current = this.data.selectPic[e.target.dataset.index]
wx.previewImage({ wx.previewImage({
current: current, current: current,
...@@ -49,28 +72,30 @@ Page({ ...@@ -49,28 +72,30 @@ Page({
}, },
//删除图片 //删除图片
deleteImg:function(e) { deleteImg: function(e) {
var that = this var that = this
that.data.selectPic.splice(e.currentTarget.dataset.index,1) that.data.selectPic.splice(e.currentTarget.dataset.index, 1)
that.setData({ that.setData({
selectPic: that.data.selectPic selectPic: that.data.selectPic
}) })
}, },
//选择小分类
tapCategory: function(e) { tapType: function(e) {
this.setData({ this.setData({
selectIndex: e.target.dataset.index, typeIndex: e.target.dataset.index,
}) })
this.getRecord()
}, },
indexChanged: function(e){ indexChanged: function(e) {
// 点中的是组中第个元素 // 点中的是组中第个元素
var index = e.target.dataset.index; var index = e.target.dataset.index;
// 读取原始的数组 // 读取原始的数组
var radioValues = this.data.radioValues; var radioValues = this.data.radioValues;
for (var i = 0; i < radioValues.length; i++){ for (var i = 0; i < radioValues.length; i++) {
// 全部改为非选中 // 全部改为非选中
radioValues[i].selected = false; radioValues[i].selected = false;
// 当前那个改为选中 // 当前那个改为选中
...@@ -85,18 +110,152 @@ Page({ ...@@ -85,18 +110,152 @@ Page({
}); });
// clazz状态 // clazz状态
this.clazzStatus(); this.clazzStatus();
this.getRecord()
},
// 初始化分类数据
configCategory: function() {
var categorys = this.data.categorys
for (var i = 0; i < this.data.categoryCode.length; i++) {
let category = this.data.recordTypes[this.data.categoryCode[i]]
categorys.push(category)
}
this.setData({
categorys: categorys
})
}, },
onLoad: function(){
getRecord: function() {
let studentIds = this.data.studentIds
console.log(studentIds)
let category = this.data.radioValues[this.data.controlIndex].code
let type = ''
if(this.data.controlIndex == 0) {
type = this.data.categoryCode[this.data.typeIndex]
}
req.queryRecordList(category, type, studentIds).then(res => {
console.log(res)
var eatCellTags = this.data.eatCellTags
var optionTag = ['diet_morning', 'diet_afternoon', 'diet_evening', 'diet_morning_more', 'diet_afternoon_more']
for (var i = 0; i < res.length; i++) {
var item = res[i]
if (item.recordItems.length == 0) {
//没有记录时, 自动生成一条
var r = {}
r.recordType = type
r.recordCategory = category
item.recordItems.push(r)
}
for (var k = 0; k < item.recordItems.length; k++) {
var r = item.recordItems[k]
if (r.recordCategory == 'sleep') {
r.cellType = 'input'
r.cellUnit = '分钟'
break
}
if (r.recordCategory == 'wc') {
r.cellType = 'select'
r.cellOptions = ['pee', 'poo', 'diaper']
break
}
if (r.recordType == 'diet_milk') {
r.cellType = 'input'
r.cellUnit = '毫升'
break
}
if (r.recordType == 'diet_water') {
r.cellType = 'input'
r.cellUnit = '次'
break
}
for (var j = 0, len = optionTag.length; j < len; j++) {
var tag = optionTag[j]
if (r.recordType == tag) {
r.cellType = 'select'
r.cellOptions = ['少', '正常', '多']
break
}
}
}
}
if (this.data.controlIndex == 0) {
this.setData({
eatRecord: res
})
} else if (this.data.controlIndex == 1) {
this.setData({
sleepRecord: res
})
} else if (this.data.controlIndex == 2) {
this.setData({
wcRecord: res
})
}
})
},
quantityCellTap: function (e) {
console.log(e.currentTarget.dataset.optionindex)
let records
if (this.data.controlIndex == 0) {
records = this.data.eatRecord
} else if (this.data.controlIndex == 1) {
records = this.data.sleepRecord
} else if (this.data.controlIndex == 2) {
records = this.data.wcRecord
}
for (var i = 0; i < records.length; i++) {
var item = records[i].recordItems[0]
item.optionIndex = e.currentTarget.dataset.optionindex
}
if (this.data.controlIndex == 0) {
this.setData({
eatRecord: records
})
} else if (this.data.controlIndex == 1) {
this.setData({
sleepRecord: records
})
} else if (this.data.controlIndex == 2) {
this.setData({
wcRecord: records
})
}
},
onLoad: function(options) {
this.data.studentIds = JSON.parse(options.studentIds)
// onLoad 比 onReady 更早调用,后者为选中时屏幕闪动一下 // onLoad 比 onReady 更早调用,后者为选中时屏幕闪动一下
this.clazzStatus(); this.clazzStatus();
//分类数据
this.configCategory()
//获取选中的分类的记录
this.getRecord()
}, },
clazzStatus: function(){ clazzStatus: function() {
/* 此方法分别被加载时调用,点击某段时调用 */ /* 此方法分别被加载时调用,点击某段时调用 */
// class样式表如"selected last","selected" // class样式表如"selected last","selected"
var clazz = []; var clazz = [];
// 参照数据源 // 参照数据源
var radioValues = this.data.radioValues; var radioValues = this.data.radioValues;
for (var i = 0; i < radioValues.length; i++){ for (var i = 0; i < radioValues.length; i++) {
// 默认为空串,即普通按钮 // 默认为空串,即普通按钮
var cls = ''; var cls = '';
// 高亮,追回selected // 高亮,追回selected
...@@ -108,7 +267,7 @@ Page({ ...@@ -108,7 +267,7 @@ Page({
cls += 'last '; cls += 'last ';
} }
//去掉尾部空格 //去掉尾部空格
cls = cls.replace(/(\s*$)/g,''); cls = cls.replace(/(\s*$)/g, '');
clazz[i] = cls; clazz[i] = cls;
} }
...@@ -122,49 +281,49 @@ Page({ ...@@ -122,49 +281,49 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
} }
}) })
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<!-- 分类选项 --> <!-- 分类选项 -->
<view class="category"> <view class="category">
<view wx:for="{{categorys}}"> <view wx:for="{{categorys}}">
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tapCategory' data-index='{{index}}'> <view class="eat_category_btn {{typeIndex == index ? 'selected' : ''}}" bindtap='tapType' data-index='{{index}}'>
{{item}} {{item}}
</view> </view>
</view> </view>
...@@ -23,15 +23,14 @@ ...@@ -23,15 +23,14 @@
<view class='kg-separater'></view> <view class='kg-separater'></view>
<!-- 数量 --> <!-- 数量 -->
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view wx:for="{{eatRecord}}">
<view wx:for="{{item.recordItems}}" wx:for-item="r">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'input',unit:'毫升'}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template>
</view> </view>
<view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'input',unit:'毫升'}}"></template>
</view> </view>
<view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'select',options:['少','正常','多多']}}"></template>
</view> </view>
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
<template is="section_header" data="{{title:'今日拍照'}}"></template> <template is="section_header" data="{{title:'今日拍照'}}"></template>
...@@ -56,11 +55,12 @@ ...@@ -56,11 +55,12 @@
<!-- 滑动区域 --> <!-- 滑动区域 -->
<scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'> <scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view wx:for="{{sleepRecord}}">
<view wx:for="{{item.recordItems}}" wx:for-item="r">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'input',unit:'分钟'}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template>
</view>
</view> </view>
<view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'input',unit:'分钟'}}"></template>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -70,9 +70,12 @@ ...@@ -70,9 +70,12 @@
<view hidden='{{controlIndex != 2}}'> <view hidden='{{controlIndex != 2}}'>
<scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'> <scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view wx:for="{{wcRecord}}">
<view wx:for="{{item.recordItems}}" wx:for-item="r">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{type:'select',options:['pee','poo','diaper']}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template>
<text class='kg-text-normal-gray' style='margin-top:30rpx' space="ensp">pee: 4次 poo: 1次 diaper: 9次</text> </view>
</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
......
// pages/home/parents/index.js // pages/home/parents/index.js
const request = require('../../../api/parrent.js') const request = require('../../../api/parrent.js')
const app = getApp()
Page({ Page({
...@@ -13,20 +13,7 @@ Page({ ...@@ -13,20 +13,7 @@ Page({
page: 0, page: 0,
pageSize: 15, pageSize: 15,
records: [], records: [],
recordTypes: { recordTypes: app.globalData.recordTypes,
"diet_morning": '早餐',
"diet_afternoon": "午餐",
"diet_milk": "牛奶",
"diet_evening": "晚餐",
"diet_morning_more": "上午加餐",
"diet_afternoon_more": "下午加餐",
"diet_water": "喝水",
"diet_milk": "饮用牛奶",
"sleep_time": "睡觉时间",
"wc_pee": "小便",
"wc_poo": "便",
"wc_diaper": "换尿布"
},
eatStates: { eatStates: {
"less": "少", "less": "少",
"normal": "正常", "normal": "正常",
......
...@@ -31,7 +31,7 @@ Page({ ...@@ -31,7 +31,7 @@ Page({
let selected = !e.currentTarget.dataset.check let selected = !e.currentTarget.dataset.check
let tags = this.data.selectTags let tags = this.data.selectTags
tags[e.currentTarget.dataset.index] = selected tags[e.currentTarget.dataset.cellindex] = selected
this.setData({ this.setData({
selectTags: tags selectTags: tags
}) })
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view wx:for="{{records}}"> <view wx:for="{{records}}">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', index:index,checked:selectTags[index]}}"></template> <template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', cellIndex:index, checked:selectTags[index]}}"></template>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -7,20 +7,29 @@ Page({ ...@@ -7,20 +7,29 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
signIcon:"/src/img/signin.png", signIcon: "/src/img/signin.png",
userIcon:"/src/img/defaut_teacher_icon.png", userIcon: "/src/img/defaut_teacher_icon.png",
records:[], records: [],
}, },
operateTap: function (event) { tapCell: function(e) {
console.log(e)
let studentId = e.currentTarget.dataset.studentid
wx.navigateTo({
url: '/pages/add_record/index?studentIds=' + JSON.stringify([studentId]),
})
},
operateTap: function(event) {
console.log(event._relatedInfo.anchorTargetText) console.log(event._relatedInfo.anchorTargetText)
wx.navigateTo({ wx.navigateTo({
url: '/pages/add_record/index', url: '/pages/add_record/index',
}) })
}, },
signTap: function (e) { signTap: function(e) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/home/sign/index', url: '/pages/home/sign/index',
}) })
...@@ -29,7 +38,7 @@ Page({ ...@@ -29,7 +38,7 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
// 设置日期 // 设置日期
let date = new Date() let date = new Date()
let dateStr = utils.formatDate(date) let dateStr = utils.formatDate(date)
...@@ -39,12 +48,12 @@ Page({ ...@@ -39,12 +48,12 @@ Page({
request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").then(res =>{ request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").then(res => {
console.log(res) console.log(res)
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
var item = res[i] var item = res[i]
item.signDate = item.signDate.substr(0,10) item.signDate = item.signDate.substr(0, 10)
} }
this.setData({ this.setData({
records: res records: res
...@@ -59,49 +68,49 @@ Page({ ...@@ -59,49 +68,49 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
} }
}) })
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<scroll-view style='height:calc(100vh - 200rpx - 140rpx)' scroll-y='true'> <scroll-view style='height:calc(100vh - 200rpx - 140rpx)' scroll-y='true'>
<template is="section_header" data="{{title:dateStr}}"></template> <template is="section_header" data="{{title:dateStr}}"></template>
<view wx:for="{{records}}"> <view wx:for="{{records}}">
<view class='home-student-info'> <view class='home-student-info' bindtap='tapCell' data-studentId='{{item.id}}'>
<!-- 名字 --> <!-- 名字 -->
<view class='home-student-name'> <view class='home-student-name'>
<view class='kg-text-normal-dark'>{{item.signStudentName}}</view> <view class='kg-text-normal-dark'>{{item.signStudentName}}</view>
......
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
<view wx:if="{{type == 'select'}}"> <view wx:if="{{type == 'select'}}">
<!-- 选择型cell --> <!-- 选择型cell -->
<view class='kg-flex-row'> <view class='kg-flex-row'>
<view wx:for="{{options}}"> <view wx:for="{{options}}" wx:for-index="optionIndex">
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tap' data-index='{{index}}' style='width: 120rpx;margin-right: 0rpx;margin-bottom: 0rpx;margin-left:20rpx;'>{{item}}</view> <view class="eat_category_btn {{selectOptionIndex == optionIndex ? 'selected' : ''}}" bindtap='quantityCellTap' data-optionIndex='{{optionIndex}}' data-cellIndex='{{cellIndex}}' style='width: 120rpx;margin-right: 0rpx;margin-bottom: 0rpx;margin-left:20rpx;'>{{item}}</view>
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{type == 'check'}}"> <view wx:if="{{type == 'check'}}">
<!-- 选择型cell --> <!-- 选择型cell -->
<image src="{{checked == true ? '/src/img/btn_selected.png' : '/src/img/btn_unselected.jpg'}}" style="height:20px; width:20px;margin-right:4px;" bindtap='tapBox' data-index="{{index}}" data-check='{{checked}}'></image> <image src="{{checked == true ? '/src/img/btn_selected.png' : '/src/img/btn_unselected.jpg'}}" style="height:20px; width:20px;margin-right:4px;" bindtap='tapBox' data-cellIndex="{{cellIndex}}" data-check='{{checked}}'></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