收藏
回答

使用境外版本的微信能如何获取微信用户的openId?在国内能获取信息,在使用国外的微信时获取不到

wx.login({
	success(res) {
		console.log('登录')
		if (res.code) {
			that.$u.api.getAuth({
				params: {
					code: res.code
				}
			}).then(response => {
				that.openID = response.data.openid
				console.log(that.openID);
				//  成功 获取当前微信信息
				wx.getUserInfo({
					success: function(res) {
						console.log(res)
						var userInfo = res.userInfo;
						uni.setStorageSync(
							'wechatUser',
							userInfo
						)
					},
					fail: function(res) {
						console.log('获取用户信息失败');
					}
				});
			})
		}
	}
});

回答关注问题邀请回答
收藏

2 个回答

  • 跨商通
    跨商通
    01-17

    要看返回的错误信息是什么。

    01-17
    有用
    回复
  • 智能回答 智能回答 该问答由AI生成
    01-17
    有用
登录 后发表内容