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

下拉刷新上拉加载

parent 67139e99
......@@ -21,5 +21,13 @@ module.exports = {
}
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({
rightIcon: '/src/img/xiugaimima.png',
pictureId: "",
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) {
......@@ -28,7 +49,7 @@ Page({
// 选择图片
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function(res) {
//选中的图片路径
......@@ -55,6 +76,8 @@ Page({
pictureId: that.data.pictureId,
userIcon: that.data.userIcon
})
that.updateStudentPicture()
} else {
throw new Error({
msg: '图片上传失败'
......@@ -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) {
wx.navigateTo({
url: '/pages/reset_psw/index',
......@@ -92,9 +131,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
const that = this
this.fillStudent()
this.httpRequest()
},
fillStudent: function() {
const that = this
if (app.globalData.login.students.length == 0) {
wx.showToast({
title: '无学生信息, 请联系管理员',
......@@ -104,19 +147,30 @@ Page({
}
let student = app.globalData.login.students[0]
var studentId = student.id
let pic = utils.handleImgShow(student.picture)
console.log(pic)
this.setData({
student: student,
userIcon: app.globalData.login.wxaUser.avatarUrl,
userIcon: pic,
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)
let resData = res
var record = resData['records']
var templist = this.data.records
if (that.data.page == 0) {
templist = []
this.setData({
hideTopMore: true
})
}
for (var i = 0; i < record.length; i++) {
var item = record[i]
......@@ -180,9 +234,7 @@ Page({
records: templist,
page: resData['paging']['page']
})
})
},
/**
......
......@@ -15,7 +15,8 @@
</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 class='timeline-cell'>
<view class='timeline-line-container'>
......@@ -75,7 +76,7 @@
<image src='{{picItem}}' class='home-student-picture' catchtap='previewPic' data-index='{{index}}' data-picIndex='{{picIndex}}' mode='aspectFill'></image>
</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>
......
......@@ -60,4 +60,10 @@
margin-left:60rpx;
margin-right:60rpx;
margin-bottom:10rpx;
}
.more-text {
text-align: center;
height: 40rpx;
line-height: 40rpx;
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ Page({
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 @@
<scroll-view style='height:calc(100vh - 120rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'>
<view wx:for="{{records}}">
<view wx:for="{{records}}" wx:key="item">
<view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', cellIndex:index, checked:selectTags[index]}}"></template>
</view>
......
......@@ -26,7 +26,8 @@ Page({
studentName: '',
kindergarten: '',
sex: '',
pictureIds: []
pictureIds: [],
studentPicture: '/src/img/defaut_teacher_icon.png'
},
//加载详情
......@@ -82,6 +83,15 @@ Page({
auditSignSummary: function(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 => {
this.setData({
showAuditBtn: false
......@@ -132,6 +142,12 @@ Page({
this.data.signSummaryId = options.signSummaryId;
let remark = options.remark
let picRemark = options.picRemark
let studentPicture = options.studentPicture
if (studentPicture != 'null') {
this.setData({
studentPicture: utils.handleImgShow(studentPicture)
})
}
this.setData({
remark: remark,
picRemark: picRemark,
......
......@@ -3,7 +3,7 @@
<view class='kg-separater' style='height:2rpx;'></view>
<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 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