安卓微信一键登录代码,在本地使用模拟器可以完成登录,但是打包成apk之后在真机上无法唤起微信,mainifest.json 已经配置过了微信登录,添加了 appid 求教问题出现在哪儿
uni.login({
provider: 'weixin',
success: (loginRes) => {
// 微信用户信息存入本地,后期备用
var auth = null
plus.oauth.getServices(
(services) => {
auth = services.find(service => {
return service.id === 'weixin'
})
try {
uni.setStorageSync('auth_service', auth)
} catch { }
},
function (e) {
console.log(e)
}
)
if (loginRes.authResult) {
this.$axios.post('/api/wxUser/loginApp.json', {
openId: loginRes.authResult.openid
}).then(res => {
if (res.success) {
this.$store.commit("setLogin", res.result);
uni.getUserInfo({
provider: 'weixin',
success: (infoRes) => {
this.$store.commit("setUserInfo", infoRes.userInfo);
}
});
uni.navigateTo({
url: '/pages/tags/index'
})
}
})
} else {
}
},
fail(e) {
console.log(e)
}
})
x***@sina.com (作者)
没解决
2023-03-03 08:48
九月的阿信
回复 x***@sina.com: 持续关注一下,解决了记得来填一下坑.
2023-04-21 11:36