ipanel-rnapp-ajb-base 1.0.33 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/App.js CHANGED
@@ -111,6 +111,7 @@ if (Platform.OS === "android") {
111
111
  // ----yusm:安卓使用DeviceEventEmitter
112
112
  eventEmitter = DeviceEventEmitter;
113
113
  } else {
114
+ // 走这个的话需要IOS对事件进行枚举定义
114
115
  eventEmitter = new NativeEventEmitter(NativeModules.NativeToRNEmitter);
115
116
  }
116
117
  // 公共 栈路由页面
@@ -353,7 +354,7 @@ const App = () => {
353
354
  }
354
355
  );
355
356
 
356
- const homedLogOutListener = eventEmitter.addListener(
357
+ const homedLogOutListener = DeviceEventEmitter.addListener(
357
358
  "HomedLogout",
358
359
  async (data) => {
359
360
  console.log("HomedLogout", data);
@@ -13,7 +13,7 @@ export const ACCOUNT_SERVICE = `${config.IPANEL_CLOUD_BASE_URI}/s/account`;
13
13
 
14
14
  export const ADG_SERVICE = `${config.IPANEL_CLOUD_BASE_ADG_URI}/s/install_ea`;
15
15
 
16
- export const APARTMENT_SERVICE = "http://192.168.22.194:47070/smartapartment";
16
+ export const APARTMENT_SERVICE = `${config.IPANEL_CLOUD_BASE_URI}/s/smart_home_manage/admin-api`;
17
17
 
18
18
  // todo 云端获取token服务:https://ai.baidu.com/ai-doc/SPEECH/Mk38lxpgn
19
19
  export const baiduAsr = (cuid, len, speechBase64) => {
@@ -35,11 +35,14 @@ export const baiduAsr = (cuid, len, speechBase64) => {
35
35
  };
36
36
 
37
37
  export const getAreaOperatorModules = async (params) => {
38
- let url = `${
39
- ["禺乐慧家", "悦慧家", "吉柿果"].includes(appName)
40
- ? config.PANYU_MODULE_VERSION_URI
41
- : config.IPANEL_CLOUD_BASE_URI
42
- }/jshomeapp/api/getAreaOperatorModules`;
38
+ let url;
39
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
40
+ url = `${config.PANYU_MODULE_VERSION_URI}/jshomeapp/api/getAreaOperatorModules`
41
+ } else if ('吉柿果' === appName) {
42
+ url = `${config.JILIN_MODULE_VERSION_URI}/jshomeapp/api/getAreaOperatorModules`
43
+ } else {
44
+ url = `${config.IPANEL_CLOUD_BASE_URI}/jshomeapp/api/getAreaOperatorModules`
45
+ }
43
46
 
44
47
  // todo 本地调试测试临时处理,本地调试时模块列表暂时对接的是dev集群
45
48
  if (!NativeModules?.RNToNativeEmitter?.serverCluster) {
@@ -62,15 +65,19 @@ export const getAreaOperatorModules = async (params) => {
62
65
  : "",
63
66
  ...params,
64
67
  },
68
+ timeout: 10 * 1000
65
69
  });
66
70
  };
67
71
 
68
72
  export const getModuleVersionInfo = async (params) => {
69
- let url = `${
70
- ["禺乐慧家", "悦慧家", "吉柿果"].includes(appName)
71
- ? config.PANYU_MODULE_VERSION_URI
72
- : config.IPANEL_CLOUD_BASE_URI
73
- }/jshomeapp/api/moduleVersionInfo`;
73
+ let url;
74
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
75
+ url = `${config.PANYU_MODULE_VERSION_URI}/jshomeapp/api/moduleVersionInfo`
76
+ } else if ('吉柿果' === appName) {
77
+ url = `${config.JILIN_MODULE_VERSION_URI}/jshomeapp/api/moduleVersionInfo`
78
+ } else {
79
+ url = `${config.IPANEL_CLOUD_BASE_URI}/jshomeapp/api/moduleVersionInfo`
80
+ }
74
81
 
75
82
  // todo 本地调试测试临时处理,本地调试时模块列表暂时对接的是dev集群
76
83
  if (!NativeModules?.RNToNativeEmitter?.serverCluster) {
@@ -108,37 +115,49 @@ export const getUserInfo = (data) => {
108
115
  };
109
116
 
110
117
  export const obtainSmscode = (data, type) => {
118
+ const params = {
119
+ action: "obtain_smscode",
120
+ ...data,
121
+ };
122
+ if (["吉柿果"].includes(appName)) {
123
+ params.operator_id = "061aa081306a455da811639160763190";
124
+ }
111
125
  return request({
112
126
  url: type === "adg" ? ADG_SERVICE : ACCOUNT_SERVICE,
113
127
  method: "POST",
114
- data: {
115
- action: "obtain_smscode",
116
- ...data,
117
- },
128
+ data: params,
118
129
  });
119
130
  };
120
131
 
121
132
  export const smscodeLogin = (data, type) => {
133
+ const params = {
134
+ action: "smscode_regist", // 未注册的手机号会注册并登录,已注册的则直接登录
135
+ // action: 'smscode_login',
136
+ ...data,
137
+ };
138
+ if (["吉柿果"].includes(appName)) {
139
+ params.operator_id = "061aa081306a455da811639160763190";
140
+ }
122
141
  return request({
123
142
  url: type === "adg" ? ADG_SERVICE : ACCOUNT_SERVICE,
124
143
  method: "POST",
125
- data: {
126
- action: "smscode_regist", // 未注册的手机号会注册并登录,已注册的则直接登录
127
- // action: 'smscode_login',
128
- ...data,
129
- },
144
+ data: params,
130
145
  });
131
146
  };
132
147
 
133
148
  // 账号密码登录的方式
134
149
  export const accountLogin = (data, type) => {
150
+ const params = {
151
+ action: "account_login",
152
+ ...data,
153
+ };
154
+ if (["吉柿果"].includes(appName)) {
155
+ params.operator_id = "061aa081306a455da811639160763190";
156
+ }
135
157
  return request({
136
158
  url: type === "adg" ? ADG_SERVICE : ACCOUNT_SERVICE,
137
159
  method: "POST",
138
- data: {
139
- action: "account_login",
140
- ...data,
141
- },
160
+ data: params,
142
161
  });
143
162
  };
144
163
 
@@ -790,8 +809,23 @@ export const getDeviceStatusReportHistory = async (data) => {
790
809
  // 获取公寓token
791
810
  export const switchToken = async (params) => {
792
811
  return request({
793
- url: `${APARTMENT_SERVICE}/switch_token`,
794
- method: "GET",
812
+ url: `${APARTMENT_SERVICE}/house/account/login`,
813
+ method: "POST",
814
+ data: params,
815
+ });
816
+ };
817
+ // 获取用户类型-用于切换角色
818
+ export const getHouseType = async () => {
819
+ return request({
820
+ url: `${APARTMENT_SERVICE}/house/account/getType`,
821
+ method: 'GET',
822
+ });
823
+ };
824
+ // 通过用户类型登录
825
+ export const loginByType = async (id, params) => {
826
+ return request({
827
+ url: `${APARTMENT_SERVICE}/house/account/loginByType?userType=${id}`,
828
+ method: 'POST',
795
829
  data: params,
796
830
  });
797
831
  };
@@ -1,13 +1,13 @@
1
- import React, {useEffect, useRef, useState} from 'react';
2
- import {Text, View, TouchableHighlight} from 'react-native';
3
- import styles from './styles';
4
- import useLatest from '../../../hooks/useLatest';
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { Text, View, TouchableHighlight } from "react-native";
3
+ import styles from "./styles";
4
+ import useLatest from "../../../hooks/useLatest";
5
5
 
6
- import {Divider} from '@rneui/themed';
6
+ import { Divider } from "@rneui/themed";
7
7
 
8
8
  let timer = null;
9
9
 
10
- const BaseDialog = ({modelRef, setModalVisible, type}) => {
10
+ const BaseDialog = ({ modelRef, setModalVisible, type }) => {
11
11
  // confirm组件和custom组件
12
12
 
13
13
  // confirm组件component传string
@@ -18,6 +18,7 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
18
18
  console.log(111, value)
19
19
  },
20
20
  confirmButtonStyle: {}, (右边按钮样式)可选
21
+ cancelButtonStyle: {}, (左边按钮样式)可选
21
22
  cancelButtonText: string, (左边按钮文字)可选
22
23
  cancelCallback: () => {}, (左边触发事件)可选
23
24
  title: string, (标题)可选
@@ -48,7 +49,7 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
48
49
  }, []);
49
50
 
50
51
  const autoClose =
51
- typeof modelRef?.autoClose === 'undefined' ? true : modelRef?.autoClose;
52
+ typeof modelRef?.autoClose === "undefined" ? true : modelRef?.autoClose;
52
53
 
53
54
  // modelRef?.content;
54
55
  const component = useRef(modelRef?.component);
@@ -70,9 +71,10 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
70
71
  style={{
71
72
  ...styles.contentView,
72
73
  paddingHorizontal: 0,
73
- alignItems: component.current ? 'stretch' : 'center',
74
+ alignItems: component.current ? "stretch" : "center",
74
75
  ...(modelRef.containerStyle || {}),
75
- }}>
76
+ }}
77
+ >
76
78
  {!!modelRef?.title && (
77
79
  <View style={[styles.title, modelRef?.titleBoxStyle]}>
78
80
  <Text style={[styles.titleText, modelRef?.titleStyle]}>
@@ -81,9 +83,9 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
81
83
  </View>
82
84
  )}
83
85
  {/* 内容区 */}
84
- {typeof modelRef?.component === 'string' ? (
86
+ {typeof modelRef?.component === "string" ? (
85
87
  <View style={[modelRef?.contentStyle]}>
86
- <Text style={[{textAlign: 'center'}, modelRef?.contentTextStyle]}>
88
+ <Text style={[{ textAlign: "center" }, modelRef?.contentTextStyle]}>
87
89
  {modelRef?.component}
88
90
  </Text>
89
91
  </View>
@@ -100,8 +102,9 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
100
102
  style={[styles.cancelStyle, styles.buttonStyle]}
101
103
  onPress={() => {
102
104
  onCannel();
103
- }}>
104
- <Text style={styles.cancelTextStyle}>
105
+ }}
106
+ >
107
+ <Text style={[styles.cancelTextStyle, modelRef?.cancelButtonStyle]}>
105
108
  {modelRef?.cancelButtonText}
106
109
  </Text>
107
110
  </TouchableHighlight>
@@ -116,10 +119,11 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
116
119
  ]}
117
120
  onPress={() => {
118
121
  onConfirm();
119
- }}>
122
+ }}
123
+ >
120
124
  <Text style={[styles.confirmTextStyle, modelRef?.confirmButtonStyle]}>
121
125
  {modelRef?.confirmButtonText}
122
- {modelRef?.timeout ? `(${timeCount}s)` : ''}
126
+ {modelRef?.timeout ? `(${timeCount}s)` : ""}
123
127
  </Text>
124
128
  </TouchableHighlight>
125
129
  </View>
@@ -127,7 +131,7 @@ const BaseDialog = ({modelRef, setModalVisible, type}) => {
127
131
  );
128
132
  };
129
133
 
130
- const Confirm = ({content}) => {
134
+ const Confirm = ({ content }) => {
131
135
  return (
132
136
  <View style={styles.modalContent}>
133
137
  <Text style={styles.confirmText}>{content}</Text>
@@ -135,10 +139,10 @@ const Confirm = ({content}) => {
135
139
  );
136
140
  };
137
141
 
138
- const CustomComponent = ({component, modelRef}) => {
142
+ const CustomComponent = ({ component, modelRef }) => {
139
143
  return (
140
144
  <View style={[styles.modalContent, modelRef?.contentStyle]}>
141
- {typeof component === 'string' ? <Text>{component}</Text> : component}
145
+ {typeof component === "string" ? <Text>{component}</Text> : component}
142
146
  </View>
143
147
  );
144
148
  };
@@ -22,32 +22,38 @@ const Home = ({steps, active, onRef}) => {
22
22
  //const [defaultIndex,setDefaultIndex] = useState(0)
23
23
  const [pickedIndex, setPickedIndex] = useState();
24
24
  const [dataLength,setDataLength] = useState(0)
25
+ const columns = useRef([])
25
26
  useImperativeHandle(onRef, () => {
26
27
  return {
27
28
  show: (str,data) => {
28
29
  setDataLength(data?.payload?.columns.length||0)
29
30
  if(data?.payload?.columns.length){
31
+ columns.current = data?.payload?.columns || []
30
32
  setPickerTitle(data?.payload?.title)
31
- setPickerData(data?.payload?.columns.map((item)=>{
32
- if(data?.payload?.nameProp){
33
- item.label = item[data?.payload?.nameProp]
34
- item.value = item?.label;
35
- }else if(typeof item !== 'object'){
33
+
34
+ setPickerData(columns.current.map((item, index) => {
35
+ if (data?.payload?.nameProp) {
36
+ return {
37
+ ...item,
38
+ label: item[data?.payload?.nameProp],
39
+ value: index
40
+ }
41
+ } else if(typeof item !== 'object') {
36
42
  return {
37
- label:item,
38
- value:item,
43
+ label: item,
44
+ value: index,
39
45
  tag:'noNameProp'
40
46
  }
41
47
  }
42
- return item})||[]);
48
+ }));
43
49
  // console.log(data)
44
50
  setPickedIndex(data?.payload?.defaultIndex||0)
45
51
  setPickerVisible(true);
46
52
  //////animatedStartValue.value = 0;
47
- return new Promise((resolve,reject)=>{
53
+ return new Promise((resolve,reject)=>{
48
54
  backResult.current = (res)=>{
49
55
  if(res?.data?.tag === 'noNameProp'){
50
- res.data = res?.data.value
56
+ res.data = res?.data.value
51
57
  }
52
58
  resolve(res)
53
59
  }
@@ -65,31 +71,31 @@ const Home = ({steps, active, onRef}) => {
65
71
  setPickerVisible(false);
66
72
  setPickedIndex(0);
67
73
  // console.log(value);
68
- const data = pickerData.find(item => {
69
- return value[0] === item.value;
70
- });
71
- const index = pickerData.findIndex(item => {
72
- return value[0] === item.value;
73
- })
74
- backResult.current({data,index})
74
+ // const data = pickerData.find(item => {
75
+ // return value[0] === item.value;
76
+ // });
77
+ // const index = pickerData.findIndex(item => {
78
+ // return value[0] === item.value;
79
+ // })
80
+ backResult.current({data: columns.current[value[0]],index: value[0]})
75
81
  }
76
82
  return <PickerV2
77
- dataLength={dataLength}
78
- pickerData={pickerData}
79
- visible={visible}
80
- // defaultValue={[pickerData[defaultIndex]?.value]}
81
- title={pickerTitle}
82
- pickedIndex={pickedIndex}
83
- changePickedIndex={index => changePickedIndex(index)}
84
- dealPickerCommit={item => dealPickerCommit(item)}
85
- dealPickerCancel={() => {
86
- ////// animatedStartValue.value = 700;
87
- setPickerTitle()
88
- setPickerVisible(false);
89
- setPickedIndex(0);
90
- }}
91
- //////animatedStartValue={animatedStartValue.value}
92
- />
83
+ dataLength={dataLength}
84
+ pickerData={pickerData}
85
+ visible={visible}
86
+ // defaultValue={[pickerData[defaultIndex]?.value]}
87
+ title={pickerTitle}
88
+ pickedIndex={pickedIndex}
89
+ changePickedIndex={index => changePickedIndex(index)}
90
+ dealPickerCommit={item => dealPickerCommit(item)}
91
+ dealPickerCancel={() => {
92
+ ////// animatedStartValue.value = 700;
93
+ setPickerTitle()
94
+ setPickerVisible(false);
95
+ setPickedIndex(0);
96
+ }}
97
+ //////animatedStartValue={animatedStartValue.value}
98
+ />
93
99
  };
94
100
  const styles = StyleSheet.create({});
95
101
  export default Home;
@@ -1,5 +1,5 @@
1
1
  import {useEffect, useCallback, useRef, useState} from 'react';
2
- // import {PermissionsAndroid, Platform} from 'react-native';
2
+ import { NativeModules } from 'react-native';
3
3
 
4
4
  // import {format} from 'date-fns';
5
5
 
@@ -7,7 +7,7 @@ import storage from '../storage';
7
7
  import eventBus, {EVENTS} from '../eventBus';
8
8
  import config from '../utils/config';
9
9
  import {shopGenMsg} from '../utils/common';
10
-
10
+ const appName = NativeModules?.RNToNativeEmitter?.appName;
11
11
  let connectStatus = -1; // -1 连接中 0 连接成功 1连接失败
12
12
  let tryConnectTimes = 0;
13
13
  let seq_id = 0;
@@ -92,7 +92,10 @@ const ShopMessageManager = () => {
92
92
  const connectMsgServer = async connectCallback => {
93
93
  const token = await storage.get('accessToken');
94
94
  const accountData = await storage.get('accountData');
95
- const wsUrl = 'ws://192.168.36.241:9100/imchat';
95
+ let wsUrl = "wss://dev.ipanelcloud2.ipanel.cn:50443/s/ishopim/imchat";
96
+ if(["吉柿果"].includes(appName)) {
97
+ wsUrl = 'wss://icloud.homed.jishimedia.com:50443/s/ishopim/imchat';
98
+ }
96
99
  const connectParams = [
97
100
  `accesstoken=${token}`,
98
101
  `nick_name=${accountData?.user?.nickname}`,
@@ -25,6 +25,7 @@ const Hook = (addressId, roomId) => {
25
25
 
26
26
  const updateAddrList = async addrList => {
27
27
  await storage.set('addressList', addrList);
28
+ await storage.set('ordinaryAddressList', addrList);
28
29
  setAddressList(addrList);
29
30
 
30
31
  const oldActiveAddr = await storage.get('activeAddr');
@@ -44,6 +45,7 @@ const Hook = (addressId, roomId) => {
44
45
  const updateActiveAddr = addr => {
45
46
  setActiveAddr(addr);
46
47
  storage.set('activeAddr', addr);
48
+ storage.set('ordinaryActiveAddr', addr);
47
49
  };
48
50
 
49
51
  const mapModel = (brand, model) => {
@@ -40,6 +40,7 @@ const Hook = () => {
40
40
 
41
41
  const updateAddrList = async addrList => {
42
42
  await storage.set('addressList', addrList);
43
+ await storage.set('ordinaryAddressList', addrList);
43
44
  setAddressList(addrList);
44
45
 
45
46
  const oldActiveAddr = await storage.get('activeAddr');
@@ -61,6 +62,7 @@ const Hook = () => {
61
62
  const updateActiveAddr = addr => {
62
63
  setActiveAddr(addr);
63
64
  storage.set('activeAddr', addr);
65
+ storage.set('ordinaryActiveAddr', addr);
64
66
  };
65
67
 
66
68
  const mapModel = (brand, model) => {
@@ -315,6 +317,7 @@ const Hook = () => {
315
317
  });
316
318
  addrList = addrInfoRes?.result?.address_list || [];
317
319
  await storage.set('addressList', addrList);
320
+ await storage.set('ordinaryAddressList', addrList);
318
321
  const newActiveAddr = addrList.find(
319
322
  addr => oldActiveAddr && addr.address_id === oldActiveAddr.address_id,
320
323
  );
@@ -324,6 +327,7 @@ const Hook = () => {
324
327
  actualActiveAddr = addrList[0];
325
328
  }
326
329
  await storage.set('activeAddr', actualActiveAddr || {});
330
+ await storage.set('ordinaryActiveAddr', actualActiveAddr || {});
327
331
  }
328
332
 
329
333
  // 获取家庭下房间列表
@@ -554,6 +558,7 @@ const Hook = () => {
554
558
  };
555
559
  });
556
560
  await storage.set('addressList', newAddrList);
561
+ await storage.set('ordinaryAddressList', newAddrList);
557
562
  global.base.addressRoomMap = newAddressRoomMap;
558
563
  global.base.roomDeviceMap = newRoomDeviceMap;
559
564
  setAddressList(newAddrList);