import{_ as t,z as e,o as a,f as s,w as r,n as i,k as l,j as o,t as n,N as d,i as h}from"./index-BUJl2M8y.js";const c=t({name:"head-image",data:()=>({colors:["#5daa31","#c7515a","#e03697","#85029b","#c9b455","#73d1f1"]}),props:{id:{type:Number},size:{type:Number,default:20},url:{type:String},name:{type:String,default:"?"},online:{type:Boolean,default:!1},circle:{type:Boolean,default:!0}},methods:{showUserInfo(t){this.id&&this.id>0&&e({url:"/pages/common/user-info?id="+this.id})}},computed:{avatarImageStyle(){return`width:${this.size}rpx;\n\t\t\t\t\theight:${this.size}rpx;`},avatarTextStyle(){return`width: ${this.size}rpx;\n\t\t\t\t\theight:${this.size}rpx;\n\t\t\t\t\tbackground-color:${this.textColor};\n\t\t\t\t\tfont-size:${.5*this.size}rpx;\n\t\t\t\t\t`},textColor(){let t=0;for(var e=0;e<this.name.length;e++)t+=this.name.charCodeAt(e);return this.colors[t%this.colors.length]}}},[["render",function(t,e,c,u,p,m){const y=d,f=h;return a(),s(f,{class:"head-image",onClick:e[0]||(e[0]=t=>m.showUserInfo(t)),title:c.name},{default:r((()=>[c.url?(a(),s(y,{key:0,class:"avatar-image",src:c.url,style:i(m.avatarImageStyle),"lazy-load":"true",mode:"aspectFill"},null,8,["src","style"])):l("",!0),c.url?l("",!0):(a(),s(f,{key:1,class:"avatar-text",style:i(m.avatarTextStyle)},{default:r((()=>[o(n(c.name.substring(0,1).toUpperCase()),1)])),_:1},8,["style"])),c.online?(a(),s(f,{key:2,class:"online",title:"用户当前在线"})):l("",!0)])),_:1},8,["title"])}],["__scopeId","data-v-9c8a6724"]]);export{c as _};
