// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
if(res.code){
wx.request({
url:
'https://mini.yuehuayueyou.com/Meeting/wx/onlogin',
//仅为示例,并非真实的接口地址
method:
"GET",
data: {
"code":res.code
},
header: {
'content-type':
'application/json'
// 默认值
},
success:
function (res) {
if (res.data.openid){
wx.setStorage({
key:
"tokenId",
data:res.data.openid,
})
}
}
})
}
}
})