import { useState } from 'react' import Taro from '@tarojs/taro' import { Image, View } from '@tarojs/components' import IconCertificateColor from "@/components/icon/icon-certificate-color"; import { TAgentDetail } from '@/types/agent'; import { AvatarMedia } from '@/components/AvatarMedia'; import IconMicOutline from '@/components/icon/IconMicOutline'; import IconArrowRightGray from '@/components/icon/IconArrowRightGray'; import IconClean from '@/components/icon/IconClean'; import IconArrowVerticalFilled from '@/components/icon/IconArrowVerticalFilled'; import { useTextChat } from '@/store/textChatStore'; import style from './index.module.less' interface IProps { agent: TAgentDetail|null haveBg: boolean onClear: ()=>void } export default ({haveBg, agent, onClear}:IProps) => { /** * 之前个人卡片信息有两种样式,现在统一为一种 */ const nameStyle = haveBg ? 'text-white' : 'text-black' const entStyle = haveBg ? 'text-white' : 'text-black-45' const [show, setShow] = useState(false) const { setIsNewChat } = useTextChat() const handleClick = (e:any) => { e.stopPropagation() setShow(!show) } const handleClean = (e:any) => { // e.stopPropagation() console.log('clean') setShow(false) setIsNewChat(true) onClear() } const handleVoiceChoose = (e:any) => { setShow(false) Taro.navigateTo({ url: '/pages/voice/index' }) console.log('handleVoiceChoose') } const renderContent = () => { return <> {agent?.name} {agent?.isEnt && } {agent?.entName && {agent?.entName} } {!!show && e.stopPropagation()}> 清除对话 音色选择 } } return ( {renderContent()} ) }