|
@@ -9,35 +9,46 @@ import IconSendBlack from "@/components/icon/icon-send-black";
|
|
|
import IconEditBlack from "@/components/icon/icon-edit-black";
|
|
|
import IconMoreBlack from "@/components/icon/icon-more-black";
|
|
|
|
|
|
-import IconPhoneGray from "@/components/icon/icon-phone-gray";
|
|
|
-import IconMailGray from "@/components/icon/icon-mail-gray";
|
|
|
-import IconLocationGray from "@/components/icon/icon-location-gray";
|
|
|
+import ContactIcon from '@/components/ContactIcon'
|
|
|
import { useAppStore } from "@/store/appStore";
|
|
|
import AgentSwap from "../AgentSwap/index";
|
|
|
-import AgentQRCode from "../agent-qrcode/index";
|
|
|
+import AgentQRCode from "../AgentQRcode/index";
|
|
|
import SharePopup from "@/components/custom-share/share-popup";
|
|
|
import Taro from "@tarojs/taro";
|
|
|
import PopupSheets from "@/components/popup/popup-sheets";
|
|
|
-import { useAgentStore } from "@/store/agentStore";
|
|
|
|
|
|
import { useModalStore } from "@/store/modalStore";
|
|
|
-
|
|
|
-export default () => {
|
|
|
+import { TAgentDetail } from "@/types/agent";
|
|
|
+interface IProps {
|
|
|
+ agent: TAgentDetail,
|
|
|
+ isVisitor: boolean, // 是否是访问他人智能体
|
|
|
+}
|
|
|
+export default ({agent, isVisitor}: IProps) => {
|
|
|
const headerHeight = useAppStore((state) => state.headerHeight);
|
|
|
const [showAgentSwap, setShowAgentSwap] = useState(false);
|
|
|
const [showAgentQRcode, setShowAgentQRcode] = useState(false);
|
|
|
const [showPopup, setShowPopup] = useState(false);
|
|
|
const [showShare, setShowShare] = useState(false);
|
|
|
|
|
|
- const agent = useAgentStore((state)=> state.agent)
|
|
|
|
|
|
|
|
|
const {showModal,} = useModalStore()
|
|
|
|
|
|
- const test = ()=> {
|
|
|
-
|
|
|
+ const handleClick = ()=> {
|
|
|
+ Taro.navigateTo({
|
|
|
+ url: `/pages/chat/index?agentId=${agent.agentId}`,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ const renderValue = (value?:string)=> {
|
|
|
+ return value?.length ? value : '--'
|
|
|
}
|
|
|
|
|
|
+ // 允许更多操作,非企业智能体且非访问者身份
|
|
|
+ const enableMoreAction = !agent?.isEnt && !isVisitor
|
|
|
+ // 是自己的智能体或者有二维码地址
|
|
|
+ const enableQrcode = agent?.isMineAgent || !!agent?.qrCodeUrl
|
|
|
+
|
|
|
|
|
|
// 自定义背景样式
|
|
|
const bgImageStyle = {
|
|
@@ -45,6 +56,7 @@ export default () => {
|
|
|
// background: `linear-gradient(rgba(242, 244, 245, 0) 0%, rgba(242, 244, 245, .8) 80% , rgba(242, 244, 245,1) 100%), url(${customBgImg})`,
|
|
|
backgroundImage: `url(https://cdn.wehome.cn/cmn/png/53/META-H8UKWHWU-2JNUAG2BARJF55VHU9QS3-YBQGHDAM-IW.png)`,
|
|
|
};
|
|
|
+
|
|
|
return (
|
|
|
<View className="relative">
|
|
|
<View className={style.topBg} style={bgImageStyle}></View>
|
|
@@ -64,39 +76,37 @@ export default () => {
|
|
|
<TagCertificated />
|
|
|
</View>
|
|
|
</View>
|
|
|
- <View
|
|
|
+ {!isVisitor && <View
|
|
|
className={style.boxButton}
|
|
|
onClick={() => {
|
|
|
setShowAgentSwap(true);
|
|
|
}}
|
|
|
>
|
|
|
<IconSwapBlack />
|
|
|
- </View>
|
|
|
+ </View>}
|
|
|
</View>
|
|
|
<View className="flex items-center gap-8">
|
|
|
{/* 和TA聊聊 */}
|
|
|
<View className="flex-1">
|
|
|
<View
|
|
|
className="button-rounded button-primary"
|
|
|
- onClick={() => {
|
|
|
- Taro.navigateTo({
|
|
|
- url: "/pages/chat/index",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onClick={handleClick}
|
|
|
>
|
|
|
<IconChatWhite />
|
|
|
和TA聊聊
|
|
|
</View>
|
|
|
</View>
|
|
|
+
|
|
|
{/* 二维码 */}
|
|
|
- <View
|
|
|
+ {enableQrcode && <View
|
|
|
className={style.boxButton}
|
|
|
onClick={() => {
|
|
|
setShowAgentQRcode(true);
|
|
|
}}
|
|
|
>
|
|
|
<IconQRCodeBlack />
|
|
|
- </View>
|
|
|
+ </View>}
|
|
|
+
|
|
|
{/* 智能体分享 */}
|
|
|
<View
|
|
|
className={style.boxButton}
|
|
@@ -106,22 +116,23 @@ export default () => {
|
|
|
>
|
|
|
<IconSendBlack />
|
|
|
</View>
|
|
|
+
|
|
|
{/* 编辑智能体 */}
|
|
|
- <View
|
|
|
+ {!isVisitor && <View
|
|
|
className={style.boxButton}
|
|
|
onClick={() => {
|
|
|
Taro.navigateTo({ url: `/pages/agent/index?agentId=${agent?.agentId}` });
|
|
|
- // Taro.navigateTo({ url: "/pages/editor-contact/index" });
|
|
|
}}
|
|
|
>
|
|
|
<IconEditBlack />
|
|
|
- </View>
|
|
|
+ </View>}
|
|
|
+
|
|
|
{/* 更多操作 */}
|
|
|
- <View className={style.boxButton} onClick={()=> {
|
|
|
+ {enableMoreAction && <View className={style.boxButton} onClick={()=> {
|
|
|
setShowPopup(true)
|
|
|
}}>
|
|
|
<IconMoreBlack />
|
|
|
- </View>
|
|
|
+ </View>}
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
@@ -131,25 +142,20 @@ export default () => {
|
|
|
</View>
|
|
|
<View className="flex flex-col gap-20 text-12 leading-20">
|
|
|
<View className="flex items-center gap-12">
|
|
|
- <View className={style.icon}>
|
|
|
- <IconPhoneGray />
|
|
|
- </View>
|
|
|
- <View>{agent?.mobile}</View>
|
|
|
+ <ContactIcon type="phone" actived={!!agent?.mobile}/>
|
|
|
+ <View>{renderValue(agent?.mobile)}</View>
|
|
|
</View>
|
|
|
<View className="flex items-center gap-12">
|
|
|
- <View className={style.icon}>
|
|
|
- <IconMailGray />
|
|
|
- </View>
|
|
|
- <View>{agent?.email}</View>
|
|
|
+ <ContactIcon type="mail" actived={!!agent?.email}/>
|
|
|
+ <View>{renderValue(agent?.email)}</View>
|
|
|
</View>
|
|
|
<View className="flex items-center gap-12">
|
|
|
- <View className={style.icon}>
|
|
|
- <IconLocationGray />
|
|
|
- </View>
|
|
|
- <View>{agent?.address}</View>
|
|
|
+ <ContactIcon type="location" actived={!!agent?.address}/>
|
|
|
+ <View>{renderValue(agent?.address)}</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
</View>
|
|
|
+
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
@@ -170,7 +176,6 @@ export default () => {
|
|
|
showModal({
|
|
|
content: <>确认删除该智能体?</>,
|
|
|
onConfirm() {
|
|
|
- console.log(111)
|
|
|
setShowPopup(false);
|
|
|
},
|
|
|
onCancel() {
|