谢谢各位,我明白了
function ilogin(that,params){
var userid = wx.getStorageSync('_userid')
if (userid){
irequest(getApp().globalData.url + 'login', {
data: { userid: userid },
success: function (res) {
if (res.type == 'error') {
idologin(that, {
success:function(res){
params.success && params.success(res)
}
})
} else {
wx.setStorage({
key: '_userid',
data: res.userid,
})
wx.setStorage({
key: '_modelid',
data: res.modelid,
})
wx.setStorage({
key: '_status',
data: res.status,
})
params.success && params.success(res)
}
},
complete:function(){
params.complete && params.complete()
}
})
}else{
idologin(that, {
success: function (res) {
params.success && params.success(res)
}
})
}
}
util.ilogin(that, {
success:function(res){
that.setData({
memberinfo:res
})
console.log(that.data.memberinfo)
}
})