作者 wumengyu

优化置灰按钮

... ... @@ -83,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,is_choose_phone:true})
this.setData({'user.tel':res.data,phone_number:res.data,is_wrong_phone:false,is_choose_phone:true})
}
});
},
... ... @@ -153,25 +153,14 @@ Page({
console.log(2);
this.setData({is_change:true});
}
// 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});
// }
if((this.data.is_choose_country&&this.data.country !== '')&&
(this.data.is_choose_city&&this.data.city !== '') &&
(this.data.user.tel!==null&&this.data.user.tel !== '') &&
(this.data.is_choose_introduce&&this.data.introduce !== '')
) {
console.log(1);
this.setData({is_change:true});
}
}
},
//保存
... ...
... ... @@ -28,7 +28,7 @@
<view class="flex-box">
<view class="title">手机号:</view>
<view class="phone-box">
<text>{{user.tel}}</text>
<text>{{user.tel!==null?user.tel:''}}</text>
<!--<input type="number" bindinput="inputPhone" bindblur="blur" value="{{is_choose_phone&&!is_wrong_phone?phone_number:user.tel}}"/>-->
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="phone-btn">自动填写</button>
</view>
... ...