作者 刘晓艳

合并分支 'wumengyu' 到 'master'

Wumengyu



查看合并请求 !19
@@ -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,
@@ -18,7 +18,7 @@ Page({ @@ -18,7 +18,7 @@ Page({
18 description: '', 18 description: '',
19 session_list: {}, 19 session_list: {},
20 show_submit_btn: false, 20 show_submit_btn: false,
21 - student_num: 0, 21 + student_num: 1,
22 areaTest: [], 22 areaTest: [],
23 test: {}, 23 test: {},
24 }, 24 },
@@ -45,16 +45,42 @@ Page({ @@ -45,16 +45,42 @@ Page({
45 currentTest: current, 45 currentTest: current,
46 current_test_id: current_id, 46 current_test_id: current_id,
47 }); 47 });
  48 + // return this.data.areaTest.forEach((item, index) => {
  49 + // console.log('index', index);
  50 + // if (item.lab_list.length > 0 && item.lab_list[current] !== undefined) {
  51 + // console.log(current, item.lab_list, item.lab_list[current].id, current_id);
  52 + // if (item.lab_list.length > 0 && (item.lab_list[current].id === current_id)) {
  53 + // this.setData({
  54 + // description: item.lab_list.length > 0 && item.lab_list[current].description ? item.lab_list[current].description : '',
  55 + // session_list: item.lab_list.length > 0 && item.lab_list[current].session_list.length > 0 ? item.lab_list[current].session_list : '',
  56 + // });
  57 + // // return
  58 + // }
  59 + // } else if (item.lab_list.length > 0 && item.lab_list[current] === undefined) {
  60 + // console.log('item.lab_list[current]', item.lab_list[current]);
  61 + // if (item.lab_list.length > 0 && (item.lab_list[index].id === current_id)) {
  62 + // this.setData({
  63 + // description: item.lab_list.length > 0 && item.lab_list[index].description ? item.lab_list[index].description : '',
  64 + // session_list: item.lab_list.length > 0 && item.lab_list[index].session_list.length > 0 ? item.lab_list[index].session_list : '',
  65 + // });
  66 + // // return
  67 + // }
  68 + // }
  69 + // });
  70 +
48 return this.data.areaTest.forEach((item, index) => { 71 return this.data.areaTest.forEach((item, index) => {
49 - // console.log(item.lab_list[current].id, current_id);  
50 - if (item.lab_list && (item.lab_list[current].id === current_id)) {  
51 - this.setData({  
52 - description: item.lab_list && item.lab_list[current].description ? item.lab_list[current].description : '',  
53 - session_list: item.lab_list && item.lab_list[current].session_list ? item.lab_list[current].session_list : '',  
54 - });  
55 - // return 72 + if( item.lab_list.length>0) {
  73 + item.lab_list.forEach((i, idx) => {
  74 + if (i.id === current_id) {
  75 + this.setData({
  76 + description: item.lab_list.length > 0 && item.lab_list[idx].description ? item.lab_list[idx].description : '',
  77 + session_list: item.lab_list.length > 0 && item.lab_list[idx].session_list.length > 0 ? item.lab_list[idx].session_list : '',
  78 + });
  79 + }
  80 + })
56 } 81 }
57 - }); 82 +
  83 + })
58 }, 84 },
59 85
60 //选择场次 86 //选择场次
@@ -100,17 +126,18 @@ Page({ @@ -100,17 +126,18 @@ Page({
100 //提交 126 //提交
101 submit() { 127 submit() {
102 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);
103 let url = '/portal/Experiment/submit_session'; 130 let url = '/portal/Experiment/submit_session';
104 let header = { 131 let header = {
105 "XX-token": wx.getStorageSync('token') 132 "XX-token": wx.getStorageSync('token')
106 }; 133 };
107 let params = { 134 let params = {
108 - experiment_id: this.data.experiment_id,  
109 - session_id: this.data.current_session_id,  
110 - 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,
111 }; 138 };
112 app.post(url, params, header).then((res) => { 139 app.post(url, params, header).then((res) => {
113 - // console.log(res); 140 + console.log(res);
114 wx.navigateTo({ 141 wx.navigateTo({
115 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
116 + '&session_id=' + this.data.current_session_id 143 + '&session_id=' + this.data.current_session_id
@@ -156,13 +183,14 @@ Page({ @@ -156,13 +183,14 @@ Page({
156 "XX-token": wx.getStorageSync('token') 183 "XX-token": wx.getStorageSync('token')
157 }; 184 };
158 app.post(url, params, header).then((res) => { 185 app.post(url, params, header).then((res) => {
  186 + // console.log('实验',res);
159 // 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],);
160 this.setData({ 188 this.setData({
161 areaTest: res.list, 189 areaTest: res.list,
162 - student_num: res.student_num,  
163 - current_test_id: res.list && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].id:'',  
164 - description: res.list && res.list[0].lab_list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].description : '',//默认显示第一个实验室的描述  
165 - session_list: res.list && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].session_list : ''//默认显示第一个实验室的实验时间 190 + student_num: res.student_num == 0?1:res.student_num,
  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:'',
  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 : '',//默认显示第一个实验室的描述
  193 + session_list: res.list.length>0 && res.list[0].lab_list.length>0 ? res.list[0].lab_list[0].session_list : ''//默认显示第一个实验室的实验时间
166 194
167 }) 195 })
168 // console.log(this.data.this_week_test_info); 196 // console.log(this.data.this_week_test_info);
@@ -15,10 +15,11 @@ @@ -15,10 +15,11 @@
15 <view class="section"> 15 <view class="section">
16 <scroll-view class="area_box" scroll-y> 16 <scroll-view class="area_box" scroll-y>
17 <block wx:for="{{areaTest}}" wx:key="index"> 17 <block wx:for="{{areaTest}}" wx:key="index">
18 - <view class="area-test" data-index="{{index}}" wx:for-index="{{idx}}"> 18 + <view class="area-test" data-index="{{index}}" wx:for-index="idx">
19 <view class="area">{{item.name}}</view> 19 <view class="area">{{item.name}}</view>
20 <view class="test-list"> 20 <view class="test-list">
21 <view class="list-item-box"> 21 <view class="list-item-box">
  22 + <view class="no-session test" wx:if="{{item.lab_list.length===0}}">暂无实验</view>
22 <block wx:for="{{item.lab_list}}" wx:key="index"> 23 <block wx:for="{{item.lab_list}}" wx:key="index">
23 <view class="list-item" bindtap="chooseTest" data-index="{{index}}" 24 <view class="list-item" bindtap="chooseTest" data-index="{{index}}"
24 data-id="{{item.id}}"> 25 data-id="{{item.id}}">
@@ -79,6 +79,7 @@ picker { @@ -79,6 +79,7 @@ picker {
79 display: flex; 79 display: flex;
80 position: relative; 80 position: relative;
81 } 81 }
  82 +
82 .list-item-box .list-item:last-child { 83 .list-item-box .list-item:last-child {
83 border: none; 84 border: none;
84 } 85 }
@@ -99,6 +100,10 @@ picker { @@ -99,6 +100,10 @@ picker {
99 line-height: 100rpx; 100 line-height: 100rpx;
100 color: #6F6F6F; 101 color: #6F6F6F;
101 font-size: 28rpx; 102 font-size: 28rpx;
  103 + overflow-x: scroll;
  104 + white-space:nowrap;
  105 + display: -webkit-box;
  106 + -webkit-overflow-scrolling: touch;
102 /*border-bottom: 1rpx solid #DEDEDE;*/ 107 /*border-bottom: 1rpx solid #DEDEDE;*/
103 } 108 }
104 .change-color { 109 .change-color {
@@ -79,7 +79,7 @@ Page({ @@ -79,7 +79,7 @@ Page({
79 icon: 'success', 79 icon: 'success',
80 success: function () { 80 success: function () {
81 setTimeout(function () { 81 setTimeout(function () {
82 - if(self.data.from_appointment) {//如果从首页或预约购买的,成功后返回上一页 82 + if(self.data.from_appointment) {//如果从首页或预约或我的畅玩卡进行购买的,成功后返回上一页
83 wx.navigateBack({delta: 1}); 83 wx.navigateBack({delta: 1});
84 self.setData({pay_success: true}); 84 self.setData({pay_success: true});
85 self.changeState(); 85 self.changeState();
@@ -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 })
@@ -57,7 +57,7 @@ Page({ @@ -57,7 +57,7 @@ Page({
57 //立即购买 57 //立即购买
58 buyCard() { 58 buyCard() {
59 wx.navigateTo({ 59 wx.navigateTo({
60 - url: '../buyCard/buyCard', 60 + url: '../buyCard/buyCard?from_index=' + true,
61 }) 61 })
62 }, 62 },
63 63