王晓东 преди 1 месец
родител
ревизия
f4ede1d64f
променени са 32 файла, в които са добавени 504 реда и са изтрити 376 реда
  1. 2 1
      package.json
  2. 1 0
      src/app.config.ts
  3. 24 11
      src/components/AgentPage/components/AgentQRcode/index.tsx
  4. 95 95
      src/components/AgentPage/components/AgentSwap/index.tsx
  5. 15 6
      src/components/AgentPage/components/SummaryBar/index.tsx
  6. 50 49
      src/components/component-list/components/address.ts
  7. 3 1
      src/components/component-list/index.tsx
  8. 6 6
      src/components/custom-share/CustomShareComponent.tsx
  9. 7 9
      src/components/custom-share/index.tsx
  10. 9 6
      src/components/custom-share/share-card/index.tsx
  11. 12 39
      src/components/custom-share/share-popup/index.tsx
  12. 22 0
      src/components/custom-share/shareUtils.ts
  13. 10 10
      src/components/widgets/widget-map/index.tsx
  14. 4 0
      src/hooks/useEditContactCard.ts
  15. 6 3
      src/pages/editor-contact/index.tsx
  16. 5 0
      src/pages/editor-pages/editor-address/index.config.ts
  17. 2 0
      src/pages/editor-pages/editor-address/index.module.less
  18. 60 0
      src/pages/editor-pages/editor-address/index.tsx
  19. 18 17
      src/pages/editor-pages/editor-email/index.tsx
  20. 10 12
      src/pages/editor-pages/editor-name/index.tsx
  21. 2 4
      src/pages/editor-pages/editor-personality/index.tsx
  22. 43 49
      src/pages/editor-pages/editor-qrcode/index.tsx
  23. 2 0
      src/pages/editor-pages/editor-tel/index.tsx
  24. 2 2
      src/pages/profile/index.tsx
  25. 7 1
      src/pages/voice/components/MyVoiceList/components/popup-recorder/index.tsx
  26. 10 10
      src/pages/voice/components/MyVoiceList/index.tsx
  27. 7 1
      src/service/agent.ts
  28. 2 2
      src/service/voice.ts
  29. 32 20
      src/store/agentStore.ts
  30. 25 9
      src/types/agent.ts
  31. 10 0
      src/types/voice.ts
  32. 1 13
      src/utils/index.ts

+ 2 - 1
package.json

@@ -11,6 +11,7 @@
   },
   "scripts": {
     "devbuild:weapp": "taro build --type weapp --watch --env production",
+    "dev:weapp": "npm run build:weapp -- --watch",
     "build:weapp": "taro build --type weapp",
     "release:weapp": "taro build --type weapp --mode release",
     "build:swan": "taro build --type swan",
@@ -22,7 +23,7 @@
     "build:jd": "taro build --type jd",
     "build:quickapp": "taro build --type quickapp",
     "build:harmony-hybrid": "taro build --type harmony-hybrid",
-    "dev:weapp": "npm run build:weapp -- --watch",
+    
     "dev:swan": "npm run build:swan -- --watch",
     "dev:alipay": "npm run build:alipay -- --watch",
     "dev:tt": "npm run build:tt -- --watch",

+ 1 - 0
src/app.config.ts

@@ -29,6 +29,7 @@ export default defineAppConfig({
     'pages/editor-pages/editor-phone/index',
     'pages/editor-pages/editor-tel/index',
     'pages/editor-pages/editor-email/index',
+    'pages/editor-pages/editor-address/index',
     'pages/editor-pages/editor-qrcode/index',
 
 

+ 24 - 11
src/components/AgentPage/components/AgentQRcode/index.tsx

@@ -8,27 +8,39 @@ import useEditContactCard from "@/hooks/useEditContactCard";
 import { useAgentStore } from "@/store/agentStore";
 import { pickAndUploadImage } from "@/utils/upload";
 import { EUploadFileScene } from "@/consts/enum";
+import Taro from "@tarojs/taro";
 
 interface IProps {
   show: boolean;
   setShow: (show: boolean) => void;
+  isVisitor?: boolean
 }
-export default ({ show, setShow }: IProps) => {
+export default ({ show, setShow, isVisitor }: IProps) => {
   const agentContactCard = useAgentStore((state) => state.agentContactCard);
   const agent = useAgentStore((state) => state.agent);
-
+  const isMine = (!isVisitor) 
+  console.log(isVisitor,1111)
+  // ?? (agent?.isMineAgent !== false)
+  // const agents = useAgentStore((state) => state.agents);
+  // const existed = agents.find((item)=> agent?.agentId === item.agentId)
   const { setValue, submit } = useEditContactCard(
     "qrCodeUrl",
     agentContactCard?.qrCodeUrl
   );
   const handleClick = async () => {
-    const result = await pickAndUploadImage(["album"], EUploadFileScene.OTHER);
-    if (!result?.url) {
-      return;
-    }
-    setValue(result.url);
+    Taro.showLoading();
+    try{
+      const result = await pickAndUploadImage(["album"], EUploadFileScene.OTHER);
+      if (!result?.url) {
+        return;
+      }
+      setValue(result.url);
 
-    submit(result.url);
+      submit(result.url);
+      Taro.hideLoading()
+    }catch(e:any){
+      Taro.hideLoading()
+    }
   };
 
   const handleClear = () => {
@@ -39,9 +51,10 @@ export default ({ show, setShow }: IProps) => {
 
   const renderQrcode = () => {
     if (agentContactCard?.qrCodeUrl) {
-      return <Image src={agentContactCard?.qrCodeUrl} mode="widthFix"></Image>;
+      return <Image src={agentContactCard?.qrCodeUrl} showMenuByLongpress mode="widthFix"></Image>;
     }
-    if(agent?.isMineAgent){
+    
+    if(isMine){
       return (
         <View onClick={handleClick}>
           <QrcodeUploadTips />
@@ -59,7 +72,7 @@ export default ({ show, setShow }: IProps) => {
             {renderQrcode()}
           </View>
 
-          {(agent?.isMineAgent !== false) && <View className={style.bottomButtons}>
+          {isMine && <View className={style.bottomButtons}>
             <View className="pr-16" onClick={handleClick}>替换</View>
             <View className="text-gray-25">|</View>
             <View className="pl-16" onClick={handleClear}>清空</View>

+ 95 - 95
src/components/AgentPage/components/AgentSwap/index.tsx

@@ -2,90 +2,126 @@ import { View } from "@tarojs/components";
 import style from "./index.module.less";
 import TagCertificated from "@/components/tag-certificated";
 
-import IconPhoneGray from "@/components/icon/IconPhoneGray";
-import IconMailGray from "@/components/icon/IconMailGray";
-import IconLocationGray from "@/components/icon/IconLocationGray";
-import IconQRCodeGray from "@/components/icon/IconQrcodeGray";
 import IconPlusBlue from "@/components/icon/icon-plus-blue";
 import Popup from "@/components/popup/popup";
 import WemetaTabs from "@/components/wemeta-tabs/index";
 import { useAgentStore } from "@/store/agentStore";
 import { TAgent } from "@/types/agent";
 import Taro from "@tarojs/taro";
-import ContactIcon from '@/components/ContactIcon'
+import ContactIcon from "@/components/ContactIcon";
 interface IProps {
   show: boolean;
   setShow: (show: boolean) => void;
 }
 export default ({ show, setShow }: IProps) => {
+  const { agents, setDefaultAgent, fetchAgents, createAgent } = useAgentStore();
+  let loading = false;
+  const personalAgents = agents.filter((item) => !item.isEnt);
+  const entAgents = agents.filter((item) => item.isEnt);
 
-  const { agents, setDefaultAgent, fetchAgents } = useAgentStore()
-  let loading = false
-  const personalAgents = agents.filter( item => !item.isEnt)
-  const entAgents = agents.filter( item => item.isEnt)
 
-  const handleClick = async (item: TAgent)=> {
-    if(loading){
-      return
+  
+
+  const handleClick = async (item: TAgent) => {
+    if (loading) {
+      return;
     }
     loading = true;
-    Taro.showLoading({title: '加载中'})
-    const result = await setDefaultAgent(item.agentId)
-    
-    if(result){
-      await fetchAgents()
+    Taro.showLoading({ title: "加载中" });
+    const result = await setDefaultAgent(item.agentId);
+
+    if (result) {
+      await fetchAgents();
     }
     loading = false;
-    Taro.hideLoading()
+    Taro.hideLoading();
+    setShow(false)
+
+  };
+
+  const handleCreate = async ()=> {
+    Taro.showLoading()
+    if (loading) {
+      return;
+    }
+    loading = true;
+    try{
+      const response = await createAgent()
+      if(response?.agentId){
+        const result = await setDefaultAgent(response.agentId);
+        if (result) {
+          await fetchAgents();
+        }
+      }
+      Taro.hideLoading()
+      loading = false;
+      setShow(false)
+    }catch(e:any){
+      Taro.hideLoading()
+      loading = false;
+    }
   }
 
   const renderCard = (item: TAgent, isEnt: boolean) => {
-    return <View className={item.isDefault ? style.cardActive : style.card}>
-    <View className="flex items-start mb-24" onClick={()=> handleClick(item)}>
-      <View className="flex flex-col flex-1">
-        <View className="flex items-end gap-8 text-gray-65">
-          <View className="text-20 font-medium leading-28 text-black">
-            {item.name}
+    return (
+      <View className={item.isDefault ? style.cardActive : style.card}>
+        <View
+          className="flex items-start mb-24"
+          onClick={() => handleClick(item)}
+        >
+          <View className="flex flex-col flex-1">
+            <View className="flex items-end gap-8 text-gray-65">
+              <View className="text-20 font-medium leading-28 text-black">
+                {item.name}
+              </View>
+              <View className="text-12 leading-20">
+                {item.position ?? "暂无职位信息"}
+              </View>
+            </View>
+            <View className="flex items-center gap-2">
+              <View className="text-12 leading-20 truncate max-w-[188px]">
+                {item.entName ?? "暂无公司信息"}
+              </View>
+              {isEnt && <TagCertificated />}
+            </View>
           </View>
-          <View className="text-12 leading-20">{item.position ?? '暂无职位信息'}</View>
         </View>
-        <View className="flex items-center gap-2">
-          <View className="text-12 leading-20 truncate max-w-[188px]">
-            {item.entName ?? '暂无公司信息'}
-          </View>
-          {isEnt && <TagCertificated />}
+        <View className={style.icons}>
+          <ContactIcon type="phone" actived={!!item?.mobile}></ContactIcon>
+          <ContactIcon type="mail" actived={!!item?.email}></ContactIcon>
+          <ContactIcon type="location" actived={!!item?.address}></ContactIcon>
+          <ContactIcon type="qrcode" actived={!!item?.qrCodeUrl}></ContactIcon>
         </View>
       </View>
-    </View>
-    <View className={style.icons}>
-      <ContactIcon type="phone" actived={!!item?.mobile}></ContactIcon>
-      <ContactIcon type="mail" actived={!!item?.email}></ContactIcon>
-      <ContactIcon type="location" actived={!!item?.address}></ContactIcon>
-      <ContactIcon type="qrcode" actived={!!item?.qrCodeUrl}></ContactIcon>
-    </View>
-  </View>
-  }
+    );
+  };
 
-  const renderPersonalAgents = ()=> {
+  const renderPersonalAgents = () => {
     return personalAgents.map((item) => {
-      return renderCard(item, false)
-    })
-  }
+      return renderCard(item, false);
+    });
+  };
 
   const renderEntAgents = () => {
-    if(entAgents.length){
+    if (entAgents.length) {
       return entAgents.map((item) => {
-        return renderCard(item, true)
-      }) 
+        return renderCard(item, true);
+      });
     }
-    return <View className={style.card}>
-    <View className="flex flex-col items-center">
-      <View className="text-16 leading-24 font-medium mb-4">你还没有企业配置的名片</View>
-      <View className="text-12 text-gray-45 leading-20 mb-24">企业小蓝本由公司创建并授权,可引用企业知识内容</View>
-      <View className="text-primary font-medium leading-22">联系我们</View>
-    </View>
-  </View>
-  }
+    return (
+      <View className={style.card}>
+        <View className="flex flex-col items-center">
+          <View className="text-16 leading-24 font-medium mb-4">
+            你还没有企业配置的名片
+          </View>
+          <View className="text-12 text-gray-45 leading-20 mb-24">
+            企业小蓝本由公司创建并授权,可引用企业知识内容
+          </View>
+          <View className="text-primary font-medium leading-22">联系我们</View>
+        </View>
+      </View>
+    );
+  };
 
   const tabList = [
     {
@@ -96,45 +132,11 @@ export default ({ show, setShow }: IProps) => {
           <View className="pt-12">
             <View className={style.tabContainer}>
               {renderPersonalAgents()}
-              {/* <View className={style.card}>
-                <View className="flex items-start mb-24">
-                  <View className="flex flex-col flex-1">
-                    <View className="flex items-end gap-8 text-gray-65">
-                      <View className="text-20 font-medium leading-28 text-black">
-                        张三
-                      </View>
-                      <View className="text-12 leading-20">销售医师</View>
-                    </View>
-                    <View className="flex items-center gap-2">
-                      <View className="text-12 leading-20 truncate max-w-[188px]">
-                        北京茗视光眼科医院管理有限公司
-                      </View>
-                      <TagCertificated />
-                    </View>
-                  </View>
-                </View>
-                <View className={style.icons}>
-                  <View className={style.icon}>
-                    <IconPhoneGray />
-                  </View>
-                  <View className={style.icon}>
-                    <IconMailGray />
-                  </View>
-                  <View className={style.icon}>
-                    <IconLocationGray />
-                  </View>
-                  <View className={style.icon}>
-                    <IconQRCodeGray />
-                  </View>
-                </View>
-              </View> */}
-              
 
-              
-              <View className="button-rounded button-primary-light gap-8 mb-15">
-              <IconPlusBlue />
-              <View>创建新的智能体</View>
-            </View>
+              <View className="button-rounded button-primary-light gap-8 mb-15" onClick={handleCreate}>
+                <IconPlusBlue />
+                <View>创建新的智能体</View>
+              </View>
             </View>
           </View>
         </>
@@ -146,9 +148,7 @@ export default ({ show, setShow }: IProps) => {
       children: (
         <>
           <View className="pt-12">
-            <View className={style.tabContainer}>
-            {renderEntAgents()}
-            </View>
+            <View className={style.tabContainer}>{renderEntAgents()}</View>
           </View>
         </>
       ),

+ 15 - 6
src/components/AgentPage/components/SummaryBar/index.tsx

@@ -19,6 +19,7 @@ import PopupSheets from "@/components/popup/popup-sheets";
 
 import { useModalStore } from "@/store/modalStore";
 import { TAgentDetail } from "@/types/agent";
+import { useAgentStore } from "@/store/agentStore";
 interface IProps {
   agent: TAgentDetail,
   isVisitor: boolean, // 是否是访问他人智能体
@@ -29,7 +30,7 @@ export default ({agent, isVisitor}: IProps) => {
   const [showAgentQRcode, setShowAgentQRcode] = useState(false);
   const [showPopup, setShowPopup] = useState(false);
   const [showShare, setShowShare] = useState(false);
-
+  const { deleteAgent } = useAgentStore()
   
 
   const {showModal,} = useModalStore()
@@ -40,6 +41,12 @@ export default ({agent, isVisitor}: IProps) => {
     });
   }
 
+  const confirmDelete = async () => {
+    if(agent.agentId){
+      await deleteAgent(agent.agentId)
+    }
+  }
+
   const renderValue = (value?:string)=> {
     return value?.length ? value :  '--'
   }
@@ -47,7 +54,7 @@ export default ({agent, isVisitor}: IProps) => {
   // 允许更多操作,非企业智能体且非访问者身份
   const enableMoreAction = !agent?.isEnt && !isVisitor
   // 是自己的智能体或者有二维码地址
-  const enableQrcode = agent?.isMineAgent !== false || !!agent?.qrCodeUrl
+  const enableQrcode = !isVisitor || !!agent?.qrCodeUrl?.length
 
 
   // 自定义背景样式
@@ -58,6 +65,7 @@ export default ({agent, isVisitor}: IProps) => {
     backgroundImage: `url(${agent?.avatarUrl})`,
   };
 
+
   return (
     <View className="relative">
       <View className={style.topBg} style={bgImageStyle}></View>
@@ -161,12 +169,12 @@ export default ({agent, isVisitor}: IProps) => {
       </View>
 
       <AgentSwap show={showAgentSwap} setShow={setShowAgentSwap}></AgentSwap>
-      <AgentQRCode show={showAgentQRcode} setShow={setShowAgentQRcode} />
-      <SharePopup
+      <AgentQRCode isVisitor={isVisitor} show={showAgentQRcode} setShow={setShowAgentQRcode} />
+      {agent && <SharePopup
         show={showShare}
         setShow={setShowShare}
-        character={null}
-      ></SharePopup>
+        agent={agent}
+      ></SharePopup>}
       <PopupSheets 
           setShow={setShowPopup} 
           show={showPopup}
@@ -178,6 +186,7 @@ export default ({agent, isVisitor}: IProps) => {
                 content: <>确认删除该智能体?</>,
                 onConfirm() {
                   setShowPopup(false);
+                  confirmDelete()
                 },
                 onCancel() {
                   setShowPopup(false);

+ 50 - 49
src/components/component-list/components/address.ts

@@ -1,58 +1,59 @@
 import { TComponentItem } from "@/types/agent";
 import { EComponentType } from "@/consts/enum";
 import { useComponentStore } from "@/store/componentStore";
+import Taro from "@tarojs/taro";
 
-export const saveAddress = async (value:any, component:TComponentItem) => {
-  const {
-    saveComponent,
-  } = useComponentStore();
-  if(!component?.data?.id){
-    return
-  }
-  if(!value.address.length){
-    return
-  }
-  
-  const c = {
-    data: {
-      address: value.address, 
-      name: value.name,
+// 编辑微官网地图组件
+
+export const useAddress = () => {
+  const { setCurrentComponent, setInsertIndex, saveComponent } =
+    useComponentStore();
+
+  const saveAddress = async (
+    value: Taro.chooseLocation.SuccessCallbackResult,
+    component: TComponentItem
+  ) => {
+    if (!component?.data?.id) {
+      return;
+    }
+    if (!value.address.length) {
+      return;
+    }
+
+    const c = {
+      data: {
+        address: value.address,
+        name: value.name,
+        latitude: value.latitude,
+        longitude: value.longitude,
+        id: component?.data?.id,
+        index: component?.data?.index,
+      },
+      enabled: component?.enabled ?? true,
+      type: EComponentType.address,
+    };
+
+    await saveComponent(c);
+  };
+
+  const handleChooseAddress = async (value, c: TComponentItem) => {
+    setInsertIndex(-1);
+    setCurrentComponent(c);
+
+    const option = {
+      address: value.address,
       latitude: value.latitude,
       longitude: value.longitude,
-      id: component?.data?.id,
-      index: component?.data?.index,
-    },
-    enabled: component?.enabled ?? true,
-    type: EComponentType.address,
+      success(result: Taro.chooseLocation.SuccessCallbackResult) {
+        console.log(result);
+
+        saveAddress(result, c);
+      },
+    };
+    Taro.chooseLocation(option);
   };
 
-  
-  await saveComponent(c)
+  return {
+    handleChooseAddress,
+  };
 };
-export const handleChooseAddress = async (value, c:TComponentItem) => {
-  const {
-    setCurrentComponent,
-    setInsertIndex,
-  } = useComponentStore();
-  setInsertIndex(-1);
-  setCurrentComponent(c);
-  // setMapVisible(true)
-
-  const option = {
-    address:  value.address,
-    latitude: value.latitude,
-    longitude: value.longitude,
-    success(result:Taro.chooseLocation.SuccessCallbackResult) {
-        console.log(result)
-        value = {
-          address: result.address, 
-          name: result.name,
-          latitude: result.latitude,
-          longitude: result.longitude
-        }
-        saveAddress(value, c)
-    }
-  }
-  Taro.chooseLocation(option)
-
-};

+ 3 - 1
src/components/component-list/index.tsx

@@ -26,7 +26,7 @@ import CardLink from "./components/card-link/index";
 
 import { TComponentItem } from "@/types/agent";
 
-import { handleChooseAddress } from './components/address'
+import { useAddress } from './components/address'
 import { EComponentType } from "@/consts/enum";
 
 interface Props {
@@ -49,6 +49,8 @@ export default ({ components, editMode = false }: Props) => {
     useState<TSocialMediaItem | null>(null);
   const [currentLink, setCurrentLink] = useState("");
 
+  const {handleChooseAddress} = useAddress()
+
   
 
   const showMediaLink = (mediaItem: TSocialMediaItem, link: string, c: TEntityComponent) => {

+ 6 - 6
src/components/custom-share/CustomShareComponent.tsx

@@ -1,18 +1,18 @@
 import {useMemo} from 'react'
 import CustomShare from '@/components/custom-share/index';
-import { ICharacter } from '@/types/index'
+import { TAgent } from '@/types/agent';
 
 interface Props {
-  character: ICharacter | null;
+  agent: TAgent | null;
 }
 const CustomShareComponent = (props: Props) => {
-  const { character } = props;
+  const { agent } = props;
   const renderedComponent = useMemo(() => {
-    if (!character) {
+    if (!agent) {
       return null;
     }
-    return <CustomShare character={character} />;
-  }, [character]);
+    return <CustomShare agent={agent} />;
+  }, [agent]);
 
   return renderedComponent;
 };

Файловите разлики са ограничени, защото са твърде много
+ 7 - 9
src/components/custom-share/index.tsx


+ 9 - 6
src/components/custom-share/share-card/index.tsx

@@ -13,10 +13,10 @@ import {
 } from "@/libs/duducanvas/index";
 import Stage from "@/libs/duducanvas/Stage";
 import Taro from "@tarojs/taro";
-import { ICharacter } from "@/types";
 import { genCharacterQrcode } from "@/service/character";
 import { forwardRef, useImperativeHandle } from "react";
 import { getAvatarImageSrc } from "../shareUtils";
+import { TAgent } from "@/types/agent";
 
 export interface IShareCard {
   saveCardToAlbum: () => void;
@@ -73,15 +73,18 @@ const genQrcode = async (
 };
 
 interface Props {
-  character: ICharacter;
+  agent: TAgent;
 }
 
-export default forwardRef(({ character }: Props, ref) => {
+export default forwardRef(({ agent }: Props, ref) => {
   const { canvasWidth, canvasHeight, ratio, rValue } = getCanvasSize();
   let stage: Stage|null;
 
   // 保存至相册
   const saveCardToAlbum = async () => {
+    if(!stage){
+      return
+    }
     Taro.showLoading();
     // 延迟获取 canvas
     await initCanvas();
@@ -115,7 +118,7 @@ export default forwardRef(({ character }: Props, ref) => {
     if(!stage){
       return
     }
-    const avatarImg = getAvatarImageSrc(character.avatar ?? "")
+    const avatarImg = getAvatarImageSrc(agent.avatarUrl ?? "")
 
     const loader = new ImgLoader(stage.canvas, [
       {
@@ -163,7 +166,7 @@ export default forwardRef(({ character }: Props, ref) => {
 
     // 用户名
     const name = new RichText({
-      text: character?.name ?? "",
+      text: agent?.name ?? "",
       fontSize: rValue(18),
       color: "black",
       fontWeight: 600,
@@ -189,7 +192,7 @@ export default forwardRef(({ character }: Props, ref) => {
 
     stage.addChild(card);
     
-    await genQrcode(character.profileId, rValue(227), rValue(234), stage, qrcodeView);
+    // await genQrcode(agent.agentId, rValue(227), rValue(234), stage, qrcodeView);
     stage.update();
     Taro.hideLoading();
     return stage;

+ 12 - 39
src/components/custom-share/share-popup/index.tsx

@@ -1,69 +1,46 @@
 import { useMemo, useRef } from "react";
 import { View, Image, Button, RootPortal } from "@tarojs/components";
-import Taro from "@tarojs/taro"
 import style from "./index.module.less";
 import IconShareWechat from "@/images/icon-share-wechat.png";
 import IconShareQrcode from "@/images/icon-share-qrcode.png";
-import IconShareLink from "@/images/icon-share-link.png";
-import { ICharacter } from "@/types/index";
 import ShareCard, {type IShareCard} from "@/components/custom-share/share-card/index";
 import CustomShareComponent from "@/components/custom-share/CustomShareComponent";
-import { HOME_URL } from '@/config'
-import { useCurrentCharacter } from "@/store/characterStore";
 import Popup from "@/components/popup/popup";
+import { TAgent } from "@/types/agent";
+import Taro from "@tarojs/taro";
 
 
 interface Props {
   show: boolean;
-  character: ICharacter | null;
+  agent: TAgent | null;
   setShow: (show:boolean) => void;
 }
-export default ({ show, setShow, character }: Props) => {
-  const currentCharacter = useCurrentCharacter();
+export default ({ show, setShow, agent }: Props) => {
   const shareCardRef = useRef<IShareCard>(null)
   // todo: 优化至点击后再去生成小程序二维码
   const ShareCardComponent = useMemo(
     () => {
-      if(character){
-        return <ShareCard ref={shareCardRef} character={character}></ShareCard>
+      if(agent){
+        return <ShareCard ref={shareCardRef} agent={agent}></ShareCard>
       }
-    }, [character]
+    }, [agent]
   );
   
 
   const handleSavePicture = () => {
     console.log(shareCardRef?.current)
-    shareCardRef?.current?.saveCardToAlbum(); // 调用子组件的保存方法
+    Taro.showToast({title: '暂不支持此功能', icon: 'none'})
+    // shareCardRef?.current?.saveCardToAlbum(); // 调用子组件的保存方法
   }
 
-  const handleCopyLink = () => {
-    Taro.setClipboardData({
-      data: `${HOME_URL}${character?.profileId}`,
-      success(){
-        Taro.showToast({
-          title: '复制成功',
-          icon: 'none'
-        })
-      },fail(res) {
-        console.log(res)
-        Taro.showToast({
-          title: '复制失败',
-          icon: 'none'
-        })
-      },
-    })
-  }
+  
   // 默认要生成分享图
   const renderSharePicture = ()=> {
-    if(currentCharacter?.profileId === character?.profileId){
-      return <CustomShareComponent character={character} />
+    if(agent?.agentId){
+      return <CustomShareComponent agent={agent} />
     }
     return <></>
   }
-
-  // if (!visible) {
-  //   return <></>;
-  // }
   
 
   return (
@@ -82,10 +59,6 @@ export default ({ show, setShow, character }: Props) => {
                 <Image src={IconShareQrcode} className={style.icon}></Image>
                 <View className={style.buttonText}>保存图片</View>
               </View>
-              <View className={style.optionButton} onClick={handleCopyLink}>
-                <Image src={IconShareLink} className={style.icon}></Image>
-                <View className={style.buttonText}>复制链接</View>
-              </View>
             </View>
           
           {ShareCardComponent}

+ 22 - 0
src/components/custom-share/shareUtils.ts

@@ -1,7 +1,29 @@
+import { getAgentShareInfo } from "@/service/agent"
+import { isSuccess } from "@/utils"
+
 export const getAvatarImageSrc = (avatarImg: string)=> {
     const mp4SuffixIndex = avatarImg.lastIndexOf('.mp4')
     if(mp4SuffixIndex > -1){
       return avatarImg.slice(0, mp4SuffixIndex) + '_cover.jpg'
     }
     return avatarImg
+}
+
+// 生成分享信息
+export const getSharePromise = async (agentId:string, shareTitle: string, tmpImage: string) => {
+  const response = await getAgentShareInfo(agentId);
+  if( isSuccess(response.status) ){
+    const o = {
+      title: shareTitle,
+      path: `/pages/profile/index?agentId=${agentId}&shareKey=${response.data.shareKey}`,
+      imageUrl: tmpImage,
+      promise: response,
+    };
+    return o
+  }
+  return {
+    title: shareTitle,
+    imageUrl: tmpImage,
+    path: `/pages/profile/index?agentId=${agentId}`,
+  };
 }

+ 10 - 10
src/components/widgets/widget-map/index.tsx

@@ -19,15 +19,15 @@ const Index: React.FC<Props> = ({children, latitude, longitude, name = '', addre
     console.log(e)
   }
 
-  const handleClick = () => {
-    Taro.openLocation({
-      latitude,
-      longitude,
-      scale: 18,
-      name: name,
-      address: address,
-    })
-  }
+  // const handleClick = () => {
+  //   Taro.openLocation({
+  //     latitude,
+  //     longitude,
+  //     scale: 18,
+  //     name: name,
+  //     address: address,
+  //   })
+  // }
   return (
     <View className='flex flex-col gap-16 px-16'>
       <View className={`flex items-center gap-8`}>
@@ -46,7 +46,7 @@ const Index: React.FC<Props> = ({children, latitude, longitude, name = '', addre
 
             style={{width: '100%', height: '300px'}}
             scale={14} />
-        <View className={style.goButton} onClick={handleClick}></View>
+        <View className={style.goButton}></View>
       </View>
     </View>    
   )

+ 4 - 0
src/hooks/useEditContactCard.ts

@@ -2,6 +2,7 @@ import Taro, { useRouter } from "@tarojs/taro";
 import { useState } from "react";
 import { useAgentStore } from "@/store/agentStore";
 import { TAgentDetail } from "@/types/agent";
+import { pickNonEmpty } from "@/utils";
 
 const useEditContactCard = (
   editKey: string,
@@ -23,6 +24,9 @@ const useEditContactCard = (
       return;
     }
 
+    
+    // const prev = pickNonEmpty(agentContactCard??{})
+
     const result = await editAgentCard(agent.agentId, {
       ...agentContactCard,
       [editKey]: _value,

+ 6 - 3
src/pages/editor-contact/index.tsx

@@ -8,7 +8,7 @@ import CardListItem from "@/components/list/card-list-item";
 import Taro, { useRouter } from "@tarojs/taro";
 import { useAgentStore } from "@/store/agentStore";
 import { TAgentDetail } from "@/types/agent";
-
+import useEditContactCard from "@/hooks/useEditContactCard";
 const  RenderEntCard = (agent: TAgentDetail|null, navToUrl: (url: string)=>void) => {
   if(!agent?.entName){
     return <></>
@@ -43,9 +43,12 @@ export default function Index() {
   const router = useRouter()
   const {agentId} = router.params
   const agent = useAgentStore(state => state.agent)
+  
   const navToUrl = (url: string)=> {
     Taro.navigateTo({url})
   }
+
+  
   
 
   return (
@@ -72,7 +75,7 @@ export default function Index() {
                 <View className="text-gray-65 mr-8 truncate max-w-[188px]">{agent?.email}</View>
               </View>
             </CardListItem>
-            <CardListItem underline arrow>
+            <CardListItem underline arrow onClick={()=> navToUrl(`/pages/editor-pages/editor-address/index?agentId=${agentId}`)}>
               <View className="flex items-center font-normal pb-16">
                 <View className="flex-1 font-normal">联系地址</View>
                 <View className="text-gray-65 mr-8 truncate max-w-[188px]">{agent?.address}</View>
@@ -81,7 +84,7 @@ export default function Index() {
             <CardListItem arrow onClick={()=> navToUrl('/pages/editor-pages/editor-qrcode/index')}>
               <View className="flex items-center font-normal pb-16">
                 <View className="flex-1 font-normal">我的二维码</View>
-                <View className="text-gray-65 mr-8 text-primary">已上传</View>
+                {(!!agent?.qrCodeUrl?.length) && <View className="text-gray-65 mr-8 text-primary">已上传</View>}
               </View>
             </CardListItem>
           </View>

+ 5 - 0
src/pages/editor-pages/editor-address/index.config.ts

@@ -0,0 +1,5 @@
+export default definePageConfig({
+  navigationBarTitleText: '章节标题',
+  "usingComponents": {},
+  navigationStyle: 'custom'
+})

+ 2 - 0
src/pages/editor-pages/editor-address/index.module.less

@@ -0,0 +1,2 @@
+
+

+ 60 - 0
src/pages/editor-pages/editor-address/index.tsx

@@ -0,0 +1,60 @@
+import { View } from "@tarojs/components";
+import BottomBar from "@/components/BottomBar";
+import PageCustom from "@/components/page-custom/index";
+import NavBarNormal from "@/components/nav-bar-normal/index";
+import WemetaTextarea from "@/components/wemeta-textarea/index";
+import { useAgentStore } from "@/store/agentStore";
+import useEditContactCard from "@/hooks/useEditContactCard";
+import Taro from "@tarojs/taro";
+export default function Index() {
+  const agentContactCard = useAgentStore((state) => state.agentContactCard);
+  
+
+  const { value, onChange, handleSubmit, setValue } = useEditContactCard(
+    "address",
+    agentContactCard?.address
+  );
+
+  // todo: 定位当前位置
+  const handleEditAddress = ()=> {
+    const option = {
+      address:  '',
+      latitude: 39.916527,
+      longitude: 116.397128,
+      success(result:Taro.chooseLocation.SuccessCallbackResult) {
+          console.log(result)
+          setValue(result.address)
+      }
+    }
+    console.log(option)
+    Taro.chooseLocation(option)
+  }
+
+  return (
+    <PageCustom>
+      <NavBarNormal backText="联系地址"></NavBarNormal>
+      <View className="flex flex-col items-center w-full">
+        <View className="w-full p-16">
+          <WemetaTextarea
+            value={value}
+            onBlur={(value: string) => onChange(value)}
+            onInput={(value: string) => onChange(value)}
+            placeholder="填写联系地址"
+            autoFocus
+          />
+          <View className="text-primary" onClick={handleEditAddress}>
+            选择地址
+          </View>
+        </View>
+        <BottomBar>
+          <View
+            className="button-rounded button-primary flex-1"
+            onClick={handleSubmit}
+          >
+            保存
+          </View>
+        </BottomBar>
+      </View>
+    </PageCustom>
+  );
+}

+ 18 - 17
src/pages/editor-pages/editor-email/index.tsx

@@ -7,31 +7,32 @@ import WemetaTextarea from "@/components/wemeta-textarea/index";
 import { useAgentStore } from "@/store/agentStore";
 import useEditContactCard from "@/hooks/useEditContactCard";
 export default function Index() {
-  const agentContactCard = useAgentStore((state)=> state.agentContactCard)
-  const {value, onChange, handleSubmit} = useEditContactCard('email', agentContactCard?.email)
-  
-  
-  
+  const agentContactCard = useAgentStore((state) => state.agentContactCard);
+  const { value, onChange, handleSubmit } = useEditContactCard(
+    "email",
+    agentContactCard?.email
+  );
 
   return (
     <PageCustom>
       <NavBarNormal backText="联系邮箱"></NavBarNormal>
       <View className="flex flex-col items-center w-full">
-        <View className={editorStyle.container}>
+        <View className="w-full p-16">
+          <WemetaTextarea
+            value={value}
+            onBlur={(value: string) => onChange(value)}
+            onInput={(value: string) => onChange(value)}
+            placeholder="填写联系邮箱"
+            autoFocus
+          />
+        </View>
+        <BottomBar>
           <View
-            className={`${editorStyle.textInputContainer} ${editorStyle.underline}`}
+            className="button-rounded button-primary flex-1"
+            onClick={handleSubmit}
           >
-            <WemetaTextarea
-              value={value}
-              onBlur={(value: string) => onChange(value)}
-              onInput={(value: string) => onChange(value)}
-              placeholder="填写联系邮箱"
-              autoFocus
-            />
+            保存
           </View>
-        </View>
-        <BottomBar>
-          <View className="button-rounded button-primary flex-1" onClick={handleSubmit}>保存</View>
         </BottomBar>
       </View>
     </PageCustom>

+ 10 - 12
src/pages/editor-pages/editor-name/index.tsx

@@ -19,18 +19,16 @@ export default function Index() {
     <PageCustom>
       <NavBarNormal backText="姓名"></NavBarNormal>
       <View className="flex flex-col items-center w-full">
-        <View className={editorStyle.container}>
-          <View
-            className={`${editorStyle.textInputContainer} ${editorStyle.underline}`}
-          >
-            <WemetaTextarea
-              value={value}
-              onBlur={(value: string) => onChange(value)}
-              onInput={(value: string) => onChange(value)}
-              placeholder="填写姓名"
-              autoFocus
-            />
-          </View>
+        <View
+          className="w-full p-16"
+        >
+          <WemetaTextarea
+            value={value}
+            onBlur={(value: string) => onChange(value)}
+            onInput={(value: string) => onChange(value)}
+            placeholder="填写姓名"
+            autoFocus
+          />
         </View>
         <BottomBar>
           <View className="button-rounded button-primary flex-1" onClick={handleSubmit}>保存</View>

+ 2 - 4
src/pages/editor-pages/editor-personality/index.tsx

@@ -21,9 +21,8 @@ export default function Index() {
     <PageCustom>
       <NavBarNormal backText="人设"></NavBarNormal>
       <View className="flex flex-col items-center w-full">
-        <View className={editorStyle.container}>
-          <View
-            className={`${editorStyle.textInputContainer} ${editorStyle.underline}`}
+      <View
+            className="w-full p-16"
           >
             <WemetaTextarea
               value={value}
@@ -34,7 +33,6 @@ export default function Index() {
               ai
             />
           </View>
-        </View>
         
         <BottomBar>
           <View className="button-rounded button-primary flex-1" onClick={handleSubmit}>保存</View>

+ 43 - 49
src/pages/editor-pages/editor-qrcode/index.tsx

@@ -1,74 +1,68 @@
 import { useState } from "react";
-import { View,Image } from "@tarojs/components";
+import { View, Image } from "@tarojs/components";
 
 import PageCustom from "@/components/page-custom/index";
 import NavBarNormal from "@/components/nav-bar-normal/index";
 import style from "./index.module.less";
 
-import { useComponentStore } from '@/store/componentStore'
-import { useCharacterStore } from '@/store/characterStore'
 import QrcodeUploadTips from "@/components/qrcode-upload-tips";
+import useEditContactCard from "@/hooks/useEditContactCard";
+import { useAgentStore } from "@/store/agentStore";
+import { pickAndUploadImage } from "@/utils/upload";
+import { EUploadFileScene } from "@/consts/enum";
+import Taro from "@tarojs/taro";
 
-import Taro, {useRouter, useUnload} from "@tarojs/taro";
 export default function Index() {
-  const router = useRouter();
-  const { id } = router.params;
-  let currentComponent = useComponentStore((state)=>  state.currentComponent);
-  const character = useCharacterStore((state)=> state.character);
-  const loading = useComponentStore((state)=> state.loading);
-  const { saveComponent } = useComponentStore();
-  const [value, setValue] = useState(currentComponent?.data?.text ?? '');
-  
-  const handleSave = async () => {
-    if(loading){
-      return
-    }
-    if(value.length <= 0){
-      return;
+  const agentContactCard = useAgentStore((state) => state.agentContactCard);
+  const { value, setValue, handleSubmit } = useEditContactCard(
+    "qrCodeUrl",
+    agentContactCard?.qrCodeUrl
+  );
+  const handleClick = async () => {
+    Taro.showLoading();
+    try{
+      const result = await pickAndUploadImage(["album"], EUploadFileScene.OTHER);
+      Taro.hideLoading();
+      if (!result?.url) {
+        return;
+      }
+      setValue(result.url);
+    }catch(e:any){
+      Taro.hideLoading();
     }
-    // const c = {
-    //   data: {
-    //     text: value,
-    //     layout: radioValue,
-    //   },
-    //   enabled: currentComponent?.enabled ?? true,
-    //   id: currentComponent?.id,
-    //   name: currentComponent?.name ?? "姓名",
-    //   index: currentComponent?.index,
-    //   characterProfileId: currentComponent?.characterProfileId ?? character?.profileId,
-    //   type: "title",
-    // };
-
-    
-    // await saveComponent(c)
   };
 
-  const onChange = (e: any) => {
-    setValue(e);
+  const handleClear = () => {
+    setValue("");
   };
-  
-
-  
 
-  const handleNavBack = async () => {
-    await handleSave()
+  const renderQrcode = ()=> {
+    if(value.length){
+      return <Image showMenuByLongpress style={{maxWidth: '344px'}} src={value} mode="widthFix"></Image>
+    }
+    return <View>
+      <QrcodeUploadTips />
+    </View>      
   }
-  
-  
 
   return (
     <PageCustom>
       <NavBarNormal backText="我的二维码"></NavBarNormal>
       <View className="px-16 pt-4">
-        <View className={style.card}>
-          <View>
-            <QrcodeUploadTips />
-          </View>
-          {/* <Image style={{maxWidth: '344px'}} src="https://cdn.wehome.cn/cmn/jpg/187/META-H8UKWHWU-2JNUAG2BARJF55VHU9QS3-4YZZNDAM-2X.jpg" mode="widthFix"></Image> */}
+        <View className={style.card} onClick={handleClick}>
+          {renderQrcode()}
         </View>
         <View className="flex flex-col gap-12">
-          <View className="button-rounded-big">更新</View>
-          <View className="button-rounded-big button-plain button-warn">清除</View>
+          <View className="button-rounded-big" onClick={handleSubmit}>
+            保存
+            {/* {!!value.length ? "更新" : "保存"} */}
+          </View>
+          {!!value.length && <View
+            className="button-rounded-big button-plain button-warn"
+            onClick={handleClear}
+          >
+            清除
+          </View>}
         </View>
       </View>
     </PageCustom>

+ 2 - 0
src/pages/editor-pages/editor-tel/index.tsx

@@ -7,6 +7,7 @@ import { useComponentStore } from "@/store/componentStore";
 import WemetaTextarea from "@/components/wemeta-textarea/index";
 import BottomBar from "@/components/BottomBar";
 import { EComponentType } from "@/consts/enum";
+import Taro from "@tarojs/taro";
 export default function Index() {
   
   let currentComponent = useComponentStore((state) => state.currentComponent);
@@ -38,6 +39,7 @@ export default function Index() {
     };
 
     await saveComponent(c);
+    Taro.navigateBack();
   };
 
   

+ 2 - 2
src/pages/profile/index.tsx

@@ -17,7 +17,7 @@ import style from "./index.module.less";
 export default function Index() {
   const { agent, fetchAgent } = useAgentStore();
   const router = useRouter();
-  const { agentId } = router.params;
+  const { agentId, shareKey } = router.params;
 
   if (!agentId) {
     return <View>loading...</View>;
@@ -56,7 +56,7 @@ export default function Index() {
   useEffect(() => {
     if (agentId) {
       const loginId = getLoginId();
-      postVisitorLog({ agentId, loginId });
+      postVisitorLog({ agentId, loginId, shareKey: shareKey ?? '' });
     }
   }, [agentId]);
 

+ 7 - 1
src/pages/voice/components/MyVoiceList/components/popup-recorder/index.tsx

@@ -74,6 +74,13 @@ export default ({
 
       return;
     }
+
+    // const acb = await cloneVoice({sourceUrl:"https://51saas.oss-cn-hangzhou.aliyuncs.com/u260727532/20250701/tmp_6479f0_5615350594ec420a8f1cd8c8102980ad.mp3",
+    //   voiceText:"健康是最重要的财富。记得每天至少喝八杯水,保持身体的水分。多吃蔬菜水果,保持均衡的饮食。适量的运动也很重要,找到你喜欢的运动方式,让健康成为你生活的一部分。"});
+    // // const res = await cloneVoice({sourceUrl: response.publicUrl, voiceText: readText});
+    // console.log(acb);
+
+    
     const { tempFilePath, duration } = res;
     if (duration.length < 10000) {
       Taro.showToast({
@@ -97,7 +104,6 @@ export default ({
     if (response && response.publicUrl) {
       Taro.showLoading();
       const res = await cloneVoice({sourceUrl: response.publicUrl, voiceText: readText});
-      console.log();
       Taro.hideLoading();
       if(isSuccess(res.status)){
         onRecordEnd(res.data.taskId, voiceName);

+ 10 - 10
src/pages/voice/components/MyVoiceList/index.tsx

@@ -73,16 +73,16 @@ export default ({ onPlay, agent }: Props) => {
     }
   };
 
-  const handleSureAction = async () => {
-    setShow(false);
-    // await voiceCloneConfirm(myVoices[voiceIndex].voiceName!);
-    // fetchVoiceList();
-  };
-
-  const handleRecloneAction = () => {
-    setPopupType("reclone");
-    setShow(true);
-  };
+  // const handleSureAction = async () => {
+  //   setShow(false);
+  //   // await voiceCloneConfirm(myVoices[voiceIndex].voiceName!);
+  //   // fetchVoiceList();
+  // };
+
+  // const handleRecloneAction = () => {
+  //   setPopupType("reclone");
+  //   setShow(true);
+  // };
 
   // 声音录制完成
   const onRecordEnd = (r: string) => {

+ 7 - 1
src/service/agent.ts

@@ -2,7 +2,7 @@ import {
   bluebookAiAgent,
 } from '@/xiaolanbenlib/api/index'
 import request from '@/xiaolanbenlib/module/axios.js'
-import { TAgentDetail, TComponentItem, TEditAgentCharacter, TAgentContactCard } from '@/types/agent'
+import { TAgentDetail, TComponentItem, TEditAgentCharacter, TAgentContactCard, TAgentShared } from '@/types/agent'
 
 
 // 创建一个新的智能体--用户点击创建按钮时调用获取新智能体id与名称信息
@@ -75,10 +75,16 @@ export const getAgent = (agentId: string) =>  {
 export const postVisitorLog = (data: {
   agentId: string,
   loginId: string,
+  shareKey?: string,
 }) => {
   return request.post<TAgentDetail>(`${bluebookAiAgent}api/v1/agent/visitor/log`, data)
 }
 
+// 获取智能体的分享信息--仅登录才能分享
+export const getAgentShareInfo = (agentId: string) => {
+  return request.get<TAgentShared>(`${bluebookAiAgent}api/v1/agent/${agentId}/shareInfo`)
+}
+
 
 
 

+ 2 - 2
src/service/voice.ts

@@ -5,14 +5,14 @@ import {
 import request from '@/xiaolanbenlib/module/axios.js'
 import Taro from '@tarojs/taro'
 
-import { TGetMyVoicesParams, TPaginatedVoiceResponse, TVoiceItem } from '@/types/voice'
+import { TGetMyVoicesParams, TPaginatedVoiceResponse, TVoiceItem, TVoiceCloneResponse } from '@/types/voice'
 
 // 克隆一个新的音色
 export const cloneVoice = (data: {
   sourceUrl: string // 源语音地址 ,
   voiceText?: string // 录音文案
 }) => {
-  return request.post<TPaginatedVoiceResponse>(`${bluebookAiAgent}api/v1/voice/clone`, data)
+  return request.post<TVoiceCloneResponse>(`${bluebookAiAgent}api/v1/my/voice/clone`, data)
 }
 
 // 删除指定克隆的音色

+ 32 - 20
src/store/agentStore.ts

@@ -20,6 +20,7 @@ import {
   TComponentItem,
 } from "@/types/agent";
 import { isSuccess, pickNonEmpty } from "@/utils";
+import Taro from "@tarojs/taro";
 
 export interface AgentStoreState {
   agents: TAgent[];
@@ -29,7 +30,7 @@ export interface AgentStoreState {
   ents: {entName: string, entId: string|number}[]
   fetchAgents: () => Promise<TAgent[]>;
   fetchAgent: (agentId: string) => Promise<TAgentDetail | null>;
-  createAgent: (data: TAgentDetail) => Promise<TAgentDetail | null>;
+  createAgent: () => Promise<TAgentDetail | null>;
   setDefaultAgent: (agentId: string) => Promise<TAgentDetail | null>;
   editAgentCharacter: (
     agentId: string,
@@ -43,7 +44,7 @@ export interface AgentStoreState {
     agentId: string,
     data: TComponentItem[]
   ) => Promise<boolean>;
-  // deleteAgent: (agentId: string) => Promise<void>
+  deleteAgent: (agentId: string) => Promise<void>
 }
 
 export const useAgentStore = create<AgentStoreState>((set, get) => ({
@@ -110,17 +111,19 @@ export const useAgentStore = create<AgentStoreState>((set, get) => ({
   createAgent: async () => {
     const response = await _createAgent();
     if (response.data) {
+      const a: TAgent = {
+        agentId: response.data.agentId ?? "",
+        isDefault: response.data.isDefault ?? false,
+        isEnt: response.data.isEnt ?? false,
+        isNewEnt: response.data.isNewEnt ?? false,
+        name: response.data.name ?? "",
+        enabledChatBg: false,
+      }
       set((state) => {
         return {
           agents: [
             ...state.agents,
-            {
-              agentId: response.data.agentId ?? "",
-              isDefault: response.data.isDefault ?? false,
-              isEnt: response.data.isEnt ?? false,
-              isNewEnt: response.data.isNewEnt ?? false,
-              name: response.data.name ?? "",
-            },
+            a,
           ],
         };
       });
@@ -159,15 +162,24 @@ export const useAgentStore = create<AgentStoreState>((set, get) => ({
     
     return result
   },
-  // deleteAgent: async (agentId: string)=> {
-  //   const response = await _deleteAgent(agentId)
-  //   if(response.status === 200){
-  //     set((state) => {
-  //       const agents = state.agents.filter((item: TAgentDetail) => item.agentId !== agentId)
-  //       return {
-  //         agents: [...agents]
-  //       }
-  //     })
-  //   }
-  // }
+  deleteAgent: async (agentId: string)=> {
+    const response = await _deleteAgent(agentId)
+    if(isSuccess(response.status)){
+      set((state) => {
+        const agents = state.agents.filter((item: TAgent) => item.agentId !== agentId)
+        return {
+          agents: [...agents]
+        }
+      })
+      const agents =await get().fetchAgents()
+      if(agents.length <= 0){
+        Taro.reLaunch({url: '/pages/index/index'})
+        return;
+      }
+      const defaultAgent = agents.find((item)=> !!item.isDefault)
+      if(defaultAgent){
+        await get().fetchAgent(defaultAgent.agentId)
+      }   
+    }
+  }
 }));

+ 25 - 9
src/types/agent.ts

@@ -1,20 +1,36 @@
 import {EComponentType} from '@/consts/enum'
 export type TAgent = {
-  address: string|null
+  address?: string|null
   agentId: string
-  avatarUrl: string|null
-  email: string
-  enabledChatBg: boolean
-  entName: string|null
+  avatarUrl?: string|null
+  avatarLogo?: string|null
+  email?: string|null
+  enabledChatBg?: boolean
+  entName?: string|null
   isDefault: boolean
   isEnt: boolean
-  entId: number|string
+  entId?: number|string|null
   isNewEnt: boolean
-  mobile: string
+  mobile?: string|null
   name: string
-  position: string|null
-  qrCodeUrl: string
+  position?: string|null
+  qrCodeUrl?: string
+}
+
+export type TAgentShared = {
+  address?: string,
+  avatarUrl?: string,
+  email?: string,
+  entName?: string,
+  isEnt?: boolean,
+  mobile?: string,
+  name?: string,
+  position?: string,
+  qrCodeUrl?: string,
+  shareKey?: string
 }
+
+
 export type TComponentItem = {
   data: {
     id: string,

+ 10 - 0
src/types/voice.ts

@@ -9,6 +9,8 @@ export enum EVoiceStatus {
 }
 export type TVoiceStatus = EVoiceStatus[keyof EVoiceStatus];
 
+
+
 export type TVoiceItem = {
   createTime: string;
   duration: number;
@@ -23,6 +25,14 @@ export type TVoiceItem = {
   voiceUrl: string;
 };
 
+export type TVoiceCloneResponse = {
+  "userId": string|number,
+  "taskId": string,
+  "status": string,
+  "message": string,
+  "data": null  
+}
+
 // 分页获取音色列表
 export type TPaginatedVoiceResponse<T = TVoiceItem> = {
   data: T[];

+ 1 - 13
src/utils/index.ts

@@ -153,19 +153,7 @@ export function useDebounceWithParams<T extends (...args: any[]) => any>(
   ) as T;
 }
 
-export const getSharePromise = async (profileId: string) => {
-  const res = await share(profileId, "wechat");
-  console.log(res, "shared referralCode:", res.data.referralCode);
-  if (res.code === 0) {
-    return {
-      title: `${APP_NAME_TEXT} | 你的智能名片`,
-      path: `/pages/profile/index?isShared=true&profileId=${profileId}&referralCode=${res.data.referralCode}`,
-    };
-  }
-  return {
-    path: `/pages/index/index`,
-  };
-};
+
 
 export const formatDate = (date: Date): string => {
   const year = date.getFullYear();

Някои файлове не бяха показани, защото твърде много файлове са промени