<template>
<view style="padding:35px;">
<!-- #ifdef MP-WEIXIN -->
<button type="primary" open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true">微信登录1</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button type="primary" open-type="getUserInfo" @click="getuserinfoh5appwx" withCredentials="true">微信登录2</button>
<!-- #endif -->
</view>
</template>
<script>
var _self;
export default {
data() {
return {
title: '欢迎使用'
}
},
methods: {
getuserinfoh5appwx: function() {
_self = this;
uni.login({
success: function(res2) {
console.log(JSON.stringify(res2) + '2');
uni.getUserInfo({
success: function(res3) {
console.log(JSON.stringify(res3) + '3');
}
})
},
});
},
getuserinfo: function(res1) {
_self = this;
uni.login({
success: function(res2) {
uni.request({
url: _self.url.login + "?code=" + res2.code,
success: function(res3) {
console.log(JSON.stringify(res3));
}
})
}
});
}
}
}
</script>
<style>
.content {
text-align: center;
height: 400upx;
}
.logo {
height: 200upx;
width: 200upx;
margin-top: 200upx;
}
.title {
font-size: 36upx;
color: #8f8f94;
}
</style>
getuserinfoh5appwx与getuserinfo获取的openid不一致
z***@126.com (作者)
那对于微信登录,小程序和ios,就无法判断为同一人。有什么解决方案吗?
2018-12-05 08:47
z***@126.com (作者)
unionid是判断多个公众号的,不满足这个场景
2018-12-05 08:47
DCloud_App_Array
这个得咨询下微信,在原生环境中客户端只是传递微信开放平台返回的值。
2018-12-05 17:10