From 78c8fcc2354ed234d3181f37274176c48e61d1d9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 27 二月 2024 16:31:00 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/account/setting/components/base.jsx |   56 +++++++++++++++++---------------------------------------
 zy-asrs-flow/src/pages/system/user/index.jsx               |    1 +
 2 files changed, 18 insertions(+), 39 deletions(-)

diff --git a/zy-asrs-flow/src/pages/account/setting/components/base.jsx b/zy-asrs-flow/src/pages/account/setting/components/base.jsx
index 3c911a5..448c0f7 100644
--- a/zy-asrs-flow/src/pages/account/setting/components/base.jsx
+++ b/zy-asrs-flow/src/pages/account/setting/components/base.jsx
@@ -1,13 +1,8 @@
-import { UploadOutlined } from '@ant-design/icons';
 import {
   ProForm,
-  ProFormDependency,
-  ProFormFieldSet,
-  ProFormSelect,
   ProFormText,
   ProFormTextArea,
 } from '@ant-design/pro-components';
-import { useRequest } from '@umijs/max';
 import { Button, Input, message, Upload } from 'antd';
 import React from 'react';
 import useStyles from './index.style';
@@ -15,18 +10,10 @@
 
 import defaultAvat from '/public/img/defaultAva.png'
 
-const validatorPhone = (rule, value, callback) => {
-  if (!value[0]) {
-    callback('Please input your area code!');
-  }
-  if (!value[1]) {
-    callback('Please input your phone number!');
-  }
-  callback();
-};
-
 const BaseView = () => {
   const { styles } = useStyles();
+  const [loading, setLoading] = React.useState(false);
+  const [currentUser, setCurrentUser] = React.useState({});
 
   const AvatarView = ({ avatar }) => (
     <>
@@ -45,16 +32,23 @@
     </>
   );
 
-  const queryCurrent = async () => {
-    await Http.doGet('api/auth/user');
+  const queryCurrent = () => {
+    setLoading(true);
+    Http.doGetPromise('api/auth/user', {}, (res) => {
+      setLoading(false);
+      setCurrentUser(res.data);
+    }).catch((err) => {
+      console.error(err);
+      setLoading(false);
+    })
   }
 
+  React.useEffect(() => {
+    queryCurrent();
+  }, []);
+
+  console.log(1);
   
-
-  const { data: currentUser, loading } = useRequest(() => {
-    return queryCurrent();
-  });
-
   const getAvatarURL = () => {
     if (currentUser) {
       if (currentUser.avatar) {
@@ -86,7 +80,7 @@
               }}
               initialValues={{
                 ...currentUser,
-                phone: currentUser?.phone.split('-'),
+                // phone: currentUser?.phone.split('-'),
               }}
               hideRequiredMark
             >
@@ -135,22 +129,6 @@
                   },
                 ]}
               />
-              <ProFormFieldSet
-                name="phone"
-                label="鑱旂郴鐢佃瘽"
-                rules={[
-                  {
-                    required: true,
-                    message: '璇疯緭鍏ユ偍鐨勮仈绯荤數璇�!',
-                  },
-                  {
-                    validator: validatorPhone,
-                  },
-                ]}
-              >
-                <Input className={styles.area_code} />
-                <Input className={styles.phone_number} />
-              </ProFormFieldSet>
             </ProForm>
           </div>
           <div className={styles.right}>
diff --git a/zy-asrs-flow/src/pages/system/user/index.jsx b/zy-asrs-flow/src/pages/system/user/index.jsx
index 0f89bb7..f6ada67 100644
--- a/zy-asrs-flow/src/pages/system/user/index.jsx
+++ b/zy-asrs-flow/src/pages/system/user/index.jsx
@@ -142,6 +142,7 @@
             const treeAllKeys = getTreeAllKeys(treeData);
             setDeptExpandedKeys(treeAllKeys);
         }).catch((err) => {
+            console.error(err);
             setDeptTreeLoading(false);
         })
     }

--
Gitblit v1.9.1