index.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { Image, View } from '@tarojs/components'
  2. import TagCertificated from "@/components/tag-certificated";
  3. import IconCertificateColor from "@/components/icon/icon-certificate-color";
  4. import { TAgentDetail } from '@/types/agent';
  5. interface IProps {
  6. size?: 'mini'|'large'
  7. agent: TAgentDetail|null
  8. }
  9. export default ({size='large', agent}:IProps) => {
  10. const renderContent = () => {
  11. if(size === 'mini'){
  12. return <>
  13. <View className="rounded-full overflow-hidden w-28 h-28">
  14. <Image src={agent?.avatarLogo} mode='widthFix' className='w-28 h-28'></Image>
  15. </View>
  16. <View className="flex flex-col flex-1 gap-4">
  17. <View className="flex items-end gap-4">
  18. <View className="text-12 font-medium leading-12">{agent?.name}</View>
  19. {agent?.isEnt && <View className="text-12 leading-12"><IconCertificateColor/></View>}
  20. </View>
  21. {agent?.entId && <View className="flex items-center gap-2">
  22. <View className="text-gray-45 text-12 leading-12 truncate max-w-[180px]">
  23. {agent?.entName}
  24. </View>
  25. </View>}
  26. </View>
  27. </>
  28. }
  29. return <>
  30. <View className="rounded-full overflow-hidden w-60 h-60">
  31. <Image src={agent?.avatarLogo} mode='widthFix' className='w-60 h-60'></Image>
  32. </View>
  33. <View className="flex flex-col flex-1">
  34. <View className="flex items-end gap-8">
  35. <View className="text-24 font-medium leading-32">{agent?.name}</View>
  36. <View className="text-12 leading-20">{agent?.position}</View>
  37. </View>
  38. <View className="flex items-center gap-2">
  39. <View className="text-12 leading-20 truncate max-w-[188px]">
  40. {agent?.entName}
  41. </View>
  42. {agent?.isEnt && <TagCertificated />}
  43. </View>
  44. </View>
  45. </>
  46. }
  47. return (
  48. <View className="flex items-center gap-8">
  49. {renderContent()}
  50. </View>
  51. )
  52. }