index.tsx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { View, Text, Image } from "@tarojs/components";
  2. import { TVisitorAgent } from "@/types/visitor";
  3. import Taro from "@tarojs/taro";
  4. import IconPhone from '@/images/svgs/dashboard/IconPhone.svg'
  5. import IconCopy from '@/images/svgs/dashboard/IconCopy.svg'
  6. import IconTime from '@/images/svgs/dashboard/IconTime.svg'
  7. import IconMark from '@/images/svgs/dashboard/IconMark.svg'
  8. import AgentCard from "@/components/AgentCard/index";
  9. export interface IndexProps {
  10. data: TVisitorAgent;
  11. }
  12. const VisitorSummary = ({ data }: IndexProps) => {
  13. const handleCopy = (value: string)=> {
  14. // 手动复制并 toast 提示
  15. Taro.setClipboardData({
  16. data: value,
  17. success(){
  18. Taro.showToast({
  19. title: '复制成功',
  20. icon: 'none'
  21. })
  22. },fail(res) {
  23. console.log(res)
  24. Taro.showToast({
  25. title: '复制失败',
  26. icon: 'none'
  27. })
  28. },
  29. })
  30. }
  31. return (
  32. <View className="w-full p-16">
  33. <AgentCard
  34. className="bg-opacity-0 p-0 rounded-none mb-16"
  35. key={data.agentId}
  36. data={data}
  37. truncate={false}
  38. onClick={() => {
  39. Taro.navigateTo({
  40. url: `/pages/profile/index?agentId=${data.agentId}`,
  41. })
  42. }}
  43. >
  44. </AgentCard>
  45. <View className="flex flex-col w-full gap-8">
  46. <View className="flex gap-8 items-center text-12 leading-20">
  47. <Image src={IconPhone} className="w-16 h-16 shrink-0 self-start"></Image>
  48. <Text>{data.mobile}</Text>
  49. <Image src={IconCopy} className="w-16 h-16 shrink-0" onClick={()=> handleCopy(data.mobile ?? '')}></Image>
  50. </View>
  51. <View className="flex gap-8 items-center text-12 leading-20">
  52. <Image src={IconMark} className="w-16 h-16 shrink-0 self-start"></Image>
  53. <View>
  54. 第<Text className="text-primary text-12 font-medium px-6">{data.visitTimes}</Text>
  55. 次访问了你的智能体「<Text className="text-primary text-12 font-medium px-6">{data.myAgentName}</Text>」
  56. </View>
  57. </View>
  58. <View className="flex gap-8 items-center text-12 leading-20">
  59. <Image src={IconTime} className="w-16 h-16 shrink-0 self-start"></Image>
  60. {data.lastChatTime}
  61. </View>
  62. </View>
  63. </View>
  64. );
  65. };
  66. export default VisitorSummary;