老用户能正常使用,新用户所有机型,wx.login都不走
return new Promise(function (resolve, reject) {
// 登录
// console.log(this.globalData.openid)
wx.login({
success: res => {
wx.request({
url: util.baseurl + ‘getopenid’,
data: {
code: res.code
},
header: {},
method: ‘GET’,
dataType: ‘json’,
responseType: ‘text’,
success: function (res) {
console.log(res);
wx.setStorageSync(‘openid’, res.data.data.openid); //存储openid
resolve(res.data);
},
fail: function (res) {
// console.log(‘请求失败,openid:’ + that.globalData.openid)
},
complete: function (res) {
//console.log(‘已执行,openid:’ + that.globalData.openid)
},
})
}
})
})