Browse Source

feat: 判断主页信息框底部对齐

王晓东 1 month ago
parent
commit
0287b728cb

+ 1 - 37
src/app.less

@@ -420,7 +420,7 @@
 
 // 智能体内容容器毛玻璃效果,距顶部距离 240 ,留出空间显示形象, 最小高度 600px 以防止没有顶到底部
 .blur-rounded-container{
-  margin-top: 296px;
+  // margin-top: 296px;
   width: 100%;
   // min-height: calc(100vh - 240px);
   box-sizing: border-box;
@@ -440,41 +440,5 @@
   height: 16px;
   border-radius: 4px;
 }
-.bubble-wrapper {
-  top: calc(100% + 12px);
-  left: -64px;
-  z-index: 2;
-  width: 142px;
-  position: absolute;
-  display: inline-block;
-  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.15)); /* 🔑 关键:父级统一阴影 */
-  box-shadow: 0 5px 5px -3px #0000001a, 0 8px 10px 1px #0000000f, 0 3px 14px 2px #0000000d;
-}
 
-.bubble {
-  position: relative;
-  background: white;
-  border-radius: 4px;
-  padding: 12px;
-  max-width: 142px;
-  font-size: 14px;
-  line-height: 22px;
-  box-shadow: 0 5px 5px -3px #0000001a, 0 8px 10px 1px #0000000f, 0 3px 14px 2px #0000000d;
-}
-.bubble-arrow-wrap{
-  position: absolute;
-  top: 0;
-  margin-left: -5px;
-  left: 50%;
-  width: 10px;
-  height: 10px;
-  transform: translateY(-50%) scaleX(0.8);
-}
-.bubble-arrow {
-  width: 10px;
-  height: 10px;
-  background: white;
-  border-radius: 1px;
-  transform: rotate(45deg);
-}
 

+ 1 - 1
src/components/AgentPage/components/AgentActionBar/index.tsx

@@ -23,7 +23,7 @@ import { useAgentStoreActions } from "@/store/agentStore";
 import LoginPopup from "@/components/LoginPopup";
 
 interface IProps {
-  agent: TAgentDetail,
+  agent: Partial<TAgentDetail>,
   isVisitor: boolean, // 是否是访问他人智能体
 }
 export default ({agent, isVisitor}: IProps) => {

+ 24 - 3
src/components/AgentPage/index.tsx

@@ -9,6 +9,7 @@ import { useEffect, useState } from "react";
 import { useComponentStore } from "@/store/componentStore";
 import ComponentList from "@/components/component-list";
 import { useUserStore } from "@/store/userStore";
+import { useAppStore } from "@/store/appStore";
 import {  DEFAULT_AVATAR_BG } from '@/config'
 
 import Taro, { useDidShow } from "@tarojs/taro";
@@ -21,9 +22,11 @@ export default function Index({ agentId }: IProps) {
   const agent = useAgentStore((state)=> state.agent);
   const { fetchAgent } = useAgentStoreActions();
   const { fetchMyEntList } = useUserStore();
+  const windowHeight = useAppStore((state)=>  state.windowHeight);
+  const headerHeight = useAppStore((state)=>  state.headerHeight);
   const [bg, setBg] = useState('')
   const [isDefaultBg, setIsDefaultBg] = useState(false)
-
+  const [marginTop, setMarginTop] = useState(0);
   const { setComponentList } = useComponentStore()
   const components = useComponentStore((state) => state.components);
 
@@ -54,6 +57,24 @@ export default function Index({ agentId }: IProps) {
     fetchMyEntList()
   }, [])
 
+  useEffect(()=> {
+    const query = Taro.createSelectorQuery();
+    // 获取滚动容器高度
+    query
+      .select('#BlurRoundedContainer')
+      .boundingClientRect((rect: any) => {
+        if (rect) {
+          console.log('ScrollView height:', rect.height, windowHeight, headerHeight)
+          if(rect.height + 296 < windowHeight - headerHeight){
+            setMarginTop(windowHeight - headerHeight - rect.height);
+          }else{
+            setMarginTop(296);
+          }
+        }
+      })
+      .exec();
+  }, [components])
+
   // 如果是默认形象,设置占位空间,点击后跳转至编辑页
   const renderDefaultPlaceholder = ()=> {
     if(!isDefaultBg){
@@ -67,9 +88,9 @@ export default function Index({ agentId }: IProps) {
 
   return (
     <PageCustom styleBg={bg}>
-      <NavBarNormal blur scrollFadeIn scrollFadeInDelta={240} leftColumn={Logo}></NavBarNormal>
+      <NavBarNormal blur scrollFadeIn scrollFadeInDelta={240} leftColumn={()=><></>}></NavBarNormal>
       {renderDefaultPlaceholder()}
-      <View className="blur-rounded-container">
+      <View className="blur-rounded-container" id="BlurRoundedContainer" style={{marginTop: `${marginTop}px`}}>
         {(!!agent) ? <AgentActionBar isVisitor={false} agent={agent}></AgentActionBar> : <></>}
         <View className={`flex flex-col gap-12 w-full p-16`}>
           <ComponentList components={components}></ComponentList>

+ 2 - 2
src/components/AvatarConfirm/index.tsx

@@ -88,11 +88,11 @@ export default function Index({ avatarItem, enabledChatBg, setEnabledChatBg, onC
                 src={pickedAvatar.avatarUrl}
               ></Image> */}
             </View>
-            <View className={style.confirmChatAvatarBgCover}>
+            {enabledChatBg && <View className={style.confirmChatAvatarBgCover}>
               <View className={style.block1}></View>
               <View className={style.block2}></View>
               <View className={style.block3}></View>
-            </View>
+            </View>}
           </View>
           <View className="flex-center gap-8 text-14 font-medium leading-22 text-black" onClick={handleEnabledChatBg}>
             <WemetaRadio checked={enabledChatBg} checkbox></WemetaRadio>

+ 4 - 4
src/components/TextPolish/index.tsx

@@ -20,9 +20,9 @@ const Index = ({
   const disabled =  text.length < 2
 
   const handleClick = async () => {
-    // console.log('请求服务端润色')
+    console.log('请求服务端润色')
     if(isLoading || disabled){
-      return Promise.resolve();
+      return false;
     }
     setIsLoading(true)
     onStateChange(true)
@@ -38,12 +38,12 @@ const Index = ({
       if(isSuccess(response.status)){
         onPolished(response.data?.content)
       }
-      return Promise.resolve();
+      return true;
     }catch(e){
       Taro.hideLoading()
       setIsLoading(false)
       onStateChange(false)
-      return Promise.resolve();
+      return false;
     }
   }
 

+ 7 - 5
src/components/WemetaModal/index.module.less

@@ -18,7 +18,7 @@
 }
 .content{
   display: flex;
-  padding: 32px;
+  padding: 24px;
   flex-direction: column;
   align-items: center;
 
@@ -26,24 +26,26 @@
 .footer{
   display: flex;
   align-items: center;
-  border-top: 1px solid rgba(#000, 0.08);
+  border-top: 1px solid rgba(#000, 0.05);
 }
 .footerButton{
   display: flex;
   flex: 1;
   align-items: center;
   justify-content: center;
-  padding: 12px 30px;
+  padding: 14px 30px;
   color: var(--color-gray-6);
+  font-family: PingFangSC-Regular;
   text-align: center;
-  font-size: 14px;
+  font-size: 15px;
   line-height: 24px;
-  border-right: 1px solid rgba(#000, 0.08);
+  border-right: 1px solid rgba(#000, 0.05);
   &:last-child{
     border-right: 0;
   }
 }
 .footerButtonPrimary{
   .footerButton();
+  font-family: PingFangSC-Medium;
   color: var(--color-primary);
 }

+ 11 - 3
src/components/WemetaTextareaAI/index.tsx

@@ -22,6 +22,7 @@ interface Props {
   autoFocus?: boolean;
   extraClass?: string;
   onConfirm?: (value: string) => void;
+  onPolishStateChange?: (loading: boolean) => void;
 }
 const DEFAULT_TEXTAREA_MAXLENGTH = 10000;
 const Index = ({
@@ -43,13 +44,13 @@ const Index = ({
   maxlength,
   extra,
   onConfirm,
+  onPolishStateChange,
 }: Props, ref: any) => {
   const [focus, setFocus] = useState(false);
   const [isPolishing, setIsPolishing] = useState(false);
   const inputRef = useRef<HTMLInputElement>(null); // 创建一个 ref
-
   // Create ref for TextPolish component
-  const textPolishRef = useRef<{ handleClick: () => void }>(null);
+  const textPolishRef = useRef<{ handleClick: () => Promise<void> }>(null);
 
   // Expose TextPolish ref to parent components
   useImperativeHandle(ref, () => ({
@@ -109,6 +110,13 @@ const Index = ({
 
   const polishText = value?.length > 0 ? value : defaultAiTips;
 
+  const handlePolishStateChange = (loading: boolean) => {
+    setIsPolishing(loading);
+    if (onPolishStateChange) {
+      onPolishStateChange(loading);
+    }
+  }
+
   return (
     <View
       className={`${
@@ -121,7 +129,7 @@ const Index = ({
           {prefix && prefix()}
         </View>
       <View className="flex items-center gap-4 text-14 font-pingfangSCMedium">
-        <TextPolish ref={textPolishRef} text={polishText} type={aiType} onPolished={onPolished} onStateChange={setIsPolishing} />
+        <TextPolish ref={textPolishRef} text={polishText} type={aiType} onPolished={onPolished} onStateChange={handlePolishStateChange} />
       </View>
       </View>
 

+ 7 - 0
src/components/icon/IconArrowRight16/index.tsx

@@ -0,0 +1,7 @@
+import { Image } from '@tarojs/components'
+import Icon from '@/images/svgs/IconArrowRight16.svg'
+export default () => {
+  return (
+    <Image src={Icon} mode="widthFix" className='w-16 h-16'></Image>
+  )
+}

+ 1 - 1
src/components/icon/IconArrowVerticalFilled/index.tsx

@@ -8,6 +8,6 @@ interface IProps {
 export default ({color, rotation = 0}: IProps) => {
   const Icon = color === 'white' ? ArrowVerticalFilledWhite : ArrowVerticalFilledGray
   return (
-    <Image src={Icon} mode="widthFix" style={{width: '16px', height: '16px', transform: `rotate(${rotation}deg)`}}></Image>
+    <Image src={Icon} mode="widthFix" style={{width: '16px', height: '16px', transition: 'transform .1s .1s', transform: `rotate(${rotation}deg)`}}></Image>
   )
 }

+ 4 - 5
src/components/list/card-list-item/index.tsx

@@ -1,12 +1,11 @@
 import { View, Image } from "@tarojs/components";
 import style from "./index.module.less";
-import IconArrowThin from "@/components/icon/icon-arrow-thin";
-import IconArrowRight24 from "@/components/icon/IconArrowRight24";
+import IconArrowRight16 from "@/components/icon/IconArrowRight16";
 
 interface Props {
   arrow?: boolean;
   children?: JSX.Element[] | JSX.Element;
-  leftRenderer?: ()=> JSX.Element[] | JSX.Element; 
+  leftRenderer?: ()=> JSX.Element[] | JSX.Element;
   rightRenderer?: () => JSX.Element[] | JSX.Element;
   className?: string,
   onClick?: (e?:any) => void;
@@ -51,10 +50,10 @@ export default ({
         )} */}
         {arrow && (
           <View className='flex-center pr-8'>
-            <IconArrowRight24 />
+            <IconArrowRight16 />
           </View>
         )}
-        
+
       </View>
     </View>
   );

+ 3 - 0
src/images/svgs/IconArrowRight16.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="design-iconfont">
+  <path d="M5.59074398,7.99468071 L10.7765482,3.15706761 C11.0310714,2.92351699 11.0628812,2.4898047 10.8401827,2.22289641 C10.6174842,1.95600375 10.2038821,1.92263044 9.94937384,2.15618106 L4.2227134,7.49423744 C4.06363453,7.62768377 4,7.7945034 4,7.99468071 C4,8.19485802 4.06363453,8.36167766 4.2227134,8.49512399 L9.94937384,13.8331804 C10.076628,13.933269 10.2357069,14 10.362961,14 C10.5538497,14 10.7129286,13.933269 10.8401827,13.766465 C11.0628812,13.4995567 11.0628812,13.0658444 10.7765482,12.8322938 L5.59074398,7.99468071 Z" transform="matrix(-1 0 0 1 16 0)" fill="#111" fill-rule="nonzero" fill-opacity=".45"/>
+</svg>

+ 1 - 1
src/pages/agent/components/AgentSetting/components/AgentCard/index.tsx

@@ -70,7 +70,7 @@ export default () => {
     return (
       <View className="relative overflow-hidden w-full h-full">
         <AvatarMedia mode="aspectFill" source={agentEdit.avatarUrl} className={style.card} lazyLoad={false} />
-        {agentEdit?.avatarUrl &&  <View className={style.confirmChatAvatarBgCover}>
+        {(agentEdit?.avatarUrl && agentEdit?.enabledChatBg) &&  <View className={style.confirmChatAvatarBgCover}>
           <View className={style.block1}></View>
           <View className={style.block2}></View>
           <View className={style.block3}></View>

+ 15 - 5
src/pages/agent/components/AgentSetting/components/AgentSettingList/index.tsx

@@ -16,11 +16,11 @@ import { forwardRef, useImperativeHandle, useRef } from "react";
 export default forwardRef(function Index(props, ref) {
 
   const agentEdit = useAgentStore((state) => state.agentEdit)
-  const { updateEditAgent } = useAgentStoreActions()
+  const { updateEditAgent, setSaveAgentEnable } = useAgentStoreActions()
 
   // Create refs for the TextPolish components
-  const personalityPolishRef = useRef<{ handleClick: () => void }>(null);
-  const greetingPolishRef = useRef<{ handleClick: () => void }>(null);
+  const personalityPolishRef = useRef<{ handleClick: () => Promise<void> }>(null);
+  const greetingPolishRef = useRef<{ handleClick: () => Promise<void> }>(null);
 
   // Expose methods to parent components
   useImperativeHandle(ref, () => ({
@@ -68,17 +68,27 @@ export default forwardRef(function Index(props, ref) {
 
   // 如果有智能体名字,且名字字符串大于 2
   const hasName = (agentEdit?.name && agentEdit.name.length >= 2)
-  const defalutPolishPersonality = hasName ? `你是 ${agentEdit?.entName} 的 ${agentEdit?.position} ${agentEdit?.name}`: ''
+  const defalutPolishPersonality = hasName ? `你是 ${agentEdit?.entName} 的 ${agentEdit?.position ? agentEdit?.position: ''} ${agentEdit?.name}`: ''
   const defalutPolishGreeting = hasName ? `我是 ${agentEdit?.name},很高兴认识你!有什么想聊的或者想解决的问题吗`: ''
 
   const questionGuides = agentEdit?.questionGuides ?? [];
   const voiceName = agentEdit?.voiceName ?? '';
 
+  const handlePolishStateChange = (loading: boolean) => {
+    console.log('polish state change', loading)
+    if(loading){
+      setSaveAgentEnable(false)
+    }else{
+      setSaveAgentEnable(true)
+    }
+  }
+
   return (
     <View className="flex flex-col gap-12">
       <WemetaTextareaAI
         aiType="personality"
         defaultAiTips={defalutPolishPersonality}
+        onPolishStateChange={handlePolishStateChange}
         prefix={() => <View>人设</View>}
         placeholder="示例:你是一名汽车销售人员,拥有专业的汽车相关知识,善于耐心的解答客户提出的每一个问题,并会主动邀请客户上门试驾。"
         value={getDisplayValue('personality')}
@@ -93,6 +103,7 @@ export default forwardRef(function Index(props, ref) {
       <WemetaTextareaAI
         aiType="greeting"
         defaultAiTips={defalutPolishGreeting}
+        onPolishStateChange={handlePolishStateChange}
         cursorSpacing={20}
         prefix={() => <View>开场白</View>}
         placeholder="开场白是你的智能体和用户说的第一句话,简单做个自我介绍吧"
@@ -123,7 +134,6 @@ export default forwardRef(function Index(props, ref) {
       <CardList>
         <CardListItem
           className="pl-16 pr-8"
-          underline
           rightRenderer={IconArrowRight}
           leftRenderer={IconVoiceColor}
           onClick={handleEditVoice}

+ 6 - 3
src/pages/agent/components/AgentSetting/index.tsx

@@ -15,7 +15,8 @@ import { useAgentStore } from "@/store/agentStore";
 export default forwardRef(function Index({save}: {save: ()=> void}, ref) {
   console.log('agent setting')
   const agentEdit = useAgentStore((state) => state.agentEdit)
-
+  const enableSave = useAgentStore((state) => state.enableSave)
+  const [isPolishing, setIsPolishing] = useState(false)
   // Create ref for AgentSettingList
   const agentSettingListRef = useRef<{ polishAllTexts: () => Promise<void> }>(null);
 
@@ -23,20 +24,22 @@ export default forwardRef(function Index({save}: {save: ()=> void}, ref) {
   useImperativeHandle(ref, () => ({
     polishAllTexts: async () => {
       if (agentSettingListRef.current) {
+        setIsPolishing(true);
         await agentSettingListRef.current.polishAllTexts();
+        setIsPolishing(false);
       }
     }
   }));
 
   // 控制按钮状态和文本
   const isNameValid = (agentEdit?.name?.length || 0) >= 2
-  const isDisabled = !isNameValid
+  const isDisabled = !isNameValid || isPolishing || !enableSave
   const buttonText = agentEdit?.agentId ? '保存' : '创建'
 
   return (
     <View className="pb-118">
       <AgentCard></AgentCard>
-      <View className="mb-20">
+      <View className="mb-12">
         <AgentContactCard></AgentContactCard>
       </View>
       <AgentSettingList ref={agentSettingListRef}></AgentSettingList>

+ 2 - 2
src/pages/agent/hooks/useConfirms.tsx

@@ -61,8 +61,8 @@ export const useConfirms = () => {
   const confirmEditWebsite = async ():Promise<boolean> => {
     return await new Promise((resolve)=> {
       showModal({
-        content: <View className="flex items-center flex-col justify-center">
-              <View className="text-black font-pingfangSCMedium font-medium text-14 leading-22">已创建智能体,继续编辑微官网?</View>
+        content: <View className="flex flex-col gap-20">
+              <View className="text-black font-pingfangSCMedium font-medium text-16 leading-24">已创建智能体,继续编辑微官网?</View>
               <View className="text-gray-5 text-14 leading-22" style="max-width: 280px;">让商务伙伴在访问你的智能体时,可以更深入的了解你的企业和业务</View>
           </View>,
         confirmText: "编辑微官网",

+ 5 - 2
src/pages/agent/index.tsx

@@ -34,6 +34,8 @@ export default function Index() {
   // 润色方法引用
   const agentSettingRef = useRef<{ polishAllTexts: () => Promise<void> }>(null);
 
+
+
   const handleTabIndexChange = async (index: 'agent' | 'website') => {
     // 如果要编辑微官网组件且是新建智能体,则提醒用户是否先创建智能体,只有创建智能体后才能编辑微官网
     if(index === 'website' && !agentEdit?.agentId){
@@ -71,6 +73,7 @@ export default function Index() {
 
 
   const handleSave  = async () => {
+
     if(!agentId && !agentEdit?.agentId){
       if(!agentEdit?.avatarUrl){
         const result  = await confirmSaveAvatar()
@@ -86,7 +89,7 @@ export default function Index() {
               await agentSettingRef.current.polishAllTexts();
             }
           }
-          console.log(agentEdit,2222)
+
         }else{
           return;
         }
@@ -133,7 +136,7 @@ export default function Index() {
     if(!agentId){
       fetchDefaultNewAgentInfo();
     }
-    console.log(111)
+
   }, [])
 
   const navBarText = agentEdit?.agentId ? '编辑智能体' : '创建智能体'

+ 37 - 0
src/pages/chat/components/PersonalCard/index.module.less

@@ -0,0 +1,37 @@
+.bubbleWrapper {
+  top: calc(100% + 12px);
+  left: -64px;
+  z-index: 2;
+  width: 142px;
+  position: absolute;
+  display: inline-block;
+  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.15)); /* 🔑 关键:父级统一阴影 */
+  box-shadow: 0 5px 5px -3px #0000001a, 0 8px 10px 1px #0000000f, 0 3px 14px 2px #0000000d;
+}
+
+.bubble {
+  position: relative;
+  background: white;
+  border-radius: 4px;
+  padding: 12px;
+  max-width: 142px;
+  font-size: 14px;
+  line-height: 22px;
+  box-shadow: 0 5px 5px -3px #0000001a, 0 8px 10px 1px #0000000f, 0 3px 14px 2px #0000000d;
+}
+.bubbleArrowWrap{
+  position: absolute;
+  top: 0;
+  margin-left: -5px;
+  left: 50%;
+  width: 10px;
+  height: 10px;
+  transform: translateY(-50%) scaleX(0.8);
+}
+.bubbleArrow {
+  width: 10px;
+  height: 10px;
+  background: white;
+  border-radius: 1px;
+  transform: rotate(45deg);
+}

+ 14 - 4
src/pages/chat/components/PersonalCard/index.tsx

@@ -9,12 +9,20 @@ 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)
@@ -27,10 +35,12 @@ export default ({haveBg, agent, onClear}:IProps) => {
   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'
     })
@@ -60,10 +70,10 @@ export default ({haveBg, agent, onClear}:IProps) => {
             <View>
               <IconArrowVerticalFilled color={ haveBg ? 'white' : 'gray' } rotation={show ? 0 : 180}  />
             </View>
-            {!!show && <View className="bubble-wrapper">
-              <View className="bubble flex flex-col gap-8">
-                <View className='bubble-arrow-wrap'>
-                  <View className='bubble-arrow'></View>
+            {!!show && <View className={style.bubbleWrapper} onClick={(e)=>e.stopPropagation()}>
+              <View className={`flex flex-col gap-8 ${style.bubble}`}>
+                <View className={style.bubbleArrowWrap}>
+                  <View className={style.bubbleArrow}></View>
                 </View>
                 <View className='flex items-center gap-4' onClick={handleClean}>
                   <View className='w-16 h-16'>

+ 4 - 1
src/pages/editor-contact/index.tsx

@@ -21,7 +21,10 @@ export default function Index() {
 
   const [disabled, setDisabled] = useState(false)
   const handleSave = ()=>{
-    console.log(agentEdit,111)
+    if(!agentEdit?.name?.trim()){
+      Taro.showToast({ title: '请填写姓名', icon: 'error' })
+      return
+    }
     if(agentEdit?.agentId){
       saveAgent()
     }

+ 35 - 10
src/pages/profile/index.tsx

@@ -19,18 +19,24 @@ import { sceneUnzip } from "@/service/wechat";
 import { postLog } from "./profile";
 import { useIsLogin } from "@/xiaolanbenlib/hooks/data/useAuth";
 import useSWR from "swr";
-import { TAgentDetail } from "@/types/agent";
+import type { TAgentDetail } from "@/types/agent";
+import { useAppStore } from "@/store/appStore";
 
 export default function Profile() {
   const [agentProfile, setAgentProfile] = useState<TAgentDetail|null>(null)
   // const { agentProfile, clearProfileAgent } = useAgentStore();
   const params = useRouter().params;
   const isLogin = useIsLogin();
+  const windowHeight = useAppStore((state)=>  state.windowHeight);
+  const headerHeight = useAppStore((state)=>  state.headerHeight);
+
+  const components = agentProfile?.components ?? []
 
   const [agentId, setCurrentAgentId]  = useState<null|string>(null)
   const [shareKey, setShareKey] = useState<null|string>(null)
   const [bg, setBg] = useState('')
-  
+  const [marginTop, setMarginTop] = useState(0);
+
   console.log(agentProfile, agentProfile?.status)
 
   const fetchAgentProfile = async (agentId: string, shareKey?:string) => {
@@ -53,15 +59,15 @@ export default function Profile() {
 
   // 定时 30 秒请求一次 log 接口
   useSWR( (agentId && (agentProfile?.status === 'normal')) ? ['/blue-aiagent/api/v1/agent/visitor/log', {
-    agentId: agentId, 
+    agentId: agentId,
     shareKey: shareKey,
     }] : false
     ,
     ([_url, data]) => {
-      
+
       if(isLogin){
         postLog(data.agentId, data.shareKey ?? '')
-      } 
+      }
     },
     {
       refreshInterval: 30000,
@@ -88,7 +94,7 @@ export default function Profile() {
           _agent && setPageBg(_agent)
           setCurrentAgentId(originalScene.agentId)
           setShareKey(originalScene.shareKey ?? "")
-          
+
           // postLog(originalScene.agentId, originalScene.shareKey ?? "");
         }
       } catch (e) {
@@ -108,7 +114,7 @@ export default function Profile() {
     setCurrentAgentId(params.agentId)
     setShareKey(params.shareKey ?? "")
   }
-  
+
   useEffect(() => {
     // 通过小程序码识别打开的页面
     const scene = decodeURIComponent(params.scene ?? "");
@@ -133,6 +139,25 @@ export default function Profile() {
     }
   }, [params.agentId]);
 
+
+  useEffect(()=> {
+    const query = Taro.createSelectorQuery();
+    // 获取滚动容器高度
+    query
+      .select('#BlurRoundedContainer')
+      .boundingClientRect((rect: any) => {
+        if (rect) {
+          console.log('ScrollView height:', rect.height, windowHeight, headerHeight)
+          if(rect.height + 296 < windowHeight - headerHeight){
+            setMarginTop(windowHeight - headerHeight - rect.height);
+          }else{
+            setMarginTop(296);
+          }
+        }
+      })
+      .exec();
+  }, [components])
+
   const renderNavBarLeft = () => {
     const pages = getCurrentPages();
     console.log(pages, "当前页面");
@@ -177,7 +202,7 @@ export default function Profile() {
         });
       }}>前往访问</View>
     }
-    
+
     // 下线了
     return <View className="button-rounded-big" onClick={()=> {
       Taro.navigateBack()
@@ -205,11 +230,11 @@ export default function Profile() {
     <PageCustom styleBg={bg}>
       <View className="w-full">
         <NavBarNormal blur scrollFadeIn scrollFadeInDelta={240}  leftColumn={renderNavBarLeft}></NavBarNormal>
-        {agentProfile && <View className="blur-rounded-container">
+        {agentProfile && <View className="blur-rounded-container" id="BlurRoundedContainer" style={{marginTop: `${marginTop}px`}}>
           <AgentActionBar isVisitor agent={agentProfile}></AgentActionBar>
           <View className="flex flex-col w-full p-16 gap-12">
             <ComponentList
-              components={agentProfile.components ?? []}
+              components={components}
             ></ComponentList>
           </View>
         </View>}

+ 18 - 18
src/pages/voice/index.tsx

@@ -66,23 +66,6 @@ const VoiceTabs: React.FC<Props> = ({}) => {
 
 
   const tabList = [
-    {
-      label: "我的",
-      key: "1",
-      children: (
-        <View className="h-full">
-          <MyVoiceList
-          agent={agentEdit}
-          onSelect={(item) => {
-            setPlayerItem(item, "cloned");
-          }}
-          onPlay={(item) => {
-            onPlay(item, "cloned");
-          }}
-          ></MyVoiceList>
-        </View>
-      ),
-    },
     {
       label: "全部",
       key: "2",
@@ -145,6 +128,23 @@ const VoiceTabs: React.FC<Props> = ({}) => {
         </View>
       ),
     },
+    {
+      label: "我的",
+      key: "1",
+      children: (
+        <View className="h-full">
+          <MyVoiceList
+          agent={agentEdit}
+          onSelect={(item) => {
+            setPlayerItem(item, "cloned");
+          }}
+          onPlay={(item) => {
+            onPlay(item, "cloned");
+          }}
+          ></MyVoiceList>
+        </View>
+      ),
+    },
   ];
 
 
@@ -162,7 +162,7 @@ const VoiceTabs: React.FC<Props> = ({}) => {
         <View className={style.voiceTab}>
           <WemetaTabs
             list={tabList}
-            current="1"
+            current="2"
             className="bg-white"
             tabStyle="outline"
           ></WemetaTabs>

+ 8 - 0
src/store/agentStore.ts

@@ -33,6 +33,7 @@ export interface AgentStoreState {
   agentContactCard: TAgentContactCard | null;// deprecated
   agentCharacter: TEditAgentCharacter | null;// deprecated
   ents: { entName: string; entId: string | number }[];
+  enableSave: boolean; // 是否允许保存
   actions: {
     fetchAgents: () => Promise<TAgent[]>;
     // 请求智能体数据登录状态
@@ -56,6 +57,7 @@ export interface AgentStoreState {
     resetData: () => void;
     clearEditAgent: () => void;
     setCurrentEditAvatar: (avatar: TAvatarItem | null) => void;
+    setSaveAgentEnable: (b:boolean) => void
   };
 }
 
@@ -65,6 +67,7 @@ export const useAgentStore = create<AgentStoreState>((set, get) => ({
   agent: null,
   // agentEdit 编辑时临时存储的智能体信息, 如果直接用 agent 存储,则切页面时会有空白数据的瞬间
   agentEdit: null,
+  enableSave: true,
   // 访问其它人页面时的 agent 信息
   agentProfile: null,
   agentContactCard: null,
@@ -308,6 +311,11 @@ export const useAgentStore = create<AgentStoreState>((set, get) => ({
         agentEdit: null,
       });
     },
+    setSaveAgentEnable: (b:boolean)=> {
+      set({
+        enableSave: b
+      })
+    }
   }
 }));