index.tsx 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { View, Image, Text } from "@tarojs/components";
  2. import style from './index.module.less'
  3. import { TModelAppConfig } from '@/types/index'
  4. import { VIP_LEVEL } from '@/config/index'
  5. import { APP_NAME_TEXT } from '@/config'
  6. interface Props {
  7. appConfig: TModelAppConfig;
  8. vip: string
  9. }
  10. export default ({appConfig, vip}: Props) => {
  11. // 有对应的 vip 则返回vip 否则返回免费用户
  12. const vipMetadata = appConfig?.vips?.find((item)=> {
  13. if(vip){
  14. return item.id === vip
  15. }else{
  16. return item.id === VIP_LEVEL.FREE
  17. }
  18. })?.metadata
  19. const isFree = vip === VIP_LEVEL.FREE
  20. if(!vipMetadata){
  21. return <></>
  22. }
  23. const renderKnowledgeRights = ()=> {
  24. if(!isFree){
  25. return <>
  26. <Text className="text-12 text-black leading-18 whitespace-nowrap">{vipMetadata.maxDocSize/1024}G知识库</Text>
  27. <Text className="text-12 text-black leading-18">文件上传容量</Text>
  28. </>
  29. }
  30. return <>
  31. <Text className="text-12 text-black leading-18">不支持知识库</Text>
  32. <Text className="text-12 text-black leading-18">文件上传</Text>
  33. </>
  34. }
  35. return (
  36. <View className="flex flex-col w-full gap-24">
  37. <View className="flex flex-wrap justify-between items-center w-full">
  38. <View className={`flex flex-col gap-8 ${style.rightItem}`}>
  39. <View className="w-48 h-48">
  40. <Image src='https://cdn.wehome.cn/cmn/png/158/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-PLOMWI2M-R91.png' mode="widthFix" className="w-48 h-48"></Image>
  41. </View>
  42. <View className="flex flex-col text-center">
  43. <Text className="text-12 text-black leading-18">最多创作</Text>
  44. <Text className="text-12 text-black leading-18">{vipMetadata.maxCharacterNum === -1 ? 30: vipMetadata.maxCharacterNum}个{APP_NAME_TEXT}</Text>
  45. </View>
  46. </View>
  47. <View className={`flex flex-col gap-8 ${style.rightItem}`}>
  48. <View className="w-48 h-48">
  49. <Image src='https://cdn.wehome.cn/cmn/png/93/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-PLOMWI2M-S91.png' mode="widthFix" className="w-48 h-48"></Image>
  50. </View>
  51. <View className="flex flex-col text-center">
  52. <Text className="text-12 text-black leading-18">{vipMetadata.cloneVoiceChatDuration / 60}分钟/天</Text>
  53. <Text className="text-12 text-black leading-18">克隆音色对话</Text>
  54. </View>
  55. </View>
  56. <View className={`flex flex-col gap-8 ${style.rightItem} ${vipMetadata.customBgImage ? '' : style.disabled}`}>
  57. <View className="w-48 h-48">
  58. <Image src='https://cdn.wehome.cn/cmn/png/33/META-H8UK0IWU-LIGPDI0B88LDCAMAO6LN3-TLOMWI2M-D71.png' mode="widthFix" className="w-48 h-48"></Image>
  59. </View>
  60. <View className="flex flex-col text-center">
  61. <Text className="text-12 text-black leading-18">自定义背景</Text>
  62. <Text className="text-12 text-black leading-18">图片上传</Text>
  63. </View>
  64. </View>
  65. </View>
  66. <View className="flex flex-wrap justify-between items-center w-full">
  67. <View className={`flex flex-col gap-8 ${style.rightItem} ${!isFree? '' : style.disabled}`}>
  68. <View className="w-48 h-48">
  69. <Image src='https://cdn.wehome.cn/cmn/png/61/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-QLOMWI2M-T91.png' mode="widthFix" className="w-48 h-48"></Image>
  70. </View>
  71. <View className="flex flex-col text-center">
  72. {renderKnowledgeRights()}
  73. </View>
  74. </View>
  75. <View className={`flex flex-col gap-8 ${style.rightItem} ${style.rightItem} ${vipMetadata.viewChatHistory ? '' : style.disabled}`}>
  76. <View className="w-48 h-48">
  77. <Image src='https://cdn.wehome.cn/cmn/png/128/META-H8UKVHWU-KIGP3BIL7M5AYC6XHNUA2-ULOMWI2M-U91.png' mode="widthFix" className="w-48 h-48"></Image>
  78. </View>
  79. <View className="flex flex-col text-center">
  80. <Text className="text-12 text-black leading-18">支持查看</Text>
  81. <Text className="text-12 text-black leading-18">AI 对话记录</Text>
  82. </View>
  83. </View>
  84. <View className={`flex flex-col gap-8 ${style.rightItem} ${vipMetadata.viewVisitStats ? '' : style.disabled}`}>
  85. <View className="w-48 h-48">
  86. <Image src='https://cdn.wehome.cn/cmn/png/32/META-H8UK0IWU-LIGPDI0B88LDCAMAO6LN3-VLOMWI2M-E71.png' mode="widthFix" className="w-48 h-48"></Image>
  87. </View>
  88. <View className="flex flex-col text-center">
  89. <Text className="text-12 text-black leading-18">支持查看</Text>
  90. <Text className="text-12 text-black leading-18">访问数据</Text>
  91. </View>
  92. </View>
  93. </View>
  94. </View>
  95. );
  96. };