Browse Source

fix:修改行政端bug

zhaojing 1 year ago
parent
commit
6f8d60b060

+ 3 - 12
src/app.tsx

@@ -1,6 +1,7 @@
 import { PageLoading } from '@ant-design/pro-layout';
 import { history, useModel } from 'umi';
 import { queryTenantData } from '@/services/sagacare_service/member';
+import { projectObj } from '@/config/api.js';
 
 /** 获取用户信息比较慢的时候会展示一个 loading */
 export const initialStateConfig = {
@@ -24,24 +25,14 @@ export async function getInitialState(): Promise<{
   if (location.pathname.indexOf('login') > -1 && token) {
     history.push('/home');
   }
-  debugger;
   let currentUser = {};
-  // let currentUser = {
-  //   appId: 'wxda2ef261ac3cca32',
-  //   companyId: '17fe48afcdde4d6797583c6d6270a035', // ff80c708fe72446eb790b764c3a7b66b,
-  //   loginType: 'app',
-  //   manageUserType: 3,
-  //   name: '赵静',
-  //   openId: 'oDcGY5Qq3Vk-7WKTNsn-lLGNT118',
-  //   phone: '13810794283',
-  //   projectId: 'Pj1101080259', //  Pj1101099999
-  //   userId: 'db445a9cd7be4341a14448928014605c',
-  // };
+
   let projectId = ''; //  Pj1101099999
   if (location.pathname.indexOf('login') == -1 && token) {
     var localUser = localStorage.getItem('user') || '';
     currentUser = JSON.parse(localUser);
     projectId = currentUser?.projectId;
+    projectObj.projectId = currentUser?.projectId;
   }
   let companyConfig = {};
   if (currentUser?.userId) {

+ 0 - 1
src/config/api.js

@@ -3,4 +3,3 @@ export const BASE_PATH = '/api';
 //export const projectId = 'Pj1101080259';//博锐
 //export const projectId = 'Pj1101140020';//吉因加
 export const projectObj = { projectId: '' };
-export const user = {};

+ 20 - 21
src/hooks/useMenuList.ts

@@ -25,27 +25,26 @@ export default function () {
           },
         ],
       },
-
-      // {
-      //   title: '运营服务',
-      //   menus: [
-      //     // {
-      //     //   id: 'environment',
-      //     //   title: '环境信息',
-      //     //   icon: homeImgMap.environment,
-      //     // },
-      //     {
-      //       id: 'equipment',
-      //       title: '设备管理',
-      //       icon: homeImgMap.equipment,
-      //     },
-      //     // {
-      //     //   id: 'runtime',
-      //     //   title: '运行时间',
-      //     //   icon: homeImgMap.runtime,
-      //     // },
-      //   ],
-      // },
+      {
+        title: '运营服务',
+        menus: [
+          {
+            id: 'environment',
+            title: '环境信息',
+            icon: homeImgMap.environment,
+          },
+          {
+            id: 'equipment',
+            title: '设备管理',
+            icon: homeImgMap.equipment,
+          },
+          {
+            id: 'runtime',
+            title: '运行时间',
+            icon: homeImgMap.runtime,
+          },
+        ],
+      },
     ]);
     // setMenuList([
     //   // { name: '环境信息', id: 'environment' },

+ 1 - 1
src/layouts/index.jsx

@@ -123,7 +123,7 @@ export default (props) => {
         {location.pathname.indexOf('home') == -1 && (
           <div className={styles.right}>
             <div className={styles.picture}>
-              <Icon type="person" style={{ fontSize: 28 }}></Icon>
+              <img className={styles.userPic} src={initialState?.companyConfig?.headImgUrl} />
             </div>
             <div
               className={styles.notify}

+ 5 - 2
src/layouts/index.less

@@ -53,8 +53,11 @@
       width: 40px;
       height: 40px;
       margin-right: 24px;
-      //   background-color: #4f4f4f;
-      //   border-radius: 40px;
+      .userPic {
+        width: 40px;
+        height: 40px;
+        border-radius: 100%;
+      }
     }
     .notify {
       margin-right: 30px;

+ 3 - 0
src/sagacare_components/navMenu/index.less

@@ -24,6 +24,9 @@
     align-items: center;
     height: 120px;
     font-size: 22px;
+    .logo {
+      height: 70px;
+    }
   }
   .setOut {
     position: absolute;

+ 2 - 1
src/sagacare_components/navMenu/index.tsx

@@ -23,13 +23,14 @@ const NavMenu: React.FC = () => {
     console.log('location', location);
   }, [location]);
   const exitClick = () => {
+    closeMenu();
     localStorage.removeItem('token');
     history.replace('/login');
   };
   return (
     <div className={styles.drawerDiv}>
       <div className={styles.title}>
-        <img src={logo} style={{ height: 70 }}></img>
+        <img className={styles.logo} src={initialState?.companyConfig?.logoUrl} />
       </div>
       <div className={styles.setOut}>
         <Popover

+ 1 - 17
src/services/sagacare_service/environment.ts

@@ -8,13 +8,8 @@ function getProjectId() {
 }
 
 function commonParams() {
-  var userObj = UserStorage.getInstance();
-  const user = userObj.getUser();
   var pubname = 'sgadmin';
-
-  return `openid=${user.id}&pubname=${pubname}&projectId=${getProjectId()}&userId=${
-    user.id
-  }&userName=${user.name}&userPhone=${user.phone}`;
+  return `projectId=${getProjectId()}&pubname=${pubname}`;
 }
 
 export async function getMapList(body: any, options?: { [key: string]: any }) {
@@ -169,17 +164,6 @@ export async function querySpace(body: any, options?: { [key: string]: any }) {
   );
 }
 
-export async function checkToken(header: any, options?: { [key: string]: any }) {
-  return request<API.EnvironmentParam>(`/sgadmin/duoduo-service/setup-service/user/zjCheckToken`, {
-    method: 'GET',
-    from: 'sagacare',
-    headers: {
-      'Content-Type': 'application/json',
-      ...header,
-    },
-    ...(options || {}),
-  });
-}
 //http://10.100.28.79/sgadmin/sso//auth/zjFreshCheckToken
 export async function reFreshCheckToken(header: any, options?: { [key: string]: any }) {
   return request<API.EnvironmentParam>(`/sgadmin/sso/auth/zjFreshCheckToken`, {

+ 6 - 15
src/services/sagacare_service/equipment.js

@@ -10,12 +10,13 @@ function getProjectId() {
 }
 
 function commonParams() {
-  var userObj = UserStorage.getInstance();
-  const user = userObj.getUser();
+  // var userObj = UserStorage.getInstance();
+  // const user = userObj.getUser();
+  // return `openid=${user.id}&pubname=${pubname}&projectId=${getProjectId()}&userId=${
+  //   user.id
+  // }&userName=${user.name}&userPhone=${user.phone}`;
   var pubname = 'sgadmin';
-  return `openid=${user.id}&pubname=${pubname}&projectId=${getProjectId()}&userId=${
-    user.id
-  }&userName=${user.name}&userPhone=${user.phone}`;
+  return `projectId=${getProjectId()}&pubname=${pubname}`;
 }
 
 // function commonParams() {
@@ -212,11 +213,6 @@ export const changeAllAirHttp = (body) => {
 
 // 查询空间空调信息
 export const querySpaceConditioners = (params) => {
-  var userObj = UserStorage.getInstance();
-  const user = userObj.getUser();
-  var pubname = 'sgadmin';
-  var paramsss = `openid=${user.id}&pubname=${pubname}&projectId=Pj1101080255&userId=${user.id}&userName=${user.name}&userPhone=${user.phone}`;
-
   return request(
     `/sgadmin/duoduo-service/duoduoenv-service/ctrl/querySpaceConditioners?${commonParams()}&spaceId=${
       params.spaceId
@@ -233,11 +229,6 @@ export const querySpaceConditioners = (params) => {
 
 //  手动控制 下发指令
 export const changeManualTempHttp = (params) => {
-  var userObj = UserStorage.getInstance();
-  const user = userObj.getUser();
-  var pubname = 'sgadmin';
-  var paramsss = `openid=${user.id}&pubname=${pubname}&projectId=Pj1101080255&userId=${user.id}&userName=${user.name}&userPhone=${user.phone}`;
-
   return request(`/sgadmin/duoduo-service/duoduoenv-service/ctrl/set?${commonParams()}`, {
     method: 'POST',
     from: 'sagacare',