Commit bc884846 authored by 张杰's avatar 张杰

带班老师添加记录(图片上传还没好)

parent ea75c4da
...@@ -9,6 +9,6 @@ module.exports = { ...@@ -9,6 +9,6 @@ module.exports = {
pageSize: pageSize, pageSize: pageSize,
studentId: studentId studentId: studentId
} }
return request.post('/preschool/wxsite/parents/queryStudentRecord.do', params) return request.post('/wxsite/parents/queryStudentRecord.do', params)
} }
} }
...@@ -11,8 +11,8 @@ const ERR_NOT_ACCESS_TOKEN = 21; ...@@ -11,8 +11,8 @@ const ERR_NOT_ACCESS_TOKEN = 21;
var DEF_APP_CONFIG = { var DEF_APP_CONFIG = {
appId: "wxfc3355043e579968", // 勾芒小程序测试号 appId: "wxfc3355043e579968", // 勾芒小程序测试号
// 开发环境 // 开发环境
domain: 'http://192.168.1.130:8080', domain: 'http://192.168.1.130:8080/preschool',
baseUrl: "http://192.168.1.130:8080" baseUrl: "http://192.168.1.130:8080/preschool"
// 川哥本地环境 // 川哥本地环境
// domain: 'http://192.168.199.198:8080', // domain: 'http://192.168.199.198:8080',
// baseUrl: "http://192.168.199.198:8080/wxmall/wxsite", // baseUrl: "http://192.168.199.198:8080/wxmall/wxsite",
...@@ -115,7 +115,7 @@ module.exports.request = function (url, method = 'GET', data = {}, ...@@ -115,7 +115,7 @@ module.exports.request = function (url, method = 'GET', data = {},
} else { } else {
// 特别处理Access Token已过期的异常: 重新登录后重放请求 // 特别处理Access Token已过期的异常: 重新登录后重放请求
const postData = data; const postData = data;
self.login().then(data => { self.kg_login().then(data => {
self.request(url, method, postData, contentType, dataType) self.request(url, method, postData, contentType, dataType)
.then(function (data) { .then(function (data) {
resolve(data); resolve(data);
...@@ -239,7 +239,7 @@ function wx_getUserInfo() { ...@@ -239,7 +239,7 @@ function wx_getUserInfo() {
* @param decryptUserInfo 是否解密用户信息 * @param decryptUserInfo 是否解密用户信息
* @return 用户信息,如果返回的 #member字段为空,说明当前粉丝没有绑定手机号, 还不是会员。 * @return 用户信息,如果返回的 #member字段为空,说明当前粉丝没有绑定手机号, 还不是会员。
*/ */
module.exports.login = function (decryptUserInfo = true) { module.exports.kg_login = function (decryptUserInfo = true) {
var self = this; var self = this;
var loginCode = ''; var loginCode = '';
return wx_login() return wx_login()
......
...@@ -2,20 +2,30 @@ var request = require('./request.js') ...@@ -2,20 +2,30 @@ var request = require('./request.js')
module.exports = { module.exports = {
/**
* 用户登录
*
* @param decryptUserInfo 是否解密用户信息
* @return 用户信息,如果返回的 #member字段为空,说明当前粉丝没有绑定手机号, 还不是会员。
*/
kg_login(decryptUserInfo = true) {
return request.kg_login(decryptUserInfo)
},
querySignSummary(teacherId, classId) { querySignSummary(teacherId, classId) {
var params = { var params = {
teacherId: teacherId, teacherId: teacherId,
classId: classId classId: classId
} }
return request.get('/preschool/wxsite/teacher/querySignSummary.do', params) return request.get('/wxsite/teacher/querySignSummary.do', params)
}, },
// 获取所有学生 // 获取所有学生
getAllStudent(classId) { getAllStudent(classId) {
var params = { var params = {
classId: classId classId: classId
} }
return request.get('/preschool/wxsite/teacher/getAllStudent.do', params) return request.get('/wxsite/teacher/getAllStudent.do', params)
}, },
// 签到接口 // 签到接口
signIn(teacherId, classId, studentIds) { signIn(teacherId, classId, studentIds) {
...@@ -24,7 +34,7 @@ module.exports = { ...@@ -24,7 +34,7 @@ module.exports = {
classId: classId, classId: classId,
studentIds: studentIds studentIds: studentIds
} }
return request.post('/preschool/wxsite/teacher/signin.do', params) return request.post('/wxsite/teacher/signin.do', params)
}, },
...@@ -33,7 +43,7 @@ module.exports = { ...@@ -33,7 +43,7 @@ module.exports = {
var params = { var params = {
signSummaryId: signSummaryId signSummaryId: signSummaryId
} }
return request.get('/preschool/wxsite/teacher/getRecordDetailForSignId.do', params) return request.get('/wxsite/teacher/getRecordDetailForSignId.do', params)
}, },
//根据记录类型查询记录流水, 在记录的时候是否需要先查询下当天的之前的记录 //根据记录类型查询记录流水, 在记录的时候是否需要先查询下当天的之前的记录
...@@ -43,11 +53,19 @@ module.exports = { ...@@ -43,11 +53,19 @@ module.exports = {
recordType: recordType, recordType: recordType,
signSummaryIds: signSummaryIds signSummaryIds: signSummaryIds
} }
return request.post('/preschool/wxsite/teacher/queryRecordList.do', params) return request.post('/wxsite/teacher/queryRecordList.do', params)
}, },
//审核签到汇总表 //审核签到汇总表
auditSignSummary(signSummaryId) { auditSignSummary(signSummaryId) {
return request.post('/preschool/wxsite/teacher/auditSignSummary.do?signSummaryId=' + signSummaryId) return request.post('/wxsite/teacher/auditSignSummary.do?signSummaryId=' + signSummaryId)
}, },
// 添加、修改记录明细
setRecord(recordList) {
var params = {
recordList: recordList
}
return request.post('/wxsite/teacher/setRecord.do', params)
}
} }
\ No newline at end of file
...@@ -50,6 +50,11 @@ App({ ...@@ -50,6 +50,11 @@ App({
"wc_poo": "便", "wc_poo": "便",
"wc_diaper": "换尿布" "wc_diaper": "换尿布"
}, },
eatStates: {
"less": "少",
"normal": "正常",
"more": "多"
},
} }
}) })
\ No newline at end of file
...@@ -25,7 +25,7 @@ Page({ ...@@ -25,7 +25,7 @@ Page({
}, },
], ],
clazz: [], clazz: [],
studentIds:[], studentIds: [],
controlIndex: 0, controlIndex: 0,
categoryCode: ['diet_morning', 'diet_afternoon', 'diet_evening', 'diet_morning_more', 'diet_afternoon_more', 'diet_water', 'diet_milk'], categoryCode: ['diet_morning', 'diet_afternoon', 'diet_evening', 'diet_morning_more', 'diet_afternoon_more', 'diet_water', 'diet_milk'],
categorys: [], categorys: [],
...@@ -34,13 +34,17 @@ Page({ ...@@ -34,13 +34,17 @@ Page({
], ],
selectPic: [], selectPic: [],
/* 所有的小分类字典 */
recordTypes: app.globalData.recordTypes, recordTypes: app.globalData.recordTypes,
/* 吃饭类型的选项字典 */
eatStates: app.globalData.eatStates,
eatCellTags: {}, eatCellTags: {},
//获取到的数据 //获取到的数据
eatRecord:[], eatRecord: [],
sleepRecord:[], sleepRecord: [],
wcRecord:[] wcRecord: [],
hidePhoto: false
}, },
...@@ -127,13 +131,14 @@ Page({ ...@@ -127,13 +131,14 @@ Page({
}) })
}, },
// 调用接口获取数据
getRecord: function() { getRecord: function() {
let studentIds = this.data.studentIds let studentIds = this.data.studentIds
console.log(studentIds) console.log(studentIds)
let category = this.data.radioValues[this.data.controlIndex].code let category = this.data.radioValues[this.data.controlIndex].code
let type = '' let type = ''
if(this.data.controlIndex == 0) { if (this.data.controlIndex == 0) {
type = this.data.categoryCode[this.data.typeIndex] type = this.data.categoryCode[this.data.typeIndex]
} }
...@@ -160,11 +165,12 @@ Page({ ...@@ -160,11 +165,12 @@ Page({
break break
} }
if (r.recordCategory == 'wc') { // if (r.recordCategory == 'wc') {
r.cellType = 'select' // r.cellType = 'select'
r.cellOptions = ['pee', 'poo', 'diaper'] // r.cellOptions = ['pee', 'poo', 'diaper']
break
} // break
// }
if (r.recordType == 'diet_milk') { if (r.recordType == 'diet_milk') {
r.cellType = 'input' r.cellType = 'input'
...@@ -181,6 +187,8 @@ Page({ ...@@ -181,6 +187,8 @@ Page({
if (r.recordType == tag) { if (r.recordType == tag) {
r.cellType = 'select' r.cellType = 'select'
r.cellOptions = ['少', '正常', '多'] r.cellOptions = ['少', '正常', '多']
let eatStatus = Object.keys(this.data.eatStates)
r.optionIndex = eatStatus.indexOf(r.eatState)
break break
} }
} }
...@@ -196,6 +204,29 @@ Page({ ...@@ -196,6 +204,29 @@ Page({
sleepRecord: res sleepRecord: res
}) })
} else if (this.data.controlIndex == 2) { } else if (this.data.controlIndex == 2) {
for (var i = 0; i < res.length; i++) {
var item = res[i]
var pee = '0'
var poo = '0'
var diaper = '0'
item.cellType = 'select'
item.cellOptions = ['pee', 'poo', 'diaper']
for (var j = 0; j < item.recordItems.length; j++) {
var r = item.recordItems[j]
if (r.recordType == 'wc_pee') {
pee = r.value
} else if (r.recordType == 'wc_poo') {
poo = r.value
} else if (r.recordType == 'wc_diaper') {
diaper = r.value
}
console.log('pee ' + pee + ' poo ' + poo + ' diaper ' + diaper)
}
let wcString = 'pee ' + pee + ' poo ' + poo + ' diaper ' + diaper
item.wcString = wcString
}
this.setData({ this.setData({
wcRecord: res wcRecord: res
}) })
...@@ -203,23 +234,45 @@ Page({ ...@@ -203,23 +234,45 @@ Page({
}) })
}, },
// 点击cell上面的选项的点击事件
quantityCellTap: function(e) {
console.log(e.currentTarget.dataset)
let optionIndex = e.currentTarget.dataset.optionindex
let cellIndex = e.currentTarget.dataset.cellindex
let records = this.getCurrentRecord()
var item = records[cellIndex].recordItems[0]
if (this.data.controlIndex == 2) {
records[cellIndex].optionIndex = e.currentTarget.dataset.optionindex
}else{
item.optionIndex = e.currentTarget.dataset.optionindex
}
quantityCellTap: function (e) {
console.log(e.currentTarget.dataset.optionindex)
let records
if (this.data.controlIndex == 0) { if (this.data.controlIndex == 0) {
records = this.data.eatRecord this.setData({
eatRecord: records
})
} else if (this.data.controlIndex == 1) { } else if (this.data.controlIndex == 1) {
records = this.data.sleepRecord this.setData({
sleepRecord: records
})
} else if (this.data.controlIndex == 2) { } else if (this.data.controlIndex == 2) {
records = this.data.wcRecord this.setData({
} wcRecord: records
})
for (var i = 0; i < records.length; i++) {
var item = records[i].recordItems[0]
item.optionIndex = e.currentTarget.dataset.optionindex
} }
},
// cell上面的输入事件
bindKeyInput: function(e) {
let value = e.detail.value
let cellIndex = e.currentTarget.dataset.cellindex
console.log(e)
let records = this.getCurrentRecord()
var item = records[cellIndex].recordItems[0]
item.value = value
if (this.data.controlIndex == 0) { if (this.data.controlIndex == 0) {
this.setData({ this.setData({
eatRecord: records eatRecord: records
...@@ -235,10 +288,93 @@ Page({ ...@@ -235,10 +288,93 @@ Page({
} }
}, },
// 返回当前点击的大类的数据
getCurrentRecord: function() {
var arrRecord = []
if (this.data.controlIndex == 0) {
arrRecord = this.data.eatRecord
} else if (this.data.controlIndex == 1) {
arrRecord = this.data.sleepRecord
} else if (this.data.controlIndex == 2) {
arrRecord = this.data.wcRecord;
}
return arrRecord
},
// 点击底部的保存按钮
operateTap: function(event) {
console.log(event._relatedInfo.anchorTargetText)
var arrRecord = []
if (this.data.controlIndex == 0) {
arrRecord = this.data.eatRecord
} else if (this.data.controlIndex == 1) {
arrRecord = this.data.sleepRecord
} else if (this.data.controlIndex == 2) {
arrRecord = this.data.wcRecord;
}
var arrRecordList = []
let eatStatus = Object.keys(this.data.eatStates)
let wcStatus = ["wc_pee", "wc_poo", "wc_diaper"]
for (var i = 0; i < arrRecord.length; i++) {
var item = arrRecord[i]
if (this.data.controlIndex == 2 && item.optionIndex != null) {
var wcType = wcStatus[item.optionIndex]
var r = null
for (var j = 0; j < item.recordItems.length; j++) {
if (item.recordItems[j].recordType == wcType) {
r = item.recordItems[j]
}
}
if (!r) {
r = {}
r.recordType = wcType
r.recordCategory = "wc"
r.value = '0';
item.recordItems.push(r)
}
r.value = (parseInt(r.value) + 1).toString()
}
for (var j = 0; j < item.recordItems.length; j++) {
var recordItem = item.recordItems[j]
var value = recordItem.value;
let addRecord = {
"id": recordItem.id,
"createName": recordItem.createName,
"createBy": recordItem.createBy,
"createDate": recordItem.createDate,
"updateName": recordItem.updateName,
"updateBy": recordItem.updateBy,
"updateDate": recordItem.updateDate,
"sysOrgCode": recordItem.sysOrgCode,
"sysCompanyCode": recordItem.sysCompanyCode,
"recordCategory": recordItem.recordCategory,
"recordType": recordItem.recordType,
"eatState": eatStatus[recordItem.optionIndex],
"value": value,
"signSummaryId": item.signSummaryId
}
arrRecordList.push(addRecord)
}
}
req.setRecord(arrRecordList).then(res => {
this.getRecord()
})
},
onLoad: function(options) { onLoad: function (options) {
this.data.studentIds = JSON.parse(options.studentIds) this.data.studentIds = JSON.parse(options.studentIds)
console.log(this.data.studentIds) console.log(this.data.studentIds)
if (this.data.studentIds.length > 1) {
this.setData({
hidePhoto: true
})
}
// onLoad 比 onReady 更早调用,后者为选中时屏幕闪动一下 // onLoad 比 onReady 更早调用,后者为选中时屏幕闪动一下
this.clazzStatus(); this.clazzStatus();
...@@ -246,10 +382,8 @@ Page({ ...@@ -246,10 +382,8 @@ Page({
this.configCategory() this.configCategory()
//获取选中的分类的记录 //获取选中的分类的记录
this.getRecord() this.getRecord()
}, },
clazzStatus: function() { clazzStatus: function() {
/* 此方法分别被加载时调用,点击某段时调用 */ /* 此方法分别被加载时调用,点击某段时调用 */
// class样式表如"selected last","selected" // class样式表如"selected last","selected"
......
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
<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="{{eatRecord}}" wx:for-index="dietIndex">
<view wx:for="{{item.recordItems}}" wx:for-item="r"> <view wx:for="{{item.recordItems}}" wx:for-item="r">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex, cellIndex:dietIndex, inputValue:r.value}}"></template>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{!hidePhoto}}">
<view class='kg-separater'></view> <view class='kg-separater'></view>
<template is="section_header" data="{{title:'今日拍照'}}"></template> <template is="section_header" data="{{title:'今日拍照'}}"></template>
<view class='home-student-picture-item' style='padding-left:20rpx;padding-bottom:40rpx;'> <view class='home-student-picture-item' style='padding-left:20rpx;padding-bottom:40rpx;'>
...@@ -47,6 +48,8 @@ ...@@ -47,6 +48,8 @@
<image src='/src/img/take_photo.png' class='add_picture'></image> <image src='/src/img/take_photo.png' class='add_picture'></image>
</view> </view>
</view> </view>
</view>
</scroll-view> </scroll-view>
</view> </view>
...@@ -55,10 +58,10 @@ ...@@ -55,10 +58,10 @@
<!-- 滑动区域 --> <!-- 滑动区域 -->
<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="{{sleepRecord}}" wx:for-index="dietIndex">
<view wx:for="{{item.recordItems}}" wx:for-item="r"> <view wx:for="{{item.recordItems}}" wx:for-item="r">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex, cellIndex:dietIndex, inputValue:r.value}}"></template>
</view> </view>
</view> </view>
</view> </view>
...@@ -70,11 +73,12 @@ ...@@ -70,11 +73,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="{{wcRecord}}" wx:for-index="dietIndex">
<view wx:for="{{item.recordItems}}" wx:for-item="r"> <!-- <view wx:for="{{item.recordItems}}" wx:for-item="r"> -->
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.recordStudentName,type:r.cellType,unit:r.cellUnit, options: r.cellOptions, selectOptionIndex:r.optionIndex}}"></template> <template is='quantity_cell' data="{{title:item.recordStudentName,type:item.cellType,unit:item.cellUnit, options: item.cellOptions, selectOptionIndex:item.optionIndex, cellIndex:dietIndex, inputValue:item.value}}"></template>
</view> <view class='kg-text-normal-gray'>{{item.wcString}}</view>
<!-- </view> -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -14,11 +14,7 @@ Page({ ...@@ -14,11 +14,7 @@ Page({
pageSize: 15, pageSize: 15,
records: [], records: [],
recordTypes: app.globalData.recordTypes, recordTypes: app.globalData.recordTypes,
eatStates: { eatStates: app.globalData.eatStates,
"less": "少",
"normal": "正常",
"more": "多"
},
testData: { testData: {
"paging": { "paging": {
"page": 0, "page": 0,
......
...@@ -50,6 +50,8 @@ Page({ ...@@ -50,6 +50,8 @@ Page({
dateStr: dateStr dateStr: dateStr
}) })
request.kg_login()
request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").then(res => { request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").then(res => {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.4.0", "libVersion": "2.4.0",
"appid": "wx946944062df64d30", "appid": "wxfc3355043e579968",
"projectname": "Kindergarten", "projectname": "Kindergarten",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view wx:if="{{type == 'input'}}"> <view wx:if="{{type == 'input'}}">
<!-- 输入型cell --> <!-- 输入型cell -->
<view class='kg-flex-row'> <view class='kg-flex-row'>
<input class='kg-border' style='width:140rpx;margin-right:10rpx;'></input> <input class='kg-border' style='width:140rpx;margin-right:10rpx;' bindinput="bindKeyInput" data-cellIndex='{{cellIndex}}' value="{{inputValue}}"></input>
<view class='kg-text-normal-gray'>{{unit}}</view> <view class='kg-text-normal-gray'>{{unit}}</view>
</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