|
|
@ -9,8 +9,9 @@ |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-item-title">头像</view> |
|
|
|
<view class="detail-item-title">头像</view> |
|
|
|
<view class="detail-item-content"> |
|
|
|
<view class="detail-item-content"> |
|
|
|
<view class="detail-item-background"></view> |
|
|
|
<button open-type="chooseAvatar" class="avatarBtn" @chooseavatar="chooseAvatar"> |
|
|
|
<image class="img" mode="aspectFill" :src="user.avatar"/> |
|
|
|
<image class="img" mode="aspectFill" :src="user.avatar"/> |
|
|
|
|
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="detail-content-item"> |
|
|
|
<view class="detail-content-item"> |
|
|
@ -105,14 +106,28 @@ |
|
|
|
id:88685, |
|
|
|
id:88685, |
|
|
|
birthday:'2002-05-11', |
|
|
|
birthday:'2002-05-11', |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
writeWaitTime:1000, |
|
|
|
|
|
|
|
writeHandler:null, |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad() { |
|
|
|
this.setSexTitle(); |
|
|
|
this.setSexTitle(); |
|
|
|
this.getUserDetail(); |
|
|
|
this.getUserDetail(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
watch:{ |
|
|
|
|
|
|
|
user:{ |
|
|
|
|
|
|
|
handler(value) { |
|
|
|
|
|
|
|
this.writeHandler && clearTimeout(this.writeHandler); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.writeHandler = setTimeout(() => { |
|
|
|
|
|
|
|
this.submit(); |
|
|
|
|
|
|
|
}, this.writeWaitTime) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
deep: true, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getUserDetail(){ |
|
|
|
getUserDetail() { |
|
|
|
userDetail().then(({ data }) => { |
|
|
|
userDetail().then(({data}) => { |
|
|
|
this.user = data; |
|
|
|
this.user = data; |
|
|
|
this.birthday = this.user.birthday ? this.user.birthday : '2000-01-01' |
|
|
|
this.birthday = this.user.birthday ? this.user.birthday : '2000-01-01' |
|
|
|
this.user.birthday = this.birthday |
|
|
|
this.user.birthday = this.birthday |
|
|
@ -120,30 +135,32 @@ |
|
|
|
this.setSexTitle(this.user.sex); |
|
|
|
this.setSexTitle(this.user.sex); |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
sexConfirm(v){ |
|
|
|
sexConfirm(v) { |
|
|
|
log(v); |
|
|
|
log(v); |
|
|
|
this.user.sex = v.value[0].value; |
|
|
|
this.user.sex = v.value[0].value; |
|
|
|
this.setSexTitle(v.value[0].value); |
|
|
|
this.setSexTitle(v.value[0].value); |
|
|
|
}, |
|
|
|
}, |
|
|
|
birthdayConfirm(v){ |
|
|
|
birthdayConfirm(v) { |
|
|
|
this.birthday = uni.$u.timeFormat(v.value, 'yyyy-mm-dd'); |
|
|
|
this.birthday = uni.$u.timeFormat(v.value, 'yyyy-mm-dd'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
submit(){ |
|
|
|
submit() { |
|
|
|
if(this.user.birthday ){ |
|
|
|
if (this.user.birthday) { |
|
|
|
this.user.birthday = uni.$u.timeFormat(this.user.birthday, 'yyyy-mm-dd') |
|
|
|
this.user.birthday = uni.$u.timeFormat(this.user.birthday, 'yyyy-mm-dd') |
|
|
|
} |
|
|
|
} |
|
|
|
updateUserDetail(this.user).then((data) =>{ |
|
|
|
updateUserDetail(this.user).then((data) => { |
|
|
|
uni.setStorageSync('user', data.data); |
|
|
|
uni.setStorageSync('user', data.data); |
|
|
|
functions.success("修改成功").then(() =>{ |
|
|
|
|
|
|
|
uni.navigateBack(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
setSexTitle(v){ |
|
|
|
setSexTitle(v) { |
|
|
|
log(v); |
|
|
|
log(v); |
|
|
|
this.sexTitle = [0, '男', '女'][v ? v : this.user.sex]; |
|
|
|
this.sexTitle = [0, '男', '女'][v ? v : this.user.sex]; |
|
|
|
log(this.sexTitle); |
|
|
|
log(this.sexTitle); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
chooseAvatar(v) { |
|
|
|
|
|
|
|
api.uploadOssFile(v.detail.avatarUrl).then(res => { |
|
|
|
|
|
|
|
this.user.avatar = res.show_path; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
onPageScroll(res) { |
|
|
|
onPageScroll(res) { |
|
|
|
|
|
|
|
|
|
|
|