fix: avatar picker uses chooseMedia, COS domain to tx.vsai.net.cn
- Replace chooseAvatar button with chooseMedia (more reliable, works on all versions) - COS avatar URL uses tx.vsai.net.cn instead of generated bucket domain - Phone shows '已授权' only (no actual number displayed)
这个提交包含在:
@@ -28,10 +28,18 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onChooseAvatar: function (e) {
|
onPickAvatar: function () {
|
||||||
if (e.detail && e.detail.avatarUrl) {
|
var self = this
|
||||||
this.setData({ avatarUrl: e.detail.avatarUrl })
|
wx.chooseMedia({
|
||||||
|
count: 1,
|
||||||
|
mediaType: ['image'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: function (res) {
|
||||||
|
if (res.tempFiles && res.tempFiles[0]) {
|
||||||
|
self.setData({ avatarUrl: res.tempFiles[0].tempFilePath })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onNicknameInput: function (e) {
|
onNicknameInput: function (e) {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
<view class="page-content">
|
<view class="page-content">
|
||||||
<view class="section-title">设置头像</view>
|
<view class="section-title">设置头像</view>
|
||||||
<view class="avatar-area">
|
<view class="avatar-area">
|
||||||
<button class="avatar-btn" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar">
|
<view class="avatar-wrap" bindtap="onPickAvatar">
|
||||||
<image class="avatar-img" src="{{avatarUrl}}" mode="aspectFill"></image>
|
<image class="avatar-img" src="{{avatarUrl}}" mode="aspectFill"></image>
|
||||||
<view class="avatar-edit-hint">点击更换</view>
|
<view class="avatar-edit-hint">点击更换</view>
|
||||||
</button>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="section-title">设置昵称</view>
|
<view class="section-title">设置昵称</view>
|
||||||
|
|||||||
@@ -21,21 +21,12 @@
|
|||||||
margin-bottom: 12rpx;
|
margin-bottom: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-btn {
|
.avatar-wrap {
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
line-height: normal;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-btn::after {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar-img {
|
.avatar-img {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ router.post('/user/avatar', requireUser, upload.single('file'), wrap(async (req,
|
|||||||
ContentType: req.file.mimetype
|
ContentType: req.file.mimetype
|
||||||
}, (err, data) => err ? reject(err) : resolve(data))
|
}, (err, data) => err ? reject(err) : resolve(data))
|
||||||
})
|
})
|
||||||
const avatarUrl = 'https://' + config.cos.bucket + '.cos.' + config.cos.region + '.myqcloud.com/' + key
|
const avatarUrl = 'https://tx.vsai.net.cn/' + key
|
||||||
await userDao.updateProfile(req.user.user_id, { nickname: null, avatar: avatarUrl, gender: null })
|
await userDao.updateProfile(req.user.user_id, { nickname: null, avatar: avatarUrl, gender: null })
|
||||||
res.json(ok({ avatar: avatarUrl }))
|
res.json(ok({ avatar: avatarUrl }))
|
||||||
}))
|
}))
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户