From f767b16e74892d8004cae6c96b354413311a143d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 07 二月 2024 15:59:18 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/App.jsx |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/zy-asrs-flow/src/App.jsx b/zy-asrs-flow/src/App.jsx
index 4aa6d96..b69abab 100644
--- a/zy-asrs-flow/src/App.jsx
+++ b/zy-asrs-flow/src/App.jsx
@@ -15,7 +15,6 @@
 const defaultAvatar = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
 
 export function render(oldRender) {
-  console.log("1");
   const token = getToken();
   if (!token || token?.length === 0) {
     oldRender();
@@ -28,7 +27,6 @@
 }
 
 export async function patchClientRoutes({ routes }) {
-  console.log("2");
   patchRouteWithRemoteMenus(routes);
 };
 
@@ -36,23 +34,25 @@
  * @see  https://umijs.org/zh-CN/plugins/plugin-initial-state
  * */
 export async function getInitialState() {
-  console.log("3");
   const fetchUserInfo = async () => {
     try {
-      // const userInfo = await getUserInfo({
-      //   skipErrorHandler: true,
-      // });
-      // if (userInfo?.user.avatar === '') {
-      //   response.user.avatar = defaultAvatar;
-      // }
-      // return {
-      //   ...userInfo
-      // };
-
-      const userInfo = await queryCurrentUser({
+      const { data: userInfo } = await getUserInfo({
         skipErrorHandler: true,
       });
-      return userInfo.data;
+      // console.log(userInfo);
+      if (userInfo?.avatar === '') {
+        userInfo.avatar = defaultAvatar;
+      }
+      userInfo.name = userInfo.nickname;
+      return {
+        ...userInfo
+      };
+
+      // const userInfo = await queryCurrentUser({
+      //   skipErrorHandler: true,
+      // });
+      // console.log(userInfo);
+      // return userInfo.data;
     } catch (error) {
       console.log(error);
       history.push(loginPath);
@@ -77,7 +77,6 @@
 
 // ProLayout 鏀寔鐨刟pi https://procomponents.ant.design/components/layout
 export const layout = ({ initialState, setInitialState }) => {
-  console.log("4");
   return {
     actionsRender: () => [<Question key="doc" />, <SelectLang key="SelectLang" />],
     avatarProps: {
@@ -91,18 +90,17 @@
       locale: false,
       // 姣忓綋 initialState?.currentUser?.userid 鍙戠敓淇敼鏃堕噸鏂版墽琛� request
       params: {
-        userId: initialState?.currentUser?.userId,
+        userId: initialState?.currentUser?.id,
       },
       request: async () => {
-        // console.log(initialState?.currentUser?.userId);
-        // if (!initialState?.currentUser?.userId) {
-        //   return [];
-        // }
+        if (!initialState?.currentUser?.id) {
+          return [];
+        }
         return getRemoteMenu();
       },
     },
     waterMarkProps: {
-      content: initialState?.currentUser?.name,
+      content: initialState?.currentUser?.nickname,
     },
     footerRender: () => <Footer />,
     onPageChange: () => {

--
Gitblit v1.9.1