Commit 991d7c35 authored by lvtz's avatar lvtz

老师端班级改版

parent 270a8044
......@@ -3,6 +3,8 @@ import {
} from '../../../service/business/common.js';
import {
erpStudentAdjust,
erpStudentCourseChange,
erpStudentDistribution
} from '../../../service/business/circlemember.js';
import {
formIdCreate
......@@ -27,23 +29,37 @@ Page({
searchname: '',
showExchangeClassModal: false,
selectItem: '',
student_ids: ''
student_ids: '',
page2: 1,
classList2: [],
classTatol2: '',
hasmore2: true,
emptyPage2: false,
my: 0
},
onLoad: function (options) {
const {sid,student_ids,id,courseid} = options;
let dakarole = LocalStorage.getItem('dakarole');
const {sid,student_ids,id,courseid,student_course_id} = options;
Object.assign(this.data, {
sid: sid || 0,
student_ids: student_ids || 0,
id: id || 0,
courseid: courseid || 0
courseid: courseid || 0,
my: dakarole==1?1:0,
student_course_id: student_course_id || 0
})
},
onShow: function () {
this.setData({
page: 1,
hasmore: true,
page2: 1,
hasmore2: true,
})
this.getClassList('init');
this.getClassListSameCourse('init');
this.getClassListDifferentCourse('init')
},
/**
......@@ -53,19 +69,14 @@ Page({
this.setData({
hasmore: true,
page: 1,
hasmore2: true,
page2: 1,
})
this.getClassList('down')
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getClassList('up')
this.getClassListSameCourse('down');
this.getClassListDifferentCourse('down')
},
getClassList(type) {
let dakarole = LocalStorage.getItem('dakarole');
getClassListSameCourse(type) {
if (!this.data.hasmore) {
return;
}
......@@ -79,9 +90,10 @@ Page({
page: this.data.page,
perPage: this.data.perPage,
school_id: this.data.sid,
extra: 'course',
// extra: 'course',
course_id: this.data.courseid,
exclude_class_id: this.data.id,
course_id: this.data.courseid
my: this.data.my
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
......@@ -158,6 +170,114 @@ Page({
})
})
},
getClassListDifferentCourse(type) {
if (!this.data.hasmore2) {
return;
}
if (this.data.listLoading2) {
return
}
this.setData({
listLoading2: true
})
erpClassListGet({
page: this.data.page2,
perPage: this.data.perPage,
school_id: this.data.sid,
extra: 'course',
// exclude_class_id: this.data.id,
exclude_course_id: this.data.courseid,
my: this.data.my
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.setData({
listLoading2: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total) {
data.list.forEach(item => {
let itemT = item.school_teachers;
let teacherArr = []
if (itemT) {
itemT.forEach((ele) => {
teacherArr.push(ele.nickname)
})
} else {
teacherArr = []
}
item.teacherArr = teacherArr.join('、');
});
this.setData({
classTatol2: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
classList2: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.classList2)) {
this.data.page2 = this.data.page2 + 1;
} else { // 没有更多了
this.setData({
hasmore2: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
classList2: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.classList2)) {
this.data.page2 = this.data.page2 + 1;
} else { // 没有更多了
this.setData({
hasmore2: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let list = this.data.classList2;
this.setData({
[`classList2[${this.data.page - 1}]`]: data.list
}, () => {
if (this.data.classTatol2 > this.caculateArrLength(this.data.classList2)) {
this.data.page2 = this.data.page2 + 1;
} else { // 没有更多了
this.setData({
hasmore2: false
})
}
})
break;
default:
break;
}
if (this.caculateArrLength(this.data.classList2) == 0) {
this.setData({
emptyPage2: true
})
} else {
this.setData({
emptyPage2: false,
})
}
}
}).catch((e) => {
this.setData({
listLoading2: false
})
})
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
......@@ -165,50 +285,134 @@ Page({
})
return _length;
},
selectItem(e){
// 点击加载更多
getMore(e){
const{type} = e.currentTarget.dataset;
switch (type) {
case '1':
this.getClassListSameCourse('up');
break;
case '2':
this.getClassListDifferentCourse('up');
break;
}
},
listenCheckboxChange(e){
let that = this;
const {item} = e.currentTarget.dataset;
const {item,opttype} = e.currentTarget.dataset;
that.setData({
selectItem : item,
showExchangeClassModal: true
opttype
// showExchangeClassModal: true
})
// console.log("选择的是",item.title)
console.log("选择的是",this.data.selectItem)
},
closeModal() {
sureExchangeClass(){
let that = this;
that.setData({
showExchangeClassModal: false
})
let opttype = that.data.opttype;
if(!this.data.selectItem.id){
wx.showModal({
title: '提示',
content: '请选择班级',
showCancel: false,
confirmColor: '#65B8F4'
})
return
}
switch(opttype){
case '1':
this.doSubmit();
break;
case '2':
this.courseChange();
break;
}
},
sureExchangeClass(){
//同课程直接调班
doSubmit(){
wx.showLoading({title: '加载中'})
erpStudentAdjust({
student_ids: this.data.student_ids,
from_class_id: this.data.id,
to_class_id: this.data.selectItem.id
}).then((res) => {
const { code, data } = res;
// wx.hideLoading();
this.setData({
listLoading: false
})
if (code != 200) { // 失败的处理
} else {
this.setData({
listLoading: false
wx.hideLoading();
wx.showToast({
title: "调班成功"
})
let pages = getCurrentPages();
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (pages.length >= 2) {
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
prevPage.setData({
showRefresh: true,
modalStudentOpt: false
});
wx.navigateBack({
delta: 1
})
}
}).catch((e) => {
wx.hideLoading()
})
},
// 不同课程 先调课再选班
courseChange(){
wx.showLoading({title: '加载中'})
erpStudentCourseChange({
student_course_id: this.data.student_course_id,
to_course_id: this.data.selectItem.course.id
}).then((res) => {
const { code, data } = res;
wx.hideLoading()
if (code != 200) { // 失败的处理
} else {
this.doSubmit2()
}
}).catch((e) => {
wx.hideLoading()
})
},
doSubmit2(){
wx.showLoading({title: '加载中'})
erpStudentDistribution({
student_id: this.data.student_ids,
class_ids: this.data.selectItem.id
}).then((res) => {
const { code, data } = res;
if (code != 200) { // 失败的处理
} else {
wx.hideLoading();
wx.showToast({
title: "调班成功"
})
let pages = getCurrentPages();
let currPage = null; //当前页面
let prevPage = null; //上一个页面
if (pages.length >= 2) {
currPage = pages[pages.length - 1]; //当前页面
prevPage = pages[pages.length - 2]; //上一个页面
}
prevPage.setData({
showRefresh: true,
modalStudentOpt: false
});
wx.navigateBack({
delta: 1
})
}
}).catch((e) => {
this.setData({
listLoading: false
})
wx.hideLoading()
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "选择班级",
"navigationBarTitleText": "调班",
"enablePullDownRefresh": true,
"usingComponents": {
"list-loading": "../../../components/listloading",
......
<wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="commonlist-bigwrap commonlist-bigwrap-round">
<view class="commonlist-box">
<view class="section-box">
<view class="section-title">
<image class="icon" src="{{localImageRoot}}2b/circleindex/icon_classsame.png?{{imageVersion}}"></image>
<view class="title">同课程班级可以直接调班</view>
<view class="desc"></view>
</view>
<view class="list-box">
<block wx:for="{{classList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="commonlist-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" bindtap="selectItem" wx:key="{{index}}">
<view class="item-titlebox">
<view class="item-title">{{item.title}}</view>
<view class="list-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" data-opttype="1" bindtap="listenCheckboxChange" wx:key="{{index}}">
<view class="title-box">
<view class="title">{{item.title}}</view>
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{item.id==selectItem.id}}"></image>
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:else></image>
</view>
</view>
</block>
</view>
<view class="btn-nomore" wx:if="{{hasmore}}" bindtap="getMore" data-type="1">点击加载更多</view>
</view>
<view class="section-box">
<view class="section-title">
<image class="icon" src="{{localImageRoot}}2b/circleindex/icon_classdifferent.png?{{imageVersion}}"></image>
<view class="title">调到不同课程的班级</view>
<view class="desc">(将自动购买所选班级的课程)</view>
</view>
<view class="list-box">
<block wx:for="{{classList2}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="list-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" data-opttype="2" bindtap="listenCheckboxChange" wx:key="{{index}}">
<view class="title-box">
<view class="title">{{item.course.title}}</view>
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{item.id==selectItem.id}}"></image>
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:else></image>
</view>
<view class="item-contentbox">
<view class="content-item">
<view class="item-label"><view class="text">老师</view>:</view>
<view class="item-text">{{circleInfo.school_teacher?circleInfo.school_teacher.nickname:'暂未分配老师'}}</view>
</view>
<view class="content-item">
<view class="item-label"><view class="text">学员</view>:</view>
<view class="item-text">{{item.class_student_count}}/{{item.capacity}}</view>
</view>
<!-- <view class="content-item">
<view class="item-label">开班时间:</view>
<view class="item-text">{{item.created_at}}</view>
</view> -->
<view class="content-item">
<view class="item-label"><view class="text">教学进度</view>:</view>
<view class="item-text">{{item.expended}}/{{item.total}}</view>
</view>
<!-- <view class="content-item">
<view class="item-label"><view class="text">上课时间</view>:</view>
<view class="item-text">{{child.date}}</view>
</view> -->
<view class="other-info">
<view class="line">班级:{{item.title}}</view>
<view class="line">老师:{{item.school_teachers.length>0?item.teacherArr:'暂未分配老师'}}</view>
</view>
</view>
</block>
</view>
<list-loading loading="{{listLoading}}"></list-loading>
<view class="btn-nomore" wx:if="{{hasmore2}}" bindtap="getMore" data-type="2">点击加载更多</view>
</view>
<view class="form-fixbtn" bindtap="sureExchangeClass">立即调班</view>
<view class="self-modal" wx:if="{{showExchangeClassModal}}">
<view class="mask" bindtap="closeModal"></view>
<view class="modal-box">
......@@ -48,10 +59,5 @@
</view>
</view>
</view>
<view class="empty-content" wx:if="{{emptyPage}}">
<image class='empty-img' src='{{imageRoot}}2b/potentialcustomer/emptyimg.png?{{imageVersion}}'></image>
<view class="empty-text">暂无数据~</view>
</view>
<view class="has-nomore" wx:if="{{!emptyPage && !hasmore}}">没有更多了</view>
</view>
<expiredTip/>
\ No newline at end of file
@import "../../../style/commonlist.wxss";
/* @import "../../../style/commonlist.wxss"; */
page{
background: #F3F4F6;
background: #fff;
padding-bottom: 170rpx;
}
.section-box{
background: #fff;
border-bottom: 16rpx solid #F2F2F2;
padding: 0 24rpx;
}
.section-box .section-title{
display: flex;
align-items: center;
padding: 38rpx 0 30rpx;
}
.section-box .section-title .icon{
width: 32rpx;
height: 32rpx;
}
.section-box .section-title .title{
font-size: 30rpx;
color: #000;
font-weight: bold;
padding: 0 17rpx;
}
.section-box .section-title .desc{
font-size: 22rpx;
color: #7B7B7B;
}
.list-box{}
.list-box .list-item{
padding: 29rpx 0 29rpx 50rpx;
position: relative;
}
.list-box .list-item::after{
content: '';
width: 711rpx;
height: 1px;
background: rgba(0,0,0,.05);
position: absolute;
left: 13rpx;
bottom: 0;
transform: scaleY(.5);
}
.list-box .list-item:last-of-type::after{
display: none;
}
.commonlist-bigwrap{
padding-top: 27rpx;
.list-box .list-item .title-box{
display: flex;
align-items: center;
justify-content: space-between;
}
.list-box .list-item .title-box .title{
position: relative;
font-size: 26rpx;
color: #000;
}
.list-box .list-item .title-box .title::before{
content: '';
width: 7rpx;
height: 21rpx;
background: #1CC8F6;
border-radius: 4rpx;
position: absolute;
left: -44rpx;
top: 50%;
transform: translateY(-50%);
}
.list-box .list-item .title-box .icon-checkbox{
width: 31rpx;
height: 31rpx;
}
.list-box .list-item .other-info{
padding-top: 24rpx;
}
.list-box .list-item .other-info .line{
font-size: 24rpx;
color: #8E8E8E;
line-height: 31rpx;
margin-bottom: 8rpx;
}
.list-box .list-item .other-info .line:last-of-type{
margin-bottom: 0;
}
.btn-nomore{
font-size: 26rpx;
color: #9C9C9D;
padding: 15rpx 0;
text-align: center;
}
.form-fixbtn{
width: 414rpx;
height: 70rpx;
font-size: 26rpx;
bottom: 50rpx;
}
.empty-content {
......
This diff is collapsed.
......@@ -2,8 +2,6 @@
"navigationBarTitleText": "班级详情",
"enablePullDownRefresh": true,
"onReachBottomDistance": 100,
"navigationBarBackgroundColor": "#35BAFD",
"navigationBarTextStyle": "white",
"usingComponents": {
"empty-content": "../../../components/emptycontent",
"poster-box": "../../../components/posterbox",
......
......@@ -57,10 +57,11 @@ Page({
suretext: '',
},
onLoad: function (options) {
const { sid, my } = options;
const { sid, my, id } = options;
this.setData({
sid:sid || 0,
my: my || 0,
id: id || 0
})
this.getClassList('init');
},
......
......@@ -23,7 +23,7 @@
</view>
</view>
<view class="class-select-box" bindtap="showClassSelectModal">
<view class="class-select-box" bindtap="showClassSelectModal" wx:if="{{my!=1}}">
<view class="label">班级:</view>
<view class="title">{{selectClass.title}}</view>
<view class="exchang-btn">切换班级 <image class="icon" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/></view>
......
......@@ -415,6 +415,8 @@ const apis = {
studentDetail: `${api}member/student`,
studentDelate: `${api}member/student`,//移除学员(旧)
erpStudentDelate: `${api}member/erp/student/remove`,//移除学员(新)
erpStudentCourseChange: `${api}member/erp/course/change`,//学员转课
erpStudentDistribution: `${api}member/erp/student/distribution`,//选班
erpStudentAdjust: `${api}member/erp/student/adjust`,//学员调班(新)
changeNickname: `${api}member/student/changeNickname`, // 设置备注名称
graduate: `${api}member/student/graduate`, //毕业
......
export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/',
host: 'https://qxapi.qingxiao.online/daka',
host2: 'https://wx.m.shangjiadao.cn',
// host: 'https://qxapi.qingxiao.online/daka',
// host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '4.0',
imageVersion: '20191104',
// host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn',
host: 'https://clock.wp53.cn',
host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785',
miniProgram: {
clock: 'wxdeee20e52a1fd7ee'
......
import constants from './constants.js';
let NODE_ENV = 'pro';
const fileManager = wx.getFileSystemManager();
try{
fileManager.accessSync('/local')
NODE_ENV = 'dev';
}catch(e){}
if( NODE_ENV === 'pro' ){
constants.host = 'https://qxapi.qingxiao.online/daka';
constants.host2 = 'https://wx.m.shangjiadao.cn';
}else{
constants.host = 'https://clock.wp53.cn';
constants.host2 = 'https://test.wp53.cn';
}
console.log(constants,'dasssssssssdadsa')
// let NODE_ENV = 'pro';
// const fileManager = wx.getFileSystemManager();
// try{
// fileManager.accessSync('/local')
// NODE_ENV = 'dev';
// }catch(e){}
// if( NODE_ENV === 'pro' ){
// constants.host = 'https://qxapi.qingxiao.online/daka';
// constants.host2 = 'https://wx.m.shangjiadao.cn';
// }else{
// constants.host = 'https://clock.wp53.cn';
// constants.host2 = 'https://test.wp53.cn';
// }
export {
constants
}
\ No newline at end of file
......@@ -68,6 +68,7 @@ function erpMemberDel(data) {
errorresolve: 1,
})
}
// 调班
function erpStudentAdjust(data) {
return wxRequest({
role: '2b',
......@@ -77,6 +78,26 @@ function erpStudentAdjust(data) {
errorresolve: 1,
})
}
// 转课
function erpStudentCourseChange(data) {
return wxRequest({
role: '2b',
url: apis.business.circleMember.erpStudentCourseChange,
data,
method: 'POST',
errorresolve: 1,
})
}
// 选班
function erpStudentDistribution(data) {
return wxRequest({
role: '2b',
url: apis.business.circleMember.erpStudentDistribution,
data,
method: 'POST',
errorresolve: 1,
})
}
// 毕业
function studentgraduate(data) {
return wxRequest({
......@@ -107,5 +128,7 @@ export {
undergraduate,
memberIntegral,
erpMemberDel,
erpStudentAdjust
erpStudentAdjust,
erpStudentCourseChange,
erpStudentDistribution
}
\ 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