Commit a74dd480 authored by SmileFei's avatar SmileFei

审核老师首页数据填充

parent 87386bce
{ {
"pages":[ "pages":[
"pages/home/reviewer/index",
"pages/home/teacher/index", "pages/home/teacher/index",
"pages/home/sign/index", "pages/home/sign/index",
"pages/home/parents/index", "pages/home/parents/index",
"pages/home/reviewer/index",
"pages/add_record/index", "pages/add_record/index",
"pages/review_student/index" "pages/review_student/index"
], ],
......
// pages/home/reviewer/index.js // pages/home/reviewer/index.js
const request = require('../../../api/teacher.js')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
className: ['一班', '一班', '一班', '一班', '一班', '一班'] selectIndex: 0,
classList: [{
"id": "4028048267a5969b0167a5b22f3807f8",
"code": "001",
"name": "一班"
},
{
"id": "00002",
"code": "002",
"name": "二班"
},
{
"id": "00003",
"code": "003",
"name": "三班"
},
{
"id": "00004",
"code": "004",
"name": "四班"
},
{
"id": "00005",
"code": "005",
"name": "五班"
}
],
teacherId: "4028048267a65d0f0167a69ae1910058",
classId: "",
records: []
},
tapClass: function(e) {
console.log(e)
this.setData({
selectIndex: e.target.dataset.index,
classId: e.currentTarget.id
}),
this.querySignSummary()
}, },
tapStudent: function(e) { tapStudent: function(e) {
...@@ -15,59 +53,81 @@ Page({ ...@@ -15,59 +53,81 @@ Page({
}) })
}, },
querySignSummary: function() {
request.querySignSummary(this.data.teacherId, this.data.classId).then(res => {
console.log(res)
for (var i = 0; i < res.length; i++) {
var item = res[i]
item.signDate = item.signDate.substr(0, 10)
}
this.setData({
records: res
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
if (this.data.classList.length > 0){
this.data.classId = this.data.classList[0].id
}
this.querySignSummary()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
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
...@@ -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:'张小华',subTitle:'向日葵小班',sex:'m'}}"></template> <template is='userInfo' data="{{userImg:'/src/img/defaut_teacher_icon.png',title:'审核老师',subTitle:'向日葵幼儿园',sex:'m'}}"></template>
<view></view> <view></view>
</view> </view>
<view class='kg-separater'></view> <view class='kg-separater'></view>
...@@ -12,73 +12,29 @@ ...@@ -12,73 +12,29 @@
<template is="section_header" data="{{title:'2018-09-12'}}"></template> <template is="section_header" data="{{title:'2018-09-12'}}"></template>
<view class="category"> <view class="category">
<view wx:for="{{className}}"> <view wx:for="{{classList}}" wx:key="id" id="{{item.id}}" bindtap='tapClass'>
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tapCategory' data-index='{{index}}'> <view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" data-index='{{index}}'>
{{item}} {{item.name}}
</view> </view>
</view> </view>
</view> </view>
<view class='kg-separater'></view> <view class='home-student-info' wx:for="{{records}}" wx:key="id" id="{{item.id}}" bindtap='tapStudent'>
<!-- 名字 -->
<!-- 记录的信息 --> <view class='home-student-name'>
<view class='kg-quantity-cell' style="margin:10px;padding:10rpx 30rpx;" bindtap='tapStudent'> <view class='kg-text-normal-dark'>{{item.signStudentName}}</view>
<view class='textImg'></view> <template is="sex" data="{{sex:item.signStudentSex == '0' ? 'm' : 'f'}}"></template>
<view class='kg-flex-row' style='justify-content:flex-start;margin-bottom:10rpx;'>
<view class='kg-text-title'>王小明</view>
<template is="sex" data="{{sex:'f'}}"></template>
</view> </view>
<!-- 图片 -->
<view class='home-student-picture-item' style='margin-left:0rpx;'> <view class='home-student-picture-item'>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image> <image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
</view> </view>
<!-- 行为 -->
<view class='kg-flex-row' style='justify-content: space-between;margin:0rpx 20rpx; margin-top:10rpx'> <view class='home-student-name' style='justify-content: space-between;margin:0rpx 30rpx;'>
<template is='imgTextView' data="{{img:'eat',text:'12' }}"> </template> <template is='imgTextView' data="{{img:'eat',text:item.eatCount }}"> </template>
<template is='imgTextView' data="{{img:'sleep',text:'2' }}"> </template> <template is='imgTextView' data="{{img:'sleep',text:item.sleepTotal }}"> </template>
<template is='imgTextView' data="{{img:'wc',text:'2' }}"> </template> <template is='imgTextView' data="{{img:'wc',text:item.wcCount }}"> </template>
</view> </view>
</view> </view>
<!-- <view class='kg-quantity-cell' style="margin:10px;padding:10rpx 30rpx;">
<view class='textImg'></view>
<view class='kg-flex-row' style='justify-content:flex-start;margin-bottom:10rpx;'>
<view class='kg-text-title'>王小明</view>
<template is="sex" data="{{sex:'f'}}"></template>
</view>
<view class='home-student-picture-item' style='margin-left:0rpx;'>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
</view>
<view class='kg-flex-row' style='justify-content: space-between;margin:0rpx 20rpx; margin-top:10rpx'>
<template is='imgTextView' data="{{img:'eat',text:'12' }}"> </template>
<template is='imgTextView' data="{{img:'sleep',text:'2' }}"> </template>
<template is='imgTextView' data="{{img:'wc',text:'2' }}"> </template>
</view>
</view>
<view class='kg-quantity-cell' style="margin:10px;padding:10rpx 30rpx;">
<view class='textImg'></view>
<view class='kg-flex-row' style='justify-content:flex-start;margin-bottom:10rpx;'>
<view class='kg-text-title'>王小明</view>
<template is="sex" data="{{sex:'f'}}"></template>
</view>
<view class='home-student-picture-item' style='margin-left:0rpx;'>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
<image src='/src/img/student_picture.png' class='home-student-picture' mode='aspectFill'></image>
</view>
<view class='kg-flex-row' style='justify-content: space-between;margin:0rpx 20rpx; margin-top:10rpx'>
<template is='imgTextView' data="{{img:'eat',text:'12' }}"> </template>
<template is='imgTextView' data="{{img:'sleep',text:'2' }}"> </template>
<template is='imgTextView' data="{{img:'wc',text:'2' }}"> </template>
</view>
</view> -->
</scroll-view> </scroll-view>
\ No newline at end of file
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