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,1354 @@
1
+ import React, {useState, useEffect, useCallback, useRef} from 'react';
2
+ import {Icon, CheckBox, Button, Divider} from '@rneui/themed';
3
+ import {
4
+ View,
5
+ Text,
6
+ StyleSheet,
7
+ Image,
8
+ ImageBackground,
9
+ TextInput,
10
+ TouchableOpacity,
11
+ TouchableWithoutFeedback,
12
+ Alert,
13
+ ScrollView,
14
+ Dimensions,
15
+ NativeModules,
16
+ Platform,
17
+ StatusBar,
18
+ Keyboard,
19
+ KeyboardAvoidingView,
20
+ } from 'react-native';
21
+ import {
22
+ LongPressGestureHandler,
23
+ GestureHandlerRootView,
24
+ } from 'react-native-gesture-handler';
25
+ import px from '../../utils/scaleSize';
26
+ import storage from '../../storage';
27
+ import {
28
+ obtainSmscode,
29
+ smscodeLogin,
30
+ accountLogin,
31
+ switchToken,
32
+ reportBigData,
33
+ } from '../../api';
34
+ import UUIDGenerator from 'react-native-uuid-generator';
35
+ import CryptoJS from 'crypto-js';
36
+ import env from '../../.local_dev/env';
37
+ import SmsCodeInput from '../../components/common/SmsCodeInput/indexNew';
38
+ import {hideLoading, showLoading, showToast} from '../../utils/notice';
39
+ import {replace, popToTop} from '../../utils/RootNavigation';
40
+ import {confirmWithContent} from '../../utils/registerDialog';
41
+ import {
42
+ updateHomedToken,
43
+ initOperatorHomedTouristAccount,
44
+ appReport,
45
+ } from '../../utils/common';
46
+ import {useSafeArea} from 'react-native-safe-area-context';
47
+ import LoginType from '../../components/common/LoginType';
48
+ import ProtocolType from '../../components/common/LoginType/protocol';
49
+ import config from '../../utils/config';
50
+ import Cell from '../../components/common/Cell';
51
+ import OpenLogSheet from './OpenLogSheet';
52
+
53
+ let protocolAgreeResolve = null;
54
+ let selectEntranceResolve = null;
55
+
56
+ const errorCodeMap = {
57
+ 20102: '验证码错误,请检查!',
58
+ 20103: '验证码错误,请检查!',
59
+ 20104: '验证码错误,请检查!',
60
+ 20200: '账号错误,登录失败!',
61
+ 20204: '密码错误,登录失败!',
62
+ 10429: '操作过频繁,请1小时后再试!',
63
+ };
64
+
65
+ const appName =
66
+ NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
67
+
68
+ const envVersion = NativeModules?.RNToNativeEmitter?.serverCluster || 'alpha';
69
+
70
+ // const appName = '遥控键码库';
71
+
72
+ function LoginScreen({navigation, route}) {
73
+ const [loginWay, setLoginWay] = useState(0); // 0 手机号+短信验证码登录,1 账号密码登录
74
+ const [activeIndex, setActiveIndex] = useState(1);
75
+ const [activeType, setActiveType] = useState('ajb');
76
+ const [phone, setPhone] = useState('');
77
+ const [smsId, setSmsId] = useState('');
78
+ const [username, setUsername] = useState('');
79
+ const [password, setPassword] = useState('');
80
+
81
+ const [userInputSmsCode, setUserInputSmsCode] = useState('');
82
+ const [smsCodeRightBtnDisabled, setSmsCodeRightBtnDisabled] = useState(false);
83
+ const [smsCodeRightBtnText, setSmsCodeRightBtnText] = useState('发送验证码');
84
+ const [smsCodeResendTime, setSmsCodeResendTime] = useState(0);
85
+
86
+ const [protocolAgree, setProtocolAgree] = useState(appName === '遥控键码库');
87
+ const [protocolDialogVisible, setProtocolDialogVisible] = useState(false);
88
+
89
+ const [serviceAgree, setServiceAgree] = useState(false);
90
+ const [serviceDialogVisible, setServiceDialogVisible] = useState(false);
91
+ const [privacyAgree, setPrivacyAgree] = useState(false);
92
+ const [privacyDialogVisible, setPrivacyDialogVisible] = useState(false);
93
+
94
+ const [keybordShow, setKeybordShow] = useState(false);
95
+
96
+ // 入口选择
97
+ const [entranceSelectVisible, setEntranceSelectVisible] = useState(false);
98
+
99
+ // 日志弹框
100
+ const [logVisible, setLogVisible] = useState(false);
101
+
102
+ useEffect(() => {
103
+ if (!route.params?.skip) {
104
+ openProtocolDialog();
105
+ }
106
+ // 忘记密码页面返回
107
+ if (route.params?.loginWay) {
108
+ setLoginWay(route.params.loginWay);
109
+ }
110
+ // (async () => {
111
+ // const coords = await getUserLocation();
112
+ // const res = await getCurrentWeather({
113
+ // lon: coords.coords.longitude,
114
+ // lat: coords.coords.latitude,
115
+ // });
116
+ // console.log(
117
+ // res.data.location.addressComponent.adcode,
118
+ // 'getCurrentWeather',
119
+ // );
120
+ // })();
121
+ const keyboardDidShow = Keyboard.addListener('keyboardDidShow', () => {
122
+ setKeybordShow(true);
123
+ });
124
+ const keyboardDidHide = Keyboard.addListener('keyboardDidHide', () => {
125
+ setKeybordShow(false);
126
+ });
127
+ return () => {
128
+ keyboardDidShow.remove();
129
+ keyboardDidHide.remove();
130
+ };
131
+ }, []);
132
+
133
+ const insets = useSafeArea();
134
+
135
+ const [isLoading, setIsLoading] = useState(true);
136
+ const timer = useRef(null);
137
+ const [isLogining, setIsLogining] = useState(false);
138
+ const [isLogined, setIsLogined] = useState(false);
139
+ const loginDisabled = !(
140
+ (loginWay === 0 && phone && userInputSmsCode) ||
141
+ (loginWay === 1 && username && password)
142
+ );
143
+ const statusBarPlaceholderStyle = {
144
+ height: Platform.OS === 'ios' ? insets.top : 0,
145
+ };
146
+
147
+ useEffect(() => {
148
+ // 获取登录状态
149
+ (async () => {
150
+ const token = await storage.get('accessToken');
151
+ if (token) {
152
+ if (appName === '遥控键码库') {
153
+ global.loading.showLoading('正在加载');
154
+ await global.base.navigateModule({
155
+ operatorId: 'ipanel',
156
+ moduleName: 'adg',
157
+ screenName: 'EntranceSelectScreen',
158
+ isReplace: true,
159
+ });
160
+ global.loading.hideLoading();
161
+ return;
162
+ }
163
+
164
+ const entranceSelect = await storage.get('entranceSelect');
165
+ if (entranceSelect === 'tyygq' && envVersion !== 'release') {
166
+ global.loading.showLoading('正在加载');
167
+ await global.base.navigateModule({
168
+ operatorId: 'ipanel',
169
+ moduleName: 'adg',
170
+ screenName: 'IstickUpdate3Screen',
171
+ isReplace: true,
172
+ });
173
+ global.loading.hideLoading();
174
+ } else {
175
+ replace('Home', {
176
+ redirect: true,
177
+ });
178
+ }
179
+ appReport('APP_STARTUP');
180
+ }
181
+ setTimeout(() => {
182
+ setIsLoading(false);
183
+ setIsLogined(!!token);
184
+ }, 0);
185
+ })();
186
+ }, []);
187
+
188
+ // useEffect(() => {
189
+ // if (isLogined) {
190
+ // replace('Home', {
191
+ // redirect: true,
192
+ // });
193
+ // }
194
+ // }, [isLogined]);
195
+
196
+ const handleSwitchLoginWay = () => {
197
+ if (loginWay === 0) {
198
+ setLoginWay(1);
199
+ } else {
200
+ setLoginWay(0);
201
+ }
202
+ };
203
+ const handleChangeActive = type => {
204
+ setActiveIndex(type);
205
+ setActiveType(type === 0 ? 'adg' : 'ajb');
206
+ resetData();
207
+ };
208
+ const resetData = () => {
209
+ if (loginWay === 0) {
210
+ setPhone('');
211
+ setSmsId('');
212
+ setUserInputSmsCode('');
213
+ setSmsCodeRightBtnDisabled(false);
214
+ setSmsCodeRightBtnText('发送验证码');
215
+ setSmsCodeResendTime(0);
216
+ } else {
217
+ setUsername('');
218
+ setPassword('');
219
+ }
220
+ setProtocolAgree(false);
221
+ setProtocolDialogVisible(false);
222
+
223
+ setPrivacyAgree(false);
224
+ setServiceAgree(false);
225
+ setPrivacyDialogVisible(false);
226
+ setServiceDialogVisible(false);
227
+ };
228
+ useEffect(() => {
229
+ if (phone.length === 11 && smsCodeResendTime === 0) {
230
+ setSmsCodeRightBtnDisabled(false);
231
+ setSmsCodeRightBtnText('获取验证码');
232
+ } else {
233
+ setSmsCodeRightBtnDisabled(true);
234
+ }
235
+ }, [phone, smsCodeResendTime]);
236
+ useEffect(() => {
237
+ if (phone.length === 11 && smsCodeResendTime === 0) {
238
+ setSmsCodeRightBtnDisabled(false);
239
+ setSmsCodeRightBtnText('获取验证码');
240
+ } else {
241
+ setSmsCodeRightBtnDisabled(true);
242
+ }
243
+ }, [phone, smsCodeResendTime]);
244
+ useEffect(() => {
245
+ if (smsCodeResendTime > 0) {
246
+ setSmsCodeRightBtnText(`${smsCodeResendTime}s后重发`);
247
+ timer.current = setTimeout(() => {
248
+ setSmsCodeResendTime(smsCodeResendTime - 1);
249
+ }, 1000);
250
+ }
251
+
252
+ return () => {
253
+ clearTimeout(timer.current);
254
+ };
255
+ }, [smsCodeResendTime]);
256
+
257
+ useEffect(() => {
258
+ if (serviceAgree && privacyAgree) {
259
+ setProtocolAgree(true);
260
+ } else {
261
+ setProtocolAgree(false);
262
+ }
263
+ }, [serviceAgree, privacyAgree]);
264
+
265
+ const onLongPress = () => {
266
+ setLogVisible(true);
267
+ };
268
+
269
+ // useEffect(() => {
270
+ // if (protocolAgree) {
271
+ // setServiceAgree(true);
272
+ // setPrivacyAgree(true);
273
+ // }
274
+ // }, [protocolAgree]);
275
+
276
+ const handleViewUserAgreement = () => {
277
+ navigation.navigate('WebviewScreen', {
278
+ title: '用户协议',
279
+ url: 'https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html',
280
+ });
281
+ };
282
+ const handleViewPrivacyClause = () => {
283
+ navigation.navigate('WebviewScreen', {
284
+ title: '隐私条款',
285
+ url: 'https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html',
286
+ });
287
+ };
288
+
289
+ const handleViewUserAgreementByType = type => {
290
+ if (type === 'service') {
291
+ setServiceDialogVisible(true);
292
+ } else if (type === 'privacy') {
293
+ setPrivacyDialogVisible(true);
294
+ }
295
+ };
296
+ let smsCodeTimer;
297
+ function validPhone(phone) {
298
+ if (!phone) {
299
+ Alert.alert('请输入手机号');
300
+ return false;
301
+ }
302
+ if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(phone)) {
303
+ // Alert.alert('请输入正确的手机号');
304
+ global.toast.showToast('手机号无效,请检查!');
305
+ return false;
306
+ }
307
+ return true;
308
+ }
309
+ const handleUserDisagree = async () => {
310
+ setProtocolDialogVisible(false);
311
+ setProtocolAgree(false);
312
+ setServiceAgree(false);
313
+ setPrivacyAgree(false);
314
+ };
315
+ const handleUserAgree = () => {
316
+ setProtocolAgree(true);
317
+ typeof protocolAgreeResolve === 'function' && protocolAgreeResolve();
318
+ protocolAgreeResolve = null;
319
+ };
320
+
321
+ const handleOneDisagree = async type => {
322
+ setProtocolAgree(false);
323
+ if (type === 'service') {
324
+ setServiceAgree(false);
325
+ setServiceDialogVisible(false);
326
+ } else if (type === 'privacy') {
327
+ setPrivacyAgree(false);
328
+ setPrivacyDialogVisible(false);
329
+ }
330
+ };
331
+ const handleOneAgree = type => {
332
+ if (type === 'service') {
333
+ setServiceAgree(true);
334
+ setServiceDialogVisible(false);
335
+ } else if (type === 'privacy') {
336
+ setPrivacyAgree(true);
337
+ setPrivacyDialogVisible(false);
338
+ }
339
+
340
+ typeof protocolAgreeResolve === 'function' && protocolAgreeResolve();
341
+ protocolAgreeResolve = null;
342
+ };
343
+
344
+ const handleSetProtocolAgree = isAgree => {
345
+ setProtocolAgree(isAgree);
346
+ setServiceAgree(isAgree);
347
+ setPrivacyAgree(isAgree);
348
+ };
349
+
350
+ const handleLoginPress = () => {
351
+ if (loginDisabled) {
352
+ return;
353
+ }
354
+ if (protocolAgree || appName === '遥控键码库') {
355
+ handleLogin();
356
+ } else {
357
+ openProtocolDialog().then(() => {
358
+ handleLogin();
359
+ });
360
+ }
361
+ };
362
+
363
+ const openProtocolDialog = () => {
364
+ return new Promise(resolve => {
365
+ setProtocolDialogVisible(true);
366
+ protocolAgreeResolve = resolve;
367
+ }).then(() => {
368
+ setProtocolDialogVisible(false);
369
+ });
370
+ };
371
+
372
+ const handleLogin = async () => {
373
+ let adcode;
374
+ let res;
375
+ const appName =
376
+ NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
377
+ // const appName = '遥控键码库';
378
+ const {deviceModal} = NativeModules?.RNToNativeEmitter || {};
379
+
380
+ const appID = await global.base.getAppId();
381
+
382
+ console.log('appID', appID);
383
+
384
+ let finallyAppID = appID;
385
+ if (!appID) {
386
+ // 兼容本地开发测试
387
+ finallyAppID = await UUIDGenerator.getRandomUUID();
388
+ }
389
+
390
+ if (loginWay === 0) {
391
+ if (!validPhone(phone)) {
392
+ return;
393
+ }
394
+
395
+ if (!smsId) {
396
+ Alert.alert('请先获取验证码');
397
+ return;
398
+ }
399
+
400
+ if (!userInputSmsCode) {
401
+ Alert.alert('请输入短信验证码');
402
+ return;
403
+ }
404
+ showLoading('登录中...');
405
+ setIsLogining(true);
406
+ let params = {
407
+ phone_number: phone,
408
+ sms_id: smsId,
409
+ sms_code: userInputSmsCode,
410
+ create_address: 1, // 注册时自动建默认家庭
411
+ extend: {
412
+ appid: finallyAppID,
413
+ model: deviceModal || '开发测试',
414
+ application: appName || '爱家宝',
415
+ platform: 'phone',
416
+ entry: 'app',
417
+ },
418
+ };
419
+ if (activeIndex === 0) {
420
+ delete params.create_address;
421
+ }
422
+ res = await smscodeLogin(params, activeType);
423
+ } else {
424
+ if (!username) {
425
+ Alert.alert('请输入账号');
426
+ return;
427
+ }
428
+
429
+ if (!password) {
430
+ Alert.alert('请输入密码');
431
+ return;
432
+ }
433
+ console.log(global.loading, 'global.loading');
434
+ showLoading('登录中...');
435
+ setIsLogining(true);
436
+ let params = {
437
+ account_name: username,
438
+ password: CryptoJS.MD5(password).toString(),
439
+ create_address: 1, // 注册时自动建默认家庭
440
+ extend: {
441
+ appid: finallyAppID,
442
+ model: deviceModal || '开发测试',
443
+ application: appName || '爱家宝',
444
+ platform: 'phone',
445
+ entry: 'app',
446
+ },
447
+ };
448
+ if (activeIndex === 0) {
449
+ delete params.create_address;
450
+ }
451
+ res = await accountLogin(params, activeType);
452
+ }
453
+ console.log(res, 'login');
454
+ if (res.code === 0) {
455
+ console.log(res.result, 'ipanelClound用户信息');
456
+ await storage.set('accountType', activeType);
457
+ await storage.set('accessToken', res.result.access_token);
458
+ await storage.set('refreshToken', res.result.refresh_token);
459
+
460
+ if (activeIndex === 1) {
461
+ if (res.result.address && res.result.address[0]) {
462
+ const addressList = res.result.address.map(item => {
463
+ return {
464
+ ...item,
465
+ room_list: null,
466
+ };
467
+ });
468
+ const defaultAddr = addressList[0];
469
+ console.log(defaultAddr.address_id, 'defaultAddr.address_id');
470
+ await storage.set('activeAddr', defaultAddr);
471
+ await storage.set('addressList', addressList);
472
+ await updateHomedToken();
473
+ } else {
474
+ await storage.set('activeAddr', {});
475
+ await storage.set('addressList', []);
476
+ }
477
+ }
478
+ delete res.result.address;
479
+ await storage.set('accountData', res.result);
480
+
481
+ // 存储boss账号信息
482
+ if (res.result?.user && res.result?.user?.bind_list) {
483
+ const bind_boss = res.result?.user?.bind_list.filter(item => {
484
+ return item.third_type === 'boss';
485
+ });
486
+ if (bind_boss.length) {
487
+ console.log(bind_boss[0], 'bind_boss[0]');
488
+ await storage.set('bossData', bind_boss[0]);
489
+ }
490
+ }
491
+
492
+ // 放开这段重新登录就会置空运营商(进入标准版)
493
+ // await storage.set(
494
+ // `${res.result?.account?.account_id || ''}currentOperator`,
495
+ // {},
496
+ // );
497
+
498
+ // 初始化默认运营商对应的homed游客账号
499
+ const envVersion =
500
+ NativeModules?.RNToNativeEmitter?.serverCluster || 'dev';
501
+ await initOperatorHomedTouristAccount({
502
+ touristUsername: finallyAppID,
503
+ domain: envVersion === 'dev' ? 'homed.me' : 'homed.tv',
504
+ touristGroupId: envVersion === 'dev' ? 115017 : 4664, // 4664: tv集群的手机APP游客用户组. 115017: 运营集群手机APP游客用户组
505
+ });
506
+ clearTimeout(smsCodeTimer);
507
+ // setIsLogined(true);
508
+ // 判断是否已经选了运营商
509
+ const currentOperator = await storage.get(
510
+ `${res.result?.account?.account_id || ''}currentOperator`,
511
+ );
512
+ // 获取公寓token
513
+ if (currentOperator?.name === '内蒙古广电网络') {
514
+ const apartmentRes = await switchToken();
515
+ if (apartmentRes?.code === 200 && apartmentRes?.token) {
516
+ storage.set('apartmentToken', apartmentRes.token);
517
+ // 公寓人员信息接口暂时还没,假设role:1为房东
518
+ storage.set('apartmentData', {role: 1});
519
+ } else {
520
+ storage.set('apartmentData', {});
521
+ storage.set('apartmentToken', '');
522
+ }
523
+ } else {
524
+ storage.set('apartmentData', {});
525
+ storage.set('apartmentToken', '');
526
+ }
527
+
528
+ // 上报APP启动事件
529
+ appReport('APP_STARTUP');
530
+
531
+ hideLoading();
532
+ setIsLogining(false);
533
+
534
+ if (appName === '遥控键码库') {
535
+ global.loading.showLoading('正在加载');
536
+ await global.base.navigateModule({
537
+ operatorId: 'ipanel',
538
+ moduleName: 'adg',
539
+ screenName: 'EntranceSelectScreen',
540
+ isReplace: true,
541
+ });
542
+ global.loading.hideLoading();
543
+ return;
544
+ }
545
+
546
+ if (activeType === 'ajb' && envVersion !== 'release') {
547
+ const entrance = await selectEntrance();
548
+ await storage.set('entranceSelect', entrance);
549
+ if (entrance === 'tyygq') {
550
+ global.loading.showLoading('正在加载');
551
+ await global.base.navigateModule({
552
+ operatorId: 'ipanel',
553
+ moduleName: 'adg',
554
+ screenName: 'IstickUpdate3Screen',
555
+ isReplace: true,
556
+ });
557
+ global.loading.hideLoading();
558
+ return;
559
+ }
560
+ }
561
+ if (appName === '禺乐慧家') {
562
+ let selectedOperator = {
563
+ id: 'c492121bac734bb983814b67ceafcae9',
564
+ name: '番禺区广电网络',
565
+ };
566
+ const accountData = await storage.get('accountData');
567
+ await storage.set(
568
+ `${accountData?.account?.account_id || ''}currentOperator`,
569
+ selectedOperator,
570
+ );
571
+ replace('Home', {
572
+ redirect: false,
573
+ });
574
+ } else if (
575
+ currentOperator ||
576
+ appName.includes('安电工') ||
577
+ activeType === 'adg' ||
578
+ env === '__LOCAL_DEV__'
579
+ ) {
580
+ replace('Home', {
581
+ redirect: false,
582
+ });
583
+ } else {
584
+ confirmWithContent({
585
+ title: '选择运营商',
586
+ component: '你是否要选择运营商',
587
+ confirmButtonText: '确定',
588
+ confirmCallback: () => {
589
+ replace('OperatorSelectScreen', {
590
+ purpose: 'init',
591
+ });
592
+ },
593
+ cancelButtonText: '先不选',
594
+ cancelCallback: () => {
595
+ replace('Home', {
596
+ redirect: false,
597
+ });
598
+ },
599
+ });
600
+ }
601
+ } else {
602
+ hideLoading();
603
+ setIsLogining(false);
604
+ const message = errorCodeMap[res.code] || res.message || '登录失败!';
605
+ global.toast.showToast(message);
606
+ }
607
+ };
608
+
609
+ // 选择入口
610
+ const selectEntrance = () => {
611
+ return new Promise(resolve => {
612
+ setEntranceSelectVisible(true);
613
+ selectEntranceResolve = resolve;
614
+ });
615
+ };
616
+
617
+ const handleGetSmsId = async () => {
618
+ if (!validPhone(phone)) {
619
+ return;
620
+ }
621
+ // 60s后重发
622
+ setSmsCodeResendTime(60);
623
+
624
+ setSmsCodeRightBtnDisabled(true);
625
+
626
+ const res = await obtainSmscode(
627
+ {
628
+ phone_number: phone,
629
+ length: 4,
630
+ type: 1, // type=1 表示登录用途
631
+ },
632
+ activeType,
633
+ ).catch(err => {
634
+ console.log(err);
635
+ setSmsCodeRightBtnText('获取验证码');
636
+ setSmsCodeRightBtnDisabled(false);
637
+ });
638
+
639
+ if (res && res.code === 0) {
640
+ setSmsId(res.result.sms_id);
641
+
642
+ smsCodeTimer = setTimeout(() => {
643
+ setSmsCodeRightBtnText('获取验证码');
644
+ setSmsCodeRightBtnDisabled(false);
645
+ }, 120000);
646
+ } else {
647
+ setSmsCodeRightBtnText('获取验证码');
648
+ setSmsCodeRightBtnDisabled(false);
649
+ }
650
+ };
651
+
652
+ loginDisabled;
653
+ const loginBtnBg = {
654
+ backgroundColor: loginDisabled
655
+ ? 'rgba(234, 96, 0, 0.3)'
656
+ : 'rgba(234, 96, 0, 1)',
657
+ };
658
+ const render = () => {
659
+ return (
660
+ <View style={{flex: 1, backgroundColor: '#fff'}}>
661
+ <ImageBackground
662
+ source={require('../../assets/img/login_bg_new.png')}
663
+ style={[styles.container, {paddingTop: 0}]}>
664
+ {isLoading || isLogined ? (
665
+ <View style={styles.welcomeView}>{/* 白屏界面 */}</View>
666
+ ) : (
667
+ <TouchableWithoutFeedback
668
+ onPress={() => {
669
+ Keyboard.dismiss();
670
+ }}>
671
+ <View style={{position: 'relative', flex: 1}}>
672
+ <View style={statusBarPlaceholderStyle} />
673
+ <View style={styles.loginHead}>
674
+ <View>
675
+ <Text style={styles.welcomeTitleText}>欢迎登录!</Text>
676
+ <Text style={styles.welcomeSubTitleText}>
677
+ 安装省心 智能管家
678
+ </Text>
679
+ </View>
680
+ <View style={{width: px(403), height: px(265)}}>
681
+ {/* <Image
682
+ source={
683
+ activeIndex === 0
684
+ ? require('../../assets/img/worker.png')
685
+ : require('../../assets/img/computer.png')
686
+ }
687
+ style={styles.topImg}
688
+ resizeMode="contain"
689
+ /> */}
690
+ {activeIndex === 0 ? (
691
+ <Image
692
+ source={require('../../assets/img/worker.png')}
693
+ style={styles.topImg}
694
+ resizeMode="contain"
695
+ />
696
+ ) : (
697
+ <GestureHandlerRootView>
698
+ <LongPressGestureHandler
699
+ minDurationMs={5000} // 设置长按的最短时间为5000毫秒,即5秒
700
+ onActivated={onLongPress}>
701
+ <Image
702
+ source={require('../../assets/img/computer.png')}
703
+ style={styles.topImg}
704
+ resizeMode="contain"
705
+ />
706
+ </LongPressGestureHandler>
707
+ </GestureHandlerRootView>
708
+ )}
709
+ </View>
710
+ </View>
711
+ {appName !== '遥控键码库' && (
712
+ <LoginType
713
+ activeIndex={activeIndex}
714
+ changeActive={handleChangeActive}
715
+ />
716
+ )}
717
+
718
+ <View
719
+ style={{
720
+ ...styles.inputView,
721
+ paddingTop: appName === '遥控键码库' ? px(100) : 0,
722
+ }}>
723
+ {loginWay === 0 && (
724
+ <>
725
+ <View
726
+ style={[
727
+ styles.inputBox,
728
+ {marginTop: px(40), marginBottom: px(75)},
729
+ ]}>
730
+ <Text style={styles.inputTitle}>+86</Text>
731
+ <View style={styles.inputDivider} />
732
+ <TextInput
733
+ keyboardType="number-pad"
734
+ style={styles.input}
735
+ value={phone}
736
+ placeholder="请输入您的手机号"
737
+ placeholderTextColor="#A6A6A6"
738
+ onChangeText={text => setPhone(text)}
739
+ returnKeyType="done"
740
+ maxLength={11}
741
+ />
742
+ </View>
743
+ <View style={[styles.inputBox]}>
744
+ <SmsCodeInput
745
+ value={userInputSmsCode}
746
+ placeholder="请输入验证码"
747
+ rightBtnDisabled={smsCodeRightBtnDisabled}
748
+ rightBtnText={smsCodeRightBtnText}
749
+ onChangeText={text => setUserInputSmsCode(text)}
750
+ onRightBtnPress={handleGetSmsId}
751
+ />
752
+ </View>
753
+ </>
754
+ )}
755
+ {loginWay === 1 && (
756
+ <>
757
+ <View
758
+ style={[
759
+ styles.inputBox,
760
+ {marginTop: px(40), marginBottom: px(75)},
761
+ ]}>
762
+ <Text style={styles.inputTitle}>账号</Text>
763
+ <View style={styles.inputDivider} />
764
+ <TextInput
765
+ style={styles.input}
766
+ placeholder="请输入您的账号"
767
+ placeholderTextColor="#A6A6A6"
768
+ value={username}
769
+ onChangeText={text => setUsername(text)}
770
+ returnKeyType="done"
771
+ />
772
+ </View>
773
+ <View style={[styles.inputBox]}>
774
+ <Text style={styles.inputTitle}>密码</Text>
775
+ <View style={styles.inputDivider} />
776
+ <TextInput
777
+ style={styles.input}
778
+ placeholder="请输入密码"
779
+ placeholderTextColor="#A6A6A6"
780
+ value={password}
781
+ secureTextEntry
782
+ onChangeText={text => setPassword(text)}
783
+ returnKeyType="done"
784
+ />
785
+ </View>
786
+ <TouchableOpacity
787
+ style={styles.forgotPassword}
788
+ onPress={() => {
789
+ navigation.navigate('ResePasswordScreen');
790
+ }}>
791
+ <Text
792
+ style={{
793
+ color: '#E86003',
794
+ fontSize: px(35),
795
+ fontWeight: 'bold',
796
+ }}>
797
+ 忘记密码
798
+ </Text>
799
+ </TouchableOpacity>
800
+ </>
801
+ )}
802
+
803
+ <TouchableOpacity
804
+ activeOpacity={0.7}
805
+ onPress={handleLoginPress}
806
+ disabled={loginDisabled}>
807
+ <View
808
+ style={{
809
+ ...styles.loginBtnBox,
810
+ marginTop: keybordShow ? px(89) : px(337),
811
+ opacity: loginDisabled ? 0.6 : 1,
812
+ }}>
813
+ <View style={[styles.loginBtn]}>
814
+ <Text style={[styles.loginBtnText]}>
815
+ {isLogining ? '正在登录中...' : '登录'}
816
+ </Text>
817
+ </View>
818
+ </View>
819
+ </TouchableOpacity>
820
+
821
+ {appName !== '遥控键码库' && (
822
+ <View style={{marginTop: px(40), width: '100%'}}>
823
+ <View style={styles.protocol}>
824
+ <CheckBox
825
+ center
826
+ checked={protocolAgree}
827
+ containerStyle={{
828
+ margin: 0,
829
+ padding: 0,
830
+ backgroundColor: 'transparent',
831
+ }}
832
+ onPress={() => handleSetProtocolAgree(!protocolAgree)}
833
+ checkedIcon={
834
+ <Icon
835
+ name="checkmark-circle-outline"
836
+ type="ionicon"
837
+ color={styles.protocolLinkAgree.color}
838
+ size={20}
839
+ />
840
+ }
841
+ uncheckedIcon={
842
+ <Icon
843
+ name="radio-button-off"
844
+ type="ionicon"
845
+ color={styles.protocolText.color}
846
+ size={20}
847
+ />
848
+ }
849
+ />
850
+ <TouchableWithoutFeedback
851
+ onPress={() => setProtocolAgree(!protocolAgree)}>
852
+ <Text style={styles.protocolText}>
853
+ 已阅读并同意
854
+ <TouchableWithoutFeedback
855
+ style={{paddingVertical: px(150)}}
856
+ onPress={() =>
857
+ handleViewUserAgreementByType('service')
858
+ }>
859
+ <Text
860
+ style={
861
+ protocolAgree || serviceAgree
862
+ ? styles.protocolLinkAgree
863
+ : styles.protocolLink
864
+ }>
865
+ 《服务条款》
866
+ </Text>
867
+ </TouchableWithoutFeedback>
868
+ 与
869
+ <TouchableWithoutFeedback
870
+ style={{paddingVertical: px(150)}}
871
+ onPress={() =>
872
+ handleViewUserAgreementByType('privacy')
873
+ }>
874
+ <Text
875
+ style={
876
+ protocolAgree || privacyAgree
877
+ ? styles.protocolLinkAgree
878
+ : styles.protocolLink
879
+ }>
880
+ 《隐私权政策》
881
+ </Text>
882
+ </TouchableWithoutFeedback>
883
+ </Text>
884
+ </TouchableWithoutFeedback>
885
+ </View>
886
+ </View>
887
+ )}
888
+ </View>
889
+
890
+ <View
891
+ style={{
892
+ position: 'absolute',
893
+ width: '100%',
894
+ top: Dimensions.get('window').height - px(180),
895
+ }}>
896
+ <View
897
+ style={{
898
+ flexDirection: 'row',
899
+ justifyContent: 'center',
900
+ alignItems: 'center',
901
+ }}>
902
+ <TouchableOpacity
903
+ activeOpacity={0.7}
904
+ onPress={handleSwitchLoginWay}>
905
+ <View style={{padding: px(20)}}>
906
+ <Text style={{color: '#E86003', fontSize: px(43)}}>
907
+ {loginWay === 0 ? '账号登录' : '手机号登录'}
908
+ </Text>
909
+ </View>
910
+ </TouchableOpacity>
911
+ </View>
912
+ </View>
913
+
914
+ {/* 选择方式 */}
915
+ {entranceSelectVisible && (
916
+ <View
917
+ style={{
918
+ ...styles.entranceSelect,
919
+ paddingTop:
920
+ (Platform.OS === 'ios' ? insets.top : 0) +
921
+ StatusBar.currentHeight,
922
+ }}>
923
+ <View
924
+ style={{
925
+ paddingTop: px(36),
926
+ paddingBottom: px(33),
927
+ marginBottom: px(38),
928
+ }}>
929
+ <Text
930
+ style={{
931
+ fontSize: px(55),
932
+ color: '#333',
933
+ fontWeight: 'bold',
934
+ textAlign: 'center',
935
+ }}>
936
+ 请选择功能
937
+ </Text>
938
+ </View>
939
+ <TouchableOpacity
940
+ style={{
941
+ ...styles.entranceSelectItem,
942
+ backgroundColor: '#F4F9F8',
943
+ }}
944
+ onPress={() => {
945
+ selectEntranceResolve && selectEntranceResolve('szjt');
946
+ selectEntranceResolve = null;
947
+ }}>
948
+ <Image
949
+ style={{
950
+ width: px(104),
951
+ height: px(104),
952
+ }}
953
+ resizeMode="contain"
954
+ source={require('../../assets/img/szjt.png')}
955
+ />
956
+ <Text
957
+ style={{
958
+ ...styles.entranceSelectText,
959
+ color: '#62C0B6',
960
+ }}>
961
+ 数字家庭
962
+ </Text>
963
+ </TouchableOpacity>
964
+ <TouchableOpacity
965
+ style={{
966
+ ...styles.entranceSelectItem,
967
+ backgroundColor: '#F2FAFF',
968
+ }}
969
+ onPress={() => {
970
+ selectEntranceResolve && selectEntranceResolve('tyygq');
971
+ selectEntranceResolve = null;
972
+ }}>
973
+ <Image
974
+ style={{
975
+ width: px(104),
976
+ height: px(104),
977
+ }}
978
+ resizeMode="contain"
979
+ source={require('../../assets/img/tykz.png')}
980
+ />
981
+ <Text
982
+ style={{
983
+ ...styles.entranceSelectText,
984
+ color: '#599FF1',
985
+ }}>
986
+ 遥控键码下载
987
+ </Text>
988
+ </TouchableOpacity>
989
+ </View>
990
+ )}
991
+ </View>
992
+ </TouchableWithoutFeedback>
993
+ )}
994
+
995
+ {serviceDialogVisible && !isLoading && (
996
+ <ProtocolType
997
+ handleOneDisagree={handleOneDisagree}
998
+ handleOneAgree={handleOneAgree}
999
+ dialogTitle="用户协议"
1000
+ url="https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html"
1001
+ type="service"
1002
+ />
1003
+ )}
1004
+
1005
+ {privacyDialogVisible && !isLoading && (
1006
+ <ProtocolType
1007
+ handleOneDisagree={handleOneDisagree}
1008
+ handleOneAgree={handleOneAgree}
1009
+ dialogTitle="隐私保护提示"
1010
+ url="https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html"
1011
+ type="privacy"
1012
+ />
1013
+ )}
1014
+
1015
+ {protocolDialogVisible && !isLoading && appName !== '遥控键码库' && (
1016
+ <View style={styles.agreementMask}>
1017
+ <View style={styles.agreementConfirmContent}>
1018
+ <View style={styles.agreementConfirmHead}>
1019
+ <Text style={styles.agreementConfirmTitle}>
1020
+ 欢迎使用爱家宝
1021
+ </Text>
1022
+ </View>
1023
+ <View style={{flex: 1}}>
1024
+ <ScrollView showsVerticalScrollIndicator={false}>
1025
+ <View>
1026
+ <Text style={styles.agreementConfirmText}>
1027
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为了更好的保障您的合法权益,请您阅读并同意
1028
+ <TouchableWithoutFeedback
1029
+ onPress={handleViewUserAgreement}
1030
+ style={{paddingVertical: px(100)}}>
1031
+ <Text style={styles.agreementConfirmImportantText}>
1032
+ 用户协议
1033
+ </Text>
1034
+ </TouchableWithoutFeedback>
1035
+ 和
1036
+ <TouchableWithoutFeedback
1037
+ onPress={handleViewPrivacyClause}>
1038
+ <Text style={styles.agreementConfirmImportantText}>
1039
+ 隐私条款
1040
+ </Text>
1041
+ </TouchableWithoutFeedback>
1042
+ 。为向您提供更优质的服务,我们可能会向您申请下列相关权限:
1043
+ </Text>
1044
+ </View>
1045
+ <View>
1046
+ <Text style={styles.agreementConfirmText}>
1047
+ 1. 读写设备存储权限(Android
1048
+ 版本):用于用于用户反馈、客服等功能中读写设备上的照片及文件;
1049
+ </Text>
1050
+ </View>
1051
+ <View>
1052
+ <Text style={styles.agreementConfirmText}>
1053
+ 2. 地理位置权限(Android、iOS
1054
+ 版本):用于家庭位置管理、判断地区提供天气服务、发现附近智能设备;
1055
+ </Text>
1056
+ </View>
1057
+ <View>
1058
+ <Text style={styles.agreementConfirmText}>
1059
+ 3. 相机权限(Android、iOS
1060
+ 版本):用于扫码绑定电视账户、扫码进行设备添加等功能;
1061
+ </Text>
1062
+ </View>
1063
+ <View>
1064
+ <Text style={styles.agreementConfirmText}>
1065
+ 4. 相册权限(Android、ios
1066
+ 版本):用于用户反馈等功能中读写设备上的照片及视频;
1067
+ </Text>
1068
+ </View>
1069
+ <View>
1070
+ <Text style={styles.agreementConfirmText}>
1071
+ 5. 麦克风权限(Android、ioS 版本):智能客服等功能;
1072
+ </Text>
1073
+ </View>
1074
+ <View>
1075
+ <Text style={styles.agreementConfirmText}>
1076
+ 6. 读取电话联系人权限(Android):用于电视通讯功能;
1077
+ </Text>
1078
+ </View>
1079
+ <View>
1080
+ <Text style={styles.agreementConfirmText}>
1081
+ 7. 开启蓝牙权限(Android、ios
1082
+ 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
1083
+ </Text>
1084
+ </View>
1085
+ <View>
1086
+ <Text style={styles.agreementConfirmText}>
1087
+ 8. 开启蓝牙权限(Android、ios
1088
+ 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
1089
+ </Text>
1090
+ </View>
1091
+ <View>
1092
+ <Text style={styles.agreementConfirmText}>
1093
+ 7. 开启蓝牙权限(Android、ios
1094
+ 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
1095
+ </Text>
1096
+ </View>
1097
+ </ScrollView>
1098
+ </View>
1099
+ <Divider color="#eee" width={1} />
1100
+ <View style={styles.agreementButtons}>
1101
+ <TouchableOpacity
1102
+ style={styles.disagreeBtn}
1103
+ activeOpacity={0.7}
1104
+ onPress={handleUserDisagree}>
1105
+ <Text style={styles.disagreeBtnText}>不同意</Text>
1106
+ </TouchableOpacity>
1107
+ <Divider color="#eee" width={1} orientation="vertical" />
1108
+ <TouchableOpacity
1109
+ style={styles.agreeBtn}
1110
+ activeOpacity={0.7}
1111
+ onPress={handleUserAgree}>
1112
+ <Text style={styles.agreeBtnText}>同意</Text>
1113
+ </TouchableOpacity>
1114
+ </View>
1115
+ </View>
1116
+ </View>
1117
+ )}
1118
+ </ImageBackground>
1119
+ {logVisible && <OpenLogSheet setVisible={setLogVisible} />}
1120
+ </View>
1121
+ );
1122
+ };
1123
+
1124
+ return render();
1125
+ }
1126
+
1127
+ const styles = StyleSheet.create({
1128
+ container: {
1129
+ flex: 1,
1130
+ },
1131
+ welcomeView: {
1132
+ flex: 1,
1133
+ alignItems: 'center',
1134
+ justifyContent: 'center',
1135
+ },
1136
+ loginHead: {
1137
+ flexDirection: 'row',
1138
+ alignItems: 'center',
1139
+ justifyContent: 'space-between',
1140
+ marginTop: px(113),
1141
+ paddingLeft: px(69),
1142
+ paddingRight: px(37),
1143
+ marginBottom: px(52),
1144
+ },
1145
+ inputView: {
1146
+ backgroundColor: '#fff',
1147
+ borderRadius: px(22),
1148
+ flex: 1,
1149
+ marginTop: px(-50),
1150
+ },
1151
+ inputDivider: {
1152
+ width: px(3),
1153
+ height: px(37),
1154
+ backgroundColor: '#eee',
1155
+ marginHorizontal: px(22),
1156
+ },
1157
+ inputTitle: {
1158
+ color: '#333',
1159
+ fontSize: px(40),
1160
+ fontWeight: '400',
1161
+ },
1162
+ forgotPassword: {
1163
+ marginTop: px(27),
1164
+ alignSelf: 'flex-end',
1165
+ marginRight: px(115),
1166
+ },
1167
+ loginView: {
1168
+ flex: 1,
1169
+ },
1170
+ welcomeTitleText: {
1171
+ fontSize: px(92),
1172
+ color: '#fff',
1173
+ fontWeight: '600',
1174
+ },
1175
+ welcomeSubTitleText: {
1176
+ paddingTop: px(17),
1177
+ color: '#FFF9F5',
1178
+ fontSize: px(46),
1179
+ },
1180
+ topImg: {
1181
+ width: '100%',
1182
+ height: '100%',
1183
+ },
1184
+ inputBox: {
1185
+ marginHorizontal: px(115),
1186
+ flexDirection: 'row',
1187
+ alignItems: 'center',
1188
+ borderBottomWidth: px(2),
1189
+ // marginVertical: 10,
1190
+ borderBottomColor: '#E8E8E8',
1191
+ height: px(100),
1192
+ },
1193
+ input: {
1194
+ height: 50,
1195
+ flex: 1,
1196
+ color: '#000',
1197
+ },
1198
+ loginBtnBox: {
1199
+ flexDirection: 'row',
1200
+ alignItems: 'center',
1201
+ },
1202
+ loginBtn: {
1203
+ marginHorizontal: px(115),
1204
+ borderRadius: px(23),
1205
+ backgroundColor: '#E86003',
1206
+ flex: 1,
1207
+ height: px(132),
1208
+ alignItems: 'center',
1209
+ justifyContent: 'center',
1210
+ },
1211
+ loginBtnText: {
1212
+ color: '#fff',
1213
+ fontSize: px(52),
1214
+ fontWeight: '600',
1215
+ },
1216
+
1217
+ protocol: {
1218
+ flexDirection: 'row',
1219
+ justifyContent: 'center',
1220
+ alignItems: 'center',
1221
+ },
1222
+ protocolText: {
1223
+ color: '#A6A6A6',
1224
+ fontSize: px(35),
1225
+ },
1226
+ protocolLink: {
1227
+ color: 'rgba(234, 96, 0, 1)',
1228
+ },
1229
+ protocolLinkAgree: {
1230
+ color: '#0EC12C',
1231
+ },
1232
+
1233
+ agreementMask: {
1234
+ position: 'absolute',
1235
+ left: 0,
1236
+ top: 0,
1237
+ bottom: 0,
1238
+ right: 0,
1239
+ zIndex: 2,
1240
+ backgroundColor: 'rgba(0,0,0,0.7)',
1241
+ },
1242
+ agreementConfirmContent: {
1243
+ position: 'absolute',
1244
+ height: 400,
1245
+ left: px(75),
1246
+ right: px(75),
1247
+ top: Dimensions.get('window').height / 2 - 200,
1248
+ backgroundColor: '#fff',
1249
+ paddingBottom: 0,
1250
+ borderRadius: px(29),
1251
+ },
1252
+ agreementConfirmHead: {
1253
+ marginTop: px(52),
1254
+ marginBottom: px(29),
1255
+ },
1256
+ headerLeft: {
1257
+ position: 'absolute',
1258
+ top: 15,
1259
+ left: 10,
1260
+ zIndex: 2,
1261
+ },
1262
+ goBackImg: {
1263
+ width: 20,
1264
+ height: 20,
1265
+ },
1266
+ agreementConfirmTitleBox: {
1267
+ // flex: 1,
1268
+ position: 'absolute',
1269
+ top: 10,
1270
+ bottom: 0,
1271
+ left: 0,
1272
+ right: 0,
1273
+ zIndex: 1,
1274
+ },
1275
+ agreementConfirmTitle: {
1276
+ fontSize: 20,
1277
+ // lineHeight: 50,
1278
+ color: '#000',
1279
+ textAlign: 'center',
1280
+ // paddingTop: 20,
1281
+ },
1282
+ agreementConfirmText: {
1283
+ fontSize: px(40),
1284
+ lineHeight: px(69),
1285
+ color: '#333',
1286
+ marginHorizontal: px(40),
1287
+ },
1288
+ agreementConfirmImportantText: {
1289
+ color: 'rgba(234, 96, 0, 1)',
1290
+ },
1291
+ agreementButtons: {
1292
+ height: 50,
1293
+ marginTop: px(12),
1294
+ flexDirection: 'row',
1295
+ justifyContent: 'space-around',
1296
+ borderBottomLeftRadius: px(29),
1297
+ },
1298
+ disagreeBtn: {
1299
+ flex: 1,
1300
+ paddingTop: px(32),
1301
+ paddingBottom: px(29),
1302
+ },
1303
+ disagreeBtnText: {
1304
+ color: '#666',
1305
+ fontSize: px(52),
1306
+ textAlign: 'center',
1307
+ fontWeight: '500',
1308
+ },
1309
+ agreeBtn: {
1310
+ flex: 1,
1311
+ paddingTop: px(32),
1312
+ paddingBottom: px(29),
1313
+ },
1314
+ agreeBtnText: {
1315
+ color: '#E86003',
1316
+ fontSize: px(52),
1317
+ textAlign: 'center',
1318
+ fontWeight: '500',
1319
+ },
1320
+
1321
+ mask: {
1322
+ position: 'absolute',
1323
+ top: 0,
1324
+ left: 0,
1325
+ bottom: 0,
1326
+ right: 0,
1327
+ justifyContent: 'center',
1328
+ alignItems: 'center',
1329
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
1330
+ },
1331
+ entranceSelect: {
1332
+ backgroundColor: '#fff',
1333
+ position: 'absolute',
1334
+ top: 0,
1335
+ bottom: 0,
1336
+ left: 0,
1337
+ right: 0,
1338
+ },
1339
+ entranceSelectItem: {
1340
+ height: px(231),
1341
+ marginHorizontal: px(38),
1342
+ paddingLeft: px(38),
1343
+ flexDirection: 'row',
1344
+ alignItems: 'center',
1345
+ borderRadius: px(16),
1346
+ marginBottom: px(27),
1347
+ },
1348
+ entranceSelectText: {
1349
+ fontWeight: '500',
1350
+ fontSize: px(55),
1351
+ marginLeft: px(33),
1352
+ },
1353
+ });
1354
+ export default LoginScreen;