ipanel-rnapp-ajb-base 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/App.js +180 -166
- package/app/api/ipanelCloudApi.js +210 -208
- package/app/assets/img/launch_bg_panyu.png +0 -0
- package/app/assets/img/launch_logo_panyu.png +0 -0
- package/app/assets/img/launch_text_panyu.png +0 -0
- package/app/assets/img/login_bg_new.png +0 -0
- package/app/base.js +69 -62
- package/app/components/common/LoginType/protocol.js +66 -44
- package/app/screens/BaseScreen.js +111 -108
- package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +99 -83
- package/app/screens/LoginScreen/index.js +193 -170
- package/app/screens/LoginScreen/indexNew.js +414 -368
- package/app/screens/RegisteCountScreen/index.js +494 -468
- package/app/screens/SbkScreen.js +149 -7
- package/app/utils/applyPermissions.js +4 -2
- package/app/utils/common.js +94 -93
- package/app/utils/config.js +15 -15
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useState, useEffect, useCallback, useRef} from
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
ScrollView,
|
|
@@ -13,31 +13,32 @@ import {
|
|
|
13
13
|
ImageBackground,
|
|
14
14
|
TouchableWithoutFeedback,
|
|
15
15
|
Dimensions,
|
|
16
|
-
} from
|
|
17
|
-
import {useSafeArea} from
|
|
18
|
-
import CryptoJS from
|
|
19
|
-
import UUIDGenerator from
|
|
20
|
-
import {Icon, Image, CheckBox, Button} from
|
|
16
|
+
} 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";
|
|
21
22
|
|
|
22
|
-
import SmsCodeInput from
|
|
23
|
+
import SmsCodeInput from "../../components/common/SmsCodeInput";
|
|
23
24
|
|
|
24
|
-
import storage from
|
|
25
|
-
import {replace} from
|
|
25
|
+
import storage from "../../storage";
|
|
26
|
+
import { replace } from "../../utils/RootNavigation";
|
|
26
27
|
import {
|
|
27
28
|
getUserLocation,
|
|
28
29
|
updateHomedToken,
|
|
29
30
|
initOperatorHomedTouristAccount,
|
|
30
31
|
appReport,
|
|
31
|
-
} from
|
|
32
|
-
import {obtainSmscode, smscodeLogin, accountLogin} from
|
|
33
|
-
import {hideLoading, showLoading, showToast} from
|
|
32
|
+
} from "../../utils/common";
|
|
33
|
+
import { obtainSmscode, smscodeLogin, accountLogin } from "../../api";
|
|
34
|
+
import { hideLoading, showLoading, showToast } from "../../utils/notice";
|
|
34
35
|
|
|
35
|
-
import {confirmWithContent} from
|
|
36
|
-
import config from
|
|
37
|
-
import ProtocolType from
|
|
36
|
+
import { confirmWithContent } from "../../utils/registerDialog";
|
|
37
|
+
import config from "../../utils/config";
|
|
38
|
+
import ProtocolType from "../../components/common/LoginType/protocol";
|
|
38
39
|
let protocolAgreeResolve = null;
|
|
39
40
|
|
|
40
|
-
function LoginScreen({navigation, route}) {
|
|
41
|
+
function LoginScreen({ navigation, route }) {
|
|
41
42
|
const insets = useSafeArea();
|
|
42
43
|
|
|
43
44
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -47,19 +48,25 @@ function LoginScreen({navigation, route}) {
|
|
|
47
48
|
|
|
48
49
|
useEffect(() => {
|
|
49
50
|
// 获取登录状态
|
|
50
|
-
storage.get(
|
|
51
|
+
storage.get("accessToken").then((token) => {
|
|
51
52
|
// const appUserAgreement = await storage.get('appUserAgreement');
|
|
52
53
|
// if (!appUserAgreement) {
|
|
53
54
|
// setProtocolAgree(false);
|
|
54
55
|
// }
|
|
55
56
|
|
|
56
57
|
if (token) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (DeviceInfo.getBrand() === "Allwinner") {
|
|
59
|
+
replace("SbkScreen", {
|
|
60
|
+
redirect: true,
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
replace("Home", {
|
|
64
|
+
redirect: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
60
67
|
|
|
61
68
|
// 上报APP启动事件
|
|
62
|
-
appReport(
|
|
69
|
+
appReport("APP_STARTUP");
|
|
63
70
|
}
|
|
64
71
|
setTimeout(() => {
|
|
65
72
|
setIsLoading(false);
|
|
@@ -78,17 +85,17 @@ function LoginScreen({navigation, route}) {
|
|
|
78
85
|
// }
|
|
79
86
|
// }, [isLogined]);
|
|
80
87
|
|
|
81
|
-
const [phone, setPhone] = useState(
|
|
82
|
-
const [smsId, setSmsId] = useState(
|
|
83
|
-
const [userInputSmsCode, setUserInputSmsCode] = useState(
|
|
88
|
+
const [phone, setPhone] = useState("");
|
|
89
|
+
const [smsId, setSmsId] = useState("");
|
|
90
|
+
const [userInputSmsCode, setUserInputSmsCode] = useState("");
|
|
84
91
|
const [smsCodeRightBtnDisabled, setSmsCodeRightBtnDisabled] = useState(false);
|
|
85
|
-
const [smsCodeRightBtnText, setSmsCodeRightBtnText] = useState(
|
|
92
|
+
const [smsCodeRightBtnText, setSmsCodeRightBtnText] = useState("获取验证码");
|
|
86
93
|
const [smsCodeResendTime, setSmsCodeResendTime] = useState(0);
|
|
87
94
|
|
|
88
95
|
useEffect(() => {
|
|
89
96
|
if (phone && smsCodeResendTime === 0) {
|
|
90
97
|
setSmsCodeRightBtnDisabled(false);
|
|
91
|
-
setSmsCodeRightBtnText(
|
|
98
|
+
setSmsCodeRightBtnText("获取验证码");
|
|
92
99
|
} else {
|
|
93
100
|
setSmsCodeRightBtnDisabled(true);
|
|
94
101
|
}
|
|
@@ -110,8 +117,8 @@ function LoginScreen({navigation, route}) {
|
|
|
110
117
|
// 1 账号密码登录
|
|
111
118
|
const [loginWay, setLoginWay] = useState(0);
|
|
112
119
|
|
|
113
|
-
const [username, setUsername] = useState(
|
|
114
|
-
const [password, setPassword] = useState(
|
|
120
|
+
const [username, setUsername] = useState("");
|
|
121
|
+
const [password, setPassword] = useState("");
|
|
115
122
|
|
|
116
123
|
const [protocolAgree, setProtocolAgree] = useState(false);
|
|
117
124
|
const [protocolDialogVisible, setProtocolDialogVisible] = useState(false);
|
|
@@ -144,11 +151,11 @@ function LoginScreen({navigation, route}) {
|
|
|
144
151
|
|
|
145
152
|
function validPhone(phone) {
|
|
146
153
|
if (!phone) {
|
|
147
|
-
Alert.alert(
|
|
154
|
+
Alert.alert("请输入手机号");
|
|
148
155
|
return false;
|
|
149
156
|
}
|
|
150
157
|
if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(phone)) {
|
|
151
|
-
Alert.alert(
|
|
158
|
+
Alert.alert("请输入正确的手机号");
|
|
152
159
|
return false;
|
|
153
160
|
}
|
|
154
161
|
return true;
|
|
@@ -167,9 +174,9 @@ function LoginScreen({navigation, route}) {
|
|
|
167
174
|
phone_number: phone,
|
|
168
175
|
length: 4,
|
|
169
176
|
type: 1, // type=1 表示登录用途
|
|
170
|
-
}).catch(err => {
|
|
177
|
+
}).catch((err) => {
|
|
171
178
|
console.log(err);
|
|
172
|
-
setSmsCodeRightBtnText(
|
|
179
|
+
setSmsCodeRightBtnText("获取验证码");
|
|
173
180
|
setSmsCodeRightBtnDisabled(false);
|
|
174
181
|
});
|
|
175
182
|
|
|
@@ -177,11 +184,11 @@ function LoginScreen({navigation, route}) {
|
|
|
177
184
|
setSmsId(res.result.sms_id);
|
|
178
185
|
|
|
179
186
|
smsCodeTimer = setTimeout(() => {
|
|
180
|
-
setSmsCodeRightBtnText(
|
|
187
|
+
setSmsCodeRightBtnText("获取验证码");
|
|
181
188
|
setSmsCodeRightBtnDisabled(false);
|
|
182
189
|
}, 120000);
|
|
183
190
|
} else {
|
|
184
|
-
setSmsCodeRightBtnText(
|
|
191
|
+
setSmsCodeRightBtnText("获取验证码");
|
|
185
192
|
setSmsCodeRightBtnDisabled(false);
|
|
186
193
|
}
|
|
187
194
|
};
|
|
@@ -195,7 +202,7 @@ function LoginScreen({navigation, route}) {
|
|
|
195
202
|
// global.base.storage.set('location', geoRes);
|
|
196
203
|
// });
|
|
197
204
|
setProtocolAgree(true);
|
|
198
|
-
typeof protocolAgreeResolve ===
|
|
205
|
+
typeof protocolAgreeResolve === "function" && protocolAgreeResolve();
|
|
199
206
|
protocolAgreeResolve = null;
|
|
200
207
|
};
|
|
201
208
|
|
|
@@ -223,7 +230,7 @@ function LoginScreen({navigation, route}) {
|
|
|
223
230
|
};
|
|
224
231
|
|
|
225
232
|
const openProtocolDialog = () => {
|
|
226
|
-
return new Promise(resolve => {
|
|
233
|
+
return new Promise((resolve) => {
|
|
227
234
|
// setProtocolDialogVisible(true);
|
|
228
235
|
protocolAgreeResolve = resolve;
|
|
229
236
|
}).then(() => {
|
|
@@ -234,11 +241,11 @@ function LoginScreen({navigation, route}) {
|
|
|
234
241
|
const handleLogin = async () => {
|
|
235
242
|
let res;
|
|
236
243
|
|
|
237
|
-
const {deviceModal, appName} = NativeModules?.RNToNativeEmitter || {};
|
|
244
|
+
const { deviceModal, appName } = NativeModules?.RNToNativeEmitter || {};
|
|
238
245
|
|
|
239
246
|
const appID = await global.base.getAppId();
|
|
240
247
|
|
|
241
|
-
console.log(
|
|
248
|
+
console.log("appID", appID);
|
|
242
249
|
|
|
243
250
|
let finallyAppID = appID;
|
|
244
251
|
if (!appID) {
|
|
@@ -252,15 +259,15 @@ function LoginScreen({navigation, route}) {
|
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
if (!smsId) {
|
|
255
|
-
Alert.alert(
|
|
262
|
+
Alert.alert("请先获取验证码");
|
|
256
263
|
return;
|
|
257
264
|
}
|
|
258
265
|
|
|
259
266
|
if (!userInputSmsCode) {
|
|
260
|
-
Alert.alert(
|
|
267
|
+
Alert.alert("请输入短信验证码");
|
|
261
268
|
return;
|
|
262
269
|
}
|
|
263
|
-
showLoading(
|
|
270
|
+
showLoading("登录中...");
|
|
264
271
|
setIsLogining(true);
|
|
265
272
|
res = await smscodeLogin({
|
|
266
273
|
phone_number: phone,
|
|
@@ -269,22 +276,22 @@ function LoginScreen({navigation, route}) {
|
|
|
269
276
|
create_address: 1, // 注册时自动建默认家庭
|
|
270
277
|
extend: {
|
|
271
278
|
appid: finallyAppID,
|
|
272
|
-
model: deviceModal ||
|
|
273
|
-
application: appName ||
|
|
279
|
+
model: deviceModal || "开发测试",
|
|
280
|
+
application: appName || "爱家宝",
|
|
274
281
|
},
|
|
275
282
|
});
|
|
276
283
|
} else {
|
|
277
284
|
if (!username) {
|
|
278
|
-
Alert.alert(
|
|
285
|
+
Alert.alert("请输入账号");
|
|
279
286
|
return;
|
|
280
287
|
}
|
|
281
288
|
|
|
282
289
|
if (!password) {
|
|
283
|
-
Alert.alert(
|
|
290
|
+
Alert.alert("请输入密码");
|
|
284
291
|
return;
|
|
285
292
|
}
|
|
286
|
-
console.log(global.loading,
|
|
287
|
-
showLoading(
|
|
293
|
+
console.log(global.loading, "global.loading");
|
|
294
|
+
showLoading("登录中...");
|
|
288
295
|
setIsLogining(true);
|
|
289
296
|
res = await accountLogin({
|
|
290
297
|
account_name: username,
|
|
@@ -292,28 +299,28 @@ function LoginScreen({navigation, route}) {
|
|
|
292
299
|
create_address: 1, // 注册时自动建默认家庭
|
|
293
300
|
extend: {
|
|
294
301
|
appid: finallyAppID,
|
|
295
|
-
model: deviceModal ||
|
|
296
|
-
application: appName ||
|
|
302
|
+
model: deviceModal || "开发测试",
|
|
303
|
+
application: appName || "爱家宝",
|
|
297
304
|
},
|
|
298
305
|
});
|
|
299
306
|
}
|
|
300
307
|
if (res.code === 0) {
|
|
301
|
-
console.log(res.result,
|
|
302
|
-
await storage.set(
|
|
303
|
-
await storage.set(
|
|
308
|
+
console.log(res.result, "ipanelClound用户信息");
|
|
309
|
+
await storage.set("accessToken", res.result.access_token);
|
|
310
|
+
await storage.set("refreshToken", res.result.refresh_token);
|
|
304
311
|
|
|
305
312
|
if (res.result.address && res.result.address[0]) {
|
|
306
313
|
const defaultAddr = res.result.address[0];
|
|
307
|
-
await storage.set(
|
|
308
|
-
await storage.set(
|
|
314
|
+
await storage.set("activeAddr", defaultAddr);
|
|
315
|
+
await storage.set("addressList", res.result.address || []);
|
|
309
316
|
await updateHomedToken();
|
|
310
317
|
} else {
|
|
311
|
-
await storage.set(
|
|
312
|
-
await storage.set(
|
|
318
|
+
await storage.set("activeAddr", {});
|
|
319
|
+
await storage.set("addressList", []);
|
|
313
320
|
}
|
|
314
321
|
|
|
315
322
|
delete res.result.address;
|
|
316
|
-
await storage.set(
|
|
323
|
+
await storage.set("accountData", res.result);
|
|
317
324
|
|
|
318
325
|
// 放开这段重新登录就会置空运营商(进入标准版)
|
|
319
326
|
// await storage.set(
|
|
@@ -323,43 +330,49 @@ function LoginScreen({navigation, route}) {
|
|
|
323
330
|
|
|
324
331
|
// 初始化默认运营商对应的homed游客账号
|
|
325
332
|
const envVersion =
|
|
326
|
-
NativeModules?.RNToNativeEmitter?.serverCluster ||
|
|
333
|
+
NativeModules?.RNToNativeEmitter?.serverCluster || "dev";
|
|
327
334
|
await initOperatorHomedTouristAccount({
|
|
328
335
|
touristUsername: finallyAppID,
|
|
329
|
-
domain: envVersion ===
|
|
330
|
-
touristGroupId: envVersion ===
|
|
336
|
+
domain: envVersion === "dev" ? "homed.me" : "homed.tv",
|
|
337
|
+
touristGroupId: envVersion === "dev" ? 115017 : 4664, // 4664: tv集群的手机APP游客用户组. 115017: 运营集群手机APP游客用户组
|
|
331
338
|
});
|
|
332
339
|
clearTimeout(smsCodeTimer);
|
|
333
340
|
// setIsLogined(true);
|
|
334
341
|
// 判断是否已经选了运营商
|
|
335
342
|
const currentOperator = await storage.get(
|
|
336
|
-
`${res.result?.account?.account_id ||
|
|
343
|
+
`${res.result?.account?.account_id || ""}currentOperator`
|
|
337
344
|
);
|
|
338
345
|
|
|
339
346
|
// 上报APP启动事件
|
|
340
|
-
appReport(
|
|
347
|
+
appReport("APP_STARTUP");
|
|
341
348
|
|
|
342
349
|
hideLoading();
|
|
343
350
|
setIsLogining(false);
|
|
344
351
|
const appName =
|
|
345
352
|
NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
|
|
346
|
-
|
|
347
|
-
|
|
353
|
+
|
|
354
|
+
if (DeviceInfo.getBrand() === "Allwinner") {
|
|
355
|
+
// 声必可屏幕
|
|
356
|
+
replace("SbkScreen", {
|
|
357
|
+
redirect: false,
|
|
358
|
+
});
|
|
359
|
+
} else if (currentOperator || appName.includes("安电工")) {
|
|
360
|
+
replace("Home", {
|
|
348
361
|
redirect: false,
|
|
349
362
|
});
|
|
350
363
|
} else {
|
|
351
364
|
confirmWithContent({
|
|
352
|
-
title:
|
|
353
|
-
component:
|
|
354
|
-
confirmButtonText:
|
|
365
|
+
title: "选择运营商",
|
|
366
|
+
component: "你是否要选择运营商",
|
|
367
|
+
confirmButtonText: "确定",
|
|
355
368
|
confirmCallback: () => {
|
|
356
|
-
replace(
|
|
357
|
-
purpose:
|
|
369
|
+
replace("OperatorSelectScreen", {
|
|
370
|
+
purpose: "init",
|
|
358
371
|
});
|
|
359
372
|
},
|
|
360
|
-
cancelButtonText:
|
|
373
|
+
cancelButtonText: "先不选",
|
|
361
374
|
cancelCallback: () => {
|
|
362
|
-
replace(
|
|
375
|
+
replace("Home", {
|
|
363
376
|
redirect: false,
|
|
364
377
|
});
|
|
365
378
|
},
|
|
@@ -368,12 +381,12 @@ function LoginScreen({navigation, route}) {
|
|
|
368
381
|
} else {
|
|
369
382
|
hideLoading();
|
|
370
383
|
setIsLogining(false);
|
|
371
|
-
global.toast.showToast(res.message +
|
|
384
|
+
global.toast.showToast(res.message + "(code: " + res.code + ")");
|
|
372
385
|
}
|
|
373
386
|
};
|
|
374
387
|
|
|
375
388
|
const statusBarPlaceholderStyle = {
|
|
376
|
-
height: (Platform.OS ===
|
|
389
|
+
height: (Platform.OS === "ios" ? insets.top : 0) + StatusBar.currentHeight,
|
|
377
390
|
};
|
|
378
391
|
|
|
379
392
|
const handleSwitchLoginWay = () => {
|
|
@@ -385,68 +398,69 @@ function LoginScreen({navigation, route}) {
|
|
|
385
398
|
};
|
|
386
399
|
|
|
387
400
|
const handleViewUserAgreement = () => {
|
|
388
|
-
navigation.navigate(
|
|
389
|
-
title:
|
|
390
|
-
url:
|
|
401
|
+
navigation.navigate("WebviewScreen", {
|
|
402
|
+
title: "用户协议",
|
|
403
|
+
url: "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/user_agreement.html",
|
|
391
404
|
});
|
|
392
405
|
};
|
|
393
406
|
const handleViewPrivacyClause = () => {
|
|
394
|
-
navigation.navigate(
|
|
395
|
-
title:
|
|
396
|
-
url:
|
|
407
|
+
navigation.navigate("WebviewScreen", {
|
|
408
|
+
title: "隐私条款",
|
|
409
|
+
url: "https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/service_agreement/privacy_policy.html",
|
|
397
410
|
});
|
|
398
411
|
};
|
|
399
|
-
const handleViewUserAgreementByType = type => {
|
|
400
|
-
if (type ===
|
|
412
|
+
const handleViewUserAgreementByType = (type) => {
|
|
413
|
+
if (type === "service") {
|
|
401
414
|
setServiceDialogVisible(true);
|
|
402
|
-
} else if (type ===
|
|
415
|
+
} else if (type === "privacy") {
|
|
403
416
|
setPrivacyDialogVisible(true);
|
|
404
417
|
}
|
|
405
418
|
};
|
|
406
419
|
|
|
407
|
-
const handleSetProtocolAgree = isAgree => {
|
|
420
|
+
const handleSetProtocolAgree = (isAgree) => {
|
|
408
421
|
setProtocolAgree(isAgree);
|
|
409
422
|
setServiceAgree(isAgree);
|
|
410
423
|
setPrivacyAgree(isAgree);
|
|
411
424
|
};
|
|
412
425
|
|
|
413
|
-
const handleOneDisagree = async type => {
|
|
426
|
+
const handleOneDisagree = async (type) => {
|
|
414
427
|
setProtocolAgree(false);
|
|
415
|
-
if (type ===
|
|
428
|
+
if (type === "service") {
|
|
416
429
|
setServiceAgree(false);
|
|
417
430
|
setServiceDialogVisible(false);
|
|
418
|
-
} else if (type ===
|
|
431
|
+
} else if (type === "privacy") {
|
|
419
432
|
setPrivacyAgree(false);
|
|
420
433
|
setPrivacyDialogVisible(false);
|
|
421
434
|
}
|
|
422
435
|
};
|
|
423
|
-
const handleOneAgree = type => {
|
|
424
|
-
if (type ===
|
|
436
|
+
const handleOneAgree = (type) => {
|
|
437
|
+
if (type === "service") {
|
|
425
438
|
setServiceAgree(true);
|
|
426
439
|
setServiceDialogVisible(false);
|
|
427
|
-
} else if (type ===
|
|
440
|
+
} else if (type === "privacy") {
|
|
428
441
|
setPrivacyAgree(true);
|
|
429
442
|
setPrivacyDialogVisible(false);
|
|
430
443
|
}
|
|
431
444
|
|
|
432
|
-
typeof protocolAgreeResolve ===
|
|
445
|
+
typeof protocolAgreeResolve === "function" && protocolAgreeResolve();
|
|
433
446
|
protocolAgreeResolve = null;
|
|
434
447
|
};
|
|
435
448
|
|
|
436
449
|
loginDisabled;
|
|
437
450
|
const loginBtnBg = {
|
|
438
451
|
backgroundColor: loginDisabled
|
|
439
|
-
?
|
|
440
|
-
:
|
|
452
|
+
? "rgba(234, 96, 0, 0.3)"
|
|
453
|
+
: "rgba(234, 96, 0, 1)",
|
|
441
454
|
};
|
|
442
455
|
|
|
443
456
|
return (
|
|
444
457
|
<ImageBackground
|
|
445
|
-
source={require(
|
|
458
|
+
source={require("../../assets/img/login_bg.png")}
|
|
446
459
|
style={[
|
|
447
460
|
styles.container,
|
|
448
|
-
{paddingTop: Platform.OS ===
|
|
449
|
-
]}
|
|
461
|
+
{ paddingTop: Platform.OS === "ios" ? insets.top : 0 },
|
|
462
|
+
]}
|
|
463
|
+
>
|
|
450
464
|
{isLoading || isLogined ? (
|
|
451
465
|
<View style={styles.welcomeView}>{/* 白屏界面 */}</View>
|
|
452
466
|
) : (
|
|
@@ -456,15 +470,16 @@ function LoginScreen({navigation, route}) {
|
|
|
456
470
|
<View style={styles.changeLoginWay}>
|
|
457
471
|
<TouchableOpacity
|
|
458
472
|
activeOpacity={0.7}
|
|
459
|
-
onPress={handleSwitchLoginWay}
|
|
473
|
+
onPress={handleSwitchLoginWay}
|
|
474
|
+
>
|
|
460
475
|
<View style={styles.changeLoginWayInner}>
|
|
461
476
|
<Image
|
|
462
|
-
source={require(
|
|
477
|
+
source={require("../../assets/img/qiehuan.png")}
|
|
463
478
|
style={styles.exchangeIcon}
|
|
464
479
|
/>
|
|
465
480
|
|
|
466
481
|
<Text style={styles.changeLoginWayText}>
|
|
467
|
-
{loginWay === 0 ?
|
|
482
|
+
{loginWay === 0 ? "密码登录" : "验证码登录"}
|
|
468
483
|
</Text>
|
|
469
484
|
</View>
|
|
470
485
|
</TouchableOpacity>
|
|
@@ -473,13 +488,13 @@ function LoginScreen({navigation, route}) {
|
|
|
473
488
|
<View style={styles.content}>
|
|
474
489
|
<View style={styles.titleBox}>
|
|
475
490
|
<Text style={styles.title}>
|
|
476
|
-
{loginWay === 0 ?
|
|
491
|
+
{loginWay === 0 ? "验证码登录" : "密码登录"}
|
|
477
492
|
</Text>
|
|
478
493
|
|
|
479
494
|
<Text style={styles.subTitle}>
|
|
480
495
|
{loginWay === 0
|
|
481
|
-
?
|
|
482
|
-
:
|
|
496
|
+
? "未注册过的手机号验证通过后将自动注册"
|
|
497
|
+
: "请使用账号和密码登录"}
|
|
483
498
|
</Text>
|
|
484
499
|
</View>
|
|
485
500
|
|
|
@@ -490,7 +505,7 @@ function LoginScreen({navigation, route}) {
|
|
|
490
505
|
style={styles.input}
|
|
491
506
|
value={phone}
|
|
492
507
|
placeholder="手机号"
|
|
493
|
-
onChangeText={text => setPhone(text)}
|
|
508
|
+
onChangeText={(text) => setPhone(text)}
|
|
494
509
|
/>
|
|
495
510
|
</View>
|
|
496
511
|
<View style={styles.inputBox}>
|
|
@@ -499,7 +514,7 @@ function LoginScreen({navigation, route}) {
|
|
|
499
514
|
placeholder="验证码"
|
|
500
515
|
rightBtnDisabled={smsCodeRightBtnDisabled}
|
|
501
516
|
rightBtnText={smsCodeRightBtnText}
|
|
502
|
-
onChangeText={text => setUserInputSmsCode(text)}
|
|
517
|
+
onChangeText={(text) => setUserInputSmsCode(text)}
|
|
503
518
|
onRightBtnPress={handleGetSmsId}
|
|
504
519
|
/>
|
|
505
520
|
</View>
|
|
@@ -513,7 +528,7 @@ function LoginScreen({navigation, route}) {
|
|
|
513
528
|
style={styles.input}
|
|
514
529
|
value={username}
|
|
515
530
|
placeholder="账号"
|
|
516
|
-
onChangeText={text => setUsername(text)}
|
|
531
|
+
onChangeText={(text) => setUsername(text)}
|
|
517
532
|
/>
|
|
518
533
|
</View>
|
|
519
534
|
<View style={styles.inputBox}>
|
|
@@ -522,7 +537,7 @@ function LoginScreen({navigation, route}) {
|
|
|
522
537
|
value={password}
|
|
523
538
|
secureTextEntry
|
|
524
539
|
placeholder="密码"
|
|
525
|
-
onChangeText={text => setPassword(text)}
|
|
540
|
+
onChangeText={(text) => setPassword(text)}
|
|
526
541
|
/>
|
|
527
542
|
</View>
|
|
528
543
|
</>
|
|
@@ -535,7 +550,7 @@ function LoginScreen({navigation, route}) {
|
|
|
535
550
|
containerStyle={{
|
|
536
551
|
margin: 0,
|
|
537
552
|
padding: 0,
|
|
538
|
-
backgroundColor:
|
|
553
|
+
backgroundColor: "transparent",
|
|
539
554
|
}}
|
|
540
555
|
onPress={() => handleSetProtocolAgree(!protocolAgree)}
|
|
541
556
|
checkedIcon={
|
|
@@ -556,31 +571,36 @@ function LoginScreen({navigation, route}) {
|
|
|
556
571
|
}
|
|
557
572
|
/>
|
|
558
573
|
<TouchableWithoutFeedback
|
|
559
|
-
onPress={() => setProtocolAgree(!protocolAgree)}
|
|
574
|
+
onPress={() => setProtocolAgree(!protocolAgree)}
|
|
575
|
+
>
|
|
560
576
|
<Text style={styles.protocolText}>
|
|
561
577
|
已阅读并同意
|
|
562
578
|
<TouchableWithoutFeedback
|
|
563
|
-
style={{paddingVertical: 100}}
|
|
564
|
-
onPress={() => handleViewUserAgreementByType(
|
|
579
|
+
style={{ paddingVertical: 100 }}
|
|
580
|
+
onPress={() => handleViewUserAgreementByType("service")}
|
|
581
|
+
>
|
|
565
582
|
<Text
|
|
566
583
|
style={
|
|
567
584
|
protocolAgree || serviceAgree
|
|
568
585
|
? styles.protocolLinkAgree
|
|
569
586
|
: styles.protocolLink
|
|
570
|
-
}
|
|
587
|
+
}
|
|
588
|
+
>
|
|
571
589
|
用户协议
|
|
572
590
|
</Text>
|
|
573
591
|
</TouchableWithoutFeedback>
|
|
574
592
|
和
|
|
575
593
|
<TouchableWithoutFeedback
|
|
576
|
-
style={{paddingVertical: 100}}
|
|
577
|
-
onPress={() => handleViewUserAgreementByType(
|
|
594
|
+
style={{ paddingVertical: 100 }}
|
|
595
|
+
onPress={() => handleViewUserAgreementByType("privacy")}
|
|
596
|
+
>
|
|
578
597
|
<Text
|
|
579
598
|
style={
|
|
580
599
|
protocolAgree || privacyAgree
|
|
581
600
|
? styles.protocolLinkAgree
|
|
582
601
|
: styles.protocolLink
|
|
583
|
-
}
|
|
602
|
+
}
|
|
603
|
+
>
|
|
584
604
|
隐私条款
|
|
585
605
|
</Text>
|
|
586
606
|
</TouchableWithoutFeedback>
|
|
@@ -591,11 +611,12 @@ function LoginScreen({navigation, route}) {
|
|
|
591
611
|
<TouchableOpacity
|
|
592
612
|
activeOpacity={0.7}
|
|
593
613
|
onPress={handleLoginPress}
|
|
594
|
-
disabled={loginDisabled}
|
|
614
|
+
disabled={loginDisabled}
|
|
615
|
+
>
|
|
595
616
|
<View style={styles.loginBtnBox}>
|
|
596
617
|
<View style={[styles.loginBtn, loginBtnBg]}>
|
|
597
618
|
<Text style={styles.loginBtnText}>
|
|
598
|
-
{isLogining ?
|
|
619
|
+
{isLogining ? "正在登录中..." : "登录"}
|
|
599
620
|
</Text>
|
|
600
621
|
</View>
|
|
601
622
|
</View>
|
|
@@ -630,9 +651,10 @@ function LoginScreen({navigation, route}) {
|
|
|
630
651
|
onPress={() => {
|
|
631
652
|
console.log(111);
|
|
632
653
|
setProtocolDialogVisible(false);
|
|
633
|
-
}}
|
|
654
|
+
}}
|
|
655
|
+
>
|
|
634
656
|
<Image
|
|
635
|
-
source={require(
|
|
657
|
+
source={require("../../assets/img/goBack.png")}
|
|
636
658
|
style={styles.goBackImg}
|
|
637
659
|
resizeMode="contain"
|
|
638
660
|
/>
|
|
@@ -717,13 +739,15 @@ function LoginScreen({navigation, route}) {
|
|
|
717
739
|
<TouchableOpacity
|
|
718
740
|
style={styles.disagreeBtn}
|
|
719
741
|
activeOpacity={0.7}
|
|
720
|
-
onPress={handleUserDisagree}
|
|
742
|
+
onPress={handleUserDisagree}
|
|
743
|
+
>
|
|
721
744
|
<Text style={styles.disagreeBtnText}>不同意</Text>
|
|
722
745
|
</TouchableOpacity>
|
|
723
746
|
<TouchableOpacity
|
|
724
747
|
style={styles.agreeBtn}
|
|
725
748
|
activeOpacity={0.7}
|
|
726
|
-
onPress={handleUserAgree}
|
|
749
|
+
onPress={handleUserAgree}
|
|
750
|
+
>
|
|
727
751
|
<Text style={styles.agreeBtnText}>同意</Text>
|
|
728
752
|
</TouchableOpacity>
|
|
729
753
|
</View>
|
|
@@ -737,36 +761,35 @@ function LoginScreen({navigation, route}) {
|
|
|
737
761
|
const styles = StyleSheet.create({
|
|
738
762
|
container: {
|
|
739
763
|
flex: 1,
|
|
740
|
-
backgroundColor:
|
|
764
|
+
backgroundColor: "#fff",
|
|
741
765
|
},
|
|
742
766
|
welcomeView: {
|
|
743
767
|
flex: 1,
|
|
744
|
-
alignItems:
|
|
745
|
-
justifyContent:
|
|
768
|
+
alignItems: "center",
|
|
769
|
+
justifyContent: "center",
|
|
746
770
|
},
|
|
747
771
|
content: {
|
|
748
|
-
|
|
772
|
+
paddingHorizontal: 30,
|
|
749
773
|
},
|
|
750
774
|
titleBox: {
|
|
751
|
-
justifyContent:
|
|
775
|
+
justifyContent: "center",
|
|
752
776
|
},
|
|
753
777
|
title: {
|
|
754
|
-
fontSize:
|
|
755
|
-
color:
|
|
778
|
+
fontSize: 24,
|
|
779
|
+
color: "rgba(48, 48, 48, 1)",
|
|
756
780
|
},
|
|
757
781
|
subTitle: {
|
|
758
782
|
fontSize: 14,
|
|
759
783
|
marginTop: 10,
|
|
760
|
-
marginBottom: 40,
|
|
761
784
|
},
|
|
762
785
|
inputBox: {
|
|
763
786
|
borderBottomWidth: 1,
|
|
764
787
|
marginVertical: 10,
|
|
765
|
-
borderBottomColor:
|
|
788
|
+
borderBottomColor: "rgba(217, 217, 217, 1)",
|
|
766
789
|
},
|
|
767
790
|
input: {
|
|
768
791
|
height: 50,
|
|
769
|
-
color:
|
|
792
|
+
color: "#333",
|
|
770
793
|
},
|
|
771
794
|
welcomText: {
|
|
772
795
|
fontSize: 30,
|
|
@@ -775,17 +798,17 @@ const styles = StyleSheet.create({
|
|
|
775
798
|
flex: 1,
|
|
776
799
|
},
|
|
777
800
|
changeLoginWay: {
|
|
778
|
-
height: 70,
|
|
779
|
-
justifyContent:
|
|
780
|
-
alignItems:
|
|
801
|
+
// height: 70,
|
|
802
|
+
justifyContent: "center",
|
|
803
|
+
alignItems: "flex-end",
|
|
781
804
|
marginRight: 20,
|
|
782
805
|
},
|
|
783
806
|
changeLoginWayInner: {
|
|
784
|
-
flexDirection:
|
|
785
|
-
alignItems:
|
|
807
|
+
flexDirection: "row",
|
|
808
|
+
alignItems: "center",
|
|
786
809
|
},
|
|
787
810
|
changeLoginWayText: {
|
|
788
|
-
color:
|
|
811
|
+
color: "rgba(51, 51, 51, 1)",
|
|
789
812
|
fontSize: 16,
|
|
790
813
|
},
|
|
791
814
|
exchangeIcon: {
|
|
@@ -795,20 +818,20 @@ const styles = StyleSheet.create({
|
|
|
795
818
|
},
|
|
796
819
|
protocol: {
|
|
797
820
|
marginVertical: 15,
|
|
798
|
-
flexDirection:
|
|
799
|
-
alignItems:
|
|
821
|
+
flexDirection: "row",
|
|
822
|
+
alignItems: "center",
|
|
800
823
|
},
|
|
801
824
|
protocolText: {
|
|
802
|
-
color:
|
|
825
|
+
color: "rgba(102, 102, 102, 1)",
|
|
803
826
|
},
|
|
804
827
|
protocolLink: {
|
|
805
|
-
color:
|
|
828
|
+
color: "rgba(234, 96, 0, 1)",
|
|
806
829
|
},
|
|
807
830
|
protocolLinkAgree: {
|
|
808
|
-
color:
|
|
831
|
+
color: "#0EC12C",
|
|
809
832
|
},
|
|
810
833
|
agreementMask: {
|
|
811
|
-
position:
|
|
834
|
+
position: "absolute",
|
|
812
835
|
left: 0,
|
|
813
836
|
top: 0,
|
|
814
837
|
bottom: 0,
|
|
@@ -816,28 +839,28 @@ const styles = StyleSheet.create({
|
|
|
816
839
|
zIndex: 2,
|
|
817
840
|
},
|
|
818
841
|
agreementConfirmContent: {
|
|
819
|
-
position:
|
|
820
|
-
width: Dimensions.get(
|
|
842
|
+
position: "absolute",
|
|
843
|
+
width: Dimensions.get("window").width - 60,
|
|
821
844
|
height: 400,
|
|
822
845
|
left: 30,
|
|
823
|
-
top: Dimensions.get(
|
|
824
|
-
backgroundColor:
|
|
846
|
+
top: Dimensions.get("window").height / 2 - 200,
|
|
847
|
+
backgroundColor: "#fff",
|
|
825
848
|
paddingBottom: 0,
|
|
826
849
|
borderWidth: 1,
|
|
827
|
-
borderColor:
|
|
850
|
+
borderColor: "#a1a1a1",
|
|
828
851
|
borderRadius: 20,
|
|
829
852
|
},
|
|
830
853
|
agreementConfirmHead: {
|
|
831
|
-
position:
|
|
832
|
-
flexDirection:
|
|
833
|
-
alignItems:
|
|
854
|
+
position: "relative",
|
|
855
|
+
flexDirection: "row",
|
|
856
|
+
alignItems: "center",
|
|
834
857
|
paddingTop: 10,
|
|
835
858
|
paddingLeft: 10,
|
|
836
859
|
marginBottom: 5,
|
|
837
860
|
height: 40,
|
|
838
861
|
},
|
|
839
862
|
headerLeft: {
|
|
840
|
-
position:
|
|
863
|
+
position: "absolute",
|
|
841
864
|
top: 15,
|
|
842
865
|
left: 10,
|
|
843
866
|
zIndex: 2,
|
|
@@ -848,7 +871,7 @@ const styles = StyleSheet.create({
|
|
|
848
871
|
},
|
|
849
872
|
agreementConfirmTitleBox: {
|
|
850
873
|
// flex: 1,
|
|
851
|
-
position:
|
|
874
|
+
position: "absolute",
|
|
852
875
|
top: 10,
|
|
853
876
|
bottom: 0,
|
|
854
877
|
left: 0,
|
|
@@ -858,61 +881,61 @@ const styles = StyleSheet.create({
|
|
|
858
881
|
agreementConfirmTitle: {
|
|
859
882
|
fontSize: 20,
|
|
860
883
|
// lineHeight: 50,
|
|
861
|
-
color:
|
|
862
|
-
textAlign:
|
|
884
|
+
color: "#000",
|
|
885
|
+
textAlign: "center",
|
|
863
886
|
// paddingTop: 20,
|
|
864
887
|
},
|
|
865
888
|
agreementConfirmText: {
|
|
866
889
|
fontSize: 16,
|
|
867
890
|
lineHeight: 30,
|
|
868
891
|
paddingHorizontal: 20,
|
|
869
|
-
color:
|
|
892
|
+
color: "#000",
|
|
870
893
|
},
|
|
871
894
|
agreementConfirmImportantText: {
|
|
872
|
-
color:
|
|
895
|
+
color: "rgba(234, 96, 0, 1)",
|
|
873
896
|
},
|
|
874
897
|
agreementButtons: {
|
|
875
898
|
height: 50,
|
|
876
|
-
flexDirection:
|
|
877
|
-
justifyContent:
|
|
878
|
-
borderTopColor:
|
|
899
|
+
flexDirection: "row",
|
|
900
|
+
justifyContent: "space-around",
|
|
901
|
+
borderTopColor: "#c1c1c1",
|
|
879
902
|
borderTopWidth: 0.5,
|
|
880
903
|
},
|
|
881
904
|
disagreeBtn: {
|
|
882
905
|
flex: 1,
|
|
883
|
-
alignItems:
|
|
884
|
-
justifyContent:
|
|
906
|
+
alignItems: "center",
|
|
907
|
+
justifyContent: "center",
|
|
885
908
|
borderBottomLeftRadius: 20,
|
|
886
909
|
},
|
|
887
910
|
disagreeBtnText: {
|
|
888
|
-
color:
|
|
911
|
+
color: "#ccc",
|
|
889
912
|
},
|
|
890
913
|
agreeBtn: {
|
|
891
914
|
flex: 1,
|
|
892
|
-
alignItems:
|
|
893
|
-
justifyContent:
|
|
894
|
-
borderLeftColor:
|
|
915
|
+
alignItems: "center",
|
|
916
|
+
justifyContent: "center",
|
|
917
|
+
borderLeftColor: "#c1c1c1",
|
|
895
918
|
borderLeftWidth: 0.5,
|
|
896
919
|
borderBottomRightRadius: 20,
|
|
897
920
|
},
|
|
898
921
|
agreeBtnText: {
|
|
899
|
-
color:
|
|
922
|
+
color: "#333",
|
|
900
923
|
fontSize: 16,
|
|
901
924
|
},
|
|
902
925
|
loginBtnBox: {
|
|
903
|
-
flexDirection:
|
|
904
|
-
alignItems:
|
|
926
|
+
flexDirection: "row",
|
|
927
|
+
alignItems: "center",
|
|
905
928
|
},
|
|
906
929
|
loginBtn: {
|
|
907
930
|
flex: 1,
|
|
908
931
|
height: 48,
|
|
909
932
|
marginHorizontal: 10,
|
|
910
933
|
borderRadius: 24,
|
|
911
|
-
alignItems:
|
|
912
|
-
justifyContent:
|
|
934
|
+
alignItems: "center",
|
|
935
|
+
justifyContent: "center",
|
|
913
936
|
},
|
|
914
937
|
loginBtnText: {
|
|
915
|
-
color:
|
|
938
|
+
color: "#fff",
|
|
916
939
|
fontSize: 18,
|
|
917
940
|
},
|
|
918
941
|
});
|