|
|
|
@ -8,7 +8,7 @@ Page({
|
|
|
|
|
data:{
|
|
|
|
|
avatarUrl: defaultAvatarUrl,
|
|
|
|
|
nickname: "",
|
|
|
|
|
sex: "",
|
|
|
|
|
gender: "",
|
|
|
|
|
birthday: "",
|
|
|
|
|
region: "",
|
|
|
|
|
contact: "",
|
|
|
|
@ -53,7 +53,7 @@ Page({
|
|
|
|
|
var data = res.data[0]
|
|
|
|
|
this.setData({
|
|
|
|
|
nickname: data.nickname,
|
|
|
|
|
sex: data.gender,
|
|
|
|
|
gender: data.gender,
|
|
|
|
|
birthday: data.birthday,
|
|
|
|
|
region: data.region,
|
|
|
|
|
contact: data.contact,
|
|
|
|
@ -85,9 +85,11 @@ Page({
|
|
|
|
|
//表单提交方法
|
|
|
|
|
submit: function(e){
|
|
|
|
|
console.log("[PROFILE] SubmitData", e.detail.value);
|
|
|
|
|
//todo: 添加输入检测
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//输入检测,检测输入是否为空
|
|
|
|
|
if(!this.cheakFrom(e.detail.value)) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//往数据库里更新的方法
|
|
|
|
|
db.where({
|
|
|
|
@ -96,7 +98,7 @@ Page({
|
|
|
|
|
//传入数据
|
|
|
|
|
data: {
|
|
|
|
|
nickname: this.data.nickname,
|
|
|
|
|
sex: this.data.sex,
|
|
|
|
|
gender: this.data.gender,
|
|
|
|
|
birthday: this.data.birthday,
|
|
|
|
|
region: this.data.region,
|
|
|
|
|
contact: this.data.contact,
|
|
|
|
@ -134,6 +136,38 @@ Page({
|
|
|
|
|
this.setData({
|
|
|
|
|
region: e.detail.value,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//更新页面的性别信息
|
|
|
|
|
genderChange: function(e){
|
|
|
|
|
this.setData({
|
|
|
|
|
gender: e.detail.value,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
cheakFrom: function(e) {
|
|
|
|
|
var hint;
|
|
|
|
|
if (e.nickname == "") {
|
|
|
|
|
hint = "昵称为空!"
|
|
|
|
|
} else if (e.gender == "") {
|
|
|
|
|
hint = "性别为空!"
|
|
|
|
|
} else if (e.birthday == "") {
|
|
|
|
|
hint = "年龄为空!"
|
|
|
|
|
} else if (e.region == "") {
|
|
|
|
|
hint = "地区为空!"
|
|
|
|
|
} else if (e.contact == "") {
|
|
|
|
|
hint = "联系方式为空!"
|
|
|
|
|
} else if (e.information == "") {
|
|
|
|
|
hint = "基本情况为空!"
|
|
|
|
|
} else{
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: hint,
|
|
|
|
|
icon: 'error',
|
|
|
|
|
duration: 2000
|
|
|
|
|
})
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|