|
@@ -9,25 +9,40 @@ interface Props {
|
|
|
onClick?: (data: TContactItem|TAgent)=>void
|
|
|
renderRight?: ()=> JSX.Element | JSX.Element[]
|
|
|
className?: string
|
|
|
+ truncate?: boolean
|
|
|
+ showPositionAndEntNamePlaceholder?: boolean // 是否显示企业名称与职位名称占位
|
|
|
}
|
|
|
-const Index = ({onClick, data, className, renderRight}: Props)=> {
|
|
|
+const Index = ({onClick, data, showPositionAndEntNamePlaceholder = false, truncate=true, className, renderRight}: Props)=> {
|
|
|
+ const hasEntName = !!data.entName?.length
|
|
|
+ const hasPosition = !!!!data.position?.length
|
|
|
+ const truncateClassName = truncate ? 'truncate':''
|
|
|
+ const renderEntNameAndPosition = ()=> {
|
|
|
+ if(showPositionAndEntNamePlaceholder){
|
|
|
+ return <><View className={`max-w-156 ${truncateClassName}`}>{hasEntName ? data.entName : '暂无企业名称'}</View>
|
|
|
+ <View className='px-4'>|</View>
|
|
|
+ <View className={truncateClassName}>{!!data.position?.length ? data.position : '暂无职位名称'}</View>
|
|
|
+ </>
|
|
|
+ }
|
|
|
+ return <>{hasEntName && <View className={`max-w-156 ${truncateClassName}`}>{data.entName}</View>}
|
|
|
+ {(hasPosition && hasEntName) && <View className='px-4'>|</View>}
|
|
|
+ {hasPosition && <View className='truncate'>{data.position}</View>}
|
|
|
+ </>
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<View className={`${style.contactCard} bg-white rounded-12 ${className}`} onClick={()=>{onClick?.(data)}}>
|
|
|
<View className={style.avatar}>
|
|
|
<AvatarMedia source={data.avatarUrl ?? ''} className='w-[55px] h-[55px]' mode="aspectFill" />
|
|
|
</View>
|
|
|
- <View className={`${style.infoColumn} truncate`}>
|
|
|
- <View className={`${style.nameRow} truncate`}>
|
|
|
- <View className={`${style.nickName} truncate`}>{data.name}</View>
|
|
|
- {data.isEnt && <View className={style.certificationContainer}><IconCertificateColor></IconCertificateColor></View>}
|
|
|
+ <View className={`${style.infoColumn} ${truncateClassName}`}>
|
|
|
+ <View className={`${style.nameRow} ${truncateClassName}`}>
|
|
|
+ <View className={`${style.nickName} ${truncateClassName}`}>{data.name}</View>
|
|
|
</View>
|
|
|
- <View className='flex flex-col w-full gap-8 truncate'>
|
|
|
- <View className={`flex items-center flex-1 ${style.subInfo} truncate`}>
|
|
|
- <View className='max-w-156 truncate'>{!!data.entName?.length ? data.entName : '暂无企业名称'}</View>
|
|
|
- <View className='px-4'>|</View>
|
|
|
- <View className='truncate'>{!!data.position?.length ? data.position : '暂无职位名称'}</View>
|
|
|
+ {(hasPosition || hasEntName) && <View className={`flex flex-col w-full gap-8 ${truncateClassName}`}>
|
|
|
+ <View className={`flex items-center flex-1 ${style.subInfo} ${truncateClassName}`}>
|
|
|
+ {renderEntNameAndPosition()}{data.isEnt && <View className={style.certificationContainer}><IconCertificateColor></IconCertificateColor></View>}
|
|
|
</View>
|
|
|
- </View>
|
|
|
+ </View>}
|
|
|
</View>
|
|
|
{renderRight && renderRight()}
|
|
|
</View>
|