ipanel-rnapp-ajb-base 1.0.39 → 1.0.41

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.
@@ -1,99 +1,307 @@
1
- import React, { useState, useEffect, useCallback, useRef } from "react";
1
+ import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import { CheckBox, Divider, Icon } from "@rneui/themed";
2
3
  import {
3
- View,
4
- ScrollView,
5
- Text,
6
- TextInput,
7
- StyleSheet,
8
4
  Alert,
5
+ Dimensions,
6
+ Image,
7
+ ImageBackground,
8
+ Keyboard,
9
+ NativeModules,
9
10
  Platform,
11
+ ScrollView,
10
12
  StatusBar,
13
+ StyleSheet,
14
+ Text,
15
+ TextInput,
11
16
  TouchableOpacity,
12
- NativeModules,
13
- ImageBackground,
14
17
  TouchableWithoutFeedback,
15
- Dimensions,
18
+ View,
16
19
  } from "react-native";
17
- import { useSafeArea } from "react-native-safe-area-context";
18
- import CryptoJS from "crypto-js";
19
- import UUIDGenerator from "react-native-uuid-generator";
20
- import { Icon, Image, CheckBox, Button } from "@rneui/themed";
21
- import DeviceInfo from "react-native-device-info";
22
-
23
- import SmsCodeInput from "../../components/common/SmsCodeInput";
24
-
20
+ import {
21
+ GestureHandlerRootView,
22
+ LongPressGestureHandler,
23
+ } from "react-native-gesture-handler";
24
+ import px from "../../utils/scaleSize";
25
25
  import storage from "../../storage";
26
+ import {
27
+ accountLogin,
28
+ obtainSmscode,
29
+ smscodeLogin,
30
+ loginByType,
31
+ getHouseType,
32
+ } from "../../api";
33
+ import UUIDGenerator from "react-native-uuid-generator";
34
+ import CryptoJS from "crypto-js";
35
+ import env from "../../.local_dev/env";
36
+ import SmsCodeInput from "../../components/common/SmsCodeInput/indexNew";
37
+ import { hideLoading, showLoading } from "../../utils/notice";
26
38
  import { replace } from "../../utils/RootNavigation";
39
+ import { confirmWithContent } from "../../utils/registerDialog";
27
40
  import {
28
- getUserLocation,
29
- updateHomedToken,
30
- initOperatorHomedTouristAccount,
31
41
  appReport,
42
+ initOperatorHomedTouristAccount,
43
+ updateHomedToken,
32
44
  } from "../../utils/common";
33
- import { obtainSmscode, smscodeLogin, accountLogin } from "../../api";
34
- import { hideLoading, showLoading, showToast } from "../../utils/notice";
35
-
36
- import { confirmWithContent } from "../../utils/registerDialog";
37
- import config from "../../utils/config";
45
+ import { useSafeArea } from "react-native-safe-area-context";
46
+ import LoginType from "../../components/common/LoginType";
38
47
  import ProtocolType from "../../components/common/LoginType/protocol";
48
+ import config from "../../utils/config";
49
+ import OpenLogSheet from "./OpenLogSheet";
50
+ import GraphSmscode from "./GraphSmscode";
51
+ import useLatest from "../../hooks/useLatest";
52
+ import { PyLoginType, PyLoginIndex } from "./PyLoginType";
53
+ import { confirmTitleContent } from "../../utils/registerDialog";
54
+
39
55
  let protocolAgreeResolve = null;
56
+ let selectEntranceResolve = null;
57
+ let checkGraphSmscodeResolve = null;
58
+
59
+ const errorCodeMap = {
60
+ 20102: "验证码错误,请检查!",
61
+ 20103: "验证码错误,请检查!",
62
+ 20104: "验证码错误,请检查!",
63
+ 20200: "账号错误,登录失败!",
64
+ 20204: "密码错误,登录失败!",
65
+ 10429: "操作过频繁,请1小时后再试!",
66
+ };
67
+
68
+ const appName =
69
+ NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
70
+
71
+ const envVersion = NativeModules?.RNToNativeEmitter?.serverCluster || "alpha";
72
+
73
+ const packageName = NativeModules?.RNToNativeEmitter?.packageName;
74
+
75
+ // const appName = '遥控键码库';
40
76
 
41
77
  function LoginScreen({ navigation, route }) {
78
+ const [loginWay, setLoginWay] = useState(0); // 0 手机号+短信验证码登录,1 账号密码登录
79
+ const [activeIndex, setActiveIndex] = useState(1);
80
+ const [activeType, setActiveType] = useState("ajb");
81
+ const [phone, setPhone] = useState("");
82
+ const [smsId, setSmsId] = useState("");
83
+ const [username, setUsername] = useState("");
84
+ const [password, setPassword] = useState("");
85
+
86
+ const [userInputSmsCode, setUserInputSmsCode] = useState("");
87
+ const [smsCodeRightBtnDisabled, setSmsCodeRightBtnDisabled] = useState(false);
88
+ const [smsCodeRightBtnText, setSmsCodeRightBtnText] = useState("发送验证码");
89
+ const [smsCodeResendTime, setSmsCodeResendTime] = useState(0);
90
+ const latestSmsCodeResendTime = useLatest(smsCodeResendTime);
91
+
92
+ const [protocolAgree, setProtocolAgree] = useState(appName === "遥控键码库");
93
+ const [protocolDialogVisible, setProtocolDialogVisible] = useState(false);
94
+
95
+ const [serviceAgree, setServiceAgree] = useState(false);
96
+ const [serviceDialogVisible, setServiceDialogVisible] = useState(false);
97
+ const [privacyAgree, setPrivacyAgree] = useState(false);
98
+ const [privacyDialogVisible, setPrivacyDialogVisible] = useState(false);
99
+
100
+ const [keybordShow, setKeybordShow] = useState(false);
101
+
102
+ // 入口选择
103
+ const [entranceSelectVisible, setEntranceSelectVisible] = useState(false);
104
+
105
+ // 日志弹框
106
+ const [logVisible, setLogVisible] = useState(false);
107
+
108
+ // 图形验证码
109
+ const [graphSmscodeVisible, setGraphSmscodeVisible] = useState(false);
110
+
111
+ // 番禺登录
112
+ const [pyLoginVisible, setPyLoginVisible] = useState(false);
113
+ const [currentOperatorName, setCurrentOperatorName] = useState("");
114
+
115
+ const smscodeCaptchaToken = useRef("");
116
+ const loginCaptchaToken = useRef("");
117
+
118
+ const checkGraphSmscode = () => {
119
+ Keyboard.dismiss();
120
+ return new Promise((resolve) => {
121
+ checkGraphSmscodeResolve = resolve;
122
+ setGraphSmscodeVisible(true);
123
+ });
124
+ };
125
+
126
+ const graphSmscodeSuccess = (data) => {
127
+ setGraphSmscodeVisible(false);
128
+ checkGraphSmscodeResolve && checkGraphSmscodeResolve(data);
129
+ checkGraphSmscodeResolve = null;
130
+ };
131
+
132
+ useEffect(() => {
133
+ if (!route.params?.skip) {
134
+ openProtocolDialog();
135
+ }
136
+ // 忘记密码页面返回
137
+ if (route.params?.loginWay) {
138
+ setLoginWay(route.params.loginWay);
139
+ }
140
+ storage.get("accountData").then(async (res) => {
141
+ const currentOperator = await storage.get(
142
+ `${res?.account?.account_id || ""}currentOperator`
143
+ );
144
+ setCurrentOperatorName(currentOperator?.name || "");
145
+ if (currentOperator?.name === "番禺有线") {
146
+ setPyLoginVisible(true);
147
+ }
148
+ });
149
+ if (appName === "悦慧家") {
150
+ setPyLoginVisible(true);
151
+ }
152
+
153
+ // (async () => {
154
+ // const coords = await getUserLocation();
155
+ // const res = await getCurrentWeather({
156
+ // lon: coords.coords.longitude,
157
+ // lat: coords.coords.latitude,
158
+ // });
159
+ // console.log(
160
+ // res.data.location.addressComponent.adcode,
161
+ // 'getCurrentWeather',
162
+ // );
163
+ // })();
164
+ const keyboardDidShow = Keyboard.addListener("keyboardDidShow", () => {
165
+ setKeybordShow(true);
166
+ });
167
+ const keyboardDidHide = Keyboard.addListener("keyboardDidHide", () => {
168
+ setKeybordShow(false);
169
+ });
170
+ return () => {
171
+ keyboardDidShow.remove();
172
+ keyboardDidHide.remove();
173
+ };
174
+ }, []);
175
+
42
176
  const insets = useSafeArea();
43
177
 
44
178
  const [isLoading, setIsLoading] = useState(true);
45
- const [isLogined, setIsLogined] = useState(false);
46
179
  const timer = useRef(null);
47
180
  const [isLogining, setIsLogining] = useState(false);
181
+ const [isLogined, setIsLogined] = useState(false);
182
+ const loginDisabled = !(
183
+ (loginWay === 0 && phone && userInputSmsCode) ||
184
+ (loginWay === 1 && username && password)
185
+ );
186
+ const statusBarPlaceholderStyle = {
187
+ height: Platform.OS === "ios" ? insets.top : 0,
188
+ };
48
189
 
49
190
  useEffect(() => {
50
191
  // 获取登录状态
51
- storage.get("accessToken").then((token) => {
52
- // const appUserAgreement = await storage.get('appUserAgreement');
53
- // if (!appUserAgreement) {
54
- // setProtocolAgree(false);
55
- // }
192
+ (async () => {
193
+ const accountType = await storage.get("accountType");
194
+ const token = await storage.get(
195
+ accountType === "adg" ? "adgAccessToken" : "accessToken"
196
+ );
197
+
198
+ if (appName === "遥控键码库") {
199
+ setTimeout(async () => {
200
+ global.loading.showLoading("正在加载");
201
+ await global.base.navigateModule({
202
+ operatorId: "ipanel",
203
+ moduleName: "adg",
204
+ screenName:
205
+ packageName === "com.ipanel.rnApp.abp2"
206
+ ? "IstickUpdate3Screen"
207
+ : "EntranceSelectScreen",
208
+ isReplace: true,
209
+ });
210
+ global.loading.hideLoading();
211
+ }, 0);
212
+
213
+ return;
214
+ // replace('Home', {
215
+ // redirect: true,
216
+ // });
217
+ }
56
218
 
57
219
  if (token) {
58
- if (DeviceInfo.getBrand() === "Allwinner") {
59
- replace("SbkScreen", {
60
- redirect: true,
220
+ // if (appName === "遥控键码库") {
221
+ // global.loading.showLoading("正在加载");
222
+ // await global.base.navigateModule({
223
+ // operatorId: "ipanel",
224
+ // moduleName: "adg",
225
+ // screenName:
226
+ // packageName === "com.ipanel.rnApp.abp2"
227
+ // ? "IstickUpdate3Screen"
228
+ // : "EntranceSelectScreen",
229
+ // isReplace: true,
230
+ // });
231
+ // global.loading.hideLoading();
232
+ // return;
233
+ // }
234
+
235
+ const entranceSelect = await storage.get("entranceSelect");
236
+ if (
237
+ entranceSelect === "tyygq" &&
238
+ envVersion !== "release" &&
239
+ !["禺乐慧家", "悦慧家", "吉柿果", "智慧中原"].includes(appName)
240
+ ) {
241
+ global.loading.showLoading("正在加载");
242
+ await global.base.navigateModule({
243
+ operatorId: "ipanel",
244
+ moduleName: "adg",
245
+ screenName: "IstickUpdate3Screen",
246
+ isReplace: true,
61
247
  });
248
+ global.loading.hideLoading();
62
249
  } else {
63
250
  replace("Home", {
64
251
  redirect: true,
65
252
  });
66
253
  }
67
-
68
- // 上报APP启动事件
69
254
  appReport("APP_STARTUP");
70
255
  }
71
256
  setTimeout(() => {
72
257
  setIsLoading(false);
73
258
  setIsLogined(!!token);
74
259
  }, 0);
75
- });
260
+ })();
76
261
  }, []);
77
262
 
78
263
  // useEffect(() => {
79
264
  // if (isLogined) {
80
- // // console.log("检测到已登录,自动跳转首页");
81
- // // TODO update account_data
82
265
  // replace('Home', {
83
266
  // redirect: true,
84
267
  // });
85
268
  // }
86
269
  // }, [isLogined]);
87
270
 
88
- const [phone, setPhone] = useState("");
89
- const [smsId, setSmsId] = useState("");
90
- const [userInputSmsCode, setUserInputSmsCode] = useState("");
91
- const [smsCodeRightBtnDisabled, setSmsCodeRightBtnDisabled] = useState(false);
92
- const [smsCodeRightBtnText, setSmsCodeRightBtnText] = useState("获取验证码");
93
- const [smsCodeResendTime, setSmsCodeResendTime] = useState(0);
271
+ const handleSwitchLoginWay = () => {
272
+ if (loginWay === 0) {
273
+ setLoginWay(1);
274
+ } else {
275
+ setLoginWay(0);
276
+ }
277
+ };
278
+ const handleChangeActive = (type) => {
279
+ setActiveIndex(type);
280
+ setActiveType(type === 0 ? "adg" : "ajb");
281
+ resetData();
282
+ };
283
+ const resetData = () => {
284
+ if (loginWay === 0) {
285
+ setPhone("");
286
+ setSmsId("");
287
+ setUserInputSmsCode("");
288
+ setSmsCodeRightBtnDisabled(false);
289
+ setSmsCodeRightBtnText("发送验证码");
290
+ setSmsCodeResendTime(0);
291
+ } else {
292
+ setUsername("");
293
+ setPassword("");
294
+ }
295
+ setProtocolAgree(false);
296
+ setProtocolDialogVisible(false);
94
297
 
298
+ setPrivacyAgree(false);
299
+ setServiceAgree(false);
300
+ setPrivacyDialogVisible(false);
301
+ setServiceDialogVisible(false);
302
+ };
95
303
  useEffect(() => {
96
- if (phone && smsCodeResendTime === 0) {
304
+ if (phone.length === 11 && smsCodeResendTime === 0) {
97
305
  setSmsCodeRightBtnDisabled(false);
98
306
  setSmsCodeRightBtnText("获取验证码");
99
307
  } else {
@@ -101,37 +309,16 @@ function LoginScreen({ navigation, route }) {
101
309
  }
102
310
  }, [phone, smsCodeResendTime]);
103
311
  useEffect(() => {
104
- if (smsCodeResendTime > 0) {
105
- setSmsCodeRightBtnText(`${smsCodeResendTime}s后重发`);
106
- timer.current = setTimeout(() => {
107
- setSmsCodeResendTime(smsCodeResendTime - 1);
108
- }, 1000);
109
- }
312
+ // if (smsCodeResendTime > 0) {
313
+ // setSmsCodeRightBtnText(`${smsCodeResendTime}s后重发`);
314
+ // timer.current = setTimeout(() => {
315
+ // setSmsCodeResendTime(smsCodeResendTime - 1);
316
+ // }, 1000);
317
+ // }
110
318
 
111
319
  return () => {
112
320
  clearTimeout(timer.current);
113
321
  };
114
- }, [smsCodeResendTime]);
115
-
116
- // 0 手机号+短信验证码登录
117
- // 1 账号密码登录
118
- const [loginWay, setLoginWay] = useState(0);
119
-
120
- const [username, setUsername] = useState("");
121
- const [password, setPassword] = useState("");
122
-
123
- const [protocolAgree, setProtocolAgree] = useState(false);
124
- const [protocolDialogVisible, setProtocolDialogVisible] = useState(false);
125
-
126
- const [serviceAgree, setServiceAgree] = useState(false);
127
- const [serviceDialogVisible, setServiceDialogVisible] = useState(false);
128
- const [privacyAgree, setPrivacyAgree] = useState(false);
129
- const [privacyDialogVisible, setPrivacyDialogVisible] = useState(false);
130
-
131
- useEffect(() => {
132
- if (!route.params?.skip) {
133
- openProtocolDialog();
134
- }
135
322
  }, []);
136
323
 
137
324
  useEffect(() => {
@@ -142,87 +329,128 @@ function LoginScreen({ navigation, route }) {
142
329
  }
143
330
  }, [serviceAgree, privacyAgree]);
144
331
 
145
- const loginDisabled = !(
146
- (loginWay === 0 && phone && userInputSmsCode) ||
147
- (loginWay === 1 && username && password)
148
- );
332
+ const onLongPress = () => {
333
+ console.log("长按打开日志弹框");
334
+ setLogVisible(true);
335
+ };
149
336
 
150
- let smsCodeTimer;
337
+ // useEffect(() => {
338
+ // if (protocolAgree) {
339
+ // setServiceAgree(true);
340
+ // setPrivacyAgree(true);
341
+ // }
342
+ // }, [protocolAgree]);
343
+
344
+ // 用户
345
+ const userAgreementURl = useMemo(() => {
346
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
347
+ return "https://szjtyfw.panyu.gd.cn:50443/iapp/ylhjstatic/service_agreement/user_agreement.html";
348
+ } else if (appName === "吉柿果") {
349
+ return "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_jlagreement/user_agreement.html";
350
+ } else {
351
+ return "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html";
352
+ }
353
+ }, []);
151
354
 
355
+ const privacyPolicyURI = useMemo(() => {
356
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
357
+ return "https://szjtyfw.panyu.gd.cn:50443/iapp/ylhjstatic/service_agreement/privacy_policy.html";
358
+ } else if (appName === "吉柿果") {
359
+ return "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_jlagreement/user_agreement.html";
360
+ } else {
361
+ return "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html";
362
+ }
363
+ }, []);
364
+
365
+ const handleViewUserAgreement = () => {
366
+ navigation.navigate("WebviewScreen", {
367
+ title: "用户协议",
368
+ url: userAgreementURl,
369
+ });
370
+ };
371
+ const handleViewPrivacyClause = () => {
372
+ navigation.navigate("WebviewScreen", {
373
+ title: "隐私条款",
374
+ url: privacyPolicyURI,
375
+ });
376
+ };
377
+
378
+ const handleLookFreely = () => {
379
+ navigation.navigate("WebviewScreen", {
380
+ title: "",
381
+ url: "https://szjtyfw.panyu.gd.cn:50443/s/tidyinfo/ylhjh5/web/#/",
382
+ });
383
+ };
384
+
385
+ const handleViewUserAgreementByType = (type) => {
386
+ if (type === "service") {
387
+ setServiceDialogVisible(true);
388
+ } else if (type === "privacy") {
389
+ setPrivacyDialogVisible(true);
390
+ }
391
+ };
392
+ let smsCodeTimer;
152
393
  function validPhone(phone) {
153
394
  if (!phone) {
154
395
  Alert.alert("请输入手机号");
155
396
  return false;
156
397
  }
157
398
  if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(phone)) {
158
- Alert.alert("请输入正确的手机号");
399
+ // Alert.alert('请输入正确的手机号');
400
+ global.toast.showToast("手机号无效,请检查!");
159
401
  return false;
160
402
  }
161
403
  return true;
162
404
  }
163
-
164
- const handleGetSmsId = async () => {
165
- if (!validPhone(phone)) {
166
- return;
167
- }
168
- // 60s后重发
169
- setSmsCodeResendTime(60);
170
-
171
- setSmsCodeRightBtnDisabled(true);
172
-
173
- const res = await obtainSmscode({
174
- phone_number: phone,
175
- length: 4,
176
- type: 1, // type=1 表示登录用途
177
- }).catch((err) => {
178
- console.log(err);
179
- setSmsCodeRightBtnText("获取验证码");
180
- setSmsCodeRightBtnDisabled(false);
181
- });
182
-
183
- if (res && res.code === 0) {
184
- setSmsId(res.result.sms_id);
185
-
186
- smsCodeTimer = setTimeout(() => {
187
- setSmsCodeRightBtnText("获取验证码");
188
- setSmsCodeRightBtnDisabled(false);
189
- }, 120000);
190
- } else {
191
- setSmsCodeRightBtnText("获取验证码");
192
- setSmsCodeRightBtnDisabled(false);
193
- }
405
+ const handleUserDisagree = async () => {
406
+ setProtocolDialogVisible(false);
407
+ setProtocolAgree(false);
408
+ setServiceAgree(false);
409
+ setPrivacyAgree(false);
194
410
  };
195
-
196
411
  const handleUserAgree = () => {
197
- // setProtocolDialogVisible(false);
198
- // handleLogin();
199
- // storage.set('appUserAgreement', true);
200
-
201
- // getUserLocation().then(geoRes => {
202
- // global.base.storage.set('location', geoRes);
203
- // });
204
412
  setProtocolAgree(true);
413
+ console.log(typeof protocolAgreeResolve);
205
414
  typeof protocolAgreeResolve === "function" && protocolAgreeResolve();
206
415
  protocolAgreeResolve = null;
207
416
  };
208
417
 
209
- const handleUserDisagree = async () => {
210
- // await storage.set('appUserAgreement', false);
211
- // NativeModules?.RNToNativeEmitter?.exitApp();
212
- setProtocolDialogVisible(false);
418
+ const handleOneDisagree = async (type) => {
213
419
  setProtocolAgree(false);
214
- setServiceAgree(false);
215
- setPrivacyAgree(false);
420
+ if (type === "service") {
421
+ setServiceAgree(false);
422
+ setServiceDialogVisible(false);
423
+ } else if (type === "privacy") {
424
+ setPrivacyAgree(false);
425
+ setPrivacyDialogVisible(false);
426
+ }
427
+ };
428
+ const handleOneAgree = (type) => {
429
+ if (type === "service") {
430
+ setServiceAgree(true);
431
+ setServiceDialogVisible(false);
432
+ } else if (type === "privacy") {
433
+ setPrivacyAgree(true);
434
+ setPrivacyDialogVisible(false);
435
+ }
436
+
437
+ typeof protocolAgreeResolve === "function" && protocolAgreeResolve();
438
+ protocolAgreeResolve = null;
439
+ };
440
+
441
+ const handleSetProtocolAgree = (isAgree) => {
442
+ setProtocolAgree(isAgree);
443
+ setServiceAgree(isAgree);
444
+ setPrivacyAgree(isAgree);
216
445
  };
217
446
 
218
447
  const handleLoginPress = () => {
219
448
  if (loginDisabled) {
220
449
  return;
221
450
  }
222
- if (protocolAgree) {
451
+ if (protocolAgree || appName === "遥控键码库") {
223
452
  handleLogin();
224
453
  } else {
225
- // setProtocolDialogVisible(true);
226
454
  openProtocolDialog().then(() => {
227
455
  handleLogin();
228
456
  });
@@ -231,7 +459,7 @@ function LoginScreen({ navigation, route }) {
231
459
 
232
460
  const openProtocolDialog = () => {
233
461
  return new Promise((resolve) => {
234
- // setProtocolDialogVisible(true);
462
+ setProtocolDialogVisible(true);
235
463
  protocolAgreeResolve = resolve;
236
464
  }).then(() => {
237
465
  setProtocolDialogVisible(false);
@@ -239,9 +467,12 @@ function LoginScreen({ navigation, route }) {
239
467
  };
240
468
 
241
469
  const handleLogin = async () => {
470
+ let adcode;
242
471
  let res;
243
-
244
- const { deviceModal, appName } = NativeModules?.RNToNativeEmitter || {};
472
+ // const appName =
473
+ // NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
474
+ // const appName = '遥控键码库';
475
+ const { deviceModal } = NativeModules?.RNToNativeEmitter || {};
245
476
 
246
477
  const appID = await global.base.getAppId();
247
478
 
@@ -269,7 +500,7 @@ function LoginScreen({ navigation, route }) {
269
500
  }
270
501
  showLoading("登录中...");
271
502
  setIsLogining(true);
272
- res = await smscodeLogin({
503
+ let params = {
273
504
  phone_number: phone,
274
505
  sms_id: smsId,
275
506
  sms_code: userInputSmsCode,
@@ -278,8 +509,19 @@ function LoginScreen({ navigation, route }) {
278
509
  appid: finallyAppID,
279
510
  model: deviceModal || "开发测试",
280
511
  application: appName || "爱家宝",
512
+ platform: "phone",
513
+ entry: "app",
281
514
  },
282
- });
515
+ operator_id:
516
+ appName === "悦慧家" ? "c492121bac734bb983814b67ceafcae9" : undefined,
517
+ };
518
+ if (activeIndex === 0) {
519
+ delete params.create_address;
520
+ }
521
+ if (loginCaptchaToken.current) {
522
+ params.captcha_token = loginCaptchaToken.current;
523
+ }
524
+ res = await smscodeLogin(params, activeType);
283
525
  } else {
284
526
  if (!username) {
285
527
  Alert.alert("请输入账号");
@@ -293,7 +535,7 @@ function LoginScreen({ navigation, route }) {
293
535
  console.log(global.loading, "global.loading");
294
536
  showLoading("登录中...");
295
537
  setIsLogining(true);
296
- res = await accountLogin({
538
+ let params = {
297
539
  account_name: username,
298
540
  password: CryptoJS.MD5(password).toString(),
299
541
  create_address: 1, // 注册时自动建默认家庭
@@ -301,27 +543,65 @@ function LoginScreen({ navigation, route }) {
301
543
  appid: finallyAppID,
302
544
  model: deviceModal || "开发测试",
303
545
  application: appName || "爱家宝",
546
+ platform: "phone",
547
+ entry: "app",
304
548
  },
305
- });
549
+ operator_id:
550
+ appName === "悦慧家" ? "c492121bac734bb983814b67ceafcae9" : undefined,
551
+ };
552
+ if (activeIndex === 0) {
553
+ delete params.create_address;
554
+ }
555
+ if (loginCaptchaToken.current) {
556
+ params.captcha_token = loginCaptchaToken.current;
557
+ }
558
+ res = await accountLogin(params, activeType);
306
559
  }
560
+ loginCaptchaToken.current = "";
307
561
  if (res.code === 0) {
308
562
  console.log(res.result, "ipanelClound用户信息");
309
- await storage.set("accessToken", res.result.access_token);
310
- await storage.set("refreshToken", res.result.refresh_token);
563
+ await storage.set("accountType", activeType);
564
+ await storage.set(
565
+ activeType === "adg" ? "adgAccessToken" : "accessToken",
566
+ res.result.access_token
567
+ );
568
+ await storage.set(
569
+ activeType === "adg" ? "adgRefreshToken" : "refreshToken",
570
+ res.result.refresh_token
571
+ );
311
572
 
312
- if (res.result.address && res.result.address[0]) {
313
- const defaultAddr = res.result.address[0];
314
- await storage.set("activeAddr", defaultAddr);
315
- await storage.set("addressList", res.result.address || []);
573
+ if (activeIndex === 1) {
574
+ if (res.result.address && res.result.address[0]) {
575
+ const addressList = res.result.address.map((item) => {
576
+ return {
577
+ ...item,
578
+ room_list: null,
579
+ };
580
+ });
581
+ const defaultAddr = addressList[0];
582
+ console.log(defaultAddr.address_id, "defaultAddr.address_id");
583
+ await storage.set("activeAddr", defaultAddr);
584
+ await storage.set("addressList", addressList);
585
+ } else {
586
+ await storage.set("activeAddr", {});
587
+ await storage.set("addressList", []);
588
+ }
316
589
  await updateHomedToken();
317
- } else {
318
- await storage.set("activeAddr", {});
319
- await storage.set("addressList", []);
320
590
  }
321
-
322
591
  delete res.result.address;
323
592
  await storage.set("accountData", res.result);
324
593
 
594
+ // 存储boss账号信息
595
+ if (res.result?.user && res.result?.user?.bind_list) {
596
+ const bind_boss = res.result?.user?.bind_list.filter((item) => {
597
+ return item.third_type === "boss";
598
+ });
599
+ if (bind_boss.length) {
600
+ console.log(bind_boss[0], "bind_boss[0]");
601
+ await storage.set("bossData", bind_boss[0]);
602
+ }
603
+ }
604
+
325
605
  // 放开这段重新登录就会置空运营商(进入标准版)
326
606
  // await storage.set(
327
607
  // `${res.result?.account?.account_id || ''}currentOperator`,
@@ -331,10 +611,62 @@ function LoginScreen({ navigation, route }) {
331
611
  // 初始化默认运营商对应的homed游客账号
332
612
  const envVersion =
333
613
  NativeModules?.RNToNativeEmitter?.serverCluster || "dev";
614
+ // homed.jishimedia.com 吉柿果homed域名
615
+ const domain = ["吉柿果"].includes(appName)
616
+ ? "homed.jishimedia.com"
617
+ : ["智慧中原"].includes(appName)
618
+ ? "homed.hnzhzy.com"
619
+ : envVersion === "dev"
620
+ ? "homed.me"
621
+ : "homed.tv";
622
+ const touristGroupId = ["吉柿果"].includes(appName)
623
+ ? 4712
624
+ : ["智慧中原"].includes(appName)
625
+ ? 1303
626
+ : envVersion === "dev"
627
+ ? 115017
628
+ : 4664;
629
+ // const domain = ["吉柿果"].includes(appName) ? "homed.tv" : envVersion === "dev" ? "homed.me" : "homed.tv";
630
+ // const touristGroupId = ["吉柿果"].includes(appName) ? 4664 : envVersion === "dev" ? 115017 : 4664;
631
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
632
+ await storage.set(
633
+ `${res.result?.account?.account_id || ""}currentOperator`,
634
+ {
635
+ id: "c492121bac734bb983814b67ceafcae9",
636
+ name: "番禺区广电网络",
637
+ }
638
+ );
639
+ }
640
+ if (["吉柿果"].includes(appName)) {
641
+ await storage.set(
642
+ `${res.result?.account?.account_id || ""}currentOperator`,
643
+ {
644
+ id: "061aa081306a455da811639160763190",
645
+ name: "吉视传媒",
646
+ }
647
+ );
648
+ } else if (["智慧中原"].includes(appName)) {
649
+ await storage.set(
650
+ `${res.result?.account?.account_id || ""}currentOperator`,
651
+ {
652
+ id: "f819e2a464644e38861f20458b673958",
653
+ name: "河南有线",
654
+ }
655
+ );
656
+ }
657
+
658
+ /**
659
+ * ☆☆☆使用homed token的完整方案:☆☆☆
660
+ - 对于 homed 数据只读的业务场景,使用游客令牌(由 http://access.homed.me/account/get_accesstoken 接口产生)。该方式的优点是不依赖ipanelcloud用户登录(当前APP实现上是ipanelcloud登录后才能看到内容,因此这个可以不着急实现),不产生垃圾用户数据
661
+ - 涉及到产生个人数据但 又不想走绑定正式homed用户流程 的业务场景,使用ipanelcloud登录后返回的 account_id 注册的游客用户token(即:await storage.get("homedTouristAccessToken") )
662
+ - 涉及到产生个人数据且 数据需要关联到正式homed用户 的业务场景,走绑定正式homed用户的流程(即:await storage.get("homedAccessToken") )
663
+ */
664
+ // 初始化默认运营商对应的homed游客账号
665
+ console.log("account_id", res.result.account_id);
334
666
  await initOperatorHomedTouristAccount({
335
- touristUsername: finallyAppID,
336
- domain: envVersion === "dev" ? "homed.me" : "homed.tv",
337
- touristGroupId: envVersion === "dev" ? 115017 : 4664, // 4664: tv集群的手机APP游客用户组. 115017: 运营集群手机APP游客用户组
667
+ touristUsername: res.result.account_id, // 使用ipanelcloud account_id 作为homed游客账号的用户名
668
+ domain: domain,
669
+ touristGroupId: touristGroupId, // 4664: tv集群的手机APP游客用户组. 115017: 运营集群手机APP游客用户组
338
670
  });
339
671
  clearTimeout(smsCodeTimer);
340
672
  // setIsLogined(true);
@@ -342,21 +674,143 @@ function LoginScreen({ navigation, route }) {
342
674
  const currentOperator = await storage.get(
343
675
  `${res.result?.account?.account_id || ""}currentOperator`
344
676
  );
677
+ // 获取公寓token
678
+ const apartmentRes = await getHouseType().catch((err) => {});
679
+ console.log(apartmentRes, "apartmentResapartmentRes");
680
+
681
+ if (apartmentRes?.code === 0) {
682
+ let list = apartmentRes.data || [];
683
+ if (list.length) {
684
+ // 拥有角色列表
685
+ const minUserType = list.reduce(
686
+ (min, current) => (current.userType < min.userType ? current : min),
687
+ list[0]
688
+ );
689
+ if (minUserType?.userType) {
690
+ const loginRes = await loginByType(minUserType?.userType, {});
691
+ console.log(loginRes, "loginRes");
692
+ if (loginRes.code === 0 && loginRes.data) {
693
+ await storage.set("apartmentData", {
694
+ ...loginRes.data,
695
+ userType: minUserType?.userType,
696
+ userTypeName: minUserType?.userTypeName,
697
+ });
698
+ await storage.set("apartmentToken", loginRes.data.accessToken);
699
+ } else {
700
+ await storage.set("apartmentData", {});
701
+ await storage.set("apartmentToken", "");
702
+ }
703
+ }
704
+ } else {
705
+ await storage.set("apartmentData", {});
706
+ await storage.set("apartmentToken", "");
707
+ }
708
+ } else {
709
+ await storage.set("apartmentData", {});
710
+ await storage.set("apartmentToken", "");
711
+ }
345
712
 
346
713
  // 上报APP启动事件
347
714
  appReport("APP_STARTUP");
348
715
 
349
716
  hideLoading();
350
717
  setIsLogining(false);
351
- const appName =
352
- NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
353
718
 
354
- if (DeviceInfo.getBrand() === "Allwinner") {
355
- // 声必可屏幕
356
- replace("SbkScreen", {
719
+ if (appName === "遥控键码库") {
720
+ global.loading.showLoading("正在加载");
721
+ await global.base.navigateModule({
722
+ operatorId: "ipanel",
723
+ moduleName: "adg",
724
+ screenName:
725
+ packageName === "com.ipanel.rnApp.abp2"
726
+ ? "IstickUpdate3Screen"
727
+ : "EntranceSelectScreen",
728
+ isReplace: true,
729
+ });
730
+ global.loading.hideLoading();
731
+ return;
732
+ }
733
+
734
+ console.log(activeType);
735
+ console.log(envVersion);
736
+ console.log(9999, appName);
737
+ if (
738
+ activeType === "ajb" &&
739
+ envVersion !== "release" &&
740
+ !["禺乐慧家", "悦慧家", "吉柿果", "智慧中原"].includes(appName) &&
741
+ currentOperatorName !== "番禺有线"
742
+ ) {
743
+ const entrance = await selectEntrance();
744
+ await storage.set("entranceSelect", entrance);
745
+ if (entrance === "tyygq") {
746
+ global.loading.showLoading("正在加载");
747
+ await global.base.navigateModule({
748
+ operatorId: "ipanel",
749
+ moduleName: "adg",
750
+ screenName: "IstickUpdate3Screen",
751
+ isReplace: true,
752
+ });
753
+ global.loading.hideLoading();
754
+ return;
755
+ }
756
+ }
757
+
758
+ if (appName.includes("爱家宝") && env !== "__BASE_SINGLETON_MODE__") {
759
+ confirmWithContent({
760
+ title: "选择运营商",
761
+ component: "你是否要选择运营商",
762
+ confirmButtonText: "确定",
763
+ confirmCallback: () => {
764
+ replace("OperatorSelectScreen", {
765
+ purpose: "init",
766
+ });
767
+ },
768
+ cancelButtonText: "先不选",
769
+ cancelCallback: () => {
770
+ replace("Home", {
771
+ redirect: false,
772
+ });
773
+ },
774
+ });
775
+ } else {
776
+ replace("Home", {
777
+ redirect: false,
778
+ });
779
+ }
780
+
781
+ /*
782
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
783
+ let selectedOperator = {
784
+ id: "c492121bac734bb983814b67ceafcae9",
785
+ name: "番禺区广电网络",
786
+ };
787
+ const accountData = await storage.get("accountData");
788
+ await storage.set(
789
+ `${accountData?.account?.account_id || ""}currentOperator`,
790
+ selectedOperator
791
+ );
792
+ replace("Home", {
357
793
  redirect: false,
358
794
  });
359
- } else if (currentOperator || appName.includes("安电工")) {
795
+ } else if (["吉柿果"].includes(appName)) {
796
+ let selectedOperator = {
797
+ id: "061aa081306a455da811639160763190",
798
+ name: "吉视传媒",
799
+ };
800
+ const accountData = await storage.get("accountData");
801
+ await storage.set(
802
+ `${accountData?.account?.account_id || ""}currentOperator`,
803
+ selectedOperator
804
+ );
805
+ replace("Home", {
806
+ redirect: false,
807
+ });
808
+ } else if (
809
+ currentOperator ||
810
+ appName.includes("安电工") ||
811
+ activeType === "adg" ||
812
+ env === "__BASE_SINGLETON_MODE__"
813
+ ) {
360
814
  replace("Home", {
361
815
  redirect: false,
362
816
  });
@@ -378,72 +832,89 @@ function LoginScreen({ navigation, route }) {
378
832
  },
379
833
  });
380
834
  }
835
+ */
381
836
  } else {
382
837
  hideLoading();
383
838
  setIsLogining(false);
384
- global.toast.showToast(res.message + "(code: " + res.code + ")");
839
+ const message = errorCodeMap[res.code] || res.message || "登录失败!";
840
+ global.toast.showToast(message);
841
+ if (res.code === 10430) {
842
+ loginCaptchaToken.current = await checkGraphSmscode();
843
+ if (loginWay === 0) {
844
+ //手机登录方式才需要重发送手机号
845
+ handleGetSmsId();
846
+ }
847
+ }
385
848
  }
386
849
  };
387
850
 
388
- const statusBarPlaceholderStyle = {
389
- height: (Platform.OS === "ios" ? insets.top : 0) + StatusBar.currentHeight,
851
+ // 选择入口
852
+ const selectEntrance = () => {
853
+ return new Promise((resolve) => {
854
+ setEntranceSelectVisible(true);
855
+ selectEntranceResolve = resolve;
856
+ });
390
857
  };
391
858
 
392
- const handleSwitchLoginWay = () => {
393
- if (loginWay === 0) {
394
- setLoginWay(1);
395
- } else {
396
- setLoginWay(0);
397
- }
859
+ const startSmsCodeResendTime = () => {
860
+ clearInterval(timer.current);
861
+ setSmsCodeResendTime(60);
862
+ setSmsCodeRightBtnText("60s后重发");
863
+ timer.current = setInterval(() => {
864
+ if (latestSmsCodeResendTime.current === 0) {
865
+ clearInterval(timer.current);
866
+ } else {
867
+ const time = latestSmsCodeResendTime.current - 1;
868
+ setSmsCodeResendTime(time);
869
+ setSmsCodeRightBtnText(`${time}s后重发`);
870
+ }
871
+ }, 1000);
398
872
  };
399
873
 
400
- const handleViewUserAgreement = () => {
401
- navigation.navigate("WebviewScreen", {
402
- title: "用户协议",
403
- url: "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html",
404
- });
405
- };
406
- const handleViewPrivacyClause = () => {
407
- navigation.navigate("WebviewScreen", {
408
- title: "隐私条款",
409
- url: "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html",
410
- });
411
- };
412
- const handleViewUserAgreementByType = (type) => {
413
- if (type === "service") {
414
- setServiceDialogVisible(true);
415
- } else if (type === "privacy") {
416
- setPrivacyDialogVisible(true);
874
+ const handleGetSmsId = async () => {
875
+ if (!validPhone(phone)) {
876
+ return;
417
877
  }
418
- };
878
+ // 60s后重发
879
+ startSmsCodeResendTime();
419
880
 
420
- const handleSetProtocolAgree = (isAgree) => {
421
- setProtocolAgree(isAgree);
422
- setServiceAgree(isAgree);
423
- setPrivacyAgree(isAgree);
424
- };
881
+ const res = await obtainSmscode(
882
+ {
883
+ phone_number: phone,
884
+ length: 4,
885
+ type: 1, // type=1 表示登录用途
886
+ captcha_token: smscodeCaptchaToken.current
887
+ ? smscodeCaptchaToken.current
888
+ : undefined,
889
+ },
890
+ activeType
891
+ ).catch((err) => {
892
+ console.log(err);
893
+ // setSmsCodeRightBtnText("获取验证码");
894
+ // setSmsCodeRightBtnDisabled(false);
895
+ setSmsCodeResendTime(0);
896
+ clearInterval(timer.current);
897
+ });
898
+ smscodeCaptchaToken.current = "";
899
+ if (res && res.code === 0) {
900
+ setSmsId(res.result.sms_id);
425
901
 
426
- const handleOneDisagree = async (type) => {
427
- setProtocolAgree(false);
428
- if (type === "service") {
429
- setServiceAgree(false);
430
- setServiceDialogVisible(false);
431
- } else if (type === "privacy") {
432
- setPrivacyAgree(false);
433
- setPrivacyDialogVisible(false);
434
- }
435
- };
436
- const handleOneAgree = (type) => {
437
- if (type === "service") {
438
- setServiceAgree(true);
439
- setServiceDialogVisible(false);
440
- } else if (type === "privacy") {
441
- setPrivacyAgree(true);
442
- setPrivacyDialogVisible(false);
902
+ // smsCodeTimer = setTimeout(() => {
903
+ // setSmsCodeRightBtnText("获取验证码");
904
+ // setSmsCodeRightBtnDisabled(false);
905
+ // }, 120000);
906
+ } else {
907
+ const message =
908
+ errorCodeMap[res.code] || res.message || "获取验证码失败!";
909
+ if (res.code === 10430) {
910
+ smscodeCaptchaToken.current = await checkGraphSmscode();
911
+ handleGetSmsId();
912
+ } else {
913
+ global.toast.showToast(message);
914
+ setSmsCodeResendTime(0);
915
+ clearInterval(timer.current);
916
+ }
443
917
  }
444
-
445
- typeof protocolAgreeResolve === "function" && protocolAgreeResolve();
446
- protocolAgreeResolve = null;
447
918
  };
448
919
 
449
920
  loginDisabled;
@@ -453,376 +924,873 @@ function LoginScreen({ navigation, route }) {
453
924
  : "rgba(234, 96, 0, 1)",
454
925
  };
455
926
 
456
- return (
457
- <ImageBackground
458
- source={require("../../assets/img/login_bg.png")}
459
- style={[
460
- styles.container,
461
- { paddingTop: Platform.OS === "ios" ? insets.top : 0 },
462
- ]}
463
- >
464
- {isLoading || isLogined ? (
465
- <View style={styles.welcomeView}>{/* 白屏界面 */}</View>
466
- ) : (
467
- <View style={styles.loginView}>
468
- <View style={statusBarPlaceholderStyle} />
469
-
470
- <View style={styles.changeLoginWay}>
471
- <TouchableOpacity
472
- activeOpacity={0.7}
473
- onPress={handleSwitchLoginWay}
927
+ // 收不到验证码
928
+ const smsCodeTips = () => {
929
+ confirmTitleContent({
930
+ title: "收不到验证码",
931
+ component:
932
+ "1、请检查手机网络是否正常\n2、请确认手机号是否为当前使用的手机号\n3、检查短信是否被安全软件拦截\n4、运营商网络原因,短信可能延迟到达",
933
+ confirmButtonText: "好的",
934
+ cancelButtonText: null,
935
+ contentTextStyle: {
936
+ textAlign: "left",
937
+ fontSize: px(45),
938
+ fontWeight: "400",
939
+ color: "#333",
940
+ },
941
+ });
942
+ };
943
+
944
+ const render = () => {
945
+ return (
946
+ <View style={{ flex: 1, backgroundColor: "#fff", position: "relative" }}>
947
+ <ImageBackground
948
+ source={
949
+ appName === "悦慧家" || currentOperatorName === "番禺有线"
950
+ ? require("../../assets/img/login_bg_py.png")
951
+ : require("../../assets/img/login_bg_new.png")
952
+ }
953
+ style={[styles.container, { paddingTop: 0 }]}
954
+ >
955
+ {pyLoginVisible ? (
956
+ <PyLoginIndex
957
+ setPyLoginVisible={setPyLoginVisible}
958
+ setLoginWay={setLoginWay}
959
+ onLongPress={onLongPress}
960
+ />
961
+ ) : isLoading || isLogined ? (
962
+ <View style={styles.welcomeView}>{/* 白屏界面 */}</View>
963
+ ) : (
964
+ <TouchableWithoutFeedback
965
+ onPress={() => {
966
+ Keyboard.dismiss();
967
+ }}
474
968
  >
475
- <View style={styles.changeLoginWayInner}>
476
- <Image
477
- source={require("../../assets/img/qiehuan.png")}
478
- style={styles.exchangeIcon}
479
- />
480
-
481
- <Text style={styles.changeLoginWayText}>
482
- {loginWay === 0 ? "密码登录" : "验证码登录"}
483
- </Text>
484
- </View>
485
- </TouchableOpacity>
486
- </View>
487
-
488
- <View style={styles.content}>
489
- <View style={styles.titleBox}>
490
- <Text style={styles.title}>
491
- {loginWay === 0 ? "验证码登录" : "密码登录"}
492
- </Text>
493
-
494
- <Text style={styles.subTitle}>
495
- {loginWay === 0
496
- ? "未注册过的手机号验证通过后将自动注册"
497
- : "请使用账号和密码登录"}
498
- </Text>
499
- </View>
500
-
501
- {loginWay === 0 && (
502
- <>
503
- <View style={styles.inputBox}>
504
- <TextInput
505
- style={styles.input}
506
- value={phone}
507
- placeholder="手机号"
508
- onChangeText={(text) => setPhone(text)}
509
- />
510
- </View>
511
- <View style={styles.inputBox}>
512
- <SmsCodeInput
513
- value={userInputSmsCode}
514
- placeholder="验证码"
515
- rightBtnDisabled={smsCodeRightBtnDisabled}
516
- rightBtnText={smsCodeRightBtnText}
517
- onChangeText={(text) => setUserInputSmsCode(text)}
518
- onRightBtnPress={handleGetSmsId}
969
+ <View
970
+ style={
971
+ appName === "悦慧家" || currentOperatorName === "番禺有线"
972
+ ? { position: "relative", flex: 1 }
973
+ : { position: "relative", flex: 1 }
974
+ }
975
+ >
976
+ <View style={statusBarPlaceholderStyle} />
977
+ {appName === "悦慧家" || currentOperatorName === "番禺有线" ? (
978
+ <PyLoginType
979
+ activeIndex={activeIndex}
980
+ handleChangeActive={handleChangeActive}
981
+ setPyLoginVisible={setPyLoginVisible}
519
982
  />
983
+ ) : (
984
+ <View style={styles.loginHead}>
985
+ <View>
986
+ <Text style={styles.welcomeTitleText}>欢迎登录!</Text>
987
+ <Text style={styles.welcomeSubTitleText}>
988
+ 安装省心 智能管家
989
+ </Text>
990
+ </View>
991
+ <View style={{ width: px(403), height: px(265) }}>
992
+ {/* <Image
993
+ source={
994
+ activeIndex === 0
995
+ ? require('../../assets/img/worker.png')
996
+ : require('../../assets/img/computer.png')
997
+ }
998
+ style={styles.topImg}
999
+ resizeMode="contain"
1000
+ /> */}
1001
+ {activeIndex === 0 ? (
1002
+ <Image
1003
+ source={require("../../assets/img/worker.png")}
1004
+ style={styles.topImg}
1005
+ resizeMode="contain"
1006
+ />
1007
+ ) : (
1008
+ <GestureHandlerRootView>
1009
+ <LongPressGestureHandler
1010
+ minDurationMs={2000} // 设置长按的最短时间为5000毫秒,即5秒
1011
+ onActivated={onLongPress}
1012
+ >
1013
+ <Image
1014
+ source={require("../../assets/img/computer.png")}
1015
+ style={styles.topImg}
1016
+ resizeMode="contain"
1017
+ />
1018
+ </LongPressGestureHandler>
1019
+ </GestureHandlerRootView>
1020
+ )}
1021
+ </View>
1022
+ </View>
1023
+ )}
1024
+
1025
+ {!["吉柿果", "遥控键码库", "智慧中原", "悦慧家"].includes(
1026
+ appName
1027
+ ) &&
1028
+ currentOperatorName !== "番禺有线" && (
1029
+ <LoginType
1030
+ activeIndex={activeIndex}
1031
+ changeActive={handleChangeActive}
1032
+ />
1033
+ )}
1034
+
1035
+ <View
1036
+ style={{
1037
+ ...styles.inputView,
1038
+ paddingTop: ["吉柿果", "遥控键码库", "智慧中原"].includes(
1039
+ appName
1040
+ )
1041
+ ? px(100)
1042
+ : 0,
1043
+ }}
1044
+ >
1045
+ {loginWay === 0 && (
1046
+ <>
1047
+ <View
1048
+ style={[
1049
+ styles.inputBox,
1050
+ { marginTop: px(40), marginBottom: px(75) },
1051
+ ]}
1052
+ >
1053
+ <Text style={styles.inputTitle}>+86</Text>
1054
+ <View style={styles.inputDivider} />
1055
+ <TextInput
1056
+ keyboardType="number-pad"
1057
+ style={styles.input}
1058
+ value={phone}
1059
+ placeholder="请输入您的手机号"
1060
+ placeholderTextColor="#A6A6A6"
1061
+ onChangeText={(text) => setPhone(text)}
1062
+ returnKeyType="done"
1063
+ maxLength={11}
1064
+ />
1065
+ </View>
1066
+ <View style={[styles.inputBox]}>
1067
+ <SmsCodeInput
1068
+ value={userInputSmsCode}
1069
+ placeholder="请输入验证码"
1070
+ rightBtnDisabled={smsCodeRightBtnDisabled}
1071
+ rightBtnText={smsCodeRightBtnText}
1072
+ appName={appName}
1073
+ currentOperatorName={currentOperatorName}
1074
+ onChangeText={(text) => setUserInputSmsCode(text)}
1075
+ onRightBtnPress={handleGetSmsId}
1076
+ />
1077
+ </View>
1078
+ </>
1079
+ )}
1080
+ {loginWay === 1 && (
1081
+ <>
1082
+ <View
1083
+ style={[
1084
+ styles.inputBox,
1085
+ { marginTop: px(40), marginBottom: px(75) },
1086
+ ]}
1087
+ >
1088
+ <Text style={styles.inputTitle}>账号</Text>
1089
+ <View style={styles.inputDivider} />
1090
+ <TextInput
1091
+ style={styles.input}
1092
+ placeholder="请输入您的账号"
1093
+ placeholderTextColor="#A6A6A6"
1094
+ value={username}
1095
+ onChangeText={(text) => setUsername(text)}
1096
+ returnKeyType="done"
1097
+ />
1098
+ </View>
1099
+ <View style={[styles.inputBox]}>
1100
+ <Text style={styles.inputTitle}>密码</Text>
1101
+ <View style={styles.inputDivider} />
1102
+ <TextInput
1103
+ style={styles.input}
1104
+ placeholder="请输入密码"
1105
+ placeholderTextColor="#A6A6A6"
1106
+ value={password}
1107
+ secureTextEntry
1108
+ onChangeText={(text) => setPassword(text)}
1109
+ returnKeyType="done"
1110
+ />
1111
+ </View>
1112
+ <View
1113
+ style={[
1114
+ styles.passBox,
1115
+ {
1116
+ justifyContent:
1117
+ /* appName === "吉柿果" ||
1118
+ currentOperatorName === "番禺有线" ||
1119
+ appName === "悦慧家"
1120
+ ? */ "flex-end",
1121
+ /* : "space-between" */
1122
+ },
1123
+ ]}
1124
+ >
1125
+ {/* {appName !== "吉柿果" &&
1126
+ appName !== "悦慧家" &&
1127
+ currentOperatorName !== "番禺有线" && (
1128
+ <TouchableOpacity
1129
+ style={{ marginTop: px(27), marginLeft: px(115) }}
1130
+ onPress={() => {
1131
+ navigation.navigate("RegisteCountScreen");
1132
+ }}
1133
+ >
1134
+ <Text
1135
+ style={{
1136
+ color: "#999999",
1137
+ fontSize: px(35),
1138
+ fontWeight: "bold",
1139
+ }}
1140
+ >
1141
+ 注册
1142
+ </Text>
1143
+ </TouchableOpacity>
1144
+ )} */}
1145
+ <TouchableOpacity
1146
+ style={styles.forgotPassword}
1147
+ onPress={() => {
1148
+ navigation.navigate("ResePasswordScreen");
1149
+ }}
1150
+ >
1151
+ <Text
1152
+ style={{
1153
+ color:
1154
+ appName === "悦慧家" ||
1155
+ currentOperatorName === "番禺有线"
1156
+ ? "#0071C4"
1157
+ : "#E86003",
1158
+ fontSize: px(35),
1159
+ fontWeight: "bold",
1160
+ }}
1161
+ >
1162
+ 忘记密码
1163
+ </Text>
1164
+ </TouchableOpacity>
1165
+ </View>
1166
+ </>
1167
+ )}
1168
+
1169
+ {loginWay === 0 && smsCodeResendTime !== 0 && (
1170
+ <TouchableOpacity
1171
+ style={{
1172
+ alignSelf: "flex-end",
1173
+ marginHorizontal: px(115),
1174
+ marginTop: px(20),
1175
+ }}
1176
+ onPress={smsCodeTips}
1177
+ >
1178
+ <Text
1179
+ style={{
1180
+ fontSize: px(35),
1181
+ color:
1182
+ appName === "悦慧家" ||
1183
+ currentOperatorName === "番禺有线"
1184
+ ? "#0071C4"
1185
+ : "#E86003",
1186
+ fontWeight: "400",
1187
+ }}
1188
+ >
1189
+ 收不到验证码
1190
+ </Text>
1191
+ </TouchableOpacity>
1192
+ )}
1193
+
1194
+ <TouchableOpacity
1195
+ activeOpacity={0.7}
1196
+ onPress={handleLoginPress}
1197
+ disabled={loginDisabled}
1198
+ >
1199
+ <View
1200
+ style={{
1201
+ ...styles.loginBtnBox,
1202
+ marginTop: keybordShow ? px(75) : px(257),
1203
+ opacity: loginDisabled ? 0.6 : 1,
1204
+ }}
1205
+ >
1206
+ <View
1207
+ style={[
1208
+ styles.loginBtn,
1209
+ appName === "悦慧家" ||
1210
+ currentOperatorName === "番禺有线"
1211
+ ? {
1212
+ backgroundColor: "#0071C4",
1213
+ borderRadius: px(93),
1214
+ }
1215
+ : {},
1216
+ ]}
1217
+ >
1218
+ <Text style={[styles.loginBtnText]}>
1219
+ {isLogining ? "正在登录中..." : "登录"}
1220
+ </Text>
1221
+ </View>
1222
+ </View>
1223
+ </TouchableOpacity>
1224
+
1225
+ {appName !== "遥控键码库" && (
1226
+ <View
1227
+ style={{
1228
+ marginTop: px(40),
1229
+ width: "100%",
1230
+ }}
1231
+ >
1232
+ <View style={styles.protocol}>
1233
+ <CheckBox
1234
+ center
1235
+ checked={protocolAgree}
1236
+ containerStyle={{
1237
+ margin: 0,
1238
+ padding: 0,
1239
+ backgroundColor: "transparent",
1240
+ }}
1241
+ onPress={() => handleSetProtocolAgree(!protocolAgree)}
1242
+ checkedIcon={
1243
+ <Icon
1244
+ name="checkmark-circle-outline"
1245
+ type="ionicon"
1246
+ color={styles.protocolLinkAgree.color}
1247
+ size={20}
1248
+ />
1249
+ }
1250
+ uncheckedIcon={
1251
+ <Icon
1252
+ name="radio-button-off"
1253
+ type="ionicon"
1254
+ color={styles.protocolText.color}
1255
+ size={20}
1256
+ />
1257
+ }
1258
+ />
1259
+ <TouchableWithoutFeedback
1260
+ onPress={() => setProtocolAgree(!protocolAgree)}
1261
+ >
1262
+ <Text style={styles.protocolText}>
1263
+ 已阅读并同意
1264
+ <TouchableWithoutFeedback
1265
+ style={{ paddingVertical: px(150) }}
1266
+ onPress={() =>
1267
+ handleViewUserAgreementByType("service")
1268
+ }
1269
+ >
1270
+ <Text
1271
+ style={
1272
+ protocolAgree || serviceAgree
1273
+ ? styles.protocolLinkAgree
1274
+ : appName === "悦慧家" ||
1275
+ currentOperatorName === "番禺有线"
1276
+ ? styles.protocolLinkPy
1277
+ : styles.protocolLink
1278
+ }
1279
+ >
1280
+ 《服务条款》
1281
+ </Text>
1282
+ </TouchableWithoutFeedback>
1283
+ 与
1284
+ <TouchableWithoutFeedback
1285
+ style={{ paddingVertical: px(150) }}
1286
+ onPress={() =>
1287
+ handleViewUserAgreementByType("privacy")
1288
+ }
1289
+ >
1290
+ <Text
1291
+ style={
1292
+ protocolAgree || privacyAgree
1293
+ ? styles.protocolLinkAgree
1294
+ : appName === "悦慧家" ||
1295
+ currentOperatorName === "番禺有线"
1296
+ ? styles.protocolLinkPy
1297
+ : styles.protocolLink
1298
+ }
1299
+ >
1300
+ 《隐私权政策》
1301
+ </Text>
1302
+ </TouchableWithoutFeedback>
1303
+ </Text>
1304
+ </TouchableWithoutFeedback>
1305
+ </View>
1306
+ </View>
1307
+ )}
520
1308
  </View>
521
- </>
522
- )}
523
1309
 
524
- {loginWay === 1 && (
525
- <>
526
- <View style={styles.inputBox}>
527
- <TextInput
528
- style={styles.input}
529
- value={username}
530
- placeholder="账号"
531
- onChangeText={(text) => setUsername(text)}
532
- />
533
- </View>
534
- <View style={styles.inputBox}>
535
- <TextInput
536
- style={styles.input}
537
- value={password}
538
- secureTextEntry
539
- placeholder="密码"
540
- onChangeText={(text) => setPassword(text)}
541
- />
1310
+ <View
1311
+ style={{
1312
+ position: "absolute",
1313
+ width: "100%",
1314
+ top:
1315
+ Dimensions.get("window").height -
1316
+ (["禺乐慧家", "悦慧家"].includes(appName)
1317
+ ? px(365)
1318
+ : px(225)),
1319
+ }}
1320
+ >
1321
+ <View
1322
+ style={{
1323
+ // flexDirection: 'row',
1324
+ justifyContent: "center",
1325
+ alignItems: "center",
1326
+ // backgroundColor:'red'
1327
+ }}
1328
+ >
1329
+ <TouchableOpacity
1330
+ activeOpacity={0.7}
1331
+ onPress={handleSwitchLoginWay}
1332
+ >
1333
+ <View
1334
+ style={{
1335
+ flexDirection: "row",
1336
+ padding: px(20),
1337
+ marginBottom: px(70),
1338
+ }}
1339
+ >
1340
+ <Text
1341
+ style={{
1342
+ color:
1343
+ appName === "悦慧家" ||
1344
+ currentOperatorName === "番禺有线"
1345
+ ? "#0071C4"
1346
+ : "#E86003",
1347
+ fontSize: px(43),
1348
+ }}
1349
+ >
1350
+ {loginWay === 0 ? "账号登录" : "手机号登录"}
1351
+ </Text>
1352
+ </View>
1353
+ </TouchableOpacity>
1354
+ {["禺乐慧家"].includes(appName) && (
1355
+ <TouchableOpacity
1356
+ activeOpacity={0.7}
1357
+ onPress={handleLookFreely}
1358
+ >
1359
+ <View style={{}}>
1360
+ <Text style={{ color: "#999", fontSize: px(43) }}>
1361
+ 暂不登录,先逛逛
1362
+ </Text>
1363
+ </View>
1364
+ </TouchableOpacity>
1365
+ )}
1366
+ </View>
542
1367
  </View>
543
- </>
544
- )}
545
1368
 
546
- <View style={styles.protocol}>
547
- <CheckBox
548
- center
549
- checked={protocolAgree}
550
- containerStyle={{
551
- margin: 0,
552
- padding: 0,
553
- backgroundColor: "transparent",
554
- }}
555
- onPress={() => handleSetProtocolAgree(!protocolAgree)}
556
- checkedIcon={
557
- <Icon
558
- name="checkmark-circle-outline"
559
- type="ionicon"
560
- color={styles.protocolLinkAgree.color}
561
- size={20}
562
- />
563
- }
564
- uncheckedIcon={
565
- <Icon
566
- name="radio-button-off"
567
- type="ionicon"
568
- color={styles.protocolText.color}
569
- size={20}
570
- />
571
- }
572
- />
573
- <TouchableWithoutFeedback
574
- onPress={() => setProtocolAgree(!protocolAgree)}
575
- >
576
- <Text style={styles.protocolText}>
577
- 已阅读并同意
578
- <TouchableWithoutFeedback
579
- style={{ paddingVertical: 100 }}
580
- onPress={() => handleViewUserAgreementByType("service")}
1369
+ {/* 选择方式 */}
1370
+ {entranceSelectVisible && (
1371
+ <View
1372
+ style={{
1373
+ ...styles.entranceSelect,
1374
+ paddingTop:
1375
+ (Platform.OS === "ios" ? insets.top : 0) +
1376
+ StatusBar.currentHeight,
1377
+ }}
581
1378
  >
582
- <Text
583
- style={
584
- protocolAgree || serviceAgree
585
- ? styles.protocolLinkAgree
586
- : styles.protocolLink
587
- }
1379
+ <View
1380
+ style={{
1381
+ paddingTop: px(36),
1382
+ paddingBottom: px(33),
1383
+ marginBottom: px(38),
1384
+ }}
588
1385
  >
589
- 用户协议
590
- </Text>
591
- </TouchableWithoutFeedback>
592
- 和
593
- <TouchableWithoutFeedback
594
- style={{ paddingVertical: 100 }}
595
- onPress={() => handleViewUserAgreementByType("privacy")}
596
- >
597
- <Text
598
- style={
599
- protocolAgree || privacyAgree
600
- ? styles.protocolLinkAgree
601
- : styles.protocolLink
602
- }
1386
+ <Text
1387
+ style={{
1388
+ fontSize: px(55),
1389
+ color: "#333",
1390
+ fontWeight: "bold",
1391
+ textAlign: "center",
1392
+ }}
1393
+ >
1394
+ 请选择功能
1395
+ </Text>
1396
+ </View>
1397
+ <TouchableOpacity
1398
+ style={{
1399
+ ...styles.entranceSelectItem,
1400
+ backgroundColor: "#F4F9F8",
1401
+ }}
1402
+ onPress={() => {
1403
+ if (selectEntranceResolve) {
1404
+ selectEntranceResolve("szjt");
1405
+ selectEntranceResolve = null;
1406
+ } else {
1407
+ replace("Home", {
1408
+ redirect: false,
1409
+ });
1410
+ }
1411
+ }}
603
1412
  >
604
- 隐私条款
605
- </Text>
606
- </TouchableWithoutFeedback>
607
- </Text>
608
- </TouchableWithoutFeedback>
609
- </View>
610
-
611
- <TouchableOpacity
612
- activeOpacity={0.7}
613
- onPress={handleLoginPress}
614
- disabled={loginDisabled}
615
- >
616
- <View style={styles.loginBtnBox}>
617
- <View style={[styles.loginBtn, loginBtnBg]}>
618
- <Text style={styles.loginBtnText}>
619
- {isLogining ? "正在登录中..." : "登录"}
620
- </Text>
621
- </View>
622
- </View>
623
- </TouchableOpacity>
624
- </View>
625
- </View>
626
- )}
627
-
628
- {serviceDialogVisible && !isLoading && (
629
- <ProtocolType
630
- handleOneDisagree={handleOneDisagree}
631
- handleOneAgree={handleOneAgree}
632
- url="https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html"
633
- type="service"
634
- />
635
- )}
636
- {privacyDialogVisible && !isLoading && (
637
- <ProtocolType
638
- handleOneDisagree={handleOneDisagree}
639
- handleOneAgree={handleOneAgree}
640
- url="https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html"
641
- type="privacy"
642
- />
643
- )}
644
-
645
- {protocolDialogVisible && !isLoading && (
646
- <View style={styles.agreementMask}>
647
- <View style={styles.agreementConfirmContent}>
648
- <View style={styles.agreementConfirmHead}>
649
- <TouchableOpacity
650
- style={styles.headerLeft}
651
- onPress={() => {
652
- console.log(111);
653
- setProtocolDialogVisible(false);
654
- }}
655
- >
656
- <Image
657
- source={require("../../assets/img/goBack.png")}
658
- style={styles.goBackImg}
659
- resizeMode="contain"
660
- />
661
- </TouchableOpacity>
662
- <View style={styles.agreementConfirmTitleBox}>
663
- <Text style={styles.agreementConfirmTitle}>欢迎使用爱家宝</Text>
1413
+ <Image
1414
+ style={{
1415
+ width: px(104),
1416
+ height: px(104),
1417
+ }}
1418
+ resizeMode="contain"
1419
+ source={require("../../assets/img/szjt.png")}
1420
+ />
1421
+ <Text
1422
+ style={{
1423
+ ...styles.entranceSelectText,
1424
+ color: "#62C0B6",
1425
+ }}
1426
+ >
1427
+ 数字家庭
1428
+ </Text>
1429
+ </TouchableOpacity>
1430
+ <TouchableOpacity
1431
+ style={{
1432
+ ...styles.entranceSelectItem,
1433
+ backgroundColor: "#F2FAFF",
1434
+ }}
1435
+ onPress={async () => {
1436
+ if (selectEntranceResolve) {
1437
+ selectEntranceResolve &&
1438
+ selectEntranceResolve("tyygq");
1439
+ selectEntranceResolve = null;
1440
+ } else {
1441
+ if (
1442
+ envVersion !== "release" &&
1443
+ ![
1444
+ "禺乐慧家",
1445
+ "悦慧家",
1446
+ "吉柿果",
1447
+ "智慧中原",
1448
+ ].includes(appName)
1449
+ ) {
1450
+ global.loading.showLoading("正在加载");
1451
+ await global.base.navigateModule({
1452
+ operatorId: "ipanel",
1453
+ moduleName: "adg",
1454
+ screenName: "IstickUpdate3Screen",
1455
+ isReplace: true,
1456
+ });
1457
+ global.loading.hideLoading();
1458
+ } else {
1459
+ replace("Home", {
1460
+ redirect: true,
1461
+ });
1462
+ }
1463
+ }
1464
+ }}
1465
+ >
1466
+ <Image
1467
+ style={{
1468
+ width: px(104),
1469
+ height: px(104),
1470
+ }}
1471
+ resizeMode="contain"
1472
+ source={require("../../assets/img/tykz.png")}
1473
+ />
1474
+ <Text
1475
+ style={{
1476
+ ...styles.entranceSelectText,
1477
+ color: "#599FF1",
1478
+ }}
1479
+ >
1480
+ 遥控键码下载
1481
+ </Text>
1482
+ </TouchableOpacity>
1483
+ </View>
1484
+ )}
664
1485
  </View>
665
- </View>
666
- <ScrollView>
667
- <View>
668
- <Text style={styles.agreementConfirmText}>
669
- 为了更好的保障您的合法权益,请您阅读并同意
670
- <TouchableWithoutFeedback onPress={handleViewUserAgreement}>
671
- <Text style={styles.agreementConfirmImportantText}>
672
- 用户协议
1486
+ </TouchableWithoutFeedback>
1487
+ )}
1488
+ {serviceDialogVisible && !isLoading && (
1489
+ <ProtocolType
1490
+ handleOneDisagree={handleOneDisagree}
1491
+ handleOneAgree={handleOneAgree}
1492
+ dialogTitle="用户协议"
1493
+ url={userAgreementURl}
1494
+ type="service"
1495
+ appName={appName}
1496
+ currentOperatorName={currentOperatorName}
1497
+ />
1498
+ )}
1499
+
1500
+ {privacyDialogVisible && !isLoading && (
1501
+ <ProtocolType
1502
+ handleOneDisagree={handleOneDisagree}
1503
+ handleOneAgree={handleOneAgree}
1504
+ dialogTitle="隐私保护提示"
1505
+ url={privacyPolicyURI}
1506
+ type="privacy"
1507
+ appName={appName}
1508
+ currentOperatorName={currentOperatorName}
1509
+ />
1510
+ )}
1511
+
1512
+ {protocolDialogVisible &&
1513
+ !isLoading &&
1514
+ appName !== "遥控键码库" &&
1515
+ !pyLoginVisible && (
1516
+ <View style={styles.agreementMask}>
1517
+ <View style={styles.agreementConfirmContent}>
1518
+ <View style={styles.agreementConfirmHead}>
1519
+ <Text style={styles.agreementConfirmTitle}>
1520
+ 欢迎使用{appName}
673
1521
  </Text>
674
- </TouchableWithoutFeedback>
675
- 和
676
- <TouchableWithoutFeedback onPress={handleViewPrivacyClause}>
677
- <Text style={styles.agreementConfirmImportantText}>
678
- 隐私条款
679
- </Text>
680
- </TouchableWithoutFeedback>
681
- 。为向您提供更优质的服务,我们可能会向您申请下列相关权限:
682
- </Text>
683
- </View>
684
- <View>
685
- <Text style={styles.agreementConfirmText}>
686
- 1. 读写设备存储权限(Android
687
- 版本):用于用于用户反馈、客服等功能中读写设备上的照片及文件;
688
- </Text>
689
- </View>
690
- <View>
691
- <Text style={styles.agreementConfirmText}>
692
- 2. 地理位置权限(Android、iOS
693
- 版本):用于家庭位置管理、判断地区提供天气服务、发现附近智能设备;
694
- </Text>
695
- </View>
696
- <View>
697
- <Text style={styles.agreementConfirmText}>
698
- 3. 相机权限(Android、iOS
699
- 版本):用于扫码绑定电视账户、扫码进行设备添加等功能;
700
- </Text>
701
- </View>
702
- <View>
703
- <Text style={styles.agreementConfirmText}>
704
- 4. 相册权限(Android、ios
705
- 版本):用于用户反馈等功能中读写设备上的照片及视频;
706
- </Text>
707
- </View>
708
- <View>
709
- <Text style={styles.agreementConfirmText}>
710
- 5. 麦克风权限(Android、ioS 版本):智能客服等功能;
711
- </Text>
712
- </View>
713
- <View>
714
- <Text style={styles.agreementConfirmText}>
715
- 6. 读取电话联系人权限(Android):用于电视通讯功能;
716
- </Text>
717
- </View>
718
- <View>
719
- <Text style={styles.agreementConfirmText}>
720
- 7. 开启蓝牙权限(Android、ios
721
- 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
722
- </Text>
723
- </View>
724
- <View>
725
- <Text style={styles.agreementConfirmText}>
726
- 8. 开启蓝牙权限(Android、ios
727
- 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
728
- </Text>
729
- </View>
730
- <View>
731
- <Text style={styles.agreementConfirmText}>
732
- 7. 开启蓝牙权限(Android、ios
733
- 版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
734
- </Text>
1522
+ </View>
1523
+ <View style={{ flex: 1 }}>
1524
+ <ScrollView showsVerticalScrollIndicator={false}>
1525
+ <View>
1526
+ <Text style={styles.agreementConfirmText}>
1527
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为了更好的保障您的合法权益,请您阅读并同意
1528
+ <TouchableWithoutFeedback
1529
+ onPress={handleViewUserAgreement}
1530
+ style={{ paddingVertical: px(100) }}
1531
+ >
1532
+ <Text
1533
+ style={
1534
+ appName === "悦慧家" ||
1535
+ currentOperatorName === "番禺有线"
1536
+ ? styles.protocolLinkPy
1537
+ : styles.agreementConfirmImportantText
1538
+ }
1539
+ >
1540
+ 用户协议
1541
+ </Text>
1542
+ </TouchableWithoutFeedback>
1543
+ 和
1544
+ <TouchableWithoutFeedback
1545
+ onPress={handleViewPrivacyClause}
1546
+ >
1547
+ <Text
1548
+ style={
1549
+ appName === "悦慧家" ||
1550
+ currentOperatorName === "番禺有线"
1551
+ ? styles.protocolLinkPy
1552
+ : styles.agreementConfirmImportantText
1553
+ }
1554
+ >
1555
+ 隐私条款
1556
+ </Text>
1557
+ </TouchableWithoutFeedback>
1558
+ 。为向您提供更优质的服务,我们可能会向您申请下列相关权限:
1559
+ </Text>
1560
+ </View>
1561
+ <View>
1562
+ <Text style={styles.agreementConfirmText}>
1563
+ 1.
1564
+ 读写设备存储权限(Android版本):用于用于用户反馈、客服等功能中读写设备上的照片及文件;
1565
+ </Text>
1566
+ </View>
1567
+ <View>
1568
+ <Text style={styles.agreementConfirmText}>
1569
+ 2.
1570
+ 地理位置权限(Android、IOS版本):用于家庭位置管理、判断地区提供天气服务、发现附近智能设备;
1571
+ </Text>
1572
+ </View>
1573
+ <View>
1574
+ <Text style={styles.agreementConfirmText}>
1575
+ 3.
1576
+ 相机权限(Android、IOS版本):用于扫码绑定电视账户、扫码进行设备添加等功能;
1577
+ </Text>
1578
+ </View>
1579
+ <View>
1580
+ <Text style={styles.agreementConfirmText}>
1581
+ 4.
1582
+ 相册权限(Android、IOS版本):用于用户反馈等功能中读写设备上的照片及视频;
1583
+ </Text>
1584
+ </View>
1585
+ <View>
1586
+ <Text style={styles.agreementConfirmText}>
1587
+ 5. 麦克风权限(Android、IOS版本):智能客服等功能;
1588
+ </Text>
1589
+ </View>
1590
+ <View>
1591
+ <Text style={styles.agreementConfirmText}>
1592
+ 6. 读取电话联系人权限(Android):用于电视通讯功能;
1593
+ </Text>
1594
+ </View>
1595
+ <View>
1596
+ <Text style={styles.agreementConfirmText}>
1597
+ 7.
1598
+ 开启蓝牙权限(Android、IOS版本):用于连接设备时连接设备发出的蓝牙信号,以进行设备通信,对于通过蓝牙连接的智能设备,也需要蓝牙权限用于通信;
1599
+ </Text>
1600
+ </View>
1601
+ <View>
1602
+ <Text style={styles.agreementConfirmText}>
1603
+ 8.
1604
+ 获取wifi的ssid与bssid权限(Android、IOS版本):用于添加与给网关设备配网时,获取附近可以连连接的wifi列表,及过滤
1605
+ 5Gwifi列表;
1606
+ </Text>
1607
+ </View>
1608
+ <View>
1609
+ <Text style={styles.agreementConfirmText}>
1610
+ 9.
1611
+ 获取mac权限(Android、IOS版本):用于获取mac添加智能设备;
1612
+ </Text>
1613
+ </View>
1614
+ </ScrollView>
1615
+ </View>
1616
+ <Divider color="#eee" width={1} />
1617
+ {appName === "悦慧家" ||
1618
+ currentOperatorName === "番禺有线" ? (
1619
+ <View
1620
+ style={{
1621
+ ...styles.agreementButtons,
1622
+ flexDirection: "column",
1623
+ height: px(255),
1624
+ }}
1625
+ >
1626
+ <TouchableOpacity
1627
+ style={{
1628
+ marginHorizontal: px(38),
1629
+ backgroundColor: "#0071C4",
1630
+ flex: 1,
1631
+ borderRadius: px(80),
1632
+ alignItems: "center",
1633
+ justifyContent: "center",
1634
+ paddingVertical: px(20),
1635
+ }}
1636
+ activeOpacity={0.7}
1637
+ onPress={handleUserAgree}
1638
+ >
1639
+ <Text style={{ color: "#fff", fontSize: px(49) }}>
1640
+ 同意
1641
+ </Text>
1642
+ </TouchableOpacity>
1643
+ <TouchableOpacity
1644
+ style={styles.disagreeBtn}
1645
+ activeOpacity={0.7}
1646
+ onPress={handleUserDisagree}
1647
+ >
1648
+ <Text
1649
+ style={{
1650
+ ...styles.disagreeBtnText,
1651
+ fontSize: px(49),
1652
+ }}
1653
+ >
1654
+ 不同意
1655
+ </Text>
1656
+ </TouchableOpacity>
1657
+ </View>
1658
+ ) : (
1659
+ <View style={styles.agreementButtons}>
1660
+ <TouchableOpacity
1661
+ style={styles.disagreeBtn}
1662
+ activeOpacity={0.7}
1663
+ onPress={handleUserDisagree}
1664
+ >
1665
+ <Text style={styles.disagreeBtnText}>不同意</Text>
1666
+ </TouchableOpacity>
1667
+ <Divider color="#eee" width={1} orientation="vertical" />
1668
+ <TouchableOpacity
1669
+ style={styles.agreeBtn}
1670
+ activeOpacity={0.7}
1671
+ onPress={handleUserAgree}
1672
+ >
1673
+ <Text style={styles.agreeBtnText}>同意</Text>
1674
+ </TouchableOpacity>
1675
+ </View>
1676
+ )}
1677
+ </View>
735
1678
  </View>
736
- </ScrollView>
1679
+ )}
1680
+ </ImageBackground>
1681
+ {logVisible && <OpenLogSheet setVisible={setLogVisible} />}
1682
+ {graphSmscodeVisible && (
1683
+ <GraphSmscode onSuccess={graphSmscodeSuccess} />
1684
+ )}
1685
+ </View>
1686
+ );
1687
+ };
737
1688
 
738
- <View style={styles.agreementButtons}>
739
- <TouchableOpacity
740
- style={styles.disagreeBtn}
741
- activeOpacity={0.7}
742
- onPress={handleUserDisagree}
743
- >
744
- <Text style={styles.disagreeBtnText}>不同意</Text>
745
- </TouchableOpacity>
746
- <TouchableOpacity
747
- style={styles.agreeBtn}
748
- activeOpacity={0.7}
749
- onPress={handleUserAgree}
750
- >
751
- <Text style={styles.agreeBtnText}>同意</Text>
752
- </TouchableOpacity>
753
- </View>
754
- </View>
755
- </View>
756
- )}
757
- </ImageBackground>
758
- );
1689
+ return render();
759
1690
  }
760
1691
 
761
1692
  const styles = StyleSheet.create({
762
1693
  container: {
763
1694
  flex: 1,
764
- backgroundColor: "#fff",
765
1695
  },
766
1696
  welcomeView: {
767
1697
  flex: 1,
768
1698
  alignItems: "center",
769
1699
  justifyContent: "center",
770
1700
  },
771
- content: {
772
- paddingHorizontal: 30,
773
- },
774
- titleBox: {
775
- justifyContent: "center",
776
- },
777
- title: {
778
- fontSize: 24,
779
- color: "rgba(48, 48, 48, 1)",
1701
+ loginHead: {
1702
+ flexDirection: "row",
1703
+ alignItems: "center",
1704
+ justifyContent: "space-between",
1705
+ marginTop: px(113),
1706
+ paddingLeft: px(69),
1707
+ paddingRight: px(37),
1708
+ marginBottom: px(52),
780
1709
  },
781
- subTitle: {
782
- fontSize: 14,
783
- marginTop: 10,
1710
+ inputView: {
1711
+ backgroundColor: "#fff",
1712
+ borderRadius: px(22),
1713
+ flex: 1,
1714
+ marginTop: px(-50),
784
1715
  },
785
- inputBox: {
786
- borderBottomWidth: 1,
787
- marginVertical: 10,
788
- borderBottomColor: "rgba(217, 217, 217, 1)",
1716
+ inputDivider: {
1717
+ width: px(3),
1718
+ height: px(37),
1719
+ backgroundColor: "#eee",
1720
+ marginHorizontal: px(22),
789
1721
  },
790
- input: {
791
- height: 50,
1722
+ inputTitle: {
792
1723
  color: "#333",
1724
+ fontSize: px(40),
1725
+ fontWeight: "400",
793
1726
  },
794
- welcomText: {
795
- fontSize: 30,
1727
+ passBox: {
1728
+ flexDirection: "row",
1729
+ justifyContent: "space-between",
1730
+ },
1731
+ forgotPassword: {
1732
+ marginTop: px(27),
1733
+ alignSelf: "flex-end",
1734
+ marginRight: px(115),
796
1735
  },
797
1736
  loginView: {
798
1737
  flex: 1,
799
1738
  },
800
- changeLoginWay: {
801
- // height: 70,
802
- justifyContent: "center",
803
- alignItems: "flex-end",
804
- marginRight: 20,
1739
+ welcomeTitleText: {
1740
+ fontSize: px(92),
1741
+ color: "#fff",
1742
+ fontWeight: "600",
1743
+ },
1744
+ welcomeSubTitleText: {
1745
+ paddingTop: px(17),
1746
+ color: "#FFF9F5",
1747
+ fontSize: px(46),
1748
+ },
1749
+ topImg: {
1750
+ width: "100%",
1751
+ height: "100%",
1752
+ },
1753
+ inputBox: {
1754
+ marginHorizontal: px(115),
1755
+ flexDirection: "row",
1756
+ alignItems: "center",
1757
+ borderBottomWidth: px(2),
1758
+ // marginVertical: 10,
1759
+ borderBottomColor: "#E8E8E8",
1760
+ height: px(100),
1761
+ },
1762
+ input: {
1763
+ height: 50,
1764
+ flex: 1,
1765
+ color: "#000",
805
1766
  },
806
- changeLoginWayInner: {
1767
+ loginBtnBox: {
807
1768
  flexDirection: "row",
808
1769
  alignItems: "center",
809
1770
  },
810
- changeLoginWayText: {
811
- color: "rgba(51, 51, 51, 1)",
812
- fontSize: 16,
1771
+ loginBtn: {
1772
+ marginHorizontal: px(115),
1773
+ borderRadius: px(23),
1774
+ backgroundColor: "#E86003",
1775
+ flex: 1,
1776
+ height: px(132),
1777
+ alignItems: "center",
1778
+ justifyContent: "center",
813
1779
  },
814
- exchangeIcon: {
815
- width: 16,
816
- height: 16,
817
- marginRight: 3,
1780
+ loginBtnText: {
1781
+ color: "#fff",
1782
+ fontSize: px(52),
1783
+ fontWeight: "600",
818
1784
  },
1785
+
819
1786
  protocol: {
820
- marginVertical: 15,
821
1787
  flexDirection: "row",
1788
+ justifyContent: "center",
822
1789
  alignItems: "center",
823
1790
  },
824
1791
  protocolText: {
825
- color: "rgba(102, 102, 102, 1)",
1792
+ color: "#A6A6A6",
1793
+ fontSize: px(35),
826
1794
  },
827
1795
  protocolLink: {
828
1796
  color: "rgba(234, 96, 0, 1)",
@@ -830,6 +1798,10 @@ const styles = StyleSheet.create({
830
1798
  protocolLinkAgree: {
831
1799
  color: "#0EC12C",
832
1800
  },
1801
+ protocolLinkPy: {
1802
+ color: "#0071C4",
1803
+ },
1804
+
833
1805
  agreementMask: {
834
1806
  position: "absolute",
835
1807
  left: 0,
@@ -837,27 +1809,21 @@ const styles = StyleSheet.create({
837
1809
  bottom: 0,
838
1810
  right: 0,
839
1811
  zIndex: 2,
1812
+ backgroundColor: "rgba(0,0,0,0.7)",
840
1813
  },
841
1814
  agreementConfirmContent: {
842
1815
  position: "absolute",
843
- width: Dimensions.get("window").width - 60,
844
1816
  height: 400,
845
- left: 30,
1817
+ left: px(75),
1818
+ right: px(75),
846
1819
  top: Dimensions.get("window").height / 2 - 200,
847
1820
  backgroundColor: "#fff",
848
1821
  paddingBottom: 0,
849
- borderWidth: 1,
850
- borderColor: "#a1a1a1",
851
- borderRadius: 20,
1822
+ borderRadius: px(29),
852
1823
  },
853
1824
  agreementConfirmHead: {
854
- position: "relative",
855
- flexDirection: "row",
856
- alignItems: "center",
857
- paddingTop: 10,
858
- paddingLeft: 10,
859
- marginBottom: 5,
860
- height: 40,
1825
+ marginTop: px(52),
1826
+ marginBottom: px(29),
861
1827
  },
862
1828
  headerLeft: {
863
1829
  position: "absolute",
@@ -886,58 +1852,75 @@ const styles = StyleSheet.create({
886
1852
  // paddingTop: 20,
887
1853
  },
888
1854
  agreementConfirmText: {
889
- fontSize: 16,
890
- lineHeight: 30,
891
- paddingHorizontal: 20,
892
- color: "#000",
1855
+ fontSize: px(40),
1856
+ lineHeight: px(69),
1857
+ color: "#333",
1858
+ marginHorizontal: px(40),
893
1859
  },
894
1860
  agreementConfirmImportantText: {
895
1861
  color: "rgba(234, 96, 0, 1)",
896
1862
  },
897
1863
  agreementButtons: {
898
1864
  height: 50,
1865
+ marginTop: px(12),
899
1866
  flexDirection: "row",
900
1867
  justifyContent: "space-around",
901
- borderTopColor: "#c1c1c1",
902
- borderTopWidth: 0.5,
1868
+ borderBottomLeftRadius: px(29),
903
1869
  },
904
1870
  disagreeBtn: {
905
1871
  flex: 1,
906
- alignItems: "center",
907
- justifyContent: "center",
908
- borderBottomLeftRadius: 20,
1872
+ paddingTop: px(32),
1873
+ paddingBottom: px(29),
909
1874
  },
910
1875
  disagreeBtnText: {
911
- color: "#ccc",
1876
+ color: "#666",
1877
+ fontSize: px(52),
1878
+ textAlign: "center",
1879
+ fontWeight: "500",
912
1880
  },
913
1881
  agreeBtn: {
914
1882
  flex: 1,
915
- alignItems: "center",
916
- justifyContent: "center",
917
- borderLeftColor: "#c1c1c1",
918
- borderLeftWidth: 0.5,
919
- borderBottomRightRadius: 20,
1883
+ paddingTop: px(32),
1884
+ paddingBottom: px(29),
920
1885
  },
921
1886
  agreeBtnText: {
922
- color: "#333",
923
- fontSize: 16,
1887
+ color: "#E86003",
1888
+ fontSize: px(52),
1889
+ textAlign: "center",
1890
+ fontWeight: "500",
924
1891
  },
925
- loginBtnBox: {
926
- flexDirection: "row",
1892
+
1893
+ mask: {
1894
+ position: "absolute",
1895
+ top: 0,
1896
+ left: 0,
1897
+ bottom: 0,
1898
+ right: 0,
1899
+ justifyContent: "center",
927
1900
  alignItems: "center",
1901
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
928
1902
  },
929
- loginBtn: {
930
- flex: 1,
931
- height: 48,
932
- marginHorizontal: 10,
933
- borderRadius: 24,
1903
+ entranceSelect: {
1904
+ backgroundColor: "#fff",
1905
+ position: "absolute",
1906
+ top: 0,
1907
+ bottom: 0,
1908
+ left: 0,
1909
+ right: 0,
1910
+ },
1911
+ entranceSelectItem: {
1912
+ height: px(231),
1913
+ marginHorizontal: px(38),
1914
+ paddingLeft: px(38),
1915
+ flexDirection: "row",
934
1916
  alignItems: "center",
935
- justifyContent: "center",
1917
+ borderRadius: px(16),
1918
+ marginBottom: px(27),
936
1919
  },
937
- loginBtnText: {
938
- color: "#fff",
939
- fontSize: 18,
1920
+ entranceSelectText: {
1921
+ fontWeight: "500",
1922
+ fontSize: px(55),
1923
+ marginLeft: px(33),
940
1924
  },
941
1925
  });
942
-
943
1926
  export default LoginScreen;