张涛 1 vuosi sitten
vanhempi
commit
02961d6817
2 muutettua tiedostoa jossa 7 lisäystä ja 11 poistoa
  1. 1
    5
      src/layouts/AuthLayout/components/Header/User.jsx
  2. 6
    6
      src/routes/routes.jsx

+ 1
- 5
src/layouts/AuthLayout/components/Header/User.jsx Näytä tiedosto

29
 );
29
 );
30
 
30
 
31
 const ChangePassword = forwardRef((props, ref) => {
31
 const ChangePassword = forwardRef((props, ref) => {
32
-  const { user } = props;
33
 
32
 
34
   const [visible, setVisible] = useState(false);
33
   const [visible, setVisible] = useState(false);
35
 
34
 
36
   const onFinish = async (values) => {
35
   const onFinish = async (values) => {
37
-    // console.log('---values---->', values)
38
     const data = {
36
     const data = {
39
       password: values.newPassword,
37
       password: values.newPassword,
40
     };
38
     };
41
-    // console.log('---ff---->', data)
42
     await changePassword(data);
39
     await changePassword(data);
43
 
40
 
44
     return true;
41
     return true;
109
       passRef.current.show();
106
       passRef.current.show();
110
     }
107
     }
111
   };
108
   };
112
-console.log(user)
113
   return (
109
   return (
114
     <Dropdown menu={{ items, onClick }}>
110
     <Dropdown menu={{ items, onClick }}>
115
       <div className="user-info">
111
       <div className="user-info">
116
-        <Avatar size={24} src={user?.account || <DefaultAvatar />} />
112
+        <Avatar size={24} src={<DefaultAvatar />} />
117
         <span className="font">{user?.userName}</span>
113
         <span className="font">{user?.userName}</span>
118
         <ChangePassword user={user} ref={passRef} />
114
         <ChangePassword user={user} ref={passRef} />
119
       </div>
115
       </div>

+ 6
- 6
src/routes/routes.jsx Näytä tiedosto

27
  */
27
  */
28
 
28
 
29
 export const authRoutes = [
29
 export const authRoutes = [
30
-  // {
31
-  //   index: true,
32
-  //   element: <Navigate to="/login" replace={true} />,
33
-  // },
30
+  {
31
+    index: true,
32
+    element: <Navigate to="/custom" replace={true} />,
33
+  },
34
   {
34
   {
35
     path: "custom",
35
     path: "custom",
36
     element: <Custom />,
36
     element: <Custom />,
102
   },
102
   },
103
 ];
103
 ];
104
 
104
 
105
-export function mergeAuthRoutes(r1, r2) {
105
+export function mergeAuthRoutes (r1, r2) {
106
   const r = r1.slice();
106
   const r = r1.slice();
107
   const children = r1[0].children.slice();
107
   const children = r1[0].children.slice();
108
   r[0].children = children.concat(r2);
108
   r[0].children = children.concat(r2);
112
 
112
 
113
 // 全部路由
113
 // 全部路由
114
 export const routes = mergeAuthRoutes(defaultRoutes, authRoutes);
114
 export const routes = mergeAuthRoutes(defaultRoutes, authRoutes);
115
-function getPath(parent = "/", current = "") {
115
+function getPath (parent = "/", current = "") {
116
   if (current.indexOf("/") === 0 || current.indexOf("http") === 0)
116
   if (current.indexOf("/") === 0 || current.indexOf("http") === 0)
117
     return current;
117
     return current;
118
   return `${parent}/${current}`.replace(/\/\//g, "/");
118
   return `${parent}/${current}`.replace(/\/\//g, "/");