var that = this
wx.login({
success: function (res) {
var appId = ' ';//微信公众号平台申请的appid
var appSecret = ' ';//微信公众号平台申请的app secret
var js_code = res.code;//调用登录接口获得的用户的登录凭证code
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appId + '&secret=' + appSecret + '&js_code=' + js_code + '&grant_type=authorization_code',
data: {},
method: 'GET',
success: function (res) {
var openid = res.data.openid //返回的用户唯一标识符openid
console.log(openid)
console.log("试试吧上面就是获得的openid")
}
})
}
})
//试验自己的服务器获取openId
//调用登录接口
wx.login({
success: function (res) {
//console.log(res);
that.globalData.loginCode = res.code
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
that.globalData.iv = res.iv
that.globalData.encryptedData = res.encryptedData
typeof cb == "function" && cb(that.globalData.userInfo)
that.req(
'https://lifar网址.aspx?Action=ActionLogin',
{
encryptedData: that.globalData.encryptedData,
iv: that.globalData.iv,
code: that.globalData.loginCode
},
'GET',
function (res) {
console.log(res)
if (
|