Commit 991d7c35 authored by lvtz's avatar lvtz

老师端班级改版

parent 270a8044
...@@ -3,6 +3,8 @@ import { ...@@ -3,6 +3,8 @@ import {
} from '../../../service/business/common.js'; } from '../../../service/business/common.js';
import { import {
erpStudentAdjust, erpStudentAdjust,
erpStudentCourseChange,
erpStudentDistribution
} from '../../../service/business/circlemember.js'; } from '../../../service/business/circlemember.js';
import { import {
formIdCreate formIdCreate
...@@ -27,23 +29,37 @@ Page({ ...@@ -27,23 +29,37 @@ Page({
searchname: '', searchname: '',
showExchangeClassModal: false, showExchangeClassModal: false,
selectItem: '', selectItem: '',
student_ids: '' student_ids: '',
page2: 1,
classList2: [],
classTatol2: '',
hasmore2: true,
emptyPage2: false,
my: 0
}, },
onLoad: function (options) { 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, { Object.assign(this.data, {
sid: sid || 0, sid: sid || 0,
student_ids: student_ids || 0, student_ids: student_ids || 0,
id: id || 0, id: id || 0,
courseid: courseid || 0 courseid: courseid || 0,
my: dakarole==1?1:0,
student_course_id: student_course_id || 0
}) })
}, },
onShow: function () { onShow: function () {
this.setData({ this.setData({
page: 1, page: 1,
hasmore: true, hasmore: true,
page2: 1,
hasmore2: true,
}) })
this.getClassList('init'); this.getClassListSameCourse('init');
this.getClassListDifferentCourse('init')
}, },
/** /**
...@@ -53,19 +69,14 @@ Page({ ...@@ -53,19 +69,14 @@ Page({
this.setData({ this.setData({
hasmore: true, hasmore: true,
page: 1, page: 1,
hasmore2: true,
page2: 1,
}) })
this.getClassList('down') this.getClassListSameCourse('down');
this.getClassListDifferentCourse('down')
}, },
/** getClassListSameCourse(type) {
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getClassList('up')
},
getClassList(type) {
let dakarole = LocalStorage.getItem('dakarole');
if (!this.data.hasmore) { if (!this.data.hasmore) {
return; return;
} }
...@@ -79,9 +90,10 @@ Page({ ...@@ -79,9 +90,10 @@ Page({
page: this.data.page, page: this.data.page,
perPage: this.data.perPage, perPage: this.data.perPage,
school_id: this.data.sid, school_id: this.data.sid,
extra: 'course', // extra: 'course',
course_id: this.data.courseid,
exclude_class_id: this.data.id, exclude_class_id: this.data.id,
course_id: this.data.courseid my: this.data.my
}).then((res) => { }).then((res) => {
const { code, data } = res; const { code, data } = res;
wx.hideLoading(); wx.hideLoading();
...@@ -158,6 +170,114 @@ Page({ ...@@ -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) { caculateArrLength(array) {
let _length = 0; let _length = 0;
array.forEach(ele => { array.forEach(ele => {
...@@ -165,50 +285,134 @@ Page({ ...@@ -165,50 +285,134 @@ Page({
}) })
return _length; 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; let that = this;
const {item} = e.currentTarget.dataset; const {item,opttype} = e.currentTarget.dataset;
that.setData({ that.setData({
selectItem : item, selectItem : item,
showExchangeClassModal: true opttype
// showExchangeClassModal: true
}) })
console.log("选择的是",this.data.selectItem)
// console.log("选择的是",item.title)
}, },
closeModal() { sureExchangeClass(){
let that = this; let that = this;
that.setData({ let opttype = that.data.opttype;
showExchangeClassModal: false 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({ erpStudentAdjust({
student_ids: this.data.student_ids, student_ids: this.data.student_ids,
from_class_id: this.data.id, from_class_id: this.data.id,
to_class_id: this.data.selectItem.id to_class_id: this.data.selectItem.id
}).then((res) => { }).then((res) => {
const { code, data } = res; const { code, data } = res;
// wx.hideLoading(); if (code != 200) { // 失败的处理
this.setData({
listLoading: false } 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) => {
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) { // 失败的处理 if (code != 200) { // 失败的处理
} else { } else {
this.setData({ this.doSubmit2()
listLoading: false }
}).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({ wx.showToast({
title: "调班成功" 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({ wx.navigateBack({
delta: 1 delta: 1
}) })
} }
}).catch((e) => { }).catch((e) => {
this.setData({ wx.hideLoading()
listLoading: false
})
}) })
} }
}) })
\ No newline at end of file
{ {
"navigationBarTitleText": "选择班级", "navigationBarTitleText": "调班",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"usingComponents": { "usingComponents": {
"list-loading": "../../../components/listloading", "list-loading": "../../../components/listloading",
......
<wxs src="./../../../filter/index.wxs" module="filter" /> <wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container"> <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"> <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="list-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" data-opttype="1" bindtap="listenCheckboxChange" wx:key="{{index}}">
<view class="item-titlebox"> <view class="title-box">
<view class="item-title">{{item.title}}</view> <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>
<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>
<view class="content-item"> </block>
<view class="item-label"><view class="text">学员</view>:</view> </view>
<view class="item-text">{{item.class_student_count}}/{{item.capacity}}</view> <view class="btn-nomore" wx:if="{{hasmore}}" bindtap="getMore" data-type="1">点击加载更多</view>
</view> </view>
<!-- <view class="content-item"> <view class="section-box">
<view class="item-label">开班时间:</view> <view class="section-title">
<view class="item-text">{{item.created_at}}</view> <image class="icon" src="{{localImageRoot}}2b/circleindex/icon_classdifferent.png?{{imageVersion}}"></image>
</view> --> <view class="title">调到不同课程的班级</view>
<view class="content-item"> <view class="desc">(将自动购买所选班级的课程)</view>
<view class="item-label"><view class="text">教学进度</view>:</view>
<view class="item-text">{{item.expended}}/{{item.total}}</view>
</view> </view>
<!-- <view class="content-item"> <view class="list-box">
<view class="item-label"><view class="text">上课时间</view>:</view> <block wx:for="{{classList2}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="item-text">{{child.date}}</view> <view class="list-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" data-opttype="2" bindtap="listenCheckboxChange" wx:key="{{index}}">
</view> --> <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="other-info">
<view class="line">班级:{{item.title}}</view>
<view class="line">老师:{{item.school_teachers.length>0?item.teacherArr:'暂未分配老师'}}</view>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
<list-loading loading="{{listLoading}}"></list-loading> <view class="btn-nomore" wx:if="{{hasmore2}}" bindtap="getMore" data-type="2">点击加载更多</view>
</view> </view>
<view class="form-fixbtn" bindtap="sureExchangeClass">立即调班</view>
<view class="self-modal" wx:if="{{showExchangeClassModal}}"> <view class="self-modal" wx:if="{{showExchangeClassModal}}">
<view class="mask" bindtap="closeModal"></view> <view class="mask" bindtap="closeModal"></view>
<view class="modal-box"> <view class="modal-box">
...@@ -48,10 +59,5 @@ ...@@ -48,10 +59,5 @@
</view> </view>
</view> </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> </view>
<expiredTip/> <expiredTip/>
\ No newline at end of file
@import "../../../style/commonlist.wxss"; /* @import "../../../style/commonlist.wxss"; */
page{ 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{ .list-box .list-item .title-box{
padding-top: 27rpx; 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 { .empty-content {
......
This diff is collapsed.
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
"navigationBarTitleText": "班级详情", "navigationBarTitleText": "班级详情",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"onReachBottomDistance": 100, "onReachBottomDistance": 100,
"navigationBarBackgroundColor": "#35BAFD",
"navigationBarTextStyle": "white",
"usingComponents": { "usingComponents": {
"empty-content": "../../../components/emptycontent", "empty-content": "../../../components/emptycontent",
"poster-box": "../../../components/posterbox", "poster-box": "../../../components/posterbox",
......
...@@ -57,10 +57,11 @@ Page({ ...@@ -57,10 +57,11 @@ Page({
suretext: '', suretext: '',
}, },
onLoad: function (options) { onLoad: function (options) {
const { sid, my } = options; const { sid, my, id } = options;
this.setData({ this.setData({
sid:sid || 0, sid:sid || 0,
my: my || 0, my: my || 0,
id: id || 0
}) })
this.getClassList('init'); this.getClassList('init');
}, },
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</view> </view>
</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="label">班级:</view>
<view class="title">{{selectClass.title}}</view> <view class="title">{{selectClass.title}}</view>
<view class="exchang-btn">切换班级 <image class="icon" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/></view> <view class="exchang-btn">切换班级 <image class="icon" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"/></view>
......
...@@ -415,6 +415,8 @@ const apis = { ...@@ -415,6 +415,8 @@ const apis = {
studentDetail: `${api}member/student`, studentDetail: `${api}member/student`,
studentDelate: `${api}member/student`,//移除学员(旧) studentDelate: `${api}member/student`,//移除学员(旧)
erpStudentDelate: `${api}member/erp/student/remove`,//移除学员(新) erpStudentDelate: `${api}member/erp/student/remove`,//移除学员(新)
erpStudentCourseChange: `${api}member/erp/course/change`,//学员转课
erpStudentDistribution: `${api}member/erp/student/distribution`,//选班
erpStudentAdjust: `${api}member/erp/student/adjust`,//学员调班(新) erpStudentAdjust: `${api}member/erp/student/adjust`,//学员调班(新)
changeNickname: `${api}member/student/changeNickname`, // 设置备注名称 changeNickname: `${api}member/student/changeNickname`, // 设置备注名称
graduate: `${api}member/student/graduate`, //毕业 graduate: `${api}member/student/graduate`, //毕业
......
export default { export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/', imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/',
host: 'https://qxapi.qingxiao.online/daka', // host: 'https://qxapi.qingxiao.online/daka',
host2: 'https://wx.m.shangjiadao.cn', // host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '4.0', storageVersion: '4.0',
imageVersion: '20191104', imageVersion: '20191104',
// host: 'https://clock.wp53.cn', host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn', host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785', appId: 'wxc1246ea029394785',
miniProgram: { miniProgram: {
clock: 'wxdeee20e52a1fd7ee' clock: 'wxdeee20e52a1fd7ee'
......
import constants from './constants.js'; import constants from './constants.js';
let NODE_ENV = 'pro'; // let NODE_ENV = 'pro';
const fileManager = wx.getFileSystemManager(); // const fileManager = wx.getFileSystemManager();
try{ // try{
fileManager.accessSync('/local') // fileManager.accessSync('/local')
NODE_ENV = 'dev'; // NODE_ENV = 'dev';
}catch(e){} // }catch(e){}
if( NODE_ENV === 'pro' ){ // if( NODE_ENV === 'pro' ){
constants.host = 'https://qxapi.qingxiao.online/daka'; // constants.host = 'https://qxapi.qingxiao.online/daka';
constants.host2 = 'https://wx.m.shangjiadao.cn'; // constants.host2 = 'https://wx.m.shangjiadao.cn';
}else{ // }else{
constants.host = 'https://clock.wp53.cn'; // constants.host = 'https://clock.wp53.cn';
constants.host2 = 'https://test.wp53.cn'; // constants.host2 = 'https://test.wp53.cn';
} // }
console.log(constants,'dasssssssssdadsa')
export { export {
constants constants
} }
\ No newline at end of file
...@@ -68,6 +68,7 @@ function erpMemberDel(data) { ...@@ -68,6 +68,7 @@ function erpMemberDel(data) {
errorresolve: 1, errorresolve: 1,
}) })
} }
// 调班
function erpStudentAdjust(data) { function erpStudentAdjust(data) {
return wxRequest({ return wxRequest({
role: '2b', role: '2b',
...@@ -77,6 +78,26 @@ function erpStudentAdjust(data) { ...@@ -77,6 +78,26 @@ function erpStudentAdjust(data) {
errorresolve: 1, 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) { function studentgraduate(data) {
return wxRequest({ return wxRequest({
...@@ -107,5 +128,7 @@ export { ...@@ -107,5 +128,7 @@ export {
undergraduate, undergraduate,
memberIntegral, memberIntegral,
erpMemberDel, 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