temple hidden change nickname
This commit is contained in:
parent
4b0f9cdf34
commit
3a5b5936c8
|
|
@ -22,10 +22,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="logout-container">
|
||||
<logout-button
|
||||
@logout-success="onLogoutSuccess"
|
||||
@logout-error="onLogoutError"
|
||||
/>
|
||||
<logout-button @logout-success="onLogoutSuccess" @logout-error="onLogoutError" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -36,7 +33,7 @@ import LogoutButton from '@/components/logout-button/logout-button.vue'
|
|||
|
||||
export default {
|
||||
components: {
|
||||
LogoutButton
|
||||
LogoutButton,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -46,11 +43,11 @@ export default {
|
|||
value: '', // 头像URL,从个人中心传递过来
|
||||
type: 'avatar',
|
||||
},
|
||||
{
|
||||
label: '昵称',
|
||||
value: '昵称', // 默认占位文字,实际应为用户昵称
|
||||
type: 'nickname',
|
||||
},
|
||||
// {
|
||||
// label: '昵称',
|
||||
// value: '昵称', // 默认占位文字,实际应为用户昵称
|
||||
// type: 'nickname',
|
||||
// },
|
||||
],
|
||||
}
|
||||
},
|
||||
|
|
@ -228,16 +225,16 @@ export default {
|
|||
showAvatarUpload() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['从相册选择', '拍照'],
|
||||
success: (res) => {
|
||||
success: res => {
|
||||
if (res.tapIndex === 0) {
|
||||
this.chooseImageFromAlbum()
|
||||
} else if (res.tapIndex === 1) {
|
||||
this.takePhoto()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
fail: err => {
|
||||
console.log('用户取消选择:', err)
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -247,17 +244,17 @@ export default {
|
|||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album'],
|
||||
success: (res) => {
|
||||
success: res => {
|
||||
const filePath = res.tempFilePaths[0]
|
||||
this.uploadAvatar(filePath)
|
||||
},
|
||||
fail: (err) => {
|
||||
fail: err => {
|
||||
console.error('选择图片失败:', err)
|
||||
uni.showToast({
|
||||
title: '选择图片失败',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -267,17 +264,17 @@ export default {
|
|||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['camera'],
|
||||
success: (res) => {
|
||||
success: res => {
|
||||
const filePath = res.tempFilePaths[0]
|
||||
this.uploadAvatar(filePath)
|
||||
},
|
||||
fail: (err) => {
|
||||
fail: err => {
|
||||
console.error('拍照失败:', err)
|
||||
uni.showToast({
|
||||
title: '拍照失败',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -285,13 +282,13 @@ export default {
|
|||
async uploadAvatar(filePath) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
title: '上传中...',
|
||||
})
|
||||
|
||||
console.log('开始上传头像:', filePath)
|
||||
|
||||
|
||||
const response = await uploadAvatar(filePath)
|
||||
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
if (response.code === 200) {
|
||||
|
|
@ -312,7 +309,7 @@ export default {
|
|||
|
||||
uni.showToast({
|
||||
title: '头像上传成功',
|
||||
icon: 'success'
|
||||
icon: 'success',
|
||||
})
|
||||
|
||||
// 通知其他页面更新头像
|
||||
|
|
@ -325,7 +322,7 @@ export default {
|
|||
console.error('头像上传失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || '上传失败',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user