bug
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-wrapper">
|
||||
<div class="btn" hover-class="text-hover">保存</div>
|
||||
<div class="btn" hover-class="text-hover" @click="save">保存</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -57,10 +57,37 @@
|
||||
})
|
||||
},
|
||||
|
||||
save () {
|
||||
if (!this.userInfo.avatarUrl) {
|
||||
return this.$toast('请上传头像')
|
||||
}
|
||||
|
||||
if (!this.userInfo.nickName) {
|
||||
return this.$toast('请输入昵称')
|
||||
}
|
||||
|
||||
this.$loading()
|
||||
this.$instance.post('/api/appwechatuser/update-nickName', null, {
|
||||
params: {
|
||||
...this.userInfo
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast('保存成功')
|
||||
|
||||
uni.$emit('updateUserInfo')
|
||||
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onChooseAvatar (e) {
|
||||
this.$loading()
|
||||
uni.uploadFile({
|
||||
url: this.$instance.defaults.baseURL + '/api/file/add',
|
||||
url: this.$instance.defaults.baseURL + '/file/add',
|
||||
filePath: e.detail.avatarUrl,
|
||||
name: 'file',
|
||||
header: {
|
||||
@@ -92,19 +119,6 @@
|
||||
success: res => {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
save () {
|
||||
this.$loading()
|
||||
this.$http.post('/app/editUserInfo', null, {
|
||||
params: {
|
||||
...this.userInfo
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$toast('保存成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user