Commit 3ba8c41e authored by 张杰's avatar 张杰

下拉刷新上拉加载

parent 67139e99
...@@ -21,5 +21,13 @@ module.exports = { ...@@ -21,5 +21,13 @@ module.exports = {
} }
return request.post('/wxsite/wxa/user/changePassword.do', param) return request.post('/wxsite/wxa/user/changePassword.do', param)
},
updateStudentPicture(studentId, pictureId) {
var param = {
studentId: studentId,
pictureId: pictureId
}
return request.post('/wxsite/parents/updateStudentPicture.do', param)
} }
} }
...@@ -20,7 +20,28 @@ Page({ ...@@ -20,7 +20,28 @@ Page({
rightIcon: '/src/img/xiugaimima.png', rightIcon: '/src/img/xiugaimima.png',
pictureId: "", pictureId: "",
userIcon: "", userIcon: "",
selectPic:[] selectPic: [],
student: {},
//顶部加载提示信息
hideTopMore: true,
// 底部加载提示信息
hideBottomMore: true
},
scrollToUpper: function(e) {
console.log("滚动到顶部")
this.setData({
hideTopMore: false
})
this.data.page = 0
this.httpRequest()
},
scrollToLower: function(e) {
this.data.page++
this.httpRequest()
}, },
tapUserInfoImg: function(e) { tapUserInfoImg: function(e) {
...@@ -28,7 +49,7 @@ Page({ ...@@ -28,7 +49,7 @@ Page({
// 选择图片 // 选择图片
wx.chooseImage({ wx.chooseImage({
count: 1, count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function(res) { success: function(res) {
//选中的图片路径 //选中的图片路径
...@@ -55,6 +76,8 @@ Page({ ...@@ -55,6 +76,8 @@ Page({
pictureId: that.data.pictureId, pictureId: that.data.pictureId,
userIcon: that.data.userIcon userIcon: that.data.userIcon
}) })
that.updateStudentPicture()
} else { } else {
throw new Error({ throw new Error({
msg: '图片上传失败' msg: '图片上传失败'
...@@ -73,6 +96,22 @@ Page({ ...@@ -73,6 +96,22 @@ Page({
}) })
}, },
updateStudentPicture: function() {
request.updateStudentPicture(this.data.student.id, this.data.pictureId).then(res => {
wx.showToast({
title: "上传成功"
});
}).catch(function(err) {
that.getAllStudent(that.data.classId)
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
});
});
},
changePwdTap: function(e) { changePwdTap: function(e) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/reset_psw/index', url: '/pages/reset_psw/index',
...@@ -92,9 +131,13 @@ Page({ ...@@ -92,9 +131,13 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
const that = this this.fillStudent()
this.httpRequest()
},
fillStudent: function() {
const that = this
if (app.globalData.login.students.length == 0) { if (app.globalData.login.students.length == 0) {
wx.showToast({ wx.showToast({
title: '无学生信息, 请联系管理员', title: '无学生信息, 请联系管理员',
...@@ -104,19 +147,30 @@ Page({ ...@@ -104,19 +147,30 @@ Page({
} }
let student = app.globalData.login.students[0] let student = app.globalData.login.students[0]
var studentId = student.id var studentId = student.id
let pic = utils.handleImgShow(student.picture)
console.log(pic)
this.setData({ this.setData({
student: student, student: student,
userIcon: app.globalData.login.wxaUser.avatarUrl, userIcon: pic,
sex: student.sex sex: student.sex
}) })
request.queryStudentRecord(that.data.page, that.data.pageSize, studentId).then(res => { },
httpRequest: function() {
const that = this
request.queryStudentRecord(that.data.page, that.data.pageSize, that.data.student.id).then(res => {
console.log(res) console.log(res)
let resData = res let resData = res
var record = resData['records'] var record = resData['records']
var templist = this.data.records var templist = this.data.records
if (that.data.page == 0) {
templist = []
this.setData({
hideTopMore: true
})
}
for (var i = 0; i < record.length; i++) { for (var i = 0; i < record.length; i++) {
var item = record[i] var item = record[i]
...@@ -180,9 +234,7 @@ Page({ ...@@ -180,9 +234,7 @@ Page({
records: templist, records: templist,
page: resData['paging']['page'] page: resData['paging']['page']
}) })
}) })
}, },
/** /**
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
<scroll-view style='height:calc(100vh - 200rpx)' scroll-y='true'> <scroll-view style='height:calc(100vh - 200rpx)' scroll-y='true' bindscrolltolower='scrollToLower' bindscrolltoupper='scrollToUpper'>
<view class='kg-text-light-gray more-text' hidden='{{hideTopMore}}'>下拉加载中…</view>
<view wx:for="{{records}}" wx:key="item"> <view wx:for="{{records}}" wx:key="item">
<view class='timeline-cell'> <view class='timeline-cell'>
<view class='timeline-line-container'> <view class='timeline-line-container'>
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
<image src='{{picItem}}' class='home-student-picture' catchtap='previewPic' data-index='{{index}}' data-picIndex='{{picIndex}}' mode='aspectFill'></image> <image src='{{picItem}}' class='home-student-picture' catchtap='previewPic' data-index='{{index}}' data-picIndex='{{picIndex}}' mode='aspectFill'></image>
</view> </view>
</view> </view>
<text class='kg-text-normal-gray' style='margin-left:60rpx;'>【禾其狗狗喝水器挂式水壶猫咪自动饮水杯用品狗笼喂水器宠物饮水器】https://m.tb.cn/h.3HA5uKq?sm=8a2196 点击链接,再选择浏览器咑閞;或復·制这段描述¥502VbroYaCP¥后到👉淘♂寳♀👈</text> <text class='kg-text-normal-gray' style='margin-left:60rpx;'>{{item.pictureRemark ? item.pictureRemark : ''}}</text>
</view> </view>
</view> </view>
......
...@@ -60,4 +60,10 @@ ...@@ -60,4 +60,10 @@
margin-left:60rpx; margin-left:60rpx;
margin-right:60rpx; margin-right:60rpx;
margin-bottom:10rpx; margin-bottom:10rpx;
}
.more-text {
text-align: center;
height: 40rpx;
line-height: 40rpx;
} }
\ No newline at end of file
...@@ -33,7 +33,7 @@ Page({ ...@@ -33,7 +33,7 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: '/pages/review_student/index?signSummaryId=' + student.id + '&pictureIds=' + JSON.stringify(student.arrIds) + '&remark=' + (student.remark ? student.remark : '') + '&picRemark=' + (student.pictureRemark ? student.pictureRemark : '') + '&studentName=' + student.signStudentName + '&sex=' + student.signStudentSex url: '/pages/review_student/index?signSummaryId=' + student.id + '&pictureIds=' + JSON.stringify(student.arrIds) + '&remark=' + (student.remark ? student.remark : '') + '&picRemark=' + (student.pictureRemark ? student.pictureRemark : '') + '&studentName=' + student.signStudentName + '&sex=' + student.signStudentSex + '&studentPicture=' + student.studentPicture
}) })
}, },
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<scroll-view style='height:calc(100vh - 120rpx - 140rpx)' scroll-y='true'> <scroll-view style='height:calc(100vh - 120rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'> <view style='margin:20rpx'>
<view wx:for="{{records}}"> <view wx:for="{{records}}" wx:key="item">
<view class='kg-quantity-cell'> <view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', cellIndex:index, checked:selectTags[index]}}"></template> <template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', cellIndex:index, checked:selectTags[index]}}"></template>
</view> </view>
......
...@@ -26,7 +26,8 @@ Page({ ...@@ -26,7 +26,8 @@ Page({
studentName: '', studentName: '',
kindergarten: '', kindergarten: '',
sex: '', sex: '',
pictureIds: [] pictureIds: [],
studentPicture: '/src/img/defaut_teacher_icon.png'
}, },
//加载详情 //加载详情
...@@ -82,6 +83,15 @@ Page({ ...@@ -82,6 +83,15 @@ Page({
auditSignSummary: function(signSummaryId) { auditSignSummary: function(signSummaryId) {
console.log(signSummaryId) console.log(signSummaryId)
let record = this.data.recordDetail
if (record.dietRecord.length == 0 && record.sleepRecord.length == 0 && record.wcRecord.length == 0) {
wx.showToast({
title: '没有记录,无法审批',
icon: 'none',
})
return
}
request.auditSignSummary(signSummaryId).then(res => { request.auditSignSummary(signSummaryId).then(res => {
this.setData({ this.setData({
showAuditBtn: false showAuditBtn: false
...@@ -132,6 +142,12 @@ Page({ ...@@ -132,6 +142,12 @@ Page({
this.data.signSummaryId = options.signSummaryId; this.data.signSummaryId = options.signSummaryId;
let remark = options.remark let remark = options.remark
let picRemark = options.picRemark let picRemark = options.picRemark
let studentPicture = options.studentPicture
if (studentPicture != 'null') {
this.setData({
studentPicture: utils.handleImgShow(studentPicture)
})
}
this.setData({ this.setData({
remark: remark, remark: remark,
picRemark: picRemark, picRemark: picRemark,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class='kg-separater' style='height:2rpx;'></view> <view class='kg-separater' style='height:2rpx;'></view>
<view class='kg-home-header kg-flex-row'> <view class='kg-home-header kg-flex-row'>
<template is='userInfo' data="{{userImg:'/src/img/defaut_teacher_icon.png',title:studentName,subTitle:'',sex:sex}}"></template> <template is='userInfo' data="{{userImg:studentPicture,title:studentName,subTitle:'',sex:sex}}"></template>
<view></view> <view></view>
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
......
src/img/defaut_teacher_icon.png

26.8 KB | W: | H:

src/img/defaut_teacher_icon.png

6.32 KB | W: | H:

src/img/defaut_teacher_icon.png
src/img/defaut_teacher_icon.png
src/img/defaut_teacher_icon.png
src/img/defaut_teacher_icon.png
  • 2-up
  • Swipe
  • Onion skin
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