|
|
@@ -42,99 +42,100 @@ Page({
|
|
|
wx.request({
|
|
|
url: host + '/api/wx/sujectitem',
|
|
|
success: res => {
|
|
|
- sub_list = res.data.data
|
|
|
- }
|
|
|
- })
|
|
|
- // options:s_name 分类名称 s_id 分类id class_id 班级id
|
|
|
- //新增报名
|
|
|
- if (options.type == 1){
|
|
|
- //班级列表
|
|
|
- wx.request({
|
|
|
- url: host + '/api/wx/class/list?subject_item0=' + options.s_id,
|
|
|
- method: 'GET',
|
|
|
- success: res => {
|
|
|
- // 过滤分类
|
|
|
- let list = sub_list.filter(item => item.id == options.s_id)
|
|
|
- this.setData({
|
|
|
- categoryArray: list[0].children,
|
|
|
- z_type: list[0].name, //提交时拼接subject_item
|
|
|
- classList: res.data.data[0].classes
|
|
|
+ sub_list = res.data.data
|
|
|
+ // options:s_name 分类名称 s_id 分类id class_id 班级id
|
|
|
+ //新增报名
|
|
|
+ if (options.type == 1){
|
|
|
+ //班级列表
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/wx/class/list?subject_item0=' + options.s_id,
|
|
|
+ method: 'GET',
|
|
|
+ success: res => {
|
|
|
+ // 过滤分类
|
|
|
+ let list = sub_list.filter(item => item.id == options.s_id)
|
|
|
+ this.setData({
|
|
|
+ categoryArray: list[0].children,
|
|
|
+ z_type: list[0].name, //提交时拼接subject_item
|
|
|
+ classList: res.data.data[0].classes
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- //修改报名
|
|
|
- if(options.type == 2){
|
|
|
- wx.request({
|
|
|
- url: host+'/api/wx/signup',
|
|
|
- method:'GET',
|
|
|
- data:{id:options.id},
|
|
|
- success:res=>{
|
|
|
- let data = res.data.data, subject_item = data.subject_item.split('|')
|
|
|
- let list = sub_list.filter(item => item.name == subject_item[0])
|
|
|
- let categoryArray = list[0].children, subject = 0,
|
|
|
- subjectArray = [], category = 0, train=0
|
|
|
- //定位分类下拉选项
|
|
|
- for(let i=0;i<categoryArray.length;i++){
|
|
|
- if (categoryArray[i].name == subject_item[1]){
|
|
|
- category=i
|
|
|
- subjectArray = categoryArray[i].children
|
|
|
- for(let j=0;j<subjectArray.length;j++){
|
|
|
- if (subjectArray[j].name == subject_item[2]){
|
|
|
- subject=j
|
|
|
+ //修改报名
|
|
|
+ if(options.type == 2){
|
|
|
+ wx.request({
|
|
|
+ url: host+'/api/wx/signup',
|
|
|
+ method:'GET',
|
|
|
+ data:{id:options.id},
|
|
|
+ success:res=>{
|
|
|
+ let data = res.data.data, subject_item = data.subject_item.split('|');
|
|
|
+ let list = sub_list.filter(item => item.name == subject_item[0]);
|
|
|
+ let categoryArray = list[0].children, subject = 0,
|
|
|
+ subjectArray = [], category = 0, train=0;
|
|
|
+
|
|
|
+ //定位分类下拉选项
|
|
|
+ for(let i=0;i<categoryArray.length;i++){
|
|
|
+ if (categoryArray[i].name == subject_item[1]){
|
|
|
+ category=i
|
|
|
+ subjectArray = categoryArray[i].children
|
|
|
+ for(let j=0;j<subjectArray.length;j++){
|
|
|
+ if (subjectArray[j].name == subject_item[2]){
|
|
|
+ subject=j
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- for(let i=0;i<this.data.trainArray.length;i++){
|
|
|
- if (this.data.trainArray[i].name == data.train_type){
|
|
|
- train=i
|
|
|
- }
|
|
|
- }
|
|
|
- //获取班级列表
|
|
|
- wx.request({
|
|
|
- url: host + '/api/wx/class/list?subject_item0=' + list[0].id,
|
|
|
- method: 'GET',
|
|
|
- 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
|
|
|
+ for(let i=0;i<this.data.trainArray.length;i++){
|
|
|
+ if (this.data.trainArray[i].name == data.train_type){
|
|
|
+ train=i
|
|
|
}
|
|
|
}
|
|
|
+ //获取班级列表
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/wx/class/list?subject_item0=' + list[0].id,
|
|
|
+ method: 'GET',
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ classList: classes,
|
|
|
+ class_: class_
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
this.setData({
|
|
|
- classList: classes,
|
|
|
- class_: class_
|
|
|
+ z_type: subject_item[0],
|
|
|
+ sex:data.sex=='男' ? 0 :1,
|
|
|
+ record: this.data.recordArray.indexOf(data.education),
|
|
|
+ receive: data.receive_card == '自取' ? 0 : 1,
|
|
|
+ categoryArray: categoryArray,
|
|
|
+ subjectArray: subjectArray,
|
|
|
+ category: category,
|
|
|
+ subject: subject,
|
|
|
+ train: train,
|
|
|
+ area:data.area.split(' ')
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ data: res.data.data
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- this.setData({
|
|
|
- z_type: subject_item[0],
|
|
|
- sex:data.sex=='男' ? 0 :1,
|
|
|
- record: this.data.recordArray.indexOf(data.education),
|
|
|
- receive: data.receive_card == '自取' ? 0 : 1,
|
|
|
- categoryArray: categoryArray,
|
|
|
- subjectArray: subjectArray,
|
|
|
- category: category,
|
|
|
- subject: subject,
|
|
|
- train: train,
|
|
|
- area:data.area.split(' ')
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- this.setData({
|
|
|
- data: res.data.data
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- //班级报名
|
|
|
- if(options.type == 3){
|
|
|
- this.setData({
|
|
|
- parice_list: options.price.split('_'),
|
|
|
- class_id: options.class_id
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ //班级报名
|
|
|
+ if(options.type == 3){
|
|
|
+ this.setData({
|
|
|
+ parice_list: options.price.split('_'),
|
|
|
+ class_id: options.class_id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
pickerChange:function(e){
|