作者 wumengyu

预约页面兼容ipx,修改个人资料学员编辑城市列表

@@ -203,6 +203,18 @@ Page({ @@ -203,6 +203,18 @@ Page({
203 const self = this; 203 const self = this;
204 // console.log('load-experiment_id',options); 204 // console.log('load-experiment_id',options);
205 self.setData({experiment_id: +options.experiment_id}); 205 self.setData({experiment_id: +options.experiment_id});
  206 + wx.getSystemInfo({
  207 + success: function (res) {
  208 + console.log('获取屏幕',res);
  209 + if(res.screenHeight>736) {
  210 + self.setData({
  211 + is_long_screen:true,
  212 + })
  213 + }
  214 +
  215 + }
  216 +
  217 + })
206 }, 218 },
207 219
208 /** 220 /**
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 </view> 13 </view>
14 14
15 <view class="section"> 15 <view class="section">
16 - <scroll-view class="area_box" scroll-y> 16 + <scroll-view class="area_box {{is_long_screen?'add-height-left':''}}" 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>
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 <scroll-view scroll-y class="test_describe"> 39 <scroll-view scroll-y class="test_describe">
40 {{description}} 40 {{description}}
41 </scroll-view> 41 </scroll-view>
42 - <scroll-view class="time-list-box" scroll-y> 42 + <scroll-view class="time-list-box {{is_long_screen?'add-height':''}}" scroll-y>
43 <view wx:for="{{session_list}}" wx:key="index" class="time-list" bindtap="chooseTime" 43 <view wx:for="{{session_list}}" wx:key="index" class="time-list" bindtap="chooseTime"
44 data-index="{{index}}" data-id="{{item.id}}" data-surplus_num="{{item.surplus_num}}"> 44 data-index="{{index}}" data-id="{{item.id}}" data-surplus_num="{{item.surplus_num}}">
45 <image src="../../../images/blue_line.png" wx:if="{{current_session_id === item.id}}" 45 <image src="../../../images/blue_line.png" wx:if="{{current_session_id === item.id}}"
@@ -42,6 +42,9 @@ picker { @@ -42,6 +42,9 @@ picker {
42 height: 900rpx; 42 height: 900rpx;
43 background-color: #fff; 43 background-color: #fff;
44 } 44 }
  45 +.add-height-left {
  46 + height: 1107rpx;
  47 +}
45 .area-test { 48 .area-test {
46 display: flex; 49 display: flex;
47 flex-direction: column; 50 flex-direction: column;
@@ -130,6 +133,9 @@ picker { @@ -130,6 +133,9 @@ picker {
130 margin-bottom: 10rpx; 133 margin-bottom: 10rpx;
131 height: 680rpx; 134 height: 680rpx;
132 } 135 }
  136 +.add-height {
  137 + height: 887rpx;
  138 +}
133 .time-list { 139 .time-list {
134 width: 100%; 140 width: 100%;
135 height: 140rpx; 141 height: 140rpx;
@@ -25,8 +25,13 @@ Page({ @@ -25,8 +25,13 @@ Page({
25 data: { 25 data: {
26 name: '', 26 name: '',
27 sex: ['男','女'], 27 sex: ['男','女'],
  28 + sex_index:0,
  29 + is_sex_change:false,
28 default_sex: {id: 1,name: '男'}, 30 default_sex: {id: 1,name: '男'},
29 - city: ['北京市', '天津市', '河北省'], 31 + // city: ['北京市', '天津市', '河北省'],
  32 + region: ['北京市', '北京市', '东城区'],
  33 + is_city_change:false,
  34 + customItem: '全部',
30 default_birth: '2008-11-11', 35 default_birth: '2008-11-11',
31 default_city: '北京市', 36 default_city: '北京市',
32 years: years, 37 years: years,
@@ -37,6 +42,13 @@ Page({ @@ -37,6 +42,13 @@ Page({
37 day: 2, 42 day: 2,
38 value: [9999, 1, 1], 43 value: [9999, 1, 1],
39 }, 44 },
  45 + bindRegionChange(e) {
  46 + console.log('picker发送选择改变,携带值为', e.detail.value)
  47 + this.setData({
  48 + region: e.detail.value,
  49 + is_city_change: true,
  50 + })
  51 + },
40 inputName(e) { 52 inputName(e) {
41 this.setData({ 53 this.setData({
42 name: e.detail.value 54 name: e.detail.value
@@ -82,9 +94,9 @@ Page({ @@ -82,9 +94,9 @@ Page({
82 let params = { 94 let params = {
83 id: self.data.current_student.id, 95 id: self.data.current_student.id,
84 name: self.data.name || self.data.current_student.name, 96 name: self.data.name || self.data.current_student.name,
85 - sex: (self.data.sex[self.data.sex_index] === '男' ? 1 : 2) || (+self.data.current_student.sex === 1 ? 1 : 2), 97 + sex: ((self.data.is_sex_change)&&self.data.sex[self.data.sex_index] == '男' ? 1 : (!self.data.is_sex_change&&+self.data.current_student.sex == 1 ? 1 : 2)),
86 birthday: self.data.birth_date || self.data.current_student.birthday, 98 birthday: self.data.birth_date || self.data.current_student.birthday,
87 - city: self.data.city[self.data.city_index] || self.data.current_student.city, 99 + city: self.data.is_city_change?self.data.region[0] + ',' + self.data.region[1] + ',' + self.data.region[2]:self.data.current_student.city,
88 }; 100 };
89 app.post(url, params, header).then((res) => { 101 app.post(url, params, header).then((res) => {
90 // console.log('保存', res); 102 // console.log('保存', res);
@@ -111,7 +123,7 @@ Page({ @@ -111,7 +123,7 @@ Page({
111 * 生命周期函数--监听页面加载 123 * 生命周期函数--监听页面加载
112 */ 124 */
113 onLoad: function(options) { 125 onLoad: function(options) {
114 - // console.log('options', options); 126 + console.log('options', options);
115 this.setData({ 127 this.setData({
116 is_back: options.is_back?options.is_back:'', 128 is_back: options.is_back?options.is_back:'',
117 current_student: options.current_student?JSON.parse(options.current_student):'', 129 current_student: options.current_student?JSON.parse(options.current_student):'',
@@ -135,7 +147,7 @@ Page({ @@ -135,7 +147,7 @@ Page({
135 * 生命周期函数--监听页面显示 147 * 生命周期函数--监听页面显示
136 */ 148 */
137 onShow: function() { 149 onShow: function() {
138 - 150 + this.setData({is_sex_change:false})
139 }, 151 },
140 152
141 /** 153 /**
@@ -30,12 +30,28 @@ @@ -30,12 +30,28 @@
30 <view class="iconfont icon-daosanjiao"></view> 30 <view class="iconfont icon-daosanjiao"></view>
31 </view> 31 </view>
32 </picker> 32 </picker>
33 - <picker bindchange="cityPickerChange" value="{{city_index}}" range="{{city}}"> 33 + <!--<picker bindchange="cityPickerChange" value="{{city_index}}" range="{{city}}">-->
  34 + <!--<view class="select-box">-->
  35 + <!--<view class="select-picker">-->
  36 + <!--<view class="sex">城 市:</view>-->
  37 + <!--<view class="picker" wx:if="{{is_city_change}}">-->
  38 + <!--{{city[city_index]}}-->
  39 + <!--</view>-->
  40 + <!--<view wx:else>{{current_student.city}}</view>-->
  41 + <!--</view>-->
  42 + <!--<view class="iconfont icon-daosanjiao"></view>-->
  43 + <!--</view>-->
  44 + <!--</picker>-->
  45 + <picker
  46 + mode="region"
  47 + bindchange="bindRegionChange"
  48 + value="{{region}}"
  49 + >
34 <view class="select-box"> 50 <view class="select-box">
35 <view class="select-picker"> 51 <view class="select-picker">
36 <view class="sex">城 市:</view> 52 <view class="sex">城 市:</view>
37 <view class="picker" wx:if="{{is_city_change}}"> 53 <view class="picker" wx:if="{{is_city_change}}">
38 - {{city[city_index]}} 54 + {{region[0]}},{{region[1]}},{{region[2]}}
39 </view> 55 </view>
40 <view wx:else>{{current_student.city}}</view> 56 <view wx:else>{{current_student.city}}</view>
41 </view> 57 </view>
@@ -154,7 +154,14 @@ Page({ @@ -154,7 +154,14 @@ Page({
154 if(res.this_page < res.total_page) { 154 if(res.this_page < res.total_page) {
155 this.setData({has_more: true}); 155 this.setData({has_more: true});
156 } 156 }
157 - // console.log('list', list); 157 + res.list.forEach((item) => {
  158 + if(item.city.indexOf(',') > 0) { //城市带逗号
  159 + console.log(item.city.indexOf(','));
  160 + return item.city = item.city.split(',')[1]
  161 + }
  162 + console.log(item.city.indexOf(','));
  163 + });
  164 + console.log('list', res.list);
158 this.setData({student_list: this.data.student_list.concat(res.list)}) 165 this.setData({student_list: this.data.student_list.concat(res.list)})
159 }) 166 })
160 }, 167 },