소스 검색

unity通讯

xujunjie 1 년 전
부모
커밋
a511a35f50
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      src/pages/Controller/components/AirConditioner.js
  2. 2 2
      src/pages/Controller/components/Light.js

+ 2 - 2
src/pages/Controller/components/AirConditioner.js

@@ -1,8 +1,8 @@
 import { queryIotList } from '@/services/controller';
+import { UnityAction } from '@/utils/utils';
 import { useParams, useRequest } from '@umijs/max';
 import { Spin } from 'antd';
 import styles from '../index.less';
-import { UnityAction } from '@/utils/utils';
 
 const Work = (props) => {
   const { projectId } = useParams();
@@ -10,7 +10,7 @@ const Work = (props) => {
   const { data, loading } = useRequest(queryIotList, {
     defaultParams: [projectId],
     onSuccess(res) {
-      UnityAction.sendMsg('ACData', res.list);
+      UnityAction.sendMsg('ACData', JSON.stringify(res.list));
     },
   });
 

+ 2 - 2
src/pages/Controller/components/Light.js

@@ -1,8 +1,8 @@
 import { queryLightList } from '@/services/controller';
+import { UnityAction } from '@/utils/utils';
 import { useParams, useRequest } from '@umijs/max';
 import { Spin } from 'antd';
 import styles from '../index.less';
-import { UnityAction } from '@/utils/utils';
 
 const Work = (props) => {
   const { projectId } = useParams();
@@ -10,7 +10,7 @@ const Work = (props) => {
   const { data, loading } = useRequest(queryLightList, {
     defaultParams: [projectId],
     onSuccess(res) {
-      UnityAction.sendMsg('lightData', res.list);
+      UnityAction.sendMsg('lightData', JSON.stringify(res.list));
     },
   });