作者 wumengyu

优化预约code为40000问题

@@ -70,6 +70,7 @@ App({ @@ -70,6 +70,7 @@ App({
70 }else if(res.data.code == '30000') { 70 }else if(res.data.code == '30000') {
71 resolve(res.data); 71 resolve(res.data);
72 } else if (res.data.code == '40001') {//返回错误提示信息 72 } else if (res.data.code == '40001') {//返回错误提示信息
  73 + console.log('code == 40001');
73 wx.showModal({ 74 wx.showModal({
74 title: '提示', 75 title: '提示',
75 content: res.data.msg, 76 content: res.data.msg,
@@ -85,14 +86,17 @@ App({ @@ -85,14 +86,17 @@ App({
85 }); 86 });
86 resolve(res.data.msg); 87 resolve(res.data.msg);
87 } else if (res.data.code == '40000') { 88 } else if (res.data.code == '40000') {
88 - wx.showModal({  
89 - title: '提示',  
90 - content: res.data.msg,  
91 - showCancel: false,  
92 - success: function (res) { }  
93 - }) 89 + console.log('code == 40000');
  90 + resolve(res.data);
  91 + // wx.showModal({
  92 + // title: '提示',
  93 + // content: res.data.msg,
  94 + // showCancel: false,
  95 + // success: function (res) { }
  96 + // })
94 } else { 97 } else {
95 console.log(res.data); 98 console.log(res.data);
  99 + console.log('app其他code');
96 wx.showModal({ 100 wx.showModal({
97 title: '提示', 101 title: '提示',
98 content: res.data.msg, 102 content: res.data.msg,
@@ -126,17 +126,18 @@ Page({ @@ -126,17 +126,18 @@ Page({
126 //提交 126 //提交
127 submit() { 127 submit() {
128 if (this.data.is_choose_session) { 128 if (this.data.is_choose_session) {
  129 + console.log(this.data.experiment_id, this.data.current_session_id, this.data.student_num);
129 let url = '/portal/Experiment/submit_session'; 130 let url = '/portal/Experiment/submit_session';
130 let header = { 131 let header = {
131 "XX-token": wx.getStorageSync('token') 132 "XX-token": wx.getStorageSync('token')
132 }; 133 };
133 let params = { 134 let params = {
134 - experiment_id: this.data.experiment_id,  
135 - session_id: this.data.current_session_id,  
136 - student_num: this.data.student_num, 135 + experiment_id: +this.data.experiment_id,
  136 + session_id: +this.data.current_session_id,
  137 + student_num: +this.data.student_num,
137 }; 138 };
138 app.post(url, params, header).then((res) => { 139 app.post(url, params, header).then((res) => {
139 - // console.log(res); 140 + console.log(res);
140 wx.navigateTo({ 141 wx.navigateTo({
141 url: '/pages/index/confirm-appointment-info/confirm-appointment-info?experiment_id=' + this.data.experiment_id 142 url: '/pages/index/confirm-appointment-info/confirm-appointment-info?experiment_id=' + this.data.experiment_id
142 + '&session_id=' + this.data.current_session_id 143 + '&session_id=' + this.data.current_session_id
@@ -182,11 +183,11 @@ Page({ @@ -182,11 +183,11 @@ Page({
182 "XX-token": wx.getStorageSync('token') 183 "XX-token": wx.getStorageSync('token')
183 }; 184 };
184 app.post(url, params, header).then((res) => { 185 app.post(url, params, header).then((res) => {
185 - // console.log('实验',res.list); 186 + // console.log('实验',res);
186 // console.log(res.list,res.list[0],res.list[0].lab_list,res.list[0].lab_list[0],); 187 // console.log(res.list,res.list[0],res.list[0].lab_list,res.list[0].lab_list[0],);
187 this.setData({ 188 this.setData({
188 areaTest: res.list, 189 areaTest: res.list,
189 - student_num: res.student_num, 190 + student_num: res.student_num == 0?1:res.student_num,
190 current_test_id: res.list.length>0 && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].id:'', 191 current_test_id: res.list.length>0 && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].id:'',
191 description: res.list.length>0 && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].description : '',//默认显示第一个实验室的描述 192 description: res.list.length>0 && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].description : '',//默认显示第一个实验室的描述
192 session_list: res.list.length>0 && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].session_list : ''//默认显示第一个实验室的实验时间 193 session_list: res.list.length>0 && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].session_list : ''//默认显示第一个实验室的实验时间
@@ -55,8 +55,8 @@ Page({ @@ -55,8 +55,8 @@ Page({
55 app.post(url,params,header).then((res) => { 55 app.post(url,params,header).then((res) => {
56 // console.log('兑换并绑定',res); 56 // console.log('兑换并绑定',res);
57 this.setData({is_confirm: false}); 57 this.setData({is_confirm: false});
58 - if(res === '参数错误') {  
59 - } 58 + // if(res === '参数错误') {
  59 + // }
60 // console.log('list', list); 60 // console.log('list', list);
61 // this.setData({picker_list: list}) 61 // this.setData({picker_list: list})
62 }) 62 })