1,访问的接口:
"USER_INFO"
2,用户名:data.name
3,头像:data.headPictrue
4,默认图形:webRoot + '/images/workbench/user.png'
如果没有头像:
- if($("#headLogo").length > 0){
- var defaultImg=webRoot + '/images/workbench/user.png';
- $('#headLogo')[0].onerror = function(){
- this.src = defaultImg;
- };
- var headPictrue=data.headPictrue;
- if(!headPictrue){
- //console.log('data.headPictrue is empty.');
- headPictrue=defaultImg;
- }
- $('#headLogo').attr('src' , headPictrue);
- }