anxiaoxia 2 years ago
parent
commit
fcc84a924c

+ 9 - 1
config/proxy.ts

@@ -14,7 +14,15 @@ export default {
       //   target: 'http://10.100.28.79',
       changeOrigin: true,
       pathRewrite: {
-        '^/sgadmin/duoduo-service': '/duoduo-service',
+        '^/sgadmin/duoduo-service': '/sgadmin/duoduo-service',
+      },
+    },
+    '/sgadmin/sso': {
+      //target: 'https://duoduoenv.sagacloud.cn/',
+      target: 'http://10.100.28.79',
+      changeOrigin: true,
+      pathRewrite: {
+        '^/sgadmin/sso': '/sgadmin/sso',
       },
     },
   },

+ 4 - 0
config/routes.ts

@@ -27,6 +27,10 @@
         redirect: '/environment',
       },
       {
+        path: '/noAuth',
+        component: './NoAuth',
+      },
+      {
         path: '/environment',
         name: 'environment',
         component: './Environment',

+ 110 - 26
src/app.tsx

@@ -1,10 +1,8 @@
-import type { Settings as LayoutSettings } from '@ant-design/pro-layout';
 import { PageLoading } from '@ant-design/pro-layout';
-import { history } from 'umi';
-import { currentUser as queryCurrentUser } from './services/ant-design-pro/api';
-import defaultSettings from '../config/defaultSettings';
-
-const loginPath = '/user/login';
+import { history, useModel } from 'umi';
+import { checkToken, reFreshCheckToken } from '@/services/ant-design-pro/environment';
+import userData from '@/config/user';
+const loginPath = '/noAuth';
 
 /** 获取用户信息比较慢的时候会展示一个 loading */
 export const initialStateConfig = {
@@ -15,37 +13,123 @@ export const initialStateConfig = {
  * @see  https://umijs.org/zh-CN/plugins/plugin-initial-state
  * */
 export async function getInitialState(): Promise<{
-  settings?: Partial<LayoutSettings>;
+  // settings?: Partial<LayoutSettings>;
   currentUser?: API.CurrentUser;
-  loading?: boolean;
-  fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
+  fetchUser?: () => Promise<API.CurrentUser | undefined>;
+  //loading?: boolean;
+  //fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
 }> {
-  const fetchUserInfo = async () => {
+  const { location } = history;
+
+  let access_token: any = location.query.access_token;
+  let refresh_token: any = location.query.refresh_token;
+
+  //如果有值 存起来
+  if (access_token) {
+    localStorage.setItem('access_token', access_token);
+    console.log("localStorage.getItem('access_token')", localStorage.getItem('access_token'));
+  }
+  if (refresh_token) {
+    localStorage.setItem('refresh_token', refresh_token);
+  }
+  console.log('getInitialState');
+  //如果没有  取缓存
+  //   if (!refresh_token) {
+  //     refresh_token = localStorage.getItem('refresh_token');
+  //   }
+
+  const fetchUser = async () => {
     try {
-      const msg = await queryCurrentUser();
-      return msg.data;
-    } catch (error) {
-      // history.push(loginPath);
+      access_token = localStorage.getItem('access_token');
+      //if (!access_token) return; //随后去掉
+      //验证acces_token 获取用户数据
+      const res = await checkToken({ token: access_token });
+      var resUser = res.data;
+    } catch (err) {
+      history.push(loginPath);
     }
+    if (resUser) {
+      var userObj = userData.getInstance();
+      userObj.setUser(resUser);
+      return resUser;
+    } else {
+      history.push(loginPath);
+      return undefined;
+    }
+  };
 
-    return undefined;
+  const currentUser = await fetchUser();
+
+  const reFreshUser = async () => {
+    refresh_token = localStorage.getItem('refresh_token');
+    //刷新token 续约token
+    const res = await reFreshCheckToken({
+      zjfreshtoken: refresh_token,
+    });
+    if (res.refresh_token) {
+      console.log('refresh_token', res.refresh_token);
+      localStorage.setItem('refresh_token', res.refresh_token);
+      localStorage.setItem('access_token', res.access_token);
+    } else {
+      //如果刷新token失败
+      //history.push(loginPath);
+    }
+    //1分钟后再执行
+    setTimeout(() => {
+      // reFreshUser();
+    }, 60000);
   };
-  // 如果是登录页面,不执行
-  if (history.location.pathname !== loginPath) {
-    // const currentUser = await fetchUserInfo();
 
-    return {
-      fetchUserInfo,
-      //currentUser,
-      settings: defaultSettings,
-    };
-  }
+  //await reFreshUser();
+
+  // || {
+  //   companyId: '245e7060643811eb934c0237aedb39a6',
+  //   createDate: 1642388952000,
+  //   depName: '[["研发算法组","上格云","博锐尚格科技股份有限公司"]]',
+  //   firstUseTime: '2020-10-16 18:37:05',
+  //   id: '2d2440710d4548f3afa55c4e8244538e',
+  //   job: '研发工程师',
+  //   manageUserType: 1,
+  //   name: '赵小静',
+  //   phone: '18801040736',
+  //   projectId: 'Pj1101080259',
+  //   status: 2,
+  //   type: 1,
+  //   updateDate: 1642388952000,
+  // };
+
   return {
-    fetchUserInfo,
-    settings: defaultSettings,
+    currentUser,
+    fetchUser,
   };
 }
 
+export const request = {
+  requestInterceptors: [
+    (url: any, options: any) => {
+      return {
+        url,
+        options: {
+          ...options,
+          interceptors: true,
+        },
+      };
+    },
+  ],
+  responseInterceptors: [
+    async (response: any) => {
+      return response;
+    },
+  ],
+  errorHandler: (error: any) => {
+    const { response } = error;
+    if (!response) {
+      // message.error('您的网络发生异常,无法连接服务器');
+    }
+    throw error;
+  },
+};
+
 // ProLayout 支持的api https://procomponents.ant.design/components/layout
 // export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
 //   return {

+ 6 - 4
src/assets/css/map.less

@@ -134,17 +134,19 @@
       text-align: center;
     }
   }
-  .searchSel {
-    border-color: rgba(77, 148, 255, 0.8);
-  }
+
   .notclick {
     background: url(../images/bg_disable.png) repeat;
-    border: 2px solid #dfe3ed;
+    border-color: #dfe3ed;
     cursor: default;
     .contentDiv {
       background-color: #eceff4;
     }
   }
+
+  .searchSel {
+    border-color: rgba(77, 148, 255, 0.8);
+  }
 }
 
 .equipmentMap {

+ 1 - 2
src/components/map/index.tsx

@@ -4,7 +4,6 @@ import { useModel } from 'umi';
 
 import cx from 'classnames';
 import Icon from '@/tenants-ui/Icon';
-import user from 'mock/user';
 
 type MapProps = {
   type: string;
@@ -173,7 +172,7 @@ const Map: React.FC<MapProps> = ({ type, selFloorId, render, mapList, mapSize })
       var mapWrapHeight = (mapRef.current || {}).clientHeight || 0;
       //   left = left * mscale + mapWrapWidth / 2;
       //   top = top * mscale + mapWrapHeight / 2;
-      debugger;
+
       setTranslateX(left * mscale + mapWrapWidth / 2);
       setTranslateY(top * mscale + mapWrapHeight / 2);
       changeSearchBuildId(''); //清空搜索记录  以防两次搜索一样的建筑的 没反应

+ 2 - 2
src/config/api.js

@@ -1,3 +1,3 @@
 export const BASE_PATH = '/api';
-// export const projectId = 'Pj3301100002';
-export  const projectId = 'Pj1101080259';
+export const projectId = 'Pj3301100002';//之江
+//export const projectId = 'Pj1101080259';

+ 19 - 0
src/config/user.ts

@@ -0,0 +1,19 @@
+class UserData {
+  private static instance: UserData;
+  private constructor() {}
+  private user: any = { name: '' };
+
+  static getInstance() {
+    if (!this.instance) {
+      this.instance = new UserData();
+    }
+    return this.instance;
+  }
+  public setUser(user: any) {
+    this.user = user;
+  }
+  public getUser() {
+    return this.user;
+  }
+}
+export default UserData;

+ 33 - 4
src/layouts/index.jsx

@@ -9,20 +9,29 @@ import NavMenu from '@/components/navMenu';
 
 export default (props) => {
   const { menuVisible, closeMenu, toggleMenu } = useModel('controller');
-
+  const { initialState, setInitialState } = useModel('@@initialState');
   const [notifyList] = useState([
     {
       title: '管理员操作指南',
       id: 'notify1',
       content: '具体介绍管理员权限下的管理功能及相关操作说明。',
+      name: '行政端操作指南.pdf',
+      url: 'http://10.100.28.79/image-service/common/file_get?systemId=dataPlatform&key=%E8%A1%8C%E6%94%BF%E7%AB%AF%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C20220419.pdf',
+    },
+    {
+      title: 'sagacare介绍',
+      id: 'notify2',
+      content: '环境健康主动管理服务',
+      name: 'saga销售手册.pdf',
+      url: 'http://10.100.28.79/image-service/common/file_get?systemId=dataPlatform&key=sagacare%E4%BB%8B%E7%BB%8D.pdf',
     },
-    { title: 'sagacare介绍', id: 'notify2', content: '环境健康主动管理服务' },
   ]);
   const showMenuClick = () => {
     toggleMenu();
   };
 
   const openNotification = () => {
+    //打开通知框
     notifyList.map((item, index) => {
       notification.open({
         key: item.id,
@@ -30,17 +39,26 @@ export default (props) => {
         description: item.content,
         duration: 0,
         onClick: () => {
-          console.log('Notification Clicked!');
+          console.log('Notification Clicked!', item);
+          // 下载pdf 需产品给出
+          //const downLoadUrl = '';
+          const a = document.createElement('a');
+          a.href = item.url;
+          a.target = '_blank';
+          a.download = item.name;
+          a.click();
         },
         icon: <SmileOutlined style={{ color: '#108ee9', fontSize: 32 }} />,
         style: {
           width: 400,
           borderRadius: 30,
+          cursor: 'pointer',
         },
         closeIcon: <></>,
       });
     });
   };
+  //关闭提醒框
   const closeNotify = () => {
     //console.log('close-notify');
     notifyList.map((item, index) => {
@@ -48,7 +66,18 @@ export default (props) => {
     });
   };
 
-  useEffect(() => {
+  useEffect(async () => {
+    // debugger;
+    // console.log('enviroment-layout', initialState);
+    // const currentUser = await initialState?.fetchUser?.();
+    // debugger;
+    // if (currentUser) {
+    //   setInitialState((s) => {
+    //     return { ...s, currentUser: currentUser };
+    //   });
+    // }
+
+    //关闭
     document.querySelector('#root').addEventListener('click', closeNotify, true);
     const { REACT_APP_ENV } = process.env;
     console.log('REACT_APP_ENV', REACT_APP_ENV);

+ 1 - 1
src/pages/Environment/index.tsx

@@ -275,7 +275,7 @@ const Environment: React.FC = () => {
                 <div
                   className={cx(mapstyles.house, {
                     [mapstyles.notclick]: !item.roomFuncType,
-                    [mapstyles.searchSel]: item.spaceId == searchSpace.spaceId,
+                    [mapstyles.searchSel]: item.spaceId && item.spaceId === searchSpace.spaceId,
                   })}
                   style={{
                     background: item.roomFuncType

+ 5 - 3
src/pages/Equipment/checLampStatus.js

@@ -36,7 +36,7 @@ export const judgeChangeResponeseSuccess = (response, paramsArr, fn) => {
             checkChangeLightStatusSuccess(paramsArr, resultArr, fn);
         }, 500);
     } else {
-        fn(); // 查询灯设备
+        fn && fn(); // 查询灯设备
     }
     /*
     if (result.result === 'success') {
@@ -62,9 +62,11 @@ export const judgeChangeResponeseSuccess = (response, paramsArr, fn) => {
 };
 
 //  开关
-export const setallLamps = (paramsArr, fn,waitSetResultFlag) => {
+export const setallLamps = (paramsArr, fn, waitSetResultFlag) => {
+    //debugger;
     setallLampHttp(paramsArr).then((res) => {
-        waitSetResultFlag.current = false
+        //debugger;
+        waitSetResultFlag && (waitSetResultFlag.current = false);
         judgeChangeResponeseSuccess(res, paramsArr, fn);
     });
 };

+ 14 - 14
src/pages/Equipment/components/topNavRight/index.tsx

@@ -46,10 +46,10 @@ const TopNavRight: React.FC<topNavRightProps> = ({
         var filterSpaceArr = mapList.filter((item) => {
           return item[selNavObj.id] !== 1;
         });
-        var filterSpaceArr2 = filterSpaceArr.filter((item) => {
-          return item.localName == '图书休闲区' || item.localName == '上格云3';
-        });
-        console.log('开启filterSpaceArr', filterSpaceArr2);
+        // var filterSpaceArr2 = filterSpaceArr.filter((item) => {
+        //   return item.localName == '图书休闲区' || item.localName == '上格云3';
+        // });
+        console.log('开启filterSpaceArr', filterSpaceArr);
         function getDeviceStatus() {
           var interval = setInterval(() => {
             queryDeviceManage();
@@ -62,13 +62,13 @@ const TopNavRight: React.FC<topNavRightProps> = ({
         //如果是空调
         if (filterSpaceArr.length == 0) return;
         if (selNavObj.id == 'airConditioner') {
-          changeAllAir(filterSpaceArr2, getDeviceStatus, '打开', projectId);
+          changeAllAir(filterSpaceArr, getDeviceStatus, '打开', projectId);
         }
         if (selNavObj.id == 'light') {
-          changeLight('all', filterSpaceArr2, getDeviceStatus, '打开');
+          changeLight('all', filterSpaceArr, getDeviceStatus, '打开');
         }
         if (selNavObj.id == 'curtain') {
-          changeCurtain('all', filterSpaceArr2, getDeviceStatus, '打开'); // '关闭' : '打开';
+          changeCurtain('all', filterSpaceArr, getDeviceStatus, '打开'); // '关闭' : '打开';
         }
       },
       onCancel() {
@@ -90,10 +90,10 @@ const TopNavRight: React.FC<topNavRightProps> = ({
         var filterSpaceArr = mapList.filter((item) => {
           return item[selNavObj.id] !== 0;
         });
-        var filterSpaceArr2 = filterSpaceArr.filter((item) => {
-          return item.localName == '图书休闲区' || item.localName == '上格云3';
-        });
-        console.log('关闭filterSpaceArr', filterSpaceArr2);
+        // var filterSpaceArr2 = filterSpaceArr.filter((item) => {
+        //   return item.localName == '图书休闲区' || item.localName == '上格云3';
+        // });
+        console.log('关闭filterSpaceArr', filterSpaceArr);
         //return;
         function getDeviceStatus() {
           var interval = setInterval(() => {
@@ -106,13 +106,13 @@ const TopNavRight: React.FC<topNavRightProps> = ({
         }
         //如果是空调
         if (selNavObj.id == 'airConditioner') {
-          changeAllAir(filterSpaceArr2, getDeviceStatus, '打开', projectId);
+          changeAllAir(filterSpaceArr, getDeviceStatus, '关闭', projectId);
         }
         if (selNavObj.id == 'light') {
-          changeLight('all', filterSpaceArr2, getDeviceStatus, '关闭');
+          changeLight('all', filterSpaceArr, getDeviceStatus, '关闭');
         }
         if (selNavObj.id == 'curtain') {
-          changeCurtain('all', filterSpaceArr2, getDeviceStatus, '关闭');
+          changeCurtain('all', filterSpaceArr, getDeviceStatus, '关闭');
         }
       },
       onCancel() {

+ 11 - 12
src/pages/Equipment/equipmentControl.js

@@ -15,6 +15,8 @@ import { setallLamps } from '@/pages/Equipment/checLampStatus.js';
 
 //开关 单个或者全部灯
 export const changeLight = (type, itemarr, getDeviceStatus, status) => {
+    //const { initialState } = useModel('@@initialState');//这里面不能这么用
+    //debugger;
     const setType = status === '打开' ? true : false; // 10关闭 12开启
     var paramsArr = [];
     itemarr.forEach((citem) => {
@@ -52,7 +54,7 @@ export const changeCurtain = (type, itemarr, getDeviceStatus, status) => {
     setEquipeHttp(paramsArr);
     message.success('指令下发成功');
     //这是在手动改变状态
-    getDeviceStatus();
+    getDeviceStatus && getDeviceStatus();
 };
 
 //开关单个空调      0是关闭 1 是开启  2 是部分开启
@@ -71,7 +73,7 @@ export const changeAir = (sitem, index, getDeviceStatus) => {
             // var mapCopy = JSON.parse(JSON.stringify(mapCombineList));
             // mapCopy[index]['airConditioner'] = res.isClose ? 0 : 1;
             // setMapCombineList(mapCopy);
-            getDeviceStatus();
+            getDeviceStatus && getDeviceStatus();
         } else {
             message.error('操作失败,请重试');
         }
@@ -94,7 +96,7 @@ export const changeAllAir = (itemarr, getDeviceStatus, status, projectId) => {
     changeAllAirHttp(paramsArr).then((res) => {
         if (res.result == 'success') {
             message.success('指令下发成功');
-            getDeviceStatus();
+            getDeviceStatus && getDeviceStatus();
         } else {
             message.error('操作失败,请重试');
         }
@@ -117,22 +119,19 @@ export const getLamp = (sitem, callback, num) => {
         });
         //说明状态改变
         if (sitem.light !== totalIsOpen) {
-            callback(totalIsOpen);
-          
+            callback && callback(totalIsOpen);
             return;
         } else if (num == 0) {
             return;
         }
-      
-        getLamp(sitem, callback, num);
-
 
+        getLamp(sitem, callback, num);
 
     });
 };
 //查询 单个空调的状态
 export const getAirInfo = (sitem, callback, num, projectId) => {
-    debugger;
+
     num = num - 1;
     const paramsObj = {
         objectId: sitem.id,
@@ -144,13 +143,13 @@ export const getAirInfo = (sitem, callback, num, projectId) => {
 
         //说明状态改变
         if (sitem.airConditioner !== totalIsOpen) {
-            callback(totalIsOpen);
-            debugger;
+            callback && callback(totalIsOpen);
+            //debugger;
             return;
         } else if (num == 0) {
             return;
         }
-        debugger;
+        // debugger;
         getAirInfo(sitem, callback, num, projectId);
 
     });

+ 6 - 5
src/pages/Equipment/index.tsx

@@ -89,9 +89,7 @@ const Environment: React.FC = () => {
   const [mapSize, setMapSize] = useState<any>({});
 
   const [equipMapList, setEquipMapList] = useState<any[]>([]);
-  const [equipMapListFloorId, setEquipMapListFloorId] = useState<string>();
   const [timeMapList, setTimeMapList] = useState<any[]>([]);
-  const [timeMapListFloorId, setTimeMapListFloorId] = useState<string>();
 
   const [selNav, setSelNav] = useState<navigatorItem>(navigatorList[0]);
   const [selFloorId, setSelFloorId] = useState<string>();
@@ -191,14 +189,17 @@ const Environment: React.FC = () => {
             //执行查询函数
             getAirInfo(item, callback, 10, projectId);
           }
-          changeAir(item, index, getDeviceStatus);
+          //changeAir(item, index, getDeviceStatus);
+          changeAir(item, index, callback);
         }
         if (selNav.id == 'light') {
           function getDeviceStatus() {
             //请求状态 10是指循环调10次
             getLamp(item, callback, 10);
           }
-          changeLight('one', [item], getDeviceStatus, status);
+          //debugger;
+          // changeLight('one', [item], getDeviceStatus, status);
+          changeLight('one', [item], callback, status);
         }
         if (selNav.id == 'curtain') {
           changeCurtain('one', [item], callback, status);
@@ -408,7 +409,7 @@ const Environment: React.FC = () => {
                     className={cx(mapstyles.house, {
                       [mapstyles.notclick]:
                         !item.roomFuncType || (selNav.id !== 'all' && item[selNav.id] == 'not'),
-                      [mapstyles.searchSel]: item.spaceId == searchSpace.spaceId,
+                      [mapstyles.searchSel]: item.spaceId && item.spaceId === searchSpace.spaceId,
                     })}
                     onClick={(event) => {
                       event.stopPropagation();

+ 19 - 0
src/pages/NoAuth/index.less

@@ -0,0 +1,19 @@
+.headerRight {
+  display: flex;
+  align-items: center;
+  .check {
+    margin-left: 20px;
+    cursor: pointer;
+  }
+}
+
+.maptop {
+  box-sizing: border-box;
+  height: 44px;
+  padding-top: 10px;
+  padding-right: 20px;
+  .right {
+    float: right;
+    width: 210px;
+  }
+}

+ 6 - 0
src/pages/NoAuth/index.tsx

@@ -0,0 +1,6 @@
+import React, { useState, useEffect } from 'react';
+
+const NoAuth: React.FC = () => {
+  return <>没有权限,请关闭当前页面,重新从能源进入。</>;
+};
+export default NoAuth;

+ 1 - 1
src/pages/Runtime/index.tsx

@@ -205,7 +205,7 @@ const Runtime: React.FC = () => {
                   key={index + 'house'}
                   className={cx(mapstyles.house, {
                     [mapstyles.notclick]: !item.roomFuncType,
-                    [mapstyles.searchSel]: item.spaceId == searchSpace.spaceId,
+                    [mapstyles.searchSel]: item.spaceId && item.spaceId === searchSpace.spaceId,
                   })}
                   style={{
                     background: item.roomFuncType

+ 51 - 20
src/services/ant-design-pro/environment.ts

@@ -1,21 +1,25 @@
 /** 登录接口 POST /api/login/account */
 import { request } from 'umi';
-import { projectId } from '@/config/api.js';
+import { projectId } from '@/config/api';
+import userData from '@/config/user';
 
 export async function getMapList(body: any, options?: { [key: string]: any }) {
-  return request<API.MapInfoRes>('/sgadmin/duoduo-service/setup-service/map/queryMapInfo', {
-    method: 'POST',
-    headers: {
-      'Content-Type': 'application/json',
+  return request<API.MapInfoRes>(
+    `/sgadmin/duoduo-service/setup-service/map/queryMapInfo?${commonParams()}`,
+    {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      ...(options || {}),
+      data: body,
     },
-    ...(options || {}),
-    data: body,
-  });
+  );
 }
 export async function getBuildingList(body: any, options?: { [key: string]: any }) {
   //debugger;
   return request<API.BuildFloorList>(
-    '/sgadmin/duoduo-service/object-service/object/building/query',
+    `/sgadmin/duoduo-service/object-service/object/building/query?${commonParams()}`,
     {
       method: 'POST',
       headers: {
@@ -28,19 +32,22 @@ export async function getBuildingList(body: any, options?: { [key: string]: any
 }
 export async function getFloorList(body: any, options?: { [key: string]: any }) {
   // debugger;
-  return request<API.BuildFloorList>('/sgadmin/duoduo-service/object-service/object/floor/query', {
-    method: 'POST',
-    headers: {
-      'Content-Type': 'application/json',
+  return request<API.BuildFloorList>(
+    `/sgadmin/duoduo-service/object-service/object/floor/query?${commonParams()}`,
+    {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      ...(options || {}),
+      data: body,
     },
-    ...(options || {}),
-    data: body,
-  });
+  );
 }
 export async function queryDeviceTimeManage(params: any, options?: { [key: string]: any }) {
   //  '/api3/duoduo-service/setup-service/deviceManage/queryDeviceTimeManage'
   return request<API.DeviceTimeType>(
-    '/sgadmin/duoduo-service/setup-service/deviceManage/queryDeviceTimeManage',
+    `/sgadmin/duoduo-service/setup-service/deviceManage/queryDeviceTimeManage?${commonParams()}`,
     {
       method: 'GET',
       params: {
@@ -57,12 +64,14 @@ function getProjectId() {
 }
 
 function commonParams() {
-  return `openid=9a1ecfbacb6b4f249bf2dd3ec7793ead&pubname=sagacareAndtenantslink&projectId=${getProjectId()}&userName=%E5%AE%89%E5%B0%8F%E9%9C%9E&userPhone=17611228068&userId=9a1ecfbacb6b4f249bf2dd3ec7793ead`;
+  var userObj = userData.getInstance();
+  const user = userObj.getUser();
+  return `openid=${user.id}&pubname=sgadmin&projectId=${getProjectId()}&userId=${user.id}`;
 }
 // chart
 export async function queryPropertyData(params: any, options?: { [key: string]: any }) {
   return request<API.DeviceTimeType>(
-    `/sgadmin/duoduo-service/duoduoenv-service/spaceAdjust/queryPropertyData?${commonParams()}`,
+    `/sgadmin/duoduo-service/duoduoenv-service/spaceAdjust/queryPropertyData`,
     {
       method: 'GET',
       params: params,
@@ -104,7 +113,7 @@ export async function queryEquipStatistics(params: any, options?: { [key: string
 export async function querySpace(body: any, options?: { [key: string]: any }) {
   //
   return request<API.EnvironmentParam>(
-    `/sgadmin/duoduo-service/object-service/object/space/query`,
+    `/sgadmin/duoduo-service/object-service/object/space/query?${commonParams()}`,
     {
       method: 'POST',
       headers: {
@@ -115,3 +124,25 @@ 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',
+    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`, {
+    method: 'GET',
+    headers: {
+      'Content-Type': 'application/json',
+      ...header,
+    },
+    ...(options || {}),
+  });
+}

+ 4 - 1
src/services/ant-design-pro/equipment.js

@@ -1,5 +1,6 @@
 import { request } from 'umi';
 import { projectId } from '@/config/api.js';
+import userData from '@/config/user';
 
 function getProjectId() {
     //const id = window.localStorage.getItem('localProjectId')
@@ -8,7 +9,9 @@ function getProjectId() {
 }
 
 function commonParams() {
-    return `openid=9a1ecfbacb6b4f249bf2dd3ec7793ead&pubname=sagacareAndtenantslink&projectId=${getProjectId()}&userName=%E5%AE%89%E5%B0%8F%E9%9C%9E&userPhone=17611228068&userId=9a1ecfbacb6b4f249bf2dd3ec7793ead`;
+    var userObj = userData.getInstance();
+     const user = userObj.getUser();
+    return `openid=${user.id}&pubname=sgadmin&projectId=${getProjectId()}&userId=${user.id}`;
 }
 
 

+ 1 - 0
src/services/ant-design-pro/typings.d.ts

@@ -21,6 +21,7 @@ declare namespace API {
     };
     address?: string;
     phone?: string;
+    [key: string]: any;
   };
 
   type LoginResult = {