소스 검색

fix: 访问页,修复可不登录访问

王晓东 2 주 전
부모
커밋
64f2ed48b8

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

@@ -160,7 +160,7 @@ export default ({agent, isVisitor}: IProps) => {
         </View>
       </View>
 
-      <AgentSwap show={showAgentSwap} setShow={setShowAgentSwap}></AgentSwap>
+      {!isVisitor && <AgentSwap show={showAgentSwap} setShow={setShowAgentSwap}></AgentSwap>}
       <AgentQRCode isVisitor={isVisitor} show={showAgentQRcode} setShow={setShowAgentQRcode} />
       {agent && <SharePopup
         show={showShare}

+ 6 - 1
src/pages/agent-gen/components/step/StepPick.tsx

@@ -28,7 +28,12 @@ export default React.memo(function Index({ prev, next, taskId, avatars, videos,
   
   const goNext = () => {
     const pickedAvatar = avatarsList[currentSwiperIndex]
-    console.log(avatarsList, currentSwiperIndex, 11111, pickedAvatar)
+    if(!pickedAvatar){
+      Taro.showToast({
+        title: '没有对应的形象'
+      })
+      return
+    }
     setPickedAvatar(pickedAvatar)
     console.log(pickedAvatar)
     next()

+ 6 - 2
src/pages/dashboard/components/VisitorList/index.tsx

@@ -1,5 +1,5 @@
 import { View, Text } from "@tarojs/components";
-import Taro, { useReachBottom } from "@tarojs/taro";
+import Taro, { useDidShow, useReachBottom } from "@tarojs/taro";
 import VisitorCard from "../VisitorCard/index";
 
 import { TVisitorAgent } from "@/types/visitor";
@@ -15,7 +15,7 @@ export default ({ agentId }: IProps) => {
     const res = await getVisitorList({ startId: nextId, pageSize, agentId });
     return res.data;
   };
-  const { list, loadMore } = useLoadMoreInfinite<TVisitorAgent>(
+  const { list, loadMore, mutate } = useLoadMoreInfinite<TVisitorAgent[]>(
     createKey(`getVisitorList${agentId}`, 10, [agentId]),
     fetcher);
 
@@ -23,6 +23,10 @@ export default ({ agentId }: IProps) => {
     loadMore();
   });
 
+  useDidShow(()=> {
+    mutate(undefined, {revalidate: true})
+  })
+
   
 
   if (!list.length) {

+ 10 - 8
src/pages/dashboard/index.tsx

@@ -28,28 +28,30 @@ export default () => {
     setSelected(value)
   }
 
-  useEffect(()=> {
-    fetchAgents()
-  }, [])
+  useDidShow(()=> {
+    
+    fetchInitData()
+  })
 
+
+  
   useEffect(() => {
     setSelected('全部智能体')
   }, [])
+  useEffect(() => {
+    
+  }, [])
 
 
   const fetchInitData = async () => {
+    await fetchAgents();
     const currentAgent = agents.find( _agent => _agent.name === selected)
-    
     const response = await getVisitorSummary(currentAgent?.agentId)
     if(isSuccess(response.status)){
       setSummary(response.data)
     }
   }
 
-  useEffect(()=> {
-    fetchInitData()
-  }, [selected])
-
 
 
   if(!agents || !selected) {

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

@@ -56,7 +56,7 @@ export default function Profile() {
   useEffect(() => {
     if (params.agentId) {
       fetchAgentProfile(params.agentId);
-      postLog(params.agentId, params.shareKey);
+      // postLog(params.agentId, params.shareKey);
     }
   }, [params.agentId]);