test_lgq/niucloud/public/wap/assets/u-avatar.2111318d.js
2024-01-24 17:36:08 +08:00

2 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as A}from"./u-icon.e3aa4770.js";import{U as e,V as t,W as a,h as n,i,w as l,J as o,K as r,I as s,n as u,M as c,aU as d,p as f,q as p,H as m,l as y,j as g,t as x,aV as h,D as S,S as b,E as v,F as k,L as I}from"./index-849cf30e.js";import{_ as H}from"./_plugin-vue_export-helper.1b428a4d.js";const R=H({name:"u-link",mixins:[t,a,{props:{color:{type:String,default:e.link.color},fontSize:{type:[String,Number],default:e.link.fontSize},underLine:{type:Boolean,default:e.link.underLine},href:{type:String,default:e.link.href},mpTips:{type:String,default:e.link.mpTips},lineColor:{type:String,default:e.link.lineColor},text:{type:String,default:e.link.text}}}],computed:{linkStyle(){return{color:this.color,fontSize:uni.$u.addUnit(this.fontSize),lineHeight:uni.$u.addUnit(uni.$u.getPx(this.fontSize)+2),textDecoration:this.underLine?"underline":"none"}}},methods:{openLink(){window.open(this.href),this.$emit("click")}}},[["render",function(A,e,t,a,d,f){const p=c;return n(),i(p,{class:"u-link",onClick:s(f.openLink,["stop"]),style:u([f.linkStyle,A.$u.addStyle(A.customStyle)])},{default:l((()=>[o(r(A.text),1)])),_:1},8,["onClick","style"])}],["__scopeId","data-v-a339e5f1"]]),B={computed:{value(){const{text:A,mode:e,format:t,href:a}=this;return"price"===e?(/^\d+(\.\d+)?$/.test(A)||uni.$u.error("金额模式下text参数需要为金额格式"),uni.$u.test.func(t)?t(A):uni.$u.priceFormat(A,2)):"date"===e?(!uni.$u.test.date(A)&&uni.$u.error("日期模式下text参数需要为日期或时间戳格式"),uni.$u.test.func(t)?t(A):t?uni.$u.timeFormat(A,t):uni.$u.timeFormat(A,"yyyy-mm-dd")):"phone"===e?uni.$u.test.func(t)?t(A):"encrypt"===t?`${A.substr(0,3)}****${A.substr(7)}`:A:"name"===e?("string"!=typeof A&&uni.$u.error("姓名模式下text参数需要为字符串格式"),uni.$u.test.func(t)?t(A):"encrypt"===t?this.formatName(A):A):"link"===e?(!uni.$u.test.url(a)&&uni.$u.error("超链接模式下href参数需要为URL格式"),A):A}},methods:{formatName(A){let e="";if(2===A.length)e=A.substr(0,1)+"*";else if(A.length>2){let t="";for(let e=0,a=A.length-2;e<a;e++)t+="*";e=A.substr(0,1)+t+A.substr(-1,1)}else e=A;return e}}},N={props:{type:{type:String,default:e.text.type},show:{type:Boolean,default:e.text.show},text:{type:[String,Number],default:e.text.text},prefixIcon:{type:String,default:e.text.prefixIcon},suffixIcon:{type:String,default:e.text.suffixIcon},mode:{type:String,default:e.text.mode},href:{type:String,default:e.text.href},format:{type:[String,Function],default:e.text.format},call:{type:Boolean,default:e.text.call},openType:{type:String,default:e.text.openType},bold:{type:Boolean,default:e.text.bold},block:{type:Boolean,default:e.text.block},lines:{type:[String,Number],default:e.text.lines},color:{type:String,default:e.text.color},size:{type:[String,Number],default:e.text.size},iconStyle:{type:[Object,String],default:e.text.iconStyle},decoration:{tepe:String,default:e.text.decoration},margin:{type:[Object,String,Number],default:e.text.margin},lineHeight:{type:[String,Number],default:e.text.lineHeight},align:{type:String,default:e.text.align},wordWrap:{type:String,default:e.text.wordWrap}}};const w=H({name:"u--text",mixins:[t,a,N],components:{uvText:H({name:"u--text",mixins:[t,a,B,N],emits:["click"],computed:{valueStyle(){const A={textDecoration:this.decoration,fontWeight:this.bold?"bold":"normal",wordWrap:this.wordWrap,fontSize:uni.$u.addUnit(this.size)};return!this.type&&(A.color=this.color),this.isNvue&&this.lines&&(A.lines=this.lines),this.lineHeight&&(A.lineHeight=uni.$u.addUnit(this.lineHeight)),!this.isNvue&&this.block&&(A.display="block"),uni.$u.deepMerge(A,uni.$u.addStyle(this.customStyle))},isNvue:()=>!1,isMp:()=>!1},data:()=>({}),methods:{clickHandler(){this.call&&"phone"===this.mode&&d({phoneNumber:this.text}),this.$emit("click")}}},[["render",function(e,t,a,s,d,S){const b=c,v=f(p("u-icon"),A),k=x,I=f(p("u-link"),R),H=h;return e.show?(n(),i(k,{key:0,class:m(["u-text",[]]),style:u({margin:e.margin,justifyContent:"left"===e.align?"flex-start":"center"===e.align?"center":"flex-end"}),onClick:S.clickHandler},{default:l((()=>["price"===e.mode?(n(),i(b,{key:0,class:m(["u-text__price",e.type&&`u-text__value--${e.type}`]),style:u([S.valueStyle])},{default:l((()=>[o("¥")])),_:1},8,["class","style"])):y("v-if",!0),e.prefixIcon?(n(),i(k,{key:1,class:"u-text__prefix-icon"},{default:l((()=>[g(v,{name:e.prefixIcon,customStyle:e.$u.addStyle(e.iconStyle)},null,8,["name","customStyle"])])),_:1})):y("v-if",!0),"link"===e.mode?(n(),i(I,{key:2,text:e.value,href:e.href,underLine:""},null,8,["text","href"])):e.openType&&S.isMp?(n(),i(H,{key:3,class:"u-reset-button u-text__value",style:u([S.valueStyle]),"data-index":e.index,openType:e.openType,onGetuserinfo:e.onGetUserInfo,onContact:e.onContact,onGetphonenumber:e.onGetPhoneNumber,onError:e.onError,onLaunchapp:e.onLaunchApp,onOpensetting:e.onOpenSetting,lang:e.lang,"session-from":e.sessionFrom,"send-message-title":e.sendMessageTitle,"send-message-path":e.sendMessagePath,"send-message-img":e.sendMessageImg,"show-message-card":e.showMessageCard,"app-parameter":e.appParameter},{default:l((()=>[o(r(e.value),1)])),_:1},8,["style","data-index","openType","onGetuserinfo","onContact","onGetphonenumber","onError","onLaunchapp","onOpensetting","lang","session-from","send-message-title","send-message-path","send-message-img","show-message-card","app-parameter"])):(n(),i(b,{key:4,class:m(["u-text__value",[e.type&&`u-text__value--${e.type}`,e.lines&&`u-line-${e.lines}`]]),style:u([S.valueStyle])},{default:l((()=>[o(r(e.value),1)])),_:1},8,["style","class"])),e.suffixIcon?(n(),i(k,{key:5,class:"u-text__suffix-icon"},{default:l((()=>[g(v,{name:e.suffixIcon,customStyle:e.$u.addStyle(e.iconStyle)},null,8,["name","customStyle"])])),_:1})):y("v-if",!0)])),_:1},8,["style","onClick"])):y("v-if",!0)}],["__scopeId","data-v-b9da4249"]])}},[["render",function(A,e,t,a,l,o){const r=S("uvText");return n(),i(r,{type:A.type,show:A.show,text:A.text,prefixIcon:A.prefixIcon,suffixIcon:A.suffixIcon,mode:A.mode,href:A.href,format:A.format,call:A.call,openType:A.openType,bold:A.bold,block:A.block,lines:A.lines,color:A.color,decoration:A.decoration,size:A.size,iconStyle:A.iconStyle,margin:A.margin,lineHeight:A.lineHeight,align:A.align,wordWrap:A.wordWrap,customStyle:A.customStyle},null,8,["type","show","text","prefixIcon","suffixIcon","mode","href","format","call","openType","bold","block","lines","color","decoration","size","iconStyle","margin","lineHeight","align","wordWrap","customStyle"])}]]),G={props:{src:{type:String,default:e.avatar.src},shape:{type:String,default:e.avatar.shape},size:{type:[String,Number],default:e.avatar.size},mode:{type:String,default:e.avatar.mode},text:{type:String,default:e.avatar.text},bgColor:{type:String,default:e.avatar.bgColor},color:{type:String,default:e.avatar.color},fontSize:{type:[String,Number],default:e.avatar.fontSize},icon:{type:String,default:e.avatar.icon},mpAvatar:{type:Boolean,default:e.avatar.mpAvatar},randomBgColor:{type:Boolean,default:e.avatar.randomBgColor},defaultUrl:{type:String,default:e.avatar.defaultUrl},colorIndex:{type:[String,Number],validator:A=>uni.$u.test.range(A,[0,19])||""===A,default:e.avatar.colorIndex},name:{type:String,default:e.avatar.name}}};const M=H({name:"u-avatar",mixins:[t,a,G],data(){return{colors:["#ffb34b","#f2bba9","#f7a196","#f18080","#88a867","#bfbf39","#89c152","#94d554","#f19ec2","#afaae4","#e1b0df","#c38cc1","#72dcdc","#9acdcb","#77b1cc","#448aca","#86cefa","#98d1ee","#73d1f1","#80a7dc"],avatarUrl:this.src,allowMp:!1}},watch:{src:{immediate:!0,handler(A){this.avatarUrl=A,A||this.errorHandler()}}},computed:{imageStyle:()=>({})},created(){this.init()},methods:{init(){},isImg(){return-1!==this.src.indexO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xWrb4ARNx3R3q2rLpa4Sl0y/YCcAAAAAAAAAAANmFud7G8r89r6X0dgFvGzLGRGtuWvTF6NAdwAAAAAAAAAAAy5W442PVN+K59EePp5ARMvOv5MvO6QXCC4AZwAAAAAAAAAAAAAcxlKLUotprg1owN+PvORborq+7Hnwl3gUbO74VzRydt8pKn68ANcJwmqwkpLmnUDkAAAAfNy9atqtyagut0AxXt5xIV8Fbj6lRd7Am5G65V6qUvtwfyx94GMAAAAAAAAAAAAAAAAAAAOU2nVOj5gdsc3LiqRvTpyqwOxbnnrhdfpSfrQB7pnv/AGvuS9gHXPMy5/Fem1yq0v0A6W29XqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z"},clickHandler(){this.$emit("click",this.name)}}},[["render",function(e,t,a,o,r,s){const c=f(p("u-icon"),A),d=f(p("u--text"),w),y=I,g=x;return n(),i(g,{class:m(["u-avatar",[`u-avatar--${e.shape}`]]),style:u([{backgroundColor:e.text||e.icon?e.randomBgColor?r.colors[""!==e.colorIndex?e.colorIndex:e.$u.random(0,19)]:e.bgColor:"transparent",width:e.$u.addUnit(e.size),height:e.$u.addUnit(e.size)},e.$u.addStyle(e.customStyle)]),onClick:s.clickHandler},{default:l((()=>[b(e.$slots,"default",{},(()=>[e.mpAvatar&&r.allowMp?(n(),v(k,{key:0},[],64)):e.icon?(n(),i(c,{key:1,name:e.icon,size:e.fontSize,color:e.color},null,8,["name","size","color"])):e.text?(n(),i(d,{key:2,text:e.text,size:e.fontSize,color:e.color,align:"center",customStyle:"justify-content: center"},null,8,["text","size","color"])):(n(),i(y,{key:3,class:m(["u-avatar__image",[`u-avatar__image--${e.shape}`]]),src:r.avatarUrl||e.defaultUrl,mode:e.mode,onError:s.errorHandler,style:u([{width:e.$u.addUnit(e.size),height:e.$u.addUnit(e.size)}])},null,8,["class","src","mode","onError","style"]))]),!0)])),_:3},8,["class","style","onClick"])}],["__scopeId","data-v-03b4cb4d"]]);export{M as _};