uni.login({
provider: 'weixin',
success: function(res) {
uni.getUserInfo({
provider: 'weixin',
success: function(res) {
let data = {
type:'weixin',
openid:res.userInfo.openId,
unionid:res.userInfo.unionId,
}
console.log(data)
httpRequest.post(httpLbApi.login.authLogin, data).then(res => {
uni.setStorageSync("token", res.data.token)
let uindex = {
nickname:res.data.nickname,
avatar:res.data.avatar,
ut:res.data.ut
}
uni.setStorageSync('uindex', uindex)
uni.showToast({
title: res.msg,
duration: 1500,
success() {
uni.switchTab({
url: '/pages/index/index'
})
}
})
})
}
})
}
})
app微信登录
最新推荐文章于 2024-04-24 17:46:03 发布