Commit 4faa408b authored by sujie@126.com's avatar sujie@126.com

Merge branch 'course_lvtz' of git.server:wangxuelai/wechatapp.shangjiadao.com into sj-dev-v6

parents 2877b80d ea6d614c
......@@ -84,8 +84,7 @@ Page({
sid,
from: from || 0
})
this.loadCircleData(id);
this.oddjobschools();
// this.oddjobschools();
wx.hideShareMenu()
if(id!=0){
this.loadCircleDetail(id);
......@@ -152,7 +151,7 @@ Page({
capacity: data.capacity,
},
needPsd: needPsd,
selectedTeachers: data.school_teacher_classes || [],
selectedTeachers: data.school_teachers || [],
courseSelect: data.course,
total: data.total
},()=>{
......
......@@ -108,45 +108,7 @@ Page({
{tabname: "未上", scheduleType: 1},
{tabname: "已上", scheduleType: 2}
],
// schedulesList: [
// {
// id:1,
// date: '2018-07',
// list: [
// {
// circlename: '艺术培训1班',
// id: 11,
// date: '7月12日 12:00-16:00',
// num: 3,
// student: '李四',
// teacher: '老师吴',
// state: 1,
// calltime: '7月12日 16:00',
// },
// {
// circlename: '艺术培训2班',
// id: 11,
// date: '7月6日 12:00-16:00',
// num: 3,
// student: '张三',
// teacher: '老师刘',
// state: 2,
// calltime: '6月13日 12:00',
// },
// {
// circlename: '艺术培训2班',
// id: 11,
// date: '7月2日 12:00-16:00',
// num: 3,
// student: '老李',
// teacher: '老师刘',
// state: 4,
// calltime: '6月16日 12:00',
// }
// ]
// }
// ],
schedulesList:[],
schedulesTotal: 0,
......@@ -290,15 +252,15 @@ Page({
}).then((res) => {
if (res.code == 200) {
let teacherArr = []
if(res.data.school_teacher_classes){
res.data.school_teacher_classes.forEach(item => {
if(res.data.school_teachers){
res.data.school_teachers.forEach(item => {
teacherArr.push(item.nickname)
})
teacherArr = teacherArr.join('、');
}else{
teacherArr = []
}
res.data.school_teacher_classes = teacherArr
res.data.school_teachers = teacherArr
if (res.data && res.data.deleted_at) {
wx.showModal({
title: '提示',
......@@ -393,9 +355,10 @@ Page({
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
schedulesListOrigin: data.list,
schedulesList: this.transformList(data.list)
}, () => {
if (this.data.schedulesTotal > this.data.schedulesList.length) {
if (this.data.schedulesTotal > this.data.schedulesListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......@@ -409,9 +372,10 @@ Page({
break;
case 'down': // 页面下拉刷新
this.setData({
schedulesListOrigin: data.list,
schedulesList: this.transformList(data.list)
}, () => {
if (this.data.schedulesTotal > this.data.schedulesList.length) {
if (this.data.schedulesTotal > this.data.schedulesListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......@@ -425,14 +389,17 @@ Page({
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let list = this.data.schedulesList;
let _list = list.concat(this.transformList(data.list));
// let list = this.data.schedulesList;
let listOrigin = this.data.schedulesListOrigin;
let _list = this.transformList(listOrigin.concat(data.list));
let _listOrigin = listOrigin.concat(data.list);
this.setData({
schedulesListOrigin: _listOrigin,
schedulesList: _list
// [`schedulesList[${this.data.page - 1}]`]: data.list
}, () => {
console.log(1111111111111,this.data.schedulesList)
if (this.data.schedulesTotal > this.data.schedulesList.length) {
if (this.data.schedulesTotal > this.data.schedulesListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......
......@@ -28,7 +28,7 @@
</view>
</view>
<view class="teacher-classroom">
{{circleInfo.school_teacher_classes.length>0?circleInfo.school_teacher_classes:'暂无'}}/{{circleInfo.class_room?circleInfo.class_room.title:'暂无'}}
{{circleInfo.school_teachers.length>0?circleInfo.school_teachers:'暂无'}}/{{circleInfo.class_room?circleInfo.class_room.title:'暂无'}}
</view>
</view>
<!-- <view class="operate-btn-box">
......@@ -101,52 +101,12 @@
</view>
<view class="content-item">
<view class="item-label">老师</view>
<view class="item-text" wx:if="{{child.teacher}}">
<view class="item-line" wx:for="{{child.teacher}}" wx:key="">
{child.nickname}
</view>
</view>
<view class="item-text" wx:else>
暂无
</view>
<view class="item-text">{{child.school_teacher?child.school_teacher.nickname:'暂无'}}</view>
</view>
</view>
</view>
</view>
</block>
<!-- <block class="commonlist-partwrap" wx:for="{{schedulesList}}" wx:key=""> -->
<!-- <view class="commonlist-header">{{item.date}}</view> -->
<!-- <view class="commonlist-box">
<view class="commonlist-item" wx:for="{{schedulesList}}" wx:key="">
<view class="item-titlebox">
<view class="item-title">{{item.end_time}}{{item.end_time}}</view>
<view class="itme-state" data-schedule="{{item}}" catchtap="scheduleOpt" data-index="{{index}}">操作</view>
</view>
<view class="item-contentbox">
<view class="content-item">
<view class="item-label">授课:</view>
<view class="item-text">{{item.date}}课时</view>
</view>
<view class="content-item">
<view class="item-label">课次:</view>
<view class="item-text">{{item.index}}</view>
</view>
<view class="content-item">
<view class="item-label">老师</view>
<view class="item-text" wx:if="{{item.teacher}}">
<view class="item-line" wx:for="{{item.teacher}}" wx:key="">
{item.nickname}
</view>
</view>
<view class="item-text" wx:else>
暂无
</view>
</view>
</view>
</view>
</view> -->
<!-- </block> -->
</view>
<view class="empty-content" wx:else>
<image class='empty-img' src='{{imageRoot}}2b/potentialcustomer/emptyimg.png?{{imageVersion}}'></image>
......
......@@ -110,7 +110,7 @@ Page({
} else {
if (data.total) {
data.list.forEach(item => {
let itemT = item.school_teacher_classes;
let itemT = item.school_teachers;
let teacherArr = []
if(itemT){
itemT.forEach((ele)=>{
......
......@@ -26,7 +26,7 @@
<view class="item-contentbox">
<view class="content-item">
<view class="item-label">老师:</view>
<view class="item-text">{{item.school_teacher_classes.length>0?item.teacherArr:'暂无'}}</view>
<view class="item-text">{{item.school_teachers.length>0?item.teacherArr:'暂无'}}</view>
</view>
<view class="content-item">
<view class="item-label">学员:</view>
......
......@@ -291,15 +291,15 @@ Page({
}).then((res) => {
if (res.code == 200) {
let teacherArr = []
if(res.data.school_teacher_classes){
res.data.school_teacher_classes.forEach(item => {
if(res.data.school_teachers){
res.data.school_teachers.forEach(item => {
teacherArr.push(item.nickname)
})
teacherArr = teacherArr.join('、');
}else{
teacherArr = []
}
res.data.school_teacher_classes = teacherArr
res.data.school_teachers = teacherArr
if (res.data && res.data.deleted_at) {
wx.showModal({
......
......@@ -28,7 +28,7 @@
</view>
</view>
<view class="teacher-classroom">
{{circleInfo.school_teacher_classes?circleInfo.school_teacher_classes:'暂无'}}/{{circleInfo.class_room?circleInfo.class_room.title:'暂无'}}
{{circleInfo.school_teachers?circleInfo.school_teachers:'暂无'}}/{{circleInfo.class_room?circleInfo.class_room.title:'暂无'}}
</view>
</view>
<!-- <view class="operate-btn-box">
......
......@@ -99,7 +99,7 @@ Page({
} else {
if (data.total) {
data.list.forEach(item => {
let itemT = item.school_teacher_classes;
let itemT = item.school_teachers;
let teacherArr = []
if(itemT){
itemT.forEach((ele)=>{
......
......@@ -9,7 +9,7 @@
<view class="item-contentbox">
<view class="content-item">
<view class="item-label">老师:</view>
<view class="item-text">{{item.school_teacher_classes.length>0?item.teacherArr:'暂无'}}</view>
<view class="item-text">{{item.school_teachers.length>0?item.teacherArr:'暂无'}}</view>
</view>
<view class="content-item">
<view class="item-label">课程:</view>
......
......@@ -20,60 +20,7 @@ Page({
hasmore: true,
emptyPage: false,
courselist: [
{
id:1,
date: '2018-07',
list: [
{
circlename: '艺术培训1班',
id: 11,
date: '7月12日 12:00-16:00',
num: 3,
student: '李四',
teacher: '老师吴',
state: 1,
calltime: '7月12日 16:00',
},
{
circlename: '艺术培训2班',
id: 11,
date: '7月6日 12:00-16:00',
num: 3,
student: '张三',
teacher: '老师刘',
state: 2,
calltime: '6月13日 12:00',
},
{
circlename: '艺术培训2班',
id: 11,
date: '7月2日 12:00-16:00',
num: 3,
student: '老李',
teacher: '老师刘',
state: 4,
calltime: '6月16日 12:00',
}
]
},
{
id:1,
date: '2018-06',
list: [
{
circlename: '艺术培训3班',
id: 11,
date: '6月12日 12:00-16:00',
num: 3,
student: '学员发',
teacher: '老师孙',
state: 3,
calltime: '6月13日 11:00',
}
]
}
]
courselist: []
},
/**
......@@ -153,9 +100,10 @@ Page({
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
courseList: [data.list]
courseListOrigin: data.list,
courseList: this.transformList(data.list)
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
if (data.total > this.data.courseListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......@@ -169,9 +117,10 @@ Page({
break;
case 'down': // 页面下拉刷新
this.setData({
courseList: [data.list]
courseListOrigin: data.list,
courseList: this.transformList(data.list)
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
if (data.total > this.data.courseListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......@@ -185,10 +134,14 @@ Page({
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let listOrigin = this.data.courseList;
let _list = this.transformList(listOrigin.concat(data.list));
let _listOrigin = listOrigin.concat(data.list);
this.setData({
[`courseList[${this.data.page - 1}]`]: data.list
courseListOrigin: _listOrigin,
courseList: _list
}, () => {
if (this.data.classTatol > this.caculateArrLength(this.data.courseList)) {
if (this.data.classTatol > this.data.courseListOrigin.length) {
let page = this.data.page + 1;
this.setData({
page,
......@@ -203,7 +156,7 @@ Page({
default:
break;
}
if (this.caculateArrLength(this.data.courseList) == 0) {
if (this.data.courseListOrigin.length == 0) {
this.setData({
emptyPage: true
})
......@@ -213,7 +166,6 @@ Page({
emptyPage: false,
})
}
console.log(this.data.emptyPage)
}
}).catch((e) => {
this.setData({
......@@ -228,4 +180,35 @@ Page({
})
return _length;
},
transformList(list){
var list_middle = [];
for (var i in list) {
var d = list[i];
var date = d.schedule.call_time.slice(0,7);
if (list_middle.hasOwnProperty(date)) {
list_middle[date].push(d);
} else {
list_middle[date] = [d]
}
}
var list_after = [];
for (var i in list_middle) {
var d = list_middle[i];
if (d.length > 0) {
// for(var i in d){
// var m = d[i].start_time.slice(4,10).split('-');
// var startT = d[i].start_time.slice(11,16);
// var endT = d[i].end_time.slice(11,16);
// var newMonth = m[1]+'月'+m[2]+'日';
// }
list_after.push({month: i, statics: d});
}
}
return list_after
},
})
\ No newline at end of file
<wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="commonlist-bigwrap" wx:if="{{courselist}}">
<block class="commonlist-partwrap" wx:for="{{courselist}}" wx:key="">
<view class="commonlist-header">{{item.date}}</view>
<view class="commonlist-bigwrap" wx:if="{{courseList}}">
<block class="commonlist-partwrap" wx:for="{{courseList}}" wx:key="">
<view class="commonlist-header">{{item.month}}</view>
<view class="commonlist-box">
<view class="commonlist-item" wx:for="{{item.list}}" wx:key="" wx:for-item="child">
<view class="commonlist-item" wx:for="{{item.statics}}" wx:key="" wx:for-item="child">
<view class="item-titlebox">
<view class="item-title">{{child.circlename}}</view>
<view class="itme-state state-{{child.state}}">{{filter.courseFilter(child.state)}}</view>
<view class="item-title">{{child.class.title}}</view>
<view class="itme-state state-{{child.type}}">{{filter.courseFilter(child.type)}}</view>
</view>
<view class="item-contentbox">
<view class="content-item">
<view class="item-label">授课时间:</view>
<view class="item-text">{{child.date}}</view>
<view class="item-text">{{filter.matchTime(child.schedule.start_time,'month')}} {{filter.matchTime(child.schedule.start_time,'hour')}}-{{filter.matchTime(child.schedule.end_time,'hour')}}</view>
</view>
<view class="content-item">
<view class="item-label">授课:</view>
<view class="item-text">{{child.num}}课时</view>
<view class="item-text">{{child.expend}}课时</view>
</view>
<view class="content-item">
<!-- <view class="content-item">
<view class="item-label">学员:</view>
<view class="item-text">{{child.student}}</view>
</view>
</view> -->
<view class="content-item">
<view class="item-label">老师:</view>
<view class="item-text">{{child.teacher}} {{child.calltime}}点名</view>
<view class="item-text">{{child.school_teacher?school_teacher.nickname:'暂无'}} {{child.schedule.call_time}}点名</view>
</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