天天看點

擷取頭像和個人資訊

1,通路的接口:

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);  

                    }  

繼續閱讀