...
|
...
|
@@ -32,25 +32,28 @@ Page({ |
|
|
inputPhone(e) {
|
|
|
this.setData({
|
|
|
phone_number: e.detail.value,
|
|
|
is_choose_phone:true
|
|
|
// is_choose_phone:true,
|
|
|
});
|
|
|
if(this.data.phone_number.length>=11) {
|
|
|
if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
|
|
wx.showToast({title:'手机号格式错误',icon:'none'});
|
|
|
this.setData({is_wrong_phone:true,phone_number_params:''});
|
|
|
// console.log('params', this.data.phone_number_params);
|
|
|
}else {
|
|
|
this.setData({
|
|
|
phone_number_params: this.data.phone_number,
|
|
|
'user.tel':this.data.phone_number,
|
|
|
is_wrong_phone:false,
|
|
|
});
|
|
|
// console.log('params', this.data.phone_number_params);
|
|
|
}
|
|
|
}
|
|
|
console.log('phone_number', this.data.phone_number);
|
|
|
// if(this.data.phone_number.length>=11) {
|
|
|
// if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
|
|
// wx.showToast({title:'手机号格式错误',icon:'none'});
|
|
|
// this.setData({is_wrong_phone:true,phone_number_params:''});
|
|
|
// // console.log('params', this.data.phone_number_params);
|
|
|
// }else {
|
|
|
// this.setData({
|
|
|
// phone_number_params: this.data.phone_number,
|
|
|
// 'user.tel':this.data.phone_number,
|
|
|
// is_wrong_phone:false,
|
|
|
// });
|
|
|
// // console.log('params', this.data.phone_number_params);
|
|
|
// }
|
|
|
// }
|
|
|
if(e.detail.value === '') {
|
|
|
// console.log('手机号为空',this.data.is_wrong_phone,this.data.phone_number_params,this.data.is_choose_phone);
|
|
|
this.setData({is_change:false});//按钮置灰
|
|
|
}else {
|
|
|
this.setData({is_change:true});
|
|
|
}
|
|
|
if((this.data.is_choose_phone&&this.data.phone_number_params !== '') &&
|
|
|
this.data.user.country !== null &&
|
...
|
...
|
@@ -64,11 +67,11 @@ Page({ |
|
|
//失去焦点
|
|
|
blur() {
|
|
|
// if(this.data.phone_number.length>=11) {
|
|
|
if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
|
|
wx.showToast({title:'手机号格式错误',icon:'none'});
|
|
|
this.setData({is_wrong_phone:true,phone_number_params:''});
|
|
|
// console.log('params', this.data.phone_number_params);
|
|
|
}
|
|
|
// if(!(/^1[0-9]{10}$/.test(this.data.phone_number))){
|
|
|
// wx.showToast({title:'手机号格式错误',icon:'none'});
|
|
|
// this.setData({is_wrong_phone:true,phone_number_params:''});
|
|
|
// // console.log('params', this.data.phone_number_params);
|
|
|
// }
|
|
|
// }
|
|
|
},
|
|
|
//自动获取手机号
|
...
|
...
|
@@ -187,6 +190,10 @@ Page({ |
|
|
},
|
|
|
//保存
|
|
|
submit() {
|
|
|
console.log('phone_number',this.data.phone_number);
|
|
|
// else if(this.data.is_wrong_phone){
|
|
|
// wx.showToast({title:'手机号格式错误',icon:'none'})
|
|
|
// }
|
|
|
// console.log('this.data.phone_number.length', this.data.phone_number.length,this.data.is_sex_change);
|
|
|
if(this.data.userInfo.gender == '未知' && this.data.is_sex_change === undefined) {
|
|
|
wx.showToast({title:'请选择性别',icon:'none'})
|
...
|
...
|
@@ -196,14 +203,16 @@ Page({ |
|
|
wx.showToast({title:'请填写城市',icon:'none'})
|
|
|
}else if (this.data.user.tel === null && this.data.phone_number === '') {
|
|
|
wx.showToast({title:'请获取手机号',icon:'none'})
|
|
|
}else if(this.data.is_wrong_phone){
|
|
|
wx.showToast({title:'手机号格式错误',icon:'none'})
|
|
|
}else if(this.data.wx_num === '' && this.data.user.wx === null) {
|
|
|
wx.showToast({title:'请填写微信号',icon:'none'})
|
|
|
}else if(this.data.introduce === '' && this.data.user.introduce === null) {
|
|
|
wx.showToast({title:'请填写简介',icon:'none'})
|
|
|
}else {
|
|
|
const choose_sex = this.data.is_sex_change&&this.data.sexList[this.data.current_sex] === '男'?1:2;
|
|
|
var choose_sex = null;
|
|
|
if(this.data.is_sex_change&&this.data.sexList[this.data.current_sex] === '男') {
|
|
|
choose_sex = 1
|
|
|
}
|
|
|
// console.log('choose_sex', choose_sex);
|
|
|
let url = '/portal/Member/detail';
|
|
|
let sex = this.data.userInfo.gender;
|
|
|
let params = {
|
...
|
...
|
@@ -212,7 +221,7 @@ Page({ |
|
|
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.is_choose_phone&&this.data.phone_number !== '')?this.data.phone_number:this.data.user.tel,
|
|
|
tel:this.data.user.tel,
|
|
|
tel:this.data.user.tel === null?this.data.phone_number:this.data.phone_number!==''?this.data.phone_number:this.data.user.tel,
|
|
|
wx: this.data.is_choose_wx?this.data.wx_num:this.data.user.wx,
|
|
|
introduce:this.data.is_choose_introduce?this.data.introduce:this.data.user.introduce
|
|
|
};
|
...
|
...
|
@@ -259,6 +268,7 @@ Page({ |
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
console.log(app.globalData.userInfo);
|
|
|
this.setData({userInfo:app.globalData.userInfo});
|
|
|
if(this.data.userInfo.tel !== null) {
|
|
|
this.setData({is_wrong_phone:false})
|
...
|
...
|
|