Browse Source

个人资料 姓名 空值修改

master
chenteng 5 years ago
parent
commit
561edca5bf
  1. 12
      pages/user/myInfo/index.js

12
pages/user/myInfo/index.js

@ -49,15 +49,16 @@ Page({
//判断名字长度,限制名字长度10个字之内,姓名不能为空 //判断名字长度,限制名字长度10个字之内,姓名不能为空
if(this.data.type === 'userName'){ if(this.data.type === 'userName'){
console.log("username"); console.log("username");
console.dir(this.data.realData); // console.dir(this.data.realData);
console.log(this.data.realData.length); // console.log(this.data.realData);
// console.log(this.data.realData.length);
if(this.data.realData.length > 10){ if(this.data.realData.length > 10){
wx.showToast({ wx.showToast({
title: '姓名长度应小于10', title: '姓名长度应小于10',
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}) })
}else if(this.data.realData.length == 0){ }else if(this.data.realData.length == 0||this.data.realData.name=="String"){
wx.showToast({ wx.showToast({
title: '姓名不能为空', title: '姓名不能为空',
icon: 'none', icon: 'none',
@ -65,10 +66,10 @@ Page({
}) })
}else{ }else{
console.log("nickName修改了"); console.log("nickName修改了");
console.log(this.data.nickName);
this.setData({ this.setData({
nickName:this.data.realData nickName:this.data.realData
}) })
console.log(this.data.nickName);
} }
} }
if(this.data.type === 'userAge'){ if(this.data.type === 'userAge'){
@ -158,7 +159,6 @@ Page({
this.setData({ this.setData({
type:type type:type
}) })
if(type === 'userIcon'){ if(type === 'userIcon'){
this.upload() this.upload()
}else{ }else{

Loading…
Cancel
Save