|
@ -10,7 +10,7 @@ Page({ |
|
|
*/ |
|
|
*/ |
|
|
data: { |
|
|
data: { |
|
|
avatarUrl:String, |
|
|
avatarUrl:String, |
|
|
nikeName: String, |
|
|
nickName: String, |
|
|
phone: String, |
|
|
phone: String, |
|
|
company: String, |
|
|
company: String, |
|
|
position: String, |
|
|
position: String, |
|
@ -23,7 +23,7 @@ Page({ |
|
|
console.log(options) |
|
|
console.log(options) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
avatarUrl: options.userIcon, |
|
|
avatarUrl: options.userIcon, |
|
|
nikeName: options.userName, |
|
|
nickName: options.userName, |
|
|
phone: options.userPhone || '', |
|
|
phone: options.userPhone || '', |
|
|
company: options.company || '', |
|
|
company: options.company || '', |
|
|
position: options.position || '', |
|
|
position: options.position || '', |
|
@ -32,9 +32,9 @@ Page({ |
|
|
onTapItem(e) { |
|
|
onTapItem(e) { |
|
|
const { type } = e.currentTarget.dataset |
|
|
const { type } = e.currentTarget.dataset |
|
|
console.log(type) |
|
|
console.log(type) |
|
|
// if(type === 'userIcon'){
|
|
|
if(type === 'userIcon'){ |
|
|
// this.upload()
|
|
|
this.upload() |
|
|
// }
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
upload(){ |
|
|
upload(){ |
|
|
let that = this |
|
|
let that = this |
|
@ -69,34 +69,16 @@ Page({ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getUserInfo(){ |
|
|
bindNickNameInput(e){ |
|
|
userModel.getUserInfo(res => { |
|
|
|
|
|
let nickName = res.result.nickName |
|
|
|
|
|
let avatarUrl = res.result.avatarUrl |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
avatarUrl: res.result.avatarUrl, |
|
|
|
|
|
nikeName: res.result.nickName, |
|
|
|
|
|
phone: res.result.phone || '', |
|
|
|
|
|
company: res.result.company || '', |
|
|
|
|
|
position: res.result.position || '', |
|
|
|
|
|
}) |
|
|
|
|
|
store.saveUserInfo({ |
|
|
|
|
|
nickName: res.result.nickName, |
|
|
|
|
|
avatarUrl: res.result.avatarUrl, |
|
|
|
|
|
phone: res.result.phone || '' |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
bindNikeNameInput(e){ |
|
|
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
nikeName:e.detail.value |
|
|
nickName:e.detail.value |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
bindPhoneInput(e) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
phone: e.detail.value |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// bindPhoneInput(e) {
|
|
|
|
|
|
// this.setData({
|
|
|
|
|
|
// phone: e.detail.value
|
|
|
|
|
|
// })
|
|
|
|
|
|
// },
|
|
|
bindCompanyInput(e) { |
|
|
bindCompanyInput(e) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
company: e.detail.value |
|
|
company: e.detail.value |
|
@ -108,15 +90,13 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
submit(){ |
|
|
submit(){ |
|
|
let avatarUrl = this.data.avatarUrl |
|
|
userModel.updateUserInfo(this.data, res => { |
|
|
let nikeName = this.data.nikeName |
|
|
|
|
|
let phone = this.data.phone |
|
|
|
|
|
let company = this.data.company |
|
|
|
|
|
let position = this.data.position |
|
|
|
|
|
|
|
|
|
|
|
userModel.updateUserInfo(avatarUrl, nikeName, phone, company, position, res => { |
|
|
|
|
|
// that.getUserInfo()
|
|
|
|
|
|
if(res.code === 200){ |
|
|
if(res.code === 200){ |
|
|
|
|
|
store.saveUserInfo({ |
|
|
|
|
|
nickName: this.data.nickName, |
|
|
|
|
|
avatarUrl: this.data.avatarUrl, |
|
|
|
|
|
phone: this.data.phone || '' |
|
|
|
|
|
}) |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: '修改成功', |
|
|
title: '修改成功', |
|
|
icon: 'none', |
|
|
icon: 'none', |
|
|