|
@@ -118,14 +118,22 @@ Page({
|
|
|
}
|
|
|
//获取班级列表
|
|
|
wx.request({
|
|
|
- url: host + '/api/wx/class/list?subject_item0=' + list[0].name,
|
|
|
+ url: host + '/api/wx/class/list' ,
|
|
|
method: 'GET',
|
|
|
+ data:{
|
|
|
+ subject_item0: subject_item[0],
|
|
|
+ subject_item1: subject_item[1],
|
|
|
+ subject_item2: subject_item[2]
|
|
|
+ },
|
|
|
success: res => {
|
|
|
- let classes = res.data.data[0].classes, class_=0
|
|
|
- for(let i=0;i<classes.length;i++){
|
|
|
- if (classes[i].cid == data.class_id){
|
|
|
- class_=i
|
|
|
- }
|
|
|
+ let class_ = 0;
|
|
|
+ if (res.data.data.length>0){
|
|
|
+ let classes = res.data.data[0].classes;
|
|
|
+ for(let i=0;i<classes.length;i++){
|
|
|
+ if (classes[i].cid == data.class_id){
|
|
|
+ class_=i
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
this.setData({
|
|
|
classList: classes,
|
|
@@ -165,6 +173,25 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ getClass(){
|
|
|
+ let category = this.data.category>=0 ? this.data.categoryArray[this.data.category].name:'',
|
|
|
+ subject = this.data.subject >= 0 ? this.data.subjectArray[this.data.subject].name : ''
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/wx/class/list?signup=1',
|
|
|
+ method: 'GET',
|
|
|
+ data:{
|
|
|
+ subject_item0: this.data.z_type,
|
|
|
+ subject_item1: category,
|
|
|
+ subject_item2: subject
|
|
|
+ },
|
|
|
+ success: res => {
|
|
|
+ // 过滤分类
|
|
|
+ this.setData({
|
|
|
+ classList: res.data.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
sure:function(){
|
|
|
if(this.data.dev==''){
|
|
|
wx.showToast({
|
|
@@ -221,12 +248,14 @@ Page({
|
|
|
dev: ''
|
|
|
})
|
|
|
}
|
|
|
+ this.getClass()
|
|
|
};
|
|
|
if (e.target.dataset.name == 'subject') {
|
|
|
this.setData({
|
|
|
subject: e.detail.value,
|
|
|
train: -1
|
|
|
})
|
|
|
+ this.getClass()
|
|
|
};
|
|
|
if (e.target.dataset.name == 'time') {
|
|
|
this.setData({
|
|
@@ -318,7 +347,7 @@ Page({
|
|
|
}
|
|
|
// console.log(this.data.class_)
|
|
|
// console.log(this.data.z_type)
|
|
|
- if (this.data.classList.length>0) {
|
|
|
+ if (this.data.classList.length > 0 && this.data.class_<0) {
|
|
|
wx.showToast({
|
|
|
title: '请选择班级',
|
|
|
icon: 'none',
|