UserAvatar_wev8.js 1.46 KB
define("UserAvatar_html",function(){return'<div id="NMEC_${id}" class="wev-comp-${compType}">\t<div class="wev-avatar-container ${style}">\t\t<img src="${avatar}">\t    <div>\t        <div class="wev-avatar-username">&nbsp;</div>\t        <span class="wev-avatar-dept">&nbsp;</span>\t        <span class="wev-avatar-jobtitle">&nbsp;</span>\t    </div>\t</div></div>'}),define(["mUtil","Component"],function(c,a){return a.init(function(t){a.super(this,t),this.type="UserAvatar",this.tpl=this.type+"_html",this.css=this.type+"_css",this.dataload=!0;var l=this.viewModel={userid:"",style:"wev-avatar-vertical",avatar:"/messager/images/icon_m_wev8.jpg"};this.beforeMount=function(){-1!=l.style.indexOf("vertical")&&(l.style="wev-avatar-vertical")||(l.style="wev-avatar-horizontal")},this.mounted=function(){var d=this,t=this.type,o=this.$el.children(".wev-comp-"+t),a=c.getActionUrl(this.type,{action:"info",userid:l.userid},this.pageid);c.getJSON(a,function(t){var a=t.data,e=a.avatar,i=e.headFormat;if("1"===i||"3"===i){var s=e.background,r=e.fontColor,n=e.shortname,v="<div class='resourceimage' style='background:"+s+"; color:"+r+";"+(-1!=l.style.indexOf("horizontal")?"padding-left:0; ":"")+" '>"+n+"</div>";$("img",o).hide(),$(".wev-avatar-container",o).prepend(v)}else $("img",o).attr("src",e.messagerUrls||l.avatar);$(".wev-avatar-username",o).html(a.userName),$(".wev-avatar-dept",o).html(a.deptName),$(".wev-avatar-jobtitle",o).html(a.jobTitle),c.trigger("dataload",d.pageid,d.id)})}})});