提交 84bfee97 编写于 作者: C chenruilong

fix(uni-id-co): 修复 微信登录时用户未设置头像的报错问题

上级 de9fd580
......@@ -120,6 +120,8 @@ module.exports = async function (params = {}) {
accessToken,
openid
})
if (avatar) {
// eslint-disable-next-line n/no-deprecated-api
const avatarPath = url.parse(avatar).pathname
const extName = avatarPath.indexOf('.') > -1 ? url.parse(avatar).pathname.split('.').pop() : 'jpg'
......@@ -130,19 +132,23 @@ module.exports = async function (params = {}) {
errCode: ERROR.GET_THIRD_PARTY_USER_INFO_FAILED
}
}
const {
fileID
} = await uniCloud.uploadFile({
cloudPath,
fileContent: getAvatarRes.data
})
extraData.nickname = nickname
extraData.avatar_file = {
name: cloudPath,
extname: extName,
url: fileID
}
}
extraData.nickname = nickname
}
await saveWeixinUserKey.call(this, {
openid,
sessionKey,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册