王晓东 1 неделя назад
Родитель
Сommit
e4872fa891

+ 2 - 1
src/app.less

@@ -449,10 +449,11 @@ page {
   }
 }
 
-// 智能体内容容器毛玻璃效果,距顶部距离 240 ,留出空间显示形象
+// 智能体内容容器毛玻璃效果,距顶部距离 240 ,留出空间显示形象, 最小高度 600px 以防止没有顶到底部
 .blur-rounded-container{
   margin-top: 240px;
   width: 100%;
+  min-height: calc(100vh - 240px);
   box-sizing: border-box;
   border-top-left-radius: 24px;
   border-top-right-radius: 24px;

+ 3 - 6
src/components/AgentPage/components/AgentSwap/index.tsx

@@ -48,15 +48,12 @@ export default ({ show, setShow }: IProps) => {
     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)
+      if(response?.agentId){
+        Taro.navigateTo({ url: `/pages/agent/index?agentId=${response.agentId}` });
+      }
     }catch(e:any){
       Taro.hideLoading()
       loading = false;

+ 6 - 7
src/components/AgentPage/index.tsx

@@ -10,7 +10,6 @@ import { useComponentStore } from "@/store/componentStore";
 import ComponentList from "@/components/component-list";
 import { useUserStore } from "@/store/userStore";
 
-import style from './index.module.less'
 import { useDidShow } from "@tarojs/taro";
 
 
@@ -25,17 +24,17 @@ export default function Index({ agentId }: IProps) {
   const { setComponentList } = useComponentStore()
   const components = useComponentStore((state) => state.components);
 
-  
-
-  useDidShow(()=> {
+  const fetchData = ()=> {
     if (agentId) {
       fetchAgent(agentId)
     }
+  }
+
+  useDidShow(()=> {
+    fetchData()
   })
   useEffect(()=> {
-    if (agentId) {
-      fetchAgent(agentId)
-    }
+    fetchData()
   },[agentId])
 
   useEffect(()=> {

+ 9 - 7
src/components/LoginPopup/index.tsx

@@ -1,14 +1,11 @@
-import NavBarNormal from "@/components/NavBarNormal/index";
 import { View,Text, Image, Checkbox, Button } from "@tarojs/components";
-import PageCustom from "@/components/page-custom/index";
-import LogoImage from '@/images/logo.png'
 import { useLogin } from '@/xiaolanbenlib/hooks/data/useAuth'
 import WemetaRadio from "@/components/WemetaRadio";
 
 import { useEffect, useState } from "react";
 
 import Popup from "@/components/popup/popup";
-import Taro from "@tarojs/taro";
+import Taro, { useDidShow } from "@tarojs/taro";
 import { navToWebView } from "@/utils/index";
 import { getSysAgreements, type TAgreementItem } from "@/service/system";
 import { isSuccess } from "@/utils";
@@ -45,12 +42,17 @@ export default function Index({showPopup, setShowPopup, onEnd}:IProps) {
   useEffect(()=> {
     fetchPageData()
   }, [])
+
+  
   
 
   return (
     <Popup setShow={setShowPopup} show={showPopup}>
-      <View className="text-24 font-medium leading-32 text-black mb-16">欢迎来到小蓝本</View>
-      <View className="text-gray-45 text-14 leading-22 mb-70">登录后享受更好的服务体验</View>
+      <View className="text-24 font-medium leading-36 text-black mb-12">欢迎来到小蓝本智能体</View>
+      <View className="text-gray-45 text-14 leading-24 mb-40">
+        <View>激活您的AI商务分身,开启智能商务</View>
+        <View>7x24h随时应答·智能管理知识库·主动拓展人脉</View>
+      </View>
       <Button
         disabled={!checked}
         className="button-rounded-big mb-16"
@@ -63,7 +65,7 @@ export default function Index({showPopup, setShowPopup, onEnd}:IProps) {
           onClick()
         }}
       >
-        手机号快登录
+        手机号快登录
       </Button>
       <View className="flex items-center justify-center text-12 mb-86 text-center">
         <View className="flex-center text-gray-45 gap-8" onClick={handleChecked}><WemetaRadio checkbox checked={checked}></WemetaRadio>同意</View>

+ 40 - 0
src/components/TabPageCheckLogin/index.tsx

@@ -0,0 +1,40 @@
+import Taro, { useDidShow } from "@tarojs/taro";
+import React, { useEffect, useState, forwardRef, useImperativeHandle } from "react";
+import LoginPopup from '@/components/LoginPopup'
+import { useIsLogin } from '@/xiaolanbenlib/hooks/data/useAuth'
+
+interface IProps {
+  onEnd: ()=>void
+}
+
+const TabPageCheckLogin = forwardRef(({ onEnd }: IProps, ref) => {
+  const [showLogin, setShowLogin] = useState(false);
+  const isLogin = useIsLogin()
+
+  useImperativeHandle(ref, () => ({
+    setShowLogin,
+  }));
+
+  const onLoginEnd = ()=> {
+    onEnd()
+  }
+
+  const checkLogin = () => {
+    if(!isLogin){
+      setShowLogin(true)
+    }else{
+      setShowLogin(false)
+    }
+  }
+  useDidShow(()=> {
+    checkLogin()
+    console.log('LoginPopup use did show')
+  })
+  useEffect(()=> {
+    checkLogin()
+  }, [isLogin])
+
+  return  <LoginPopup showPopup={true} setShowPopup={setShowLogin} onEnd={onLoginEnd}></LoginPopup>
+});
+
+export default TabPageCheckLogin;

+ 1 - 1
src/components/page-custom/index.tsx

@@ -8,7 +8,7 @@ interface Props {
   bgColor?: string;
   isflex?: boolean; // 有横向滚动的scroll-view 容器不能包裹在 flex comlumn 布局中
   style?: React.CSSProperties;
-  styleBg?: string;
+  styleBg?: string|null;
   paddingTop?: number;
   fullPage?: boolean;
   onClick?: (e:any)=> void

+ 1 - 1
src/components/page-wrapper/index.tsx

@@ -8,7 +8,7 @@ import { GlobalModal } from '@/components/GlobalModal/index';
 interface Props {
   children?: React.ReactChild | React.ReactChild[];
   style?: React.CSSProperties;
-  styleBg?: string;
+  styleBg?: string|null;
   onClick?: (e:any)=> void
 }
 

+ 10 - 7
src/pages/contact/index.tsx

@@ -12,6 +12,8 @@ import PageCustom from "@/components/page-custom/index";
 import { TContactItem } from "@/types/contact";
 import { isSuccess } from "@/utils";
 import { delContact } from "@/service/contact";
+import TabPageCheckLogin from '@/components/TabPageCheckLogin'
+
 export default function Index() {
   const [searchValue, setSearchValue] = useState("");
 
@@ -45,10 +47,6 @@ export default function Index() {
   const {list, setSize, mutate} = useLoadMoreInfinite<TContactItem[]>(getKey, fetcher)
 
 
-  const resetFetchList = () => {
-    setSize(1);
-  };
-
   const handleSearchBarChanged = (v: string) => {
     setSearchValue(v);
   };
@@ -86,9 +84,13 @@ export default function Index() {
     }
   };
 
-  useDidShow(() => {
-    mutate(undefined, {revalidate:true})
+  useDidShow(()=> {
+    mutate()
   })
+  const onLoginEnd = ()=> {
+    mutate()
+  }
+  
 
   const handleDelete = (contactId: string|number) => {
     
@@ -156,7 +158,7 @@ export default function Index() {
         </View>
         <View className="rounded-container-header"></View>
         <View className="px-16 text-gray-45 text-12 leading-20 mb-20">
-          共 4 个联系人
+          共 4 个联系人 
         </View>
         <ScrollView
           scrollY
@@ -169,6 +171,7 @@ export default function Index() {
           <View className={style.contactContent}>{renderContent()}</View>  
         </ScrollView>
       </View>
+      <TabPageCheckLogin onEnd={onLoginEnd}></TabPageCheckLogin>
     </PageCustom>
   );
 }

+ 19 - 6
src/pages/dashboard/index.tsx

@@ -15,16 +15,20 @@ import { TAgent } from "@/types/agent";
 import { TVisitorAgent } from "@/types/visitor";
 import { getVisitorList } from "@/service/visitor";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
-
+import TabPageCheckLogin from '@/components/TabPageCheckLogin'
 export default () => {
   
   const {agents, fetchAgents} = useAgentStore()
   
   const [show, setShow] = useState(false);
+  
   // 是否显示选择器
   const [currentAgent, setCurrentAgent] = useState<TAgent|null>(null)
   const [summary, setSummary] = useState<TVisitorSummary>()
 
+
+  const [showLogin, setShowLogin] = useState(false);
+
   const fetcher = async ([_url, {nextId, pageSize}, [agentId]]) => {
     console.log(nextId, agentId)
     const res = await getVisitorList({ startId: nextId, pageSize, agentId});
@@ -54,24 +58,32 @@ export default () => {
 
   useDidShow(()=> {
     fetchInitData()
+    mutate()
   })
 
-  
 
 
-  if(!agents) {
-    return <View>...</View>
+  const onLoginEnd = ()=> {
+    fetchInitData()
+    mutate()
   }
+  
+
+  
   useReachBottom(() => {
     loadMore()
   })
 
   useDidShow(()=> {
-    mutate(undefined, {revalidate: true})
+    mutate()
   })
 
   const unprocessedDislikeCnt = summary?.unprocessedDislikeCnt ?? 0
 
+  if(!agents) {
+    return <View>...</View>
+  }
+
   return (
     <PageCustom>
       <NavBarNormal scrollFadeIn leftColumn={()=> <Text className="font-medium text-dark leading-22 text-16">数据分析</Text>}>
@@ -113,7 +125,8 @@ export default () => {
         <VisitorList list={list} agentId={currentAgent?.agentId}></VisitorList>
         
         <AgentList show={show} setShow={setShow} currentAgent={currentAgent} setCurrentAgent={setCurrentAgent}></AgentList>
-        
+
+        <TabPageCheckLogin onEnd={onLoginEnd}></TabPageCheckLogin>
       </View>
       
     </PageCustom>

+ 3 - 5
src/pages/index/components/InitView/index.tsx

@@ -44,11 +44,9 @@ export default function Index({}: IProps) {
       })
     await fetchSysCoreCnf()
     await fetchtMyInfo()
-    const agents = await fetchAgents()
-    const agent = agents.find( item=> item.isDefault)
-    // if(agent){
-    //   setDefault(agent)
-    // }
+    
+    // 获取智能体
+    await fetchAgents()
   }
 
   useEffect(() => {

+ 22 - 6
src/pages/index/components/WelcomeTips/index.tsx

@@ -1,22 +1,37 @@
 import { View, Image } from "@tarojs/components";
 import style from "./index.module.less";
 import Taro from "@tarojs/taro";
-
+import LoginPopup from '@/components/LoginPopup'
 import { useAgentStore } from "@/store/agentStore";
+import { useState } from "react";
 interface IProps {
   // children: JSX.Element|JSX.Element[]
 }
 export default function Index({}: IProps) {  
   const { createAgent } = useAgentStore()
+  const [showLogin, setShowLogin] = useState(false);
   const handleCreate = async ()=> {
-    const agentDetail = await createAgent()
-    if(agentDetail){
-      Taro.navigateTo({
-        url: `/pages/agent/index?agentId=${agentDetail.agentId}`
-      })
+    try{
+      const agentDetail = await createAgent()
+      if(agentDetail){
+        if(agentDetail){
+          Taro.navigateTo({ url: `/pages/agent/index?agentId=${agentDetail.agentId}` });
+        }
+        // Taro.navigateTo({
+        //   url: `/pages/agent/index?agentId=${agentDetail.agentId}`
+        // })
+      }
+    }catch(e){
+      if(e.code === 401){
+        setShowLogin(true)
+      }
+      
     }
     
   }
+  const handleOnEnd = ()=> {
+    setShowLogin(false)
+  }
   return (
     <View className={style.container}>
       <View className={style.demoAvatar}>
@@ -48,6 +63,7 @@ export default function Index({}: IProps) {
           <View className="button-rounded-big" onClick={handleCreate}>创建智能体</View>
         </View>
       </View>
+      <LoginPopup setShowPopup={setShowLogin} showPopup={showLogin} onEnd={handleOnEnd}></LoginPopup>
       </View>
   );
 }

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

@@ -3,11 +3,12 @@ import InitView from "./components/InitView";
 import { useDidShow } from "@tarojs/taro";
 import { useAgentStore } from "@/store/agentStore";
 import { useIsLogin } from "@/xiaolanbenlib/hooks/data/useAuth";
+import { useEffect } from "react";
 
 export default function Index() {
   const isLogin = useIsLogin();
   
-  const { fetchAgents, defaultAgent } = useAgentStore();
+  const { fetchAgents, defaultAgent, resetData } = useAgentStore();
 
   useDidShow(() => {
     // 如果没有登录过,则显示默认欢迎页
@@ -16,6 +17,13 @@ export default function Index() {
       fetchAgents();
     }
   });
+  
+  // 如果登出,则重置当前 agent store
+  useEffect(()=> {
+    if(!isLogin){
+      resetData()
+    }
+  }, [isLogin])
   if (!defaultAgent) {
     return <InitView></InitView>;
   }

+ 10 - 0
src/pages/knowledge/LoginMutationContext.tsx

@@ -0,0 +1,10 @@
+// src/context/MutationContext.jsx
+import { createContext } from 'react'
+
+// 创建 Context 对象
+const MutationContext = createContext({
+  isMutate: false,
+  setLoginShow: (value)=> {}
+})
+
+export default MutationContext

+ 17 - 4
src/pages/knowledge/components/PersonalTab/components/ScrollList.tsx

@@ -3,7 +3,7 @@ import { ScrollView, View, Image } from "@tarojs/components";
 import FigureList from "@/components/list/FigureList";
 import FigureListItem from "@/components/list/FigureListItem";
 import { useDidShow } from "@tarojs/taro";
-import { useEffect, useState } from "react";
+import { useEffect } from "react";
 
 import RotateLoading from "@/components/rotate-loading";
 import Taro from "@tarojs/taro";
@@ -15,9 +15,10 @@ import EmptyData from "@/components/empty-data";
 import type { TKnowledgeItem } from "@/types/knowledge";
 
 import { deleteMyKnowledge, getKnowledgeList } from "@/service/knowledge";
-
+import { useContext } from "react";
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
 import { isSuccess } from "@/utils";
+import LoginMutationContext from "@/pages/knowledge/LoginMutationContext";
 
 export interface IProps {
   types?: EKnowlegeTypes[];
@@ -25,11 +26,13 @@ export interface IProps {
 }
 
 const Index = ({ types, setTotalCount }: IProps) => {
+  const { isMutate, setLoginShow } = useContext(LoginMutationContext)
+
   const fetcher = async ([_url, { nextId, pageSize }, [types]]) => {
     const res = await getKnowledgeList({ startId: nextId, pageSize, types });
     return res.data;
   };
-  const { list, loadMore, mutate, data, pageIndex } = useLoadMoreInfinite<
+  const { list, loadMore, mutate, data, pageIndex, error } = useLoadMoreInfinite<
     TKnowledgeItem[]
   >(createKey("getKnowledgeList", 20, [types]), fetcher);
 
@@ -38,9 +41,19 @@ const Index = ({ types, setTotalCount }: IProps) => {
   };
 
   useDidShow(() => {
-    mutate(undefined, { revalidate: true });
+    mutate();
   });
 
+  useEffect(()=> {
+    mutate();
+  }, [isMutate])
+  useEffect(()=> {
+    if(error?.code === 401){
+      setLoginShow(true)
+    }
+    
+  }, [error])
+
   useEffect(() => {
     if (data && pageIndex === 1) {
       setTotalCount(data?.[0].totalCount || 0);

+ 17 - 3
src/pages/knowledge/components/PersonalTab/components/ScrollListChat.tsx

@@ -8,7 +8,7 @@ import KnowledgeIcon from '@/components/KnowledgeIcon'
 import FigureList from "@/components/list/FigureList";
 import FigureListItem from "@/components/list/FigureListItem";
 
-import { useEffect, useRef, useState } from "react";
+import { useContext, useEffect, useRef, useState } from "react";
 import Taro, { useDidShow } from "@tarojs/taro";
 
 import { useUserStore } from "@/store/userStore";
@@ -25,6 +25,8 @@ import {
 import { useLoadMoreInfinite, createKey } from "@/utils/loadMoreInfinite";
 import { DEFAULT_AGENT } from "@/config";
 import { isSuccess } from "@/utils";
+import LoginMutationContext from "@/pages/knowledge/LoginMutationContext";
+
 
 interface IProps {
   assistantOnly?: boolean;
@@ -34,6 +36,8 @@ interface IProps {
 const Index = ({assistantOnly, setTotalCount}: IProps) => {
 
   const [scrollTop, setScrollTop] = useState(9999)
+
+  const { isMutate, setLoginShow } = useContext(LoginMutationContext)
   
 
   const fetcher = async ([_url, {nextId, pageSize}]) => {
@@ -42,7 +46,7 @@ const Index = ({assistantOnly, setTotalCount}: IProps) => {
   };
 
   
-  const { list, loadMore, pageIndex, mutate ,data  } = useLoadMoreInfinite<TKnowledgeStreamResponseData[]>(
+  const { list, loadMore, pageIndex, mutate ,data, error  } = useLoadMoreInfinite<TKnowledgeStreamResponseData[]>(
     createKey('getMyKnowledgeStream', 10),
     fetcher,
   );
@@ -103,9 +107,19 @@ const Index = ({assistantOnly, setTotalCount}: IProps) => {
   }, [pageIndex])
 
   useDidShow(()=> {
-    mutate(undefined, { revalidate: true });
+    mutate();
   })
 
+  useEffect(()=> {
+    mutate();
+  }, [isMutate])
+  useEffect(()=> {
+    if(error?.code === 401){
+      setLoginShow(true)
+    }
+    
+  }, [error])
+
   useEffect(() => {
     if(data &&  pageIndex === 1) {
       setTotalCount(data?.[0].totalCount || 0)

+ 25 - 1
src/pages/knowledge/index.tsx

@@ -9,7 +9,11 @@ import WemetaTabs from "@/components/wemeta-tabs/index";
 import PersonalTab from "./components/PersonalTab";
 import CompanyTab from "./components/CompanyTab";
 import CorrectionList from "./components/CorrectionList";
+import TabPageCheckLogin from '@/components/TabPageCheckLogin'
 import style from "./index.module.less";
+import { useRef, useState } from "react";
+import Taro, { useDidShow } from "@tarojs/taro";
+import LoginMutationContext from './LoginMutationContext'
 
 // 渲染统一容器带高光圆角的头部
 const renderTabContainer = (children: JSX.Element) => {
@@ -24,6 +28,10 @@ const renderTabContainer = (children: JSX.Element) => {
 };
 
 export default function Index() {
+  
+  const [isMutate, setLoginMutation] = useState(false)
+  const loginRef = useRef<{ setShowLogin: (show: boolean) => void }>(null);
+
   const tabList = [
     {
       key: "1",
@@ -41,6 +49,19 @@ export default function Index() {
       children: renderTabContainer(<CorrectionList />),
     },
   ];
+
+  const setLoginShow = ()=> {
+    loginRef.current?.setShowLogin(true)
+  }
+
+  const onLoginEnd = ()=> {
+    setLoginMutation(!isMutate)
+  }
+  useDidShow(()=> {
+    setLoginMutation(!isMutate)
+  })
+  
+
   return (
     <PageCustom>
       <NavBarNormal
@@ -49,9 +70,12 @@ export default function Index() {
       ></NavBarNormal>
       <View className="w-full">
         <View className={style.container}>
-          <WemetaTabs current="1" list={tabList} className="px-16"></WemetaTabs>
+          <LoginMutationContext.Provider value={{ isMutate, setLoginShow }}>
+            <WemetaTabs current="1" list={tabList} className="px-16"></WemetaTabs>
+          </LoginMutationContext.Provider>
         </View>
       </View>
+      <TabPageCheckLogin onEnd={onLoginEnd} ref={loginRef}></TabPageCheckLogin>
     </PageCustom>
   );
 }

+ 13 - 0
src/store/agentStore.ts

@@ -53,6 +53,7 @@ export interface AgentStoreState {
     data: TComponentItem[]
   ) => Promise<boolean>;
   deleteAgent: (agentId: string) => Promise<void>
+  resetData: () => void
 }
 
 export const useAgentStore = create<AgentStoreState>((set, get) => ({
@@ -64,6 +65,18 @@ export const useAgentStore = create<AgentStoreState>((set, get) => ({
   agentProfileContactCard: null,
   agentCharacter: null,
   ents: [],
+  resetData: ()=> {
+    set({
+      agents: [],
+      agent: null,
+      agentProfile: null,
+      agentContactCard: null,
+      defaultAgent: null,
+      agentProfileContactCard: null,
+      agentCharacter: null,
+      ents: [],
+    })
+  },
   fetchAgents: async () => {
     const response = await getAgents();
     const agentsData = response?.data

+ 15 - 4
src/utils/loadMoreInfinite.ts

@@ -1,3 +1,4 @@
+import { useSWRConfig } from "swr";
 import useSWRInfinite from "swr/infinite";
 
 export type TResponseData<D> = {
@@ -25,7 +26,7 @@ export const createKey = (query: string, pageSize: number = 10, extra: Record<st
         extra,
       ];
     }
-    console.log(previousPageData.nextId, 77779)
+    
     if (previousPageData && previousPageData.nextId) {
       return [
         query,
@@ -37,7 +38,8 @@ export const createKey = (query: string, pageSize: number = 10, extra: Record<st
   };
 }
 export const useLoadMoreInfinite = <T>(getKey, fetcher, params = {}) => {
-  const { data, setSize, size, mutate, isLoading } = useSWRInfinite<{
+  const {cache} = useSWRConfig()
+  const { data, setSize, size, mutate, isLoading, error } = useSWRInfinite<{
     data: T
     nextId?: string
     totalCount?: null | number
@@ -48,8 +50,16 @@ export const useLoadMoreInfinite = <T>(getKey, fetcher, params = {}) => {
     revalidateIfStale: false,
     revalidateFirstPage: false,
     onErrorRetry(err, key, config, revalidate, revalidateOpts) {
-      if (err.status === 404) return
-      if (err.status === 401) return
+      if (err.code === 404) return
+      if (err.code === 401) {
+        // 获取所有缓存的 key(SWR 缓存基于 key 存储)
+        const allKeys = Array.from(cache.keys());
+        // 过滤出当前分页请求相关的 key(如包含 /api/list?page=)
+        const relevantKeys = allKeys.filter(_key => _key.includes(key));
+        // 逐个删除这些 key 的缓存
+        relevantKeys.forEach(key => cache.delete(key));
+        return
+      }
       if (revalidateOpts.retryCount >= 3) return
     },
   });
@@ -73,5 +83,6 @@ export const useLoadMoreInfinite = <T>(getKey, fetcher, params = {}) => {
     mutate,
     setSize,
     loadMore,
+    error,
   }
 }

+ 0 - 1
src/xiaolanbenlib/hooks/data/useAuth.tsx

@@ -133,7 +133,6 @@ export function useIsLogin() {
       setIsLogin(newState)
     }
     if(!newState){
-      
       // Taro.navigateTo({url: '/pages/login/index'})
     }
   }, [isLogin])

+ 19 - 7
src/xiaolanbenlib/module/axios.js

@@ -1,9 +1,16 @@
-import Taro from '@tarojs/taro'
+import Taro, { useRouter } from '@tarojs/taro'
 import Axios from 'axios'
 import { OPEN_ID_STORAGE_KEY } from '../constant'
 import { getUserInfo } from '../utils/auth'
 import sign from './sign'
 
+const whitePageList = [
+  'pages/dashboard/index',
+  'pages/contact/index',
+  'pages/index/index',
+  'pages/knowledge/index',
+]
+
 const axiosIns = Axios.create({
   siren: false,
 })
@@ -68,12 +75,17 @@ axiosIns.interceptors.response.use(
     }
     if (error.code === 401) {
       Taro.setStorageSync('hasLogin', '0')
-      Taro.switchTab({
-        url: '/pages/personal/index',
-      });
-      // Taro.navigateTo({
-      //   url: '/pages/login/index'
-      // })
+      // 如果在非白名单页,则需要跳转 '我的' 页登录
+      // 白名单页,不跳转,自行处理登录逻辑
+      const pages = Taro.getCurrentPages();
+      const currentPage = pages[pages.length - 1];
+      const currentRoute = currentPage.route;
+      console.log(currentRoute)
+      if (!whitePageList.includes(currentRoute)) {
+        Taro.switchTab({
+          url: '/pages/personal/index',
+        });
+      }
       return Promise.reject(error)
     } else if (error.code === 1020 || error.code === 1021) {
       return error