Browse Source

fix:完善个人头像

zhaojing 1 year ago
parent
commit
7c3a5b153e

+ 7 - 0
src/assets/images/page-home/menu.svg

@@ -0,0 +1,7 @@
+<svg width="32" height="34" viewBox="0 0 32 34" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect width="32" height="34" rx="6" fill="#E9E7E7"/>
+<rect x="6" y="5" width="8" height="10" rx="2" fill="white"/>
+<rect x="6" y="19" width="8" height="10" rx="2" fill="white"/>
+<rect x="18" y="5" width="8" height="10" rx="2" fill="white"/>
+<rect x="18" y="19" width="8" height="10" rx="2" fill="white"/>
+</svg>

+ 8 - 7
src/config/sagacare/sagacare_image.js

@@ -6,13 +6,14 @@ import envir_jiaquan from '@/assets/images/page-enviroment/jiaquan.svg';
 import envir_tvoc from '@/assets/images/page-enviroment/tvoc.svg';
 
 export const homeImgMap = {
-    staff: require('@/assets/images/page-home/staff.svg'),
-    environment: require('@/assets/images/page-home/environment.svg'),
-    equipment: require('@/assets/images/page-home/equipment.svg'),
-    runtime: require('@/assets/images/page-home/runtime.svg'),
-    set: require('@/assets/images/page-home/set.svg'),
-    qiyeLogo: require('@/assets/images/page-home/qiyeLogo.png'),
-}
+  staff: require('@/assets/images/page-home/staff.svg'),
+  environment: require('@/assets/images/page-home/environment.svg'),
+  equipment: require('@/assets/images/page-home/equipment.svg'),
+  runtime: require('@/assets/images/page-home/runtime.svg'),
+  set: require('@/assets/images/page-home/set.svg'),
+  qiyeLogo: require('@/assets/images/page-home/qiyeLogo.png'),
+  menu: require('@/assets/images/page-home/menu.svg'),
+};
 export const equipImageMap = {
   //   temperMapTop: require('@/assets/images/page-enviroment/temperMapTop.png'),
   //   co2MapTop: require('@/assets/images/page-enviroment/co2MapTop.png'),

+ 4 - 1
src/layouts/index.jsx

@@ -7,6 +7,7 @@ import Icon from '@/tenants-ui/SgIcon';
 import { Drawer, notification } from 'antd';
 import NavMenu from '@/sagacare_components/navMenu';
 import Head from '@/sagacare_components/head';
+import { homeImgMap } from '@/config/sagacare/sagacare_image.js';
 
 export default (props) => {
   const { menuVisible, closeMenu, toggleMenu } = useModel('controller');
@@ -133,7 +134,9 @@ export default (props) => {
             >
               <Icon className={styles.notify} type="notify" style={{ fontSize: 21 }}></Icon>
             </div>
-            <MenuFoldOutlined style={{ fontSize: 24 }} onClick={showMenuClick} />
+            <div className={styles.menuDiv}>
+              <img src={homeImgMap.menu} onClick={showMenuClick} />
+            </div>
           </div>
         )}
       </div>

+ 3 - 0
src/layouts/index.less

@@ -69,5 +69,8 @@
         }
       }
     }
+    .menuDiv {
+      cursor: pointer;
+    }
   }
 }

+ 7 - 0
src/pages/Home/index.less

@@ -3,6 +3,13 @@
   justify-content: space-between;
   .left {
     width: 500px;
+    .userPic {
+      width: 75px;
+      height: 75px;
+      margin-right: 8px;
+      overflow: hidden;
+      border-radius: 100%;
+    }
     .userName {
       color: #000000;
       font-size: 20px;

+ 7 - 1
src/pages/Home/index.tsx

@@ -12,7 +12,13 @@ const Runtime: React.FC = () => {
   return (
     <div className={styles.homewrap}>
       <div className={styles.left}>
-        <span className={styles.userName}>你好,{initialState?.currentUser?.name}</span>
+        <div>
+          <img className={styles.userPic} src={initialState?.companyConfig?.headImgUrl} />
+          <span className={styles.userName}>
+            你好,
+            {initialState?.companyConfig?.name}
+          </span>
+        </div>
       </div>
       <div className={styles.right}>
         <NavMenu></NavMenu>

+ 9 - 1
src/pages/Information/index.jsx

@@ -8,6 +8,7 @@ import {
   getFileUrl,
 } from '@/services/sagacare_service/infomation';
 export default () => {
+  const { initialState } = useModel('@@initialState');
   const fileInputRef = useRef();
   const [englishAbbreviation, setEnglishAbbreviation] = useState('');
   const [abbreviation, setAbbreviation] = useState('');
@@ -33,7 +34,13 @@ export default () => {
     [abbreviation, englishAbbreviation, intro, logoUrl],
   );
   function getData() {
-    companyInfo().then((res) => {
+    let params = {
+      criteria: {
+        projectId: initialState?.currentUser?.projectId,
+        companyId: initialState?.currentUser?.companyId,
+      },
+    };
+    companyInfo(params).then((res) => {
       const resData = res.data || {};
       setEnglishAbbreviation(resData.englishAbbreviation || '');
       setAbbreviation(resData.abbreviation || '');
@@ -50,6 +57,7 @@ export default () => {
       englishAbbreviation: englishAbbreviation,
       intro: intro,
       logoUrl: logoUrl,
+      companyId: initialState?.currentUser?.companyId,
     };
     params[key] = value;
     companyUpdate(params).then((res) => {

+ 1 - 8
src/services/sagacare_service/infomation.js

@@ -18,13 +18,7 @@ function commonParams() {
 }
 
 // 获取企业信息
-export const companyInfo = () => {
-  let params = {
-    criteria: {
-      projectId: 'Pj1101099999',
-      companyId: '751329b106254ac58c2bd3ae9eaefaa7',
-    },
-  };
+export const companyInfo = (params) => {
   return request(`/sgadmin/duoduo-service/custom-service/company/info`, {
     method: 'POST',
     from: 'sagacare',
@@ -38,7 +32,6 @@ export const companyInfo = () => {
 };
 // 修改企业 信息
 export const companyUpdate = (params) => {
-  params.companyId = '751329b106254ac58c2bd3ae9eaefaa7';
   return request(`/sgadmin/duoduo-service/custom-service/company/update`, {
     method: 'POST',
     from: 'sagacare',