Commit 87386bce authored by 张杰's avatar 张杰

签到

parent 97af6b10
......@@ -11,8 +11,8 @@ const ERR_NOT_ACCESS_TOKEN = 21;
var DEF_APP_CONFIG = {
appId: "wxfc3355043e579968", // 勾芒小程序测试号
// 开发环境
domain: 'http://192.168.1.135:8080',
baseUrl: "http://192.168.1.135:8080"
domain: 'http://192.168.1.130:8080',
baseUrl: "http://192.168.1.130:8080"
// 川哥本地环境
// domain: 'http://192.168.199.198:8080',
// baseUrl: "http://192.168.199.198:8080/wxmall/wxsite",
......
var request = require('./request.js')
module.exports = {
querySignSummary(teacherId, classId) {
var params = {
teacherId: teacherId,
classId: classId
}
return request.get('/preschool/wxsite/teacher/querySignSummary.do', params)
},
// 获取所有学生
getAllStudent(classId) {
var params = {
classId: classId
}
return request.get('/preschool/wxsite/teacher/getAllStudent.do', params)
},
// 签到接口
signIn(teacherId, classId, studentIds) {
var params = {
teacherId: teacherId,
classId: classId,
studentIds: studentIds
}
return request.post('/preschool/wxsite/teacher/signin.do', params)
}
}
\ No newline at end of file
{
"pages":[
"pages/home/parents/index",
"pages/home/teacher/index",
"pages/home/sign/index",
"pages/home/parents/index",
"pages/home/reviewer/index",
"pages/add_record/index",
......
......@@ -64,8 +64,8 @@
.add_picture_view {
position: relative;
width: calc(100vw / 4 + 30rpx);
height: calc(100vw / 4 + 30rpx);
width: calc(100vw / 4 + 20rpx);
height: calc(100vw / 4 + 20rpx);
margin-right: 30rpx;
}
......
......@@ -59,7 +59,7 @@
</view>
</view>
<!-- <view class='kg-separater' style='height:2rpx;margin-left:80rpx;margin-right:0rpx;'></view> -->
<!-- <soview class='kg-separater' style='height:2rpx;margin-left:80rpx;margin-right:0rpx;'></view> -->
<!-- 今日照片 -->
<!-- <template is='imgTextView' data="{{img:'today',text:'今日照片'}}"> </template>
<view class='home-student-picture-item' style='margin-left:40rpx;'>
......
// pages/home/sign/index.js
const req = require('../../../api/teacher.js')
Page({
/**
* 页面的初始数据
*/
data: {
selectTags:{}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
req.getAllStudent('001').then(res=>{
console.log(res)
this.setData({
records: res
})
})
},
tapBox: function (e) {
console.log(e)
let selected = !e.currentTarget.dataset.check
let tags = this.data.selectTags
tags[e.currentTarget.dataset.index] = selected
this.setData({
selectTags: tags
})
},
operateTap: function (event) {
console.log(event._relatedInfo.anchorTargetText)
let records= this.data.records
var studentIds = []
for (var i = 0; i < records.length; i++) {
let item = records[i]
if (this.data.selectTags[i]) {
studentIds.push(item.id)
}
}
console.log(studentIds)
req.signIn('4028048267a65d0f0167a69ae1910058', '001', studentIds).then(res=>{
wx.showToast({
title: '签到成功~',
icon: 'none',
duration: 1500
})
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 1500)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "签到"
}
\ No newline at end of file
<!--pages/home/sign/index.wxml-->
<import src='/template/operate_btn/index.wxml'></import>
<view></view>
<view class='kg-text-title kg-flex-row' style="margin-left:40rpx;height:100rpx;">向日葵小班</view>
<view class='kg-separater'></view>
<scroll-view style='height:calc(100vh - 120rpx - 140rpx)' scroll-y='true'>
<view style='margin:20rpx'>
<view wx:for="{{records}}">
<view class='kg-quantity-cell'>
<template is='quantity_cell' data="{{title:item.name,type:'check',unit:'毫升', index:index,checked:selectTags[index]}}"></template>
</view>
</view>
</view>
</scroll-view>
<template is="operate_btn" data="{{title:'确认'}}"></template>
\ No newline at end of file
/* pages/home/sign/index.wxss */
@import '../teacher/index.wxss'
\ No newline at end of file
// pages/home/teacher/index.js
const request = require('../../../api/teacher.js')
const utils = require('../../../utils/util.js')
Page({
/**
......@@ -7,6 +9,7 @@ Page({
data: {
signIcon:"/src/img/signin.png",
userIcon:"/src/img/defaut_teacher_icon.png",
records:[],
},
......@@ -17,10 +20,39 @@ Page({
})
},
signTap: function (e) {
wx.navigateTo({
url: '/pages/home/sign/index',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 设置日期
let date = new Date()
let dateStr = utils.formatDate(date)
this.setData({
dateStr: dateStr
})
request.querySignSummary("4028048267a65d0f0167a69ae1910058", "4028048267a5969b0167a5b22f3807f8").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
})
})
},
......
......@@ -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:userIcon,title:'向日葵小班-张老师',subTitle:'共19人',sex:''}}"></template>
<view class='home-header-roll-call'>
<view class='home-header-roll-call' bindtap='signTap'>
<image class='roll-call-image' src='{{signIcon}}'></image>
<view class='roll-call-title'>点名</view>
</view>
......@@ -11,13 +11,13 @@
<view class='kg-separater'></view>
<!-- 滑动区域 -->
<scroll-view style='height:calc(100vh - 200rpx - 140rpx)' scroll-y='true'>
<template is="section_header" data="{{title:'2018-09-12'}}"></template>
<view wx:for="{{[1,2,3,4,5,6]}}">
<template is="section_header" data="{{title:dateStr}}"></template>
<view wx:for="{{records}}">
<view class='home-student-info'>
<!-- 名字 -->
<view class='home-student-name'>
<view class='kg-text-normal-dark'>张小华</view>
<image class='kg-sex-icon' src='/src/img/female.png' mode='aspectFit'></image>
<view class='kg-text-normal-dark'>{{item.signStudentName}}</view>
<template is="sex" data="{{sex:item.signStudentSex == '0' ? 'm' : 'f'}}"></template>
</view>
<!-- 图片 -->
<view class='home-student-picture-item'>
......@@ -27,9 +27,9 @@
</view>
<!-- 行为 -->
<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:'sleep',text:'2' }}"> </template>
<template is='imgTextView' data="{{img:'wc',text:'2' }}"> </template>
<template is='imgTextView' data="{{img:'eat',text:item.eatCount }}"> </template>
<template is='imgTextView' data="{{img:'sleep',text:item.sleepTotal }}"> </template>
<template is='imgTextView' data="{{img:'wc',text:item.wcCount }}"> </template>
</view>
</view>
</view>
......
......@@ -20,18 +20,29 @@
<!-- 添加记录的cell -->
<template name='quantity_cell'>
<view class='kg-flex-row '>
<view class='g-text-normal-dark'>张小华</view>
<!-- 输入型cell -->
<view class='kg-flex-row' hidden="{{type != 'input'}}">
<input class='kg-border' style='width:140rpx;margin-right:10rpx;'></input>
<view class='kg-text-normal-gray'>{{unit}}</view>
<view class='g-text-normal-dark'>{{title}}</view>
<view wx:if="{{type == 'input'}}">
<!-- 输入型cell -->
<view class='kg-flex-row'>
<input class='kg-border' style='width:140rpx;margin-right:10rpx;'></input>
<view class='kg-text-normal-gray'>{{unit}}</view>
</view>
</view>
<!-- 选择型cell -->
<view class='kg-flex-row' hidden="{{type != 'select'}}">
<view wx:for="{{options}}">
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tap' data-index='{{index}}' style='width: 120rpx;margin-right: 0rpx;margin-bottom: 0rpx;margin-left:20rpx;'>{{item}}</view>
<view wx:if="{{type == 'select'}}">
<!-- 选择型cell -->
<view class='kg-flex-row'>
<view wx:for="{{options}}">
<view class="eat_category_btn {{selectIndex == index ? 'selected' : ''}}" bindtap='tap' data-index='{{index}}' style='width: 120rpx;margin-right: 0rpx;margin-bottom: 0rpx;margin-left:20rpx;'>{{item}}</view>
</view>
</view>
</view>
<view wx:if="{{type == 'check'}}">
<!-- 选择型cell -->
<image src="{{checked == true ? '/src/img/btn_selected.png' : '/src/img/btn_unselected.jpg'}}" style="height:20px; width:20px;margin-right:4px;" bindtap='tapBox' data-index="{{index}}" data-check='{{checked}}'></image>
</view>
</view>
</template>
......@@ -78,4 +89,4 @@ sex:性别 f/m (女性/男性)
<image src='/src/img/{{img}}.png' style='width: 50rpx;height: 40rpx;'></image>
<text class='kg-text-normal-dark' style='margin-left:10rpx'>{{text}}</text>
</view>
</template>
</template>
\ 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