实现效果如下:
首先使用uni.login获取用户登录凭证code:
官方代码:
uni.login({
provider: 'weixin', //使用微信登录
success: function (loginRes) {
console.log(loginRes.authResult);
}
});
success返回参数如下:
头像选择:
需要将 button 组件 open-type
的值设置为 chooseAvatar
,当用户选择需要使用的头像之后,可以通过 bindchooseavatar
事件回调获取到头像信息的临时路径。
从基础库2.24.4版本起,若用户上传的图片未通过安全监测,不触发bindchooseavatar
事件。
昵称填写:
需要将 input 组件 type
的值设置为