|
@@ -17,6 +17,7 @@ Page({ |
|
@@ -17,6 +17,7 @@ Page({ |
17
|
phone_number_params:'',
|
17
|
phone_number_params:'',
|
18
|
introduce:'',
|
18
|
introduce:'',
|
19
|
is_change:false,
|
19
|
is_change:false,
|
|
|
20
|
+ is_choose_phone:false
|
20
|
},
|
21
|
},
|
21
|
//选择性别
|
22
|
//选择性别
|
22
|
sexPickerChange(e) {
|
23
|
sexPickerChange(e) {
|
|
@@ -30,6 +31,7 @@ Page({ |
|
@@ -30,6 +31,7 @@ Page({ |
30
|
inputPhone(e) {
|
31
|
inputPhone(e) {
|
31
|
this.setData({
|
32
|
this.setData({
|
32
|
phone_number: e.detail.value,
|
33
|
phone_number: e.detail.value,
|
|
|
34
|
+ is_choose_phone:true
|
33
|
});
|
35
|
});
|
34
|
if(this.data.phone_number.length>=11) {
|
36
|
if(this.data.phone_number.length>=11) {
|
35
|
if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
37
|
if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
|
@@ -44,6 +46,18 @@ Page({ |
|
@@ -44,6 +46,18 @@ Page({ |
44
|
console.log('params', this.data.phone_number_params);
|
46
|
console.log('params', this.data.phone_number_params);
|
45
|
}
|
47
|
}
|
46
|
}
|
48
|
}
|
|
|
49
|
+ if(e.detail.value === '') {
|
|
|
50
|
+ console.log('手机号为空',this.data.is_wrong_phone,this.data.phone_number,this.data.is_choose_phone);
|
|
|
51
|
+ this.setData({is_change:false});//按钮置灰
|
|
|
52
|
+ }
|
|
|
53
|
+ if((this.data.is_choose_phone&&this.data.phone_number !== '') &&
|
|
|
54
|
+ this.data.user.country !== null &&
|
|
|
55
|
+ this.data.user.city !== null &&
|
|
|
56
|
+ this.data.user.introduce !== null
|
|
|
57
|
+ ){
|
|
|
58
|
+ console.log(2);
|
|
|
59
|
+ this.setData({is_change:true});
|
|
|
60
|
+ }
|
47
|
},
|
61
|
},
|
48
|
//失去焦点
|
62
|
//失去焦点
|
49
|
blur() {
|
63
|
blur() {
|
|
@@ -69,7 +83,7 @@ Page({ |
|
@@ -69,7 +83,7 @@ Page({ |
69
|
app.post(url, params, {}).then((res) => {
|
83
|
app.post(url, params, {}).then((res) => {
|
70
|
console.log('自动获取手机号', res);
|
84
|
console.log('自动获取手机号', res);
|
71
|
if (+res.code === 1) {
|
85
|
if (+res.code === 1) {
|
72
|
- this.setData({phone_number:res.data,is_wrong_phone:false})
|
86
|
+ this.setData({phone_number:res.data,is_wrong_phone:false,is_choose_phone:true})
|
73
|
}
|
87
|
}
|
74
|
});
|
88
|
});
|
75
|
},
|
89
|
},
|
|
@@ -78,14 +92,36 @@ Page({ |
|
@@ -78,14 +92,36 @@ Page({ |
78
|
this.setData({
|
92
|
this.setData({
|
79
|
country: e.detail.value,
|
93
|
country: e.detail.value,
|
80
|
is_choose_country:true
|
94
|
is_choose_country:true
|
81
|
- })
|
95
|
+ });
|
|
|
96
|
+ if(e.detail.value === '') {
|
|
|
97
|
+ this.setData({is_change:false});
|
|
|
98
|
+ }
|
|
|
99
|
+ if((this.data.is_choose_country&&this.data.country !== '') &&
|
|
|
100
|
+ this.data.user.city !== null &&
|
|
|
101
|
+ this.data.user.tel !== null &&
|
|
|
102
|
+ this.data.user.introduce !== null
|
|
|
103
|
+ ){
|
|
|
104
|
+ console.log(2);
|
|
|
105
|
+ this.setData({is_change:true});
|
|
|
106
|
+ }
|
82
|
},
|
107
|
},
|
83
|
//输入城市
|
108
|
//输入城市
|
84
|
inputCity(e) {
|
109
|
inputCity(e) {
|
85
|
this.setData({
|
110
|
this.setData({
|
86
|
city: e.detail.value,
|
111
|
city: e.detail.value,
|
87
|
is_choose_city:true
|
112
|
is_choose_city:true
|
88
|
- })
|
113
|
+ });
|
|
|
114
|
+ if(e.detail.value === '') {
|
|
|
115
|
+ this.setData({is_change:false});
|
|
|
116
|
+ }
|
|
|
117
|
+ if((this.data.is_choose_city&&this.data.city !== '') &&
|
|
|
118
|
+ this.data.user.country !== null &&
|
|
|
119
|
+ this.data.user.tel !== null &&
|
|
|
120
|
+ this.data.user.introduce !== null
|
|
|
121
|
+ ){
|
|
|
122
|
+ console.log(2);
|
|
|
123
|
+ this.setData({is_change:true});
|
|
|
124
|
+ }
|
89
|
},
|
125
|
},
|
90
|
//简介
|
126
|
//简介
|
91
|
inputContent(e) {
|
127
|
inputContent(e) {
|
|
@@ -105,17 +141,37 @@ Page({ |
|
@@ -105,17 +141,37 @@ Page({ |
105
|
introduce: textcontent,
|
141
|
introduce: textcontent,
|
106
|
is_choose_introduce:true
|
142
|
is_choose_introduce:true
|
107
|
});
|
143
|
});
|
|
|
144
|
+ if(e.detail.value === '') {
|
|
|
145
|
+ this.setData({is_change:false});
|
|
|
146
|
+ }
|
108
|
console.log('textcontent', textcontent);
|
147
|
console.log('textcontent', textcontent);
|
109
|
- if(this.data.current_sex !== undefined &&
|
|
|
110
|
- this.data.country !== '' &&
|
|
|
111
|
- this.data.city !== '' &&
|
|
|
112
|
- this.data.phone_number !== '' &&
|
|
|
113
|
- !this.data.is_wrong_phone &&
|
|
|
114
|
- this.data.introduce !== '') {
|
148
|
+ if((this.data.is_choose_introduce&&this.data.introduce !== '') &&
|
|
|
149
|
+ this.data.user.city !== null &&
|
|
|
150
|
+ this.data.user.tel !== null &&
|
|
|
151
|
+ this.data.user.country !== null
|
|
|
152
|
+ ){
|
|
|
153
|
+ console.log(2);
|
115
|
this.setData({is_change:true});
|
154
|
this.setData({is_change:true});
|
116
|
- }else {
|
|
|
117
|
- this.setData({is_change:false});
|
|
|
118
|
}
|
155
|
}
|
|
|
156
|
+ // if((this.data.is_choose_country&&this.data.country !== '')&&
|
|
|
157
|
+ // (this.data.is_choose_city&&this.data.city !== '') &&
|
|
|
158
|
+ // (this.data.is_choose_phone&&this.data.phone_number !== '') &&
|
|
|
159
|
+ // (this.data.is_choose_introduce&&this.data.introduce !== '')
|
|
|
160
|
+ // ) {
|
|
|
161
|
+ // console.log(1);
|
|
|
162
|
+ // this.setData({is_change:true});
|
|
|
163
|
+ // }else if((this.data.is_choose_country&&this.data.country !== '')){
|
|
|
164
|
+ // console.log(2);
|
|
|
165
|
+ // this.setData({is_change:true});
|
|
|
166
|
+ // }
|
|
|
167
|
+ // if(((this.data.is_choose_country&&this.data.country !== '') || this.data.user.country !== null) &&
|
|
|
168
|
+ // ((this.data.is_choose_city&&this.data.city !== '')|| this.data.user.city !== null) &&
|
|
|
169
|
+ // ((this.data.is_choose_phone&&this.data.phone_number !== '')|| this.data.user.tel !== null) &&
|
|
|
170
|
+ // !this.data.is_wrong_phone &&
|
|
|
171
|
+ // ((this.data.is_choose_introduce&&this.data.introduce !== '') || this.data.user.introduce !== null)) {
|
|
|
172
|
+ // console.log('111');
|
|
|
173
|
+ // this.setData({is_change:true});
|
|
|
174
|
+ // }
|
119
|
}
|
175
|
}
|
120
|
},
|
176
|
},
|
121
|
//保存
|
177
|
//保存
|
|
@@ -125,8 +181,8 @@ Page({ |
|
@@ -125,8 +181,8 @@ Page({ |
125
|
wx.showToast({title:'请填写国家',icon:'none'})
|
181
|
wx.showToast({title:'请填写国家',icon:'none'})
|
126
|
}else if(this.data.city === '' && this.data.user.city === null) {
|
182
|
}else if(this.data.city === '' && this.data.user.city === null) {
|
127
|
wx.showToast({title:'请填写城市',icon:'none'})
|
183
|
wx.showToast({title:'请填写城市',icon:'none'})
|
128
|
- }else if (this.data.phone_number === '' && this.data.user.tel === null) {
|
|
|
129
|
- wx.showToast({title:'请填写手机号',icon:'none'})
|
184
|
+ }else if (this.data.user.tel === null) {
|
|
|
185
|
+ wx.showToast({title:'请获取手机号',icon:'none'})
|
130
|
}else if(this.data.is_wrong_phone){
|
186
|
}else if(this.data.is_wrong_phone){
|
131
|
wx.showToast({title:'手机号格式错误',icon:'none'})
|
187
|
wx.showToast({title:'手机号格式错误',icon:'none'})
|
132
|
}else if(this.data.introduce === '' && this.data.user.introduce === null) {
|
188
|
}else if(this.data.introduce === '' && this.data.user.introduce === null) {
|
|
@@ -139,7 +195,8 @@ Page({ |
|
@@ -139,7 +195,8 @@ Page({ |
139
|
sex: sex || this.data.user.sex,
|
195
|
sex: sex || this.data.user.sex,
|
140
|
country:this.data.is_choose_country?this.data.country:this.data.user.country,
|
196
|
country:this.data.is_choose_country?this.data.country:this.data.user.country,
|
141
|
city:this.data.is_choose_city?this.data.city:this.data.user.city,
|
197
|
city:this.data.is_choose_city?this.data.city:this.data.user.city,
|
142
|
- tel:this.data.phone_number !== ''?this.data.phone_number:this.data.user.tel,
|
198
|
+ // tel:(this.data.is_choose_phone&&this.data.phone_number !== '')?this.data.phone_number:this.data.user.tel,
|
|
|
199
|
+ tel:this.data.user.tel,
|
143
|
introduce:this.data.is_choose_introduce?this.data.introduce:this.data.user.introduce
|
200
|
introduce:this.data.is_choose_introduce?this.data.introduce:this.data.user.introduce
|
144
|
};
|
201
|
};
|
145
|
app.post(url, params, {}).then((res) => {
|
202
|
app.post(url, params, {}).then((res) => {
|
|
@@ -182,6 +239,9 @@ Page({ |
|
@@ -182,6 +239,9 @@ Page({ |
182
|
*/
|
239
|
*/
|
183
|
onLoad: function (options) {
|
240
|
onLoad: function (options) {
|
184
|
this.setData({userInfo:app.globalData.userInfo});
|
241
|
this.setData({userInfo:app.globalData.userInfo});
|
|
|
242
|
+ if(this.data.userInfo.tel !== null) {
|
|
|
243
|
+ this.setData({is_wrong_phone:false})
|
|
|
244
|
+ }
|
185
|
// console.log('userInfo', this.data.userInfo);
|
245
|
// console.log('userInfo', this.data.userInfo);
|
186
|
this.getDetail();
|
246
|
this.getDetail();
|
187
|
|
247
|
|