...
|
...
|
@@ -17,6 +17,7 @@ Page({ |
|
|
phone_number_params:'',
|
|
|
introduce:'',
|
|
|
is_change:false,
|
|
|
is_choose_phone:false
|
|
|
},
|
|
|
//选择性别
|
|
|
sexPickerChange(e) {
|
...
|
...
|
@@ -30,6 +31,7 @@ Page({ |
|
|
inputPhone(e) {
|
|
|
this.setData({
|
|
|
phone_number: e.detail.value,
|
|
|
is_choose_phone:true
|
|
|
});
|
|
|
if(this.data.phone_number.length>=11) {
|
|
|
if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
...
|
...
|
@@ -44,6 +46,18 @@ Page({ |
|
|
console.log('params', this.data.phone_number_params);
|
|
|
}
|
|
|
}
|
|
|
if(e.detail.value === '') {
|
|
|
console.log('手机号为空',this.data.is_wrong_phone,this.data.phone_number,this.data.is_choose_phone);
|
|
|
this.setData({is_change:false});//按钮置灰
|
|
|
}
|
|
|
if((this.data.is_choose_phone&&this.data.phone_number !== '') &&
|
|
|
this.data.user.country !== null &&
|
|
|
this.data.user.city !== null &&
|
|
|
this.data.user.introduce !== null
|
|
|
){
|
|
|
console.log(2);
|
|
|
this.setData({is_change:true});
|
|
|
}
|
|
|
},
|
|
|
//失去焦点
|
|
|
blur() {
|
...
|
...
|
@@ -69,7 +83,7 @@ Page({ |
|
|
app.post(url, params, {}).then((res) => {
|
|
|
console.log('自动获取手机号', res);
|
|
|
if (+res.code === 1) {
|
|
|
this.setData({phone_number:res.data,is_wrong_phone:false})
|
|
|
this.setData({phone_number:res.data,is_wrong_phone:false,is_choose_phone:true})
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -78,14 +92,36 @@ Page({ |
|
|
this.setData({
|
|
|
country: e.detail.value,
|
|
|
is_choose_country:true
|
|
|
})
|
|
|
});
|
|
|
if(e.detail.value === '') {
|
|
|
this.setData({is_change:false});
|
|
|
}
|
|
|
if((this.data.is_choose_country&&this.data.country !== '') &&
|
|
|
this.data.user.city !== null &&
|
|
|
this.data.user.tel !== null &&
|
|
|
this.data.user.introduce !== null
|
|
|
){
|
|
|
console.log(2);
|
|
|
this.setData({is_change:true});
|
|
|
}
|
|
|
},
|
|
|
//输入城市
|
|
|
inputCity(e) {
|
|
|
this.setData({
|
|
|
city: e.detail.value,
|
|
|
is_choose_city:true
|
|
|
})
|
|
|
});
|
|
|
if(e.detail.value === '') {
|
|
|
this.setData({is_change:false});
|
|
|
}
|
|
|
if((this.data.is_choose_city&&this.data.city !== '') &&
|
|
|
this.data.user.country !== null &&
|
|
|
this.data.user.tel !== null &&
|
|
|
this.data.user.introduce !== null
|
|
|
){
|
|
|
console.log(2);
|
|
|
this.setData({is_change:true});
|
|
|
}
|
|
|
},
|
|
|
//简介
|
|
|
inputContent(e) {
|
...
|
...
|
@@ -105,17 +141,37 @@ Page({ |
|
|
introduce: textcontent,
|
|
|
is_choose_introduce:true
|
|
|
});
|
|
|
if(e.detail.value === '') {
|
|
|
this.setData({is_change:false});
|
|
|
}
|
|
|
console.log('textcontent', textcontent);
|
|
|
if(this.data.current_sex !== undefined &&
|
|
|
this.data.country !== '' &&
|
|
|
this.data.city !== '' &&
|
|
|
this.data.phone_number !== '' &&
|
|
|
!this.data.is_wrong_phone &&
|
|
|
this.data.introduce !== '') {
|
|
|
if((this.data.is_choose_introduce&&this.data.introduce !== '') &&
|
|
|
this.data.user.city !== null &&
|
|
|
this.data.user.tel !== null &&
|
|
|
this.data.user.country !== null
|
|
|
){
|
|
|
console.log(2);
|
|
|
this.setData({is_change:true});
|
|
|
}else {
|
|
|
this.setData({is_change:false});
|
|
|
}
|
|
|
// if((this.data.is_choose_country&&this.data.country !== '')&&
|
|
|
// (this.data.is_choose_city&&this.data.city !== '') &&
|
|
|
// (this.data.is_choose_phone&&this.data.phone_number !== '') &&
|
|
|
// (this.data.is_choose_introduce&&this.data.introduce !== '')
|
|
|
// ) {
|
|
|
// console.log(1);
|
|
|
// this.setData({is_change:true});
|
|
|
// }else if((this.data.is_choose_country&&this.data.country !== '')){
|
|
|
// console.log(2);
|
|
|
// this.setData({is_change:true});
|
|
|
// }
|
|
|
// if(((this.data.is_choose_country&&this.data.country !== '') || this.data.user.country !== null) &&
|
|
|
// ((this.data.is_choose_city&&this.data.city !== '')|| this.data.user.city !== null) &&
|
|
|
// ((this.data.is_choose_phone&&this.data.phone_number !== '')|| this.data.user.tel !== null) &&
|
|
|
// !this.data.is_wrong_phone &&
|
|
|
// ((this.data.is_choose_introduce&&this.data.introduce !== '') || this.data.user.introduce !== null)) {
|
|
|
// console.log('111');
|
|
|
// this.setData({is_change:true});
|
|
|
// }
|
|
|
}
|
|
|
},
|
|
|
//保存
|
...
|
...
|
@@ -125,8 +181,8 @@ Page({ |
|
|
wx.showToast({title:'请填写国家',icon:'none'})
|
|
|
}else if(this.data.city === '' && this.data.user.city === null) {
|
|
|
wx.showToast({title:'请填写城市',icon:'none'})
|
|
|
}else if (this.data.phone_number === '' && this.data.user.tel === null) {
|
|
|
wx.showToast({title:'请填写手机号',icon:'none'})
|
|
|
}else if (this.data.user.tel === null) {
|
|
|
wx.showToast({title:'请获取手机号',icon:'none'})
|
|
|
}else if(this.data.is_wrong_phone){
|
|
|
wx.showToast({title:'手机号格式错误',icon:'none'})
|
|
|
}else if(this.data.introduce === '' && this.data.user.introduce === null) {
|
...
|
...
|
@@ -139,7 +195,8 @@ Page({ |
|
|
sex: sex || this.data.user.sex,
|
|
|
country:this.data.is_choose_country?this.data.country:this.data.user.country,
|
|
|
city:this.data.is_choose_city?this.data.city:this.data.user.city,
|
|
|
tel:this.data.phone_number !== ''?this.data.phone_number:this.data.user.tel,
|
|
|
// tel:(this.data.is_choose_phone&&this.data.phone_number !== '')?this.data.phone_number:this.data.user.tel,
|
|
|
tel:this.data.user.tel,
|
|
|
introduce:this.data.is_choose_introduce?this.data.introduce:this.data.user.introduce
|
|
|
};
|
|
|
app.post(url, params, {}).then((res) => {
|
...
|
...
|
@@ -182,6 +239,9 @@ Page({ |
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
this.setData({userInfo:app.globalData.userInfo});
|
|
|
if(this.data.userInfo.tel !== null) {
|
|
|
this.setData({is_wrong_phone:false})
|
|
|
}
|
|
|
// console.log('userInfo', this.data.userInfo);
|
|
|
this.getDetail();
|
|
|
|
...
|
...
|
|