Commit bc884846 authored by 张杰's avatar 张杰

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

parent ea75c4da
......@@ -9,6 +9,6 @@ module.exports = {
pageSize: pageSize,
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;
var DEF_APP_CONFIG = {
appId: "wxfc3355043e579968", // 勾芒小程序测试号
// 开发环境
domain: 'http://192.168.1.130:8080',
baseUrl: "http://192.168.1.130:8080"
domain: 'http://192.168.1.130:8080/preschool',
baseUrl: "http://192.168.1.130:8080/preschool"
// 川哥本地环境
// domain: 'http://192.168.199.198:8080',
// baseUrl: "http://192.168.199.198:8080/wxmall/wxsite",
......@@ -115,7 +115,7 @@ module.exports.request = function (url, method = 'GET', data = {},
} else {
// 特别处理Access Token已过期的异常: 重新登录后重放请求
const postData = data;
self.login().then(data => {
self.kg_login().then(data => {
self.request(url, method, postData, contentType, dataType)
.then(function (data) {
resolve(data);
......@@ -239,7 +239,7 @@ function wx_getUserInfo() {
* @param decryptUserInfo 是否解密用户信息
* @return 用户信息,如果返回的 #member字段为空,说明当前粉丝没有绑定手机号, 还不是会员。
*/
module.exports.login = function (decryptUserInfo = true) {
module.exports.kg_login = function (decryptUserInfo = true) {
var self = this;
var loginCode = '';
return wx_login()
......
......@@ -2,20 +2,30 @@ var request = require('./request.js')
module.exports = {
/**
* 用户登录
*
* @param decryptUserInfo 是否解密用户信息
* @return 用户信息,如果返回的 #member字段为空,说明当前粉丝没有绑定手机号, 还不是会员。
*/
kg_login(decryptUserInfo = true) {
return request.kg_login(decryptUserInfo)
},
querySignSummary(teacherId, classId) {
var params = {
teacherId: teacherId,
classId: classId
}
return request.get('/preschool/wxsite/teacher/querySignSummary.do', params)
return request.get('/wxsite/teacher/querySignSummary.do', params)
},
// 获取所有学生
getAllStudent(classId) {
var params = {
classId: classId
}
return request.get('/preschool/wxsite/teacher/getAllStudent.do', params)
return request.get('/wxsite/teacher/getAllStudent.do', params)
},
// 签到接口
signIn(teacherId, classId, studentIds) {
......@@ -24,7 +34,7 @@ module.exports = {
classId: classId,
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 = {
var params = {
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 = {
recordType: recordType,
signSummaryIds: signSummaryIds
}
return request.post('/preschool/wxsite/teacher/queryRecordList.do', params)
return request.post('/wxsite/teacher/queryRecordList.do', params)
},
//审核签到汇总表
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({
"wc_poo": "便",
"wc_diaper": "换尿布"
},
eatStates: {
"less": "少",
"normal": "正常",
"more": "多"
},
}
})
\ No newline at end of file
......@@ -25,7 +25,7 @@ Page({
},
],
clazz: [],
studentIds:[],
studentIds: [],
controlIndex: 0,
categoryCode: ['diet_morning', 'diet_afternoon', 'diet_evening', 'diet_morning_more', 'diet_afternoon_more', 'diet_water', 'diet_milk'],
categorys: [],
......@@ -34,13 +34,17 @@ Page({
],
selectPic: [],
/* 所有的小分类字典 */
recordTypes: app.globalData.recordTypes,
/* 吃饭类型的选项字典 */
eatStates: app.globalData.eatStates,
eatCellTags: {},
//获取到的数据
eatRecord:[],
sleepRecord:[],
wcRecord:[]
eatRecord: [],
sleepRecord: [],
wcRecord: [],
hidePhoto: false
},
......@@ -126,14 +130,15 @@ Page({
categorys: categorys
})
},
// 调用接口获取数据
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) {
if (this.data.controlIndex == 0) {
type = this.data.categoryCode[this.data.typeIndex]
}
......@@ -160,11 +165,12 @@ Page({
break
}
if (r.recordCategory == 'wc') {
r.cellType = 'select'
r.cellOptions = ['pee', 'poo', 'diaper']
break
}
// if (r.recordCategory == 'wc') {
// r.cellType = 'select'
// r.cellOptions = ['pee', 'poo', 'diaper']
// break
// }
if (r.recordType == 'diet_milk') {
r.cellType = 'input'
......@@ -181,6 +187,8 @@ Page({
if (r.recordType == tag) {
r.cellType = 'select'
r.cellOptions = ['少', '正常', '多']
let eatStatus = Object.keys(this.data.eatStates)
r.optionIndex = eatStatus.indexOf(r.eatState)
break
}
}
......@@ -196,30 +204,75 @@ Page({
sleepRecord: res
})
} 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({
wcRecord: res
})
}
})
},
// 点击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) {
records = this.data.eatRecord
this.setData({
eatRecord: records
})
} else if (this.data.controlIndex == 1) {
records = this.data.sleepRecord
this.setData({
sleepRecord: records
})
} 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
this.setData({
wcRecord: records
})
}
},
// 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) {
this.setData({
eatRecord: records
......@@ -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()
}
onLoad: function(options) {
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) {
this.data.studentIds = JSON.parse(options.studentIds)
console.log(this.data.studentIds)
if (this.data.studentIds.length > 1) {
this.setData({
hidePhoto: true
})
}
// onLoad 比 onReady 更早调用,后者为选中时屏幕闪动一下
this.clazzStatus();
......@@ -246,10 +382,8 @@ Page({
this.configCategory()
//获取选中的分类的记录
this.getRecord()
},
clazzStatus: function() {
/* 此方法分别被加载时调用,点击某段时调用 */
// class样式表如"selected last","selected"
......
......@@ -23,30 +23,33 @@
<view class='kg-separater'></view>
<!-- 数量 -->
<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 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 class='kg-separater'></view>
<template is="section_header" data="{{title:'今日拍照'}}"></template>
<view class='home-student-picture-item' style='padding-left:20rpx;padding-bottom:40rpx;'>
<!-- 选择的图片 -->
<view wx:for="{{selectPic}}">
<view class='add_picture_view'>
<image src='{{item}}' class='add_picture' bindtap='previewPic' data-index='{{index}}' mode='aspectFill'></image>
<image src='/src/img/cancel.png' class='delete' bindtap='deleteImg' data-index='{{index}}'></image>
<view wx:if="{{!hidePhoto}}">
<view class='kg-separater'></view>
<template is="section_header" data="{{title:'今日拍照'}}"></template>
<view class='home-student-picture-item' style='padding-left:20rpx;padding-bottom:40rpx;'>
<!-- 选择的图片 -->
<view wx:for="{{selectPic}}">
<view class='add_picture_view'>
<image src='{{item}}' class='add_picture' bindtap='previewPic' data-index='{{index}}' mode='aspectFill'></image>
<image src='/src/img/cancel.png' class='delete' bindtap='deleteImg' data-index='{{index}}'></image>
</view>
</view>
<!-- 添加图片按钮 -->
<view class='add_picture_view' bindtap='addPicture'>
<image src='/src/img/take_photo.png' class='add_picture'></image>
</view>
</view>
<!-- 添加图片按钮 -->
<view class='add_picture_view' bindtap='addPicture'>
<image src='/src/img/take_photo.png' class='add_picture'></image>
</view>
</view>
</scroll-view>
</view>
......@@ -55,10 +58,10 @@
<!-- 滑动区域 -->
<scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'>
<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 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>
......@@ -70,11 +73,12 @@
<view hidden='{{controlIndex != 2}}'>
<scroll-view style='height:calc(100vh - 50px - 2rpx - 20rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'>
<view wx:for="{{wcRecord}}">
<view wx:for="{{item.recordItems}}" wx:for-item="r">
<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>
</view>
<view wx:for="{{wcRecord}}" wx:for-index="dietIndex">
<!-- <view wx:for="{{item.recordItems}}" wx:for-item="r"> -->
<view class='kg-quantity-cell'>
<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 class='kg-text-normal-gray'>{{item.wcString}}</view>
<!-- </view> -->
</view>
</view>
</view>
......
......@@ -14,11 +14,7 @@ Page({
pageSize: 15,
records: [],
recordTypes: app.globalData.recordTypes,
eatStates: {
"less": "少",
"normal": "正常",
"more": "多"
},
eatStates: app.globalData.eatStates,
testData: {
"paging": {
"page": 0,
......
......@@ -50,6 +50,8 @@ Page({
dateStr: dateStr
})
request.kg_login()
request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").then(res => {
......
......@@ -12,7 +12,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.4.0",
"appid": "wx946944062df64d30",
"appid": "wxfc3355043e579968",
"projectname": "Kindergarten",
"debugOptions": {
"hidedInDevtools": []
......
......@@ -24,7 +24,7 @@
<view wx:if="{{type == 'input'}}">
<!-- 输入型cell -->
<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>
</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