|
api.ajax({
url: 'https://d.apicloud.com/mcm/api/user/' + userInfo.userId,
method: 'get',
headers: {
"X-APICloud-AppId": "A6070164598639",
"X-APICloud-AppKey": appKey,
"Authorization": userInfo.id
}
}, function(ret, err) {
if (ret) {
//alert(JSON.stringify(ret));
fnUpdateLocalAvatar(ret);
} else {
alert(JSON.stringify(err));
}
});
}
// 更新头像显示
function fnUpdateLocalAvatar(data_) {
if (!data_.avatar) {
return;
}
var icon = $api.byId('icon');
api.imageCache({
url:data_.avatar.url 此处出错!!!回传函数data_中包含反斜杠\,
}, function(ret, err) {
if (ret) {
icon.style.backgroundImage = 'url(' + ret.url + ')';
} else {
api.toast({
msg: '获取头像失败',
duration: 2000,
location: 'bottom'
});
}
});
}
|
|