ipanel-rnapp-ajb-base 1.0.0

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.
Files changed (155) hide show
  1. package/app/.local_dev/DemoPage.js +46 -0
  2. package/app/.local_dev/env.js +1 -0
  3. package/app/.local_dev/polyfill.js +83 -0
  4. package/app/App.js +485 -0
  5. package/app/api/homedApi.js +42 -0
  6. package/app/api/index.js +2 -0
  7. package/app/api/ipanelCloudApi.js +796 -0
  8. package/app/assets/img/add.png +0 -0
  9. package/app/assets/img/add_img.png +0 -0
  10. package/app/assets/img/album.png +0 -0
  11. package/app/assets/img/album2.png +0 -0
  12. package/app/assets/img/album3.png +0 -0
  13. package/app/assets/img/album@2x.png +0 -0
  14. package/app/assets/img/album@3x.png +0 -0
  15. package/app/assets/img/audioRecordBar.png +0 -0
  16. package/app/assets/img/bootom_bar_bg.png +0 -0
  17. package/app/assets/img/close.png +0 -0
  18. package/app/assets/img/computer.png +0 -0
  19. package/app/assets/img/confirm.png +0 -0
  20. package/app/assets/img/delete_pic.png +0 -0
  21. package/app/assets/img/disabled.png +0 -0
  22. package/app/assets/img/goBack.png +0 -0
  23. package/app/assets/img/goBack2.png +0 -0
  24. package/app/assets/img/ischeck.png +0 -0
  25. package/app/assets/img/launch_bg.png +0 -0
  26. package/app/assets/img/launch_bg_panyu.png +0 -0
  27. package/app/assets/img/launch_logo.png +0 -0
  28. package/app/assets/img/launch_logo_panyu.png +0 -0
  29. package/app/assets/img/launch_text.png +0 -0
  30. package/app/assets/img/launch_text_panyu.png +0 -0
  31. package/app/assets/img/link.png +0 -0
  32. package/app/assets/img/login_bg.png +0 -0
  33. package/app/assets/img/login_bg_new.png +0 -0
  34. package/app/assets/img/login_left.png +0 -0
  35. package/app/assets/img/login_right.png +0 -0
  36. package/app/assets/img/nocheck.png +0 -0
  37. package/app/assets/img/personal.png +0 -0
  38. package/app/assets/img/photo.png +0 -0
  39. package/app/assets/img/photo@2x.png +0 -0
  40. package/app/assets/img/photo@3x.png +0 -0
  41. package/app/assets/img/protocol_checked.png +0 -0
  42. package/app/assets/img/qiehuan.png +0 -0
  43. package/app/assets/img/scan_border_bottom_left.png +0 -0
  44. package/app/assets/img/scan_border_bottom_right.png +0 -0
  45. package/app/assets/img/scan_border_top_left.png +0 -0
  46. package/app/assets/img/scan_border_top_right.png +0 -0
  47. package/app/assets/img/scan_move.png +0 -0
  48. package/app/assets/img/szjt.png +0 -0
  49. package/app/assets/img/tab.png +0 -0
  50. package/app/assets/img/tykz.png +0 -0
  51. package/app/assets/img/update_bg.png +0 -0
  52. package/app/assets/img/video.png +0 -0
  53. package/app/assets/img/video@2x.png +0 -0
  54. package/app/assets/img/video@3x.png +0 -0
  55. package/app/assets/img/worker.png +0 -0
  56. package/app/assets/img/wx.png +0 -0
  57. package/app/assets/img/ykq.png +0 -0
  58. package/app/assets/img/zfb.png +0 -0
  59. package/app/base.js +342 -0
  60. package/app/components/VersionUpdateConfirm.js +117 -0
  61. package/app/components/common/AccordionCell/index.js +67 -0
  62. package/app/components/common/ActionPicker/BasicPicker.js +136 -0
  63. package/app/components/common/ActionPicker/index.js +106 -0
  64. package/app/components/common/AddressPicker/index.js +211 -0
  65. package/app/components/common/Card/index.js +19 -0
  66. package/app/components/common/Cell/index.js +381 -0
  67. package/app/components/common/CustomDialog/index.js +120 -0
  68. package/app/components/common/CustomTabBar/index.js +157 -0
  69. package/app/components/common/CustomTabBar_bak/TabBarInput.js +210 -0
  70. package/app/components/common/CustomTabBar_bak/index.js +832 -0
  71. package/app/components/common/DateTimingPicker/index.js +254 -0
  72. package/app/components/common/Dialog/Notify.js +36 -0
  73. package/app/components/common/Dialog/baseDialog.js +146 -0
  74. package/app/components/common/Dialog/index.js +113 -0
  75. package/app/components/common/Dialog/prompt.js +145 -0
  76. package/app/components/common/Dialog/quickSelect.js +54 -0
  77. package/app/components/common/Dialog/select.js +125 -0
  78. package/app/components/common/Dialog/styles.js +167 -0
  79. package/app/components/common/Loading/index.js +71 -0
  80. package/app/components/common/LoginType/index.js +171 -0
  81. package/app/components/common/LoginType/protocol.js +160 -0
  82. package/app/components/common/Notify/index.js +68 -0
  83. package/app/components/common/OnceTouchable/index.js +33 -0
  84. package/app/components/common/PaymentPicker/index.js +264 -0
  85. package/app/components/common/ProductOrderPicker/index.js +524 -0
  86. package/app/components/common/ScreenBackHeader/index.js +144 -0
  87. package/app/components/common/ScrollPicker/index.js +232 -0
  88. package/app/components/common/SelectPicker/index.js +171 -0
  89. package/app/components/common/SmsCodeInput/index.js +93 -0
  90. package/app/components/common/SmsCodeInput/indexNew.js +101 -0
  91. package/app/components/common/Steps/index.js +126 -0
  92. package/app/components/common/Tag/index.js +17 -0
  93. package/app/components/common/Toast/index.js +103 -0
  94. package/app/components/common/WeekDaysPicker/index.js +196 -0
  95. package/app/components/index.js +8 -0
  96. package/app/components/iot/AddDeviceActionSheet/index.js +934 -0
  97. package/app/components/iot/AddressActionSheet/index.js +91 -0
  98. package/app/components/iot/RoomActionSheet/index.js +205 -0
  99. package/app/components/iot/ViewDeviceActionSheet/index.js +834 -0
  100. package/app/components/sheets.js +30 -0
  101. package/app/eventBus/index.js +54 -0
  102. package/app/hooks/checkLogin.js +30 -0
  103. package/app/hooks/shopMessageManager.js +308 -0
  104. package/app/hooks/useAddress.js +179 -0
  105. package/app/hooks/useAddress2.js +587 -0
  106. package/app/hooks/useDebounceFn.js +6 -0
  107. package/app/hooks/useDynamicPackages.js +22 -0
  108. package/app/hooks/useKeyboard.js +25 -0
  109. package/app/hooks/useLatest.js +10 -0
  110. package/app/hooks/useMessageManager.js +368 -0
  111. package/app/hooks/useNavigationFocus.js +19 -0
  112. package/app/hooks/useUser.js +56 -0
  113. package/app/screens/BaseScreen.js +389 -0
  114. package/app/screens/CommonScreens/BindPhoneScreen/index.js +179 -0
  115. package/app/screens/CommonScreens/BossScreen/index.js +138 -0
  116. package/app/screens/CommonScreens/DeviceAnswerDetailScreen/index.js +50 -0
  117. package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +365 -0
  118. package/app/screens/CommonScreens/EditInvoiceTitleScreen/index.js +279 -0
  119. package/app/screens/CommonScreens/FamilyDetailScreen/index.js +421 -0
  120. package/app/screens/CommonScreens/InvoiceTitleListScreen/index.js +118 -0
  121. package/app/screens/CommonScreens/OperatorSelectScreen/index.js +315 -0
  122. package/app/screens/CommonScreens/PersonalScreen/index.js +348 -0
  123. package/app/screens/CommonScreens/ScanQRCodeScreen/index.js +407 -0
  124. package/app/screens/CommonScreens/TvAlbumScreen/index.js +407 -0
  125. package/app/screens/LoginScreen/OpenLogSheet.js +241 -0
  126. package/app/screens/LoginScreen/index.js +920 -0
  127. package/app/screens/LoginScreen/indexNew.js +1354 -0
  128. package/app/screens/ResePassword/index.js +364 -0
  129. package/app/screens/SbkScreen.js +19 -0
  130. package/app/screens/WebviewScreen.js +41 -0
  131. package/app/storage/index.js +166 -0
  132. package/app/utils/EventEmitter.js +43 -0
  133. package/app/utils/RootNavigation.js +32 -0
  134. package/app/utils/SBK_plugin/convert.js +90 -0
  135. package/app/utils/SBK_plugin/convertStatus.js +250 -0
  136. package/app/utils/SBK_plugin/eventProcess.js +339 -0
  137. package/app/utils/SBK_plugin/index.js +32 -0
  138. package/app/utils/SBK_plugin/ipanelDeviceToSbkDevice.js +68 -0
  139. package/app/utils/SBK_plugin/sbk_defs.js +191 -0
  140. package/app/utils/StyleComposite.js +37 -0
  141. package/app/utils/applyPermissions.js +251 -0
  142. package/app/utils/bundleUpdater.js +46 -0
  143. package/app/utils/common.js +380 -0
  144. package/app/utils/config.js +47 -0
  145. package/app/utils/errCodes.js +3 -0
  146. package/app/utils/homedData.js +57 -0
  147. package/app/utils/http.js +178 -0
  148. package/app/utils/notice.js +15 -0
  149. package/app/utils/priceConversion.js +30 -0
  150. package/app/utils/registerDialog.js +90 -0
  151. package/app/utils/scaleSize.js +12 -0
  152. package/app/utils/soundPlayer.js +85 -0
  153. package/bin/local-dev.js +7 -0
  154. package/index.js +8 -0
  155. package/package.json +18 -0
@@ -0,0 +1,407 @@
1
+ import {RNCamera} from 'react-native-camera';
2
+ import React, {Component} from 'react';
3
+ import {
4
+ Modal,
5
+ StyleSheet,
6
+ Animated,
7
+ Platform,
8
+ Image,
9
+ TouchableOpacity,
10
+ default as Easing,
11
+ Dimensions,
12
+ NativeModules,
13
+ } from 'react-native';
14
+ import {View, Text} from 'react-native';
15
+ import LinearGradient from 'react-native-linear-gradient';
16
+ import {launchImageLibrary} from 'react-native-image-picker';
17
+ // import LocalBarcodeRecognizer from 'react-native-local-barcode-recognizer';
18
+
19
+ const LocalBarcodeRecognizer = NativeModules?.LocalBarcodeRecognizer;
20
+
21
+ import ScreenBackHeader from '../../../components/common/ScreenBackHeader';
22
+
23
+ const px = global.base.scaleSize;
24
+ import applyPermissions from '../../../utils/applyPermissions';
25
+
26
+ let screenWidth = Dimensions.get('window').width;
27
+
28
+ export default class ScanQRCode extends Component {
29
+ constructor(props) {
30
+ super(props);
31
+ this.state = {
32
+ title: this.props.route.params?.title || '扫码',
33
+ message:
34
+ this.props.route.params?.message ||
35
+ '请将设备二维码、条形码对准屏幕中央区域',
36
+ visible: false,
37
+ //中间横线动画初始值
38
+ moveAnim: new Animated.Value(-2),
39
+ scanDone: false,
40
+ scanHeight: 0,
41
+ hasPermissions: false,
42
+ };
43
+ }
44
+
45
+ async componentDidMount() {
46
+ await this.requestCameraPermission();
47
+ // this.startAnimation();
48
+
49
+ // 加上定时器异步设置visible,不然ios会白屏,原因暂时不明
50
+ setTimeout(() => {
51
+ this.setState({
52
+ visible: true,
53
+ });
54
+ });
55
+ }
56
+
57
+ //请求权限的方法
58
+ requestCameraPermission = async () => {
59
+ if (!(await applyPermissions.camera())) {
60
+ this.props.navigation.goBack();
61
+ } else {
62
+ this.setState({
63
+ hasPermissions: true,
64
+ });
65
+ }
66
+ };
67
+
68
+ /** 扫描框动画*/
69
+ startAnimation = () => {
70
+ this.state.moveAnim.setValue(-2);
71
+ Animated.sequence([
72
+ Animated.timing(this.state.moveAnim, {
73
+ toValue: this.state.scanHeight - 2,
74
+ duration: 1500,
75
+ easing: Easing.linear,
76
+ useNativeDriver: true,
77
+ }),
78
+ Animated.timing(this.state.moveAnim, {
79
+ toValue: -1,
80
+ duration: 1500,
81
+ easing: Easing.linear,
82
+ useNativeDriver: true,
83
+ }),
84
+ ]).start(() => this.startAnimation());
85
+ };
86
+
87
+ onBarCodeRead = result => {
88
+ if (this.state.scanDone) {
89
+ return;
90
+ }
91
+ const {navigate, getState} = this.props.navigation;
92
+ const sourceRouteName = this.props.route.params?.sourceRouteName || '';
93
+ const {data} = result; //只要拿到data就可以了
94
+ console.log(data, '扫描数据');
95
+ //扫码后的操作
96
+ if (data) {
97
+ const routes = getState().routes;
98
+ if (routes[routes.length - 2]) {
99
+ navigate({
100
+ name: sourceRouteName || routes[routes.length - 2].name,
101
+ params: {
102
+ scanResult: data,
103
+ },
104
+ merge: true,
105
+ });
106
+ this.setState({
107
+ scanDone: true,
108
+ });
109
+ }
110
+ }
111
+ };
112
+
113
+ handleOnLayout = event => {
114
+ const {height} = event.nativeEvent.layout;
115
+ this.setState(
116
+ {
117
+ scanHeight: height,
118
+ },
119
+ () => {
120
+ this.startAnimation();
121
+ },
122
+ );
123
+ };
124
+
125
+ handleSelectPicture = async () => {
126
+ if (!LocalBarcodeRecognizer) {
127
+ global.toast.showToast('当前版本不支持');
128
+ return;
129
+ }
130
+ const result = await launchImageLibrary({
131
+ mediaType: 'photo',
132
+ selectionLimit: 1,
133
+ includeBase64: true,
134
+ });
135
+ if (result.didCancel) {
136
+ console.log('cancel');
137
+ } else if (result.errorCode) {
138
+ console.log('error', result);
139
+ } else {
140
+ console.log(result.assets[0].base64.substr(0, 10));
141
+ let data = await LocalBarcodeRecognizer?.decode(
142
+ result.assets[0].base64,
143
+ {},
144
+ );
145
+ console.log(data, '扫描数据');
146
+ const {navigate, getState} = this.props.navigation;
147
+ const sourceRouteName = this.props.route.params?.sourceRouteName || '';
148
+ //扫码后的操作
149
+ if (data) {
150
+ const routes = getState().routes;
151
+ if (routes[routes.length - 2]) {
152
+ navigate({
153
+ name: sourceRouteName || routes[routes.length - 2].name,
154
+ params: {
155
+ scanResult: data,
156
+ },
157
+ merge: true,
158
+ });
159
+ this.setState({
160
+ scanDone: true,
161
+ });
162
+ }
163
+ }
164
+ }
165
+ };
166
+
167
+ render() {
168
+ if (this.state.hasPermissions && this.state.visible) {
169
+ return (
170
+ <View
171
+ animationType="slide"
172
+ transparent={true}
173
+ statusBarTranslucent={true}
174
+ visible={this.state.visible}
175
+ style={styles.container}
176
+ onRequestClose={() => {
177
+ // Alert.alert("Modal has been closed.");
178
+ // this.setState()
179
+ this.props.navigation.goBack();
180
+ }}>
181
+ <ScreenBackHeader title={this.state.title} />
182
+
183
+ <RNCamera
184
+ ref={ref => {
185
+ this.camera = ref;
186
+ }}
187
+ autoFocus={RNCamera.Constants.AutoFocus.on} /*自动对焦*/
188
+ style={[styles.preview]}
189
+ type={RNCamera.Constants.Type.back} /*切换前后摄像头 front前back后*/
190
+ flashMode={RNCamera.Constants.FlashMode.off} /*相机闪光模式*/
191
+ onBarCodeRead={this.onBarCodeRead}
192
+ captureAudio={false}>
193
+ <View
194
+ style={{
195
+ // flex: 1,
196
+ // justifyContent: 'center',
197
+ // alignItems: 'center',
198
+ flex: 1,
199
+ }}>
200
+ <View
201
+ style={{height: px(500), backgroundColor: 'rgba(34,34,34,0.7)'}}
202
+ />
203
+ <View
204
+ style={{
205
+ height: screenWidth - px(386),
206
+ flexDirection: 'row',
207
+ }}>
208
+ <View
209
+ style={{flex: 1, backgroundColor: 'rgba(34,34,34,0.7)'}}
210
+ />
211
+ <View onLayout={this.handleOnLayout} style={styles.scanBox}>
212
+ <Animated.View
213
+ style={[{transform: [{translateY: this.state.moveAnim}]}]}>
214
+ <Image
215
+ source={require('../../../assets/img/scan_move.png')}
216
+ style={{
217
+ height: px(12),
218
+ width: screenWidth - px(386),
219
+ }}
220
+ resizeMode="contain"
221
+ />
222
+ </Animated.View>
223
+ <Image
224
+ source={require('../../../assets/img/scan_border_top_left.png')}
225
+ style={styles.topLeftBorder}
226
+ />
227
+ <Image
228
+ source={require('../../../assets/img/scan_border_top_right.png')}
229
+ style={styles.topRightBorder}
230
+ />
231
+ <Image
232
+ source={require('../../../assets/img/scan_border_bottom_left.png')}
233
+ style={styles.bottomLeftBorder}
234
+ />
235
+ <Image
236
+ source={require('../../../assets/img/scan_border_bottom_right.png')}
237
+ style={styles.bottomRightBorder}
238
+ />
239
+ </View>
240
+ <View
241
+ style={{flex: 1, backgroundColor: 'rgba(34,34,34,0.7)'}}
242
+ />
243
+ </View>
244
+ <View
245
+ style={{
246
+ flex: 1,
247
+ backgroundColor: 'rgba(34,34,34,0.7)',
248
+ justifyContent: 'space-between',
249
+ alignItems: 'center',
250
+ }}>
251
+ <Text style={styles.rectangleText}>{this.state.message}</Text>
252
+ <TouchableOpacity
253
+ onPress={this.handleSelectPicture}
254
+ style={{
255
+ marginBottom: px(90),
256
+ }}>
257
+ <Image
258
+ source={require('../../../assets/img/album3.png')}
259
+ style={{
260
+ width: px(130),
261
+ height: px(130),
262
+ }}
263
+ resizeMode="contain"
264
+ />
265
+
266
+ <Text style={styles.albumText}>相册</Text>
267
+ </TouchableOpacity>
268
+ </View>
269
+ <View
270
+ style={{
271
+ width: screenWidth - px(386),
272
+ }}
273
+ />
274
+ </View>
275
+ </RNCamera>
276
+ </View>
277
+ );
278
+ } else {
279
+ return null;
280
+ }
281
+ }
282
+ }
283
+
284
+ const styles = StyleSheet.create({
285
+ container: {
286
+ flex: 1,
287
+ zIndex: 99999,
288
+ elevation: 0,
289
+ },
290
+ preview: {
291
+ flex: 1,
292
+ },
293
+ rectangleContainer: {
294
+ flex: 1,
295
+ justifyContent: 'flex-end',
296
+ alignItems: 'center',
297
+ },
298
+ rectangle: {
299
+ height: 200,
300
+ width: 200,
301
+ borderWidth: 1,
302
+ borderColor: '#fcb602',
303
+ backgroundColor: 'transparent',
304
+ borderRadius: 10,
305
+ },
306
+ rectangleText: {
307
+ color: '#fff',
308
+ marginTop: px(66),
309
+ fontSize: px(50),
310
+ marginBottom: px(150),
311
+ marginHorizontal: px(120),
312
+ fontWeight: '300',
313
+ },
314
+ border: {
315
+ flex: 0,
316
+ height: 2,
317
+ backgroundColor: '#fcb602',
318
+ // borderRadius: 50,
319
+ },
320
+ topLeftBorder: {
321
+ position: 'absolute',
322
+ top: -0.3,
323
+ left: -0.3,
324
+ width: px(55),
325
+ height: px(55),
326
+ },
327
+ topRightBorder: {
328
+ position: 'absolute',
329
+ top: -0.3,
330
+ right: -0.3,
331
+ width: px(55),
332
+ height: px(55),
333
+ },
334
+ bottomLeftBorder: {
335
+ position: 'absolute',
336
+ bottom: -0.3,
337
+ left: -0.3,
338
+ width: px(55),
339
+ height: px(55),
340
+ },
341
+ bottomRightBorder: {
342
+ position: 'absolute',
343
+ bottom: -0.3,
344
+ right: -0.3,
345
+ width: px(55),
346
+ height: px(55),
347
+ },
348
+ leftBorder: {
349
+ position: 'absolute',
350
+ width: px(5),
351
+ top: 0,
352
+ left: 0,
353
+ bottom: 0,
354
+ },
355
+ rightBorder: {
356
+ position: 'absolute',
357
+ width: px(5),
358
+ top: 0,
359
+ right: 0,
360
+ bottom: 0,
361
+ },
362
+ topSection: {
363
+ backgroundColor: 'transparent',
364
+ height: px(247),
365
+ },
366
+ centerSection: {
367
+ flexDirection: 'row',
368
+ height: px(915),
369
+ },
370
+ sideSection: {
371
+ width: px(82),
372
+ backgroundColor: 'transparent',
373
+ },
374
+ bottomBorder: {
375
+ position: 'absolute',
376
+ height: px(5),
377
+ left: 0,
378
+ right: 0,
379
+ bottom: 0,
380
+ },
381
+ bottomSection: {
382
+ flex: 1,
383
+ backgroundColor: 'transparent',
384
+ alignItems: 'center',
385
+ },
386
+ albumImg: {
387
+ width: px(165),
388
+ height: px(165),
389
+ marginTop: px(70),
390
+ },
391
+
392
+ scanBox: {
393
+ height: screenWidth - px(386),
394
+ width: screenWidth - px(386),
395
+ // borderColor: '#eee',
396
+ // borderWidth: 0.3,
397
+ // borderStyle: 'solid',
398
+ },
399
+
400
+ albumText: {
401
+ color: '#fff',
402
+ fontSize: px(46),
403
+ marginTop: px(12),
404
+ textAlign: 'center',
405
+ fontWeight: '300',
406
+ },
407
+ });