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) {
|
||||
if (e.detail && e.detail.avatarUrl) {
|
||||
this.setData({ avatarUrl: e.detail.avatarUrl })
|
||||
}
|
||||
onPickAvatar: function () {
|
||||
var self = this
|
||||
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) {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
<view class="page-content">
|
||||
<view class="section-title">设置头像</view>
|
||||
<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>
|
||||
<view class="avatar-edit-hint">点击更换</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-title">设置昵称</view>
|
||||
|
||||
@@ -21,21 +21,12 @@
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.avatar-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: normal;
|
||||
.avatar-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/user/avatar', requireUser, upload.single('file'), wrap(async (req,
|
||||
ContentType: req.file.mimetype
|
||||
}, (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 })
|
||||
res.json(ok({ avatar: avatarUrl }))
|
||||
}))
|
||||
|
||||
在新工单中引用
屏蔽一个用户