ipanel-rnapp-ajb-base 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/App.js CHANGED
@@ -40,7 +40,7 @@ import storage from "./storage";
40
40
 
41
41
  import { navigationRef } from "./utils/RootNavigation";
42
42
  import checkLogin from "./hooks/checkLogin";
43
- import { getModuleVersionInfo } from "./api/";
43
+ import { getModuleVersionInfo, getUserInfo, delThirdId } from "./api/";
44
44
  import { appReport } from "./utils/common";
45
45
 
46
46
  // 基础导航页、登录页
@@ -353,10 +353,55 @@ const App = () => {
353
353
  }
354
354
  );
355
355
 
356
+ const homedLogOutListener = eventEmitter.addListener(
357
+ "HomedLogout",
358
+ async (data) => {
359
+ console.log("HomedLogout", data);
360
+
361
+ const accountData = await storage.get("accountData");
362
+ // const activeAddr = await storage.get('activeAddr');
363
+ const res = await getUserInfo();
364
+ console.log(res, "HomedLogout getUserInfo");
365
+ const userList = res.result?.user_list || [];
366
+ const currentUser = userList.find(
367
+ (item) => item.user_id === accountData?.user.user_id
368
+ );
369
+ const bindList = currentUser?.bind_list || [];
370
+ console.log(bindList, "HomedLogout bindList");
371
+ const homedConfig = bindList.find(
372
+ (item) => item.third_type === "homed"
373
+ );
374
+ console.log("homedConfig", homedConfig);
375
+
376
+ if (homedConfig) {
377
+ // 解绑当前cloud用户对应的homed用户
378
+ const result = await delThirdId({
379
+ third_type: "homed",
380
+ third_id: homedConfig.third_id,
381
+ user_id: homedConfig.user_id,
382
+ }).catch((err) => {
383
+ console.error(err);
384
+ });
385
+ if (!result || result.code !== 0) {
386
+ console.error("解绑homed用户失败:", result);
387
+ global.toast.showToast("解绑电视用户失败");
388
+ return;
389
+ }
390
+ global.toast.showToast("已解绑电视用户");
391
+ await storage.remove("homedAccessToken");
392
+ await storage.remove("HomedLoginResult");
393
+ } else {
394
+ console.log("当前未绑定homed用户");
395
+ global.toast.showToast("当前没有绑定电视用户,无法解绑");
396
+ }
397
+ }
398
+ );
399
+
356
400
  return () => {
357
401
  keyboardDidShowListener.remove();
358
402
  keyboardDidHideListener.remove();
359
403
  cellularDataStateListener.remove();
404
+ homedLogOutListener.remove();
360
405
  };
361
406
  }, []);
362
407
 
@@ -36,7 +36,7 @@ export const baiduAsr = (cuid, len, speechBase64) => {
36
36
 
37
37
  export const getAreaOperatorModules = async (params) => {
38
38
  let url = `${
39
- ["禺乐慧家", "悦慧家"].includes(appName)
39
+ ["禺乐慧家", "悦慧家", "吉柿果"].includes(appName)
40
40
  ? config.PANYU_MODULE_VERSION_URI
41
41
  : config.IPANEL_CLOUD_BASE_URI
42
42
  }/jshomeapp/api/getAreaOperatorModules`;
@@ -67,7 +67,7 @@ export const getAreaOperatorModules = async (params) => {
67
67
 
68
68
  export const getModuleVersionInfo = async (params) => {
69
69
  let url = `${
70
- ["禺乐慧家", "悦慧家"].includes(appName)
70
+ ["禺乐慧家", "悦慧家", "吉柿果"].includes(appName)
71
71
  ? config.PANYU_MODULE_VERSION_URI
72
72
  : config.IPANEL_CLOUD_BASE_URI
73
73
  }/jshomeapp/api/moduleVersionInfo`;
@@ -165,6 +165,17 @@ export const deviceReportThird = (data) => {
165
165
  });
166
166
  };
167
167
 
168
+ export const delThirdId = (data) => {
169
+ return request({
170
+ url: ACCOUNT_SERVICE,
171
+ method: "POST",
172
+ data: {
173
+ action: "del_third_id",
174
+ ...data,
175
+ },
176
+ });
177
+ };
178
+
168
179
  export const obtainThirdToken = (data) => {
169
180
  return request({
170
181
  url: ACCOUNT_SERVICE,
@@ -846,7 +857,7 @@ export const queryCountByName = (data) => {
846
857
  // 获取图形验证码
847
858
  export const getCaptcha = (data) => {
848
859
  return request({
849
- url: "https://code.ipanel.cn/captcha/get",
860
+ url: `${config.IPANEL_CLOUD_BASE_URI}/captcha/get`,
850
861
  method: "GET",
851
862
  data,
852
863
  });
@@ -854,7 +865,7 @@ export const getCaptcha = (data) => {
854
865
 
855
866
  // 校验图形验证码
856
867
  export const checkCaptcha = (data) => {
857
- return fetch("https://code.ipanel.cn/captcha/check", {
868
+ return fetch(`${config.IPANEL_CLOUD_BASE_URI}/captcha/check`, {
858
869
  method: "POST",
859
870
  body: data,
860
871
  headers: {
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from "react";
1
+ import React, { useState, useEffect, useMemo } from "react";
2
2
  import {
3
3
  Alert,
4
4
  View,
@@ -154,6 +154,7 @@ function HomeTabScreen({ navigation, route }) {
154
154
  return {
155
155
  name: pack.moduleName,
156
156
  component: components[index],
157
+ meta: pack.meta || {},
157
158
  options: {
158
159
  title: pack.moduleChineseName,
159
160
  headerShown: false,
@@ -243,8 +244,10 @@ function HomeTabScreen({ navigation, route }) {
243
244
  // 刷新token
244
245
  const checkToken = async () => {
245
246
  const accountType = await storage.get("accountType");
246
- const accessTokenKey = accountType === 'adg' ? 'adgAccessToken' : 'accessToken';
247
- const refreshTokenKey = accountType === 'adg' ? 'adgRefreshToken' : 'refreshToken';
247
+ const accessTokenKey =
248
+ accountType === "adg" ? "adgAccessToken" : "accessToken";
249
+ const refreshTokenKey =
250
+ accountType === "adg" ? "adgRefreshToken" : "refreshToken";
248
251
  const access_token = await storage.get(accessTokenKey);
249
252
  const refresh_token = await storage.get(refreshTokenKey);
250
253
  const logout = () => {
@@ -283,6 +286,90 @@ function HomeTabScreen({ navigation, route }) {
283
286
  }
284
287
  };
285
288
 
289
+ const logoSource = useMemo(() => {
290
+ if (["禺乐慧家", "悦慧家"].includes(appName)) {
291
+ return require("../assets/img/launch_logo_panyu.png");
292
+ } else if (appName === "吉柿果") {
293
+ return require("../assets/img/launch_logo_jilin.png");
294
+ } else {
295
+ return require("../assets/img/launch_logo.png");
296
+ }
297
+ }, []);
298
+
299
+ // 启动页
300
+ const renderLaunch = () => {
301
+ if (appName === "吉柿果") {
302
+ return (
303
+ <View style={styles.loadingView}>
304
+ <Image
305
+ source={logoSource}
306
+ style={{
307
+ width: px(241 * 1.5),
308
+ height: px(310 * 1.5),
309
+ marginBottom: px(80),
310
+ }}
311
+ resizeMode="contain"
312
+ />
313
+ <ActivityIndicator size="large" />
314
+ <View style={styles.bottomLaunch}>
315
+ <Image
316
+ source={require("../assets/img/launch_logo_jilin_bottom1.png")}
317
+ style={{
318
+ width: px(600),
319
+ height: px(100),
320
+ marginBottom: px(30),
321
+ }}
322
+ resizeMode="contain"
323
+ />
324
+ <Image
325
+ source={require("../assets/img/launch_logo_jilin_bottom2.png")}
326
+ style={{
327
+ width: px(750),
328
+ height: px(100),
329
+ }}
330
+ resizeMode="contain"
331
+ />
332
+ </View>
333
+ </View>
334
+ );
335
+ } else {
336
+ return (
337
+ <ImageBackground
338
+ style={styles.loadingView}
339
+ source={
340
+ ["禺乐慧家", "悦慧家"].includes(appName)
341
+ ? require("../assets/img/launch_bg_panyu.png")
342
+ : require("../assets/img/launch_bg.png")
343
+ }
344
+ >
345
+ <Image
346
+ source={logoSource}
347
+ style={{
348
+ width: px(231),
349
+ height: px(231),
350
+ marginBottom: px(80),
351
+ }}
352
+ resizeMode="contain"
353
+ />
354
+ <Image
355
+ source={
356
+ ["禺乐慧家", "悦慧家"].includes(appName)
357
+ ? require("../assets/img/launch_text_panyu.png")
358
+ : require("../assets/img/launch_text.png")
359
+ }
360
+ style={{
361
+ width: px(687),
362
+ height: px(60),
363
+ marginBottom: px(80),
364
+ }}
365
+ resizeMode="contain"
366
+ />
367
+ <ActivityIndicator size="large" />
368
+ </ImageBackground>
369
+ );
370
+ }
371
+ };
372
+
286
373
  // smartHome专用
287
374
  const {
288
375
  handleTextSubmit,
@@ -335,56 +422,19 @@ function HomeTabScreen({ navigation, route }) {
335
422
  }}
336
423
  >
337
424
  {tabScreens.map((item, index) => (
338
- <Tab.Screen
339
- name={item.name}
340
- component={item.component}
341
- key={index}
342
- options={item.options}
343
- />
425
+ <Tab.Screen name={item.name} key={index} options={item.options}>
426
+ {(props) => {
427
+ props.route.params = props.route.params || {};
428
+ // 传递后台配置的模块业务元数据meta
429
+ props.route.params.meta = item.meta || {};
430
+ return <item.component {...props} />;
431
+ }}
432
+ </Tab.Screen>
344
433
  ))}
345
434
  </Tab.Navigator>
346
435
  </View>
347
436
  ) : (
348
- <ImageBackground
349
- style={styles.loadingView}
350
- source={
351
- ["禺乐慧家", "悦慧家"].includes(appName)
352
- ? require("../assets/img/launch_bg_panyu.png")
353
- : require("../assets/img/launch_bg.png")
354
- }
355
- >
356
- {/*<Text style={styles.loadingText}>*/}
357
- {/* 欢迎使用{appName.includes('安电工') ? '安电工' : '爱家宝'}*/}
358
- {/*</Text>*/}
359
- {/*<ActivityIndicator size="large" />*/}
360
- <Image
361
- source={
362
- ["禺乐慧家", "悦慧家"].includes(appName)
363
- ? require("../assets/img/launch_logo_panyu.png")
364
- : require("../assets/img/launch_logo.png")
365
- }
366
- style={{
367
- width: px(231),
368
- height: px(231),
369
- marginBottom: px(80),
370
- }}
371
- resizeMode="contain"
372
- />
373
- <Image
374
- source={
375
- ["禺乐慧家", "悦慧家"].includes(appName)
376
- ? require("../assets/img/launch_text_panyu.png")
377
- : require("../assets/img/launch_text.png")
378
- }
379
- style={{
380
- width: px(687),
381
- height: px(60),
382
- marginBottom: px(80),
383
- }}
384
- resizeMode="contain"
385
- />
386
- <ActivityIndicator size="large" />
387
- </ImageBackground>
437
+ renderLaunch()
388
438
  )}
389
439
  </View>
390
440
  );
@@ -395,12 +445,21 @@ const styles = StyleSheet.create({
395
445
  flex: 1,
396
446
  alignItems: "center",
397
447
  justifyContent: "center",
398
- // backgroundColor: '#fff',
448
+ position: "relative",
449
+ backgroundColor: "#fff",
399
450
  },
400
451
  loadingText: {
401
452
  fontSize: 20,
402
453
  marginBottom: 10,
403
454
  },
455
+
456
+ bottomLaunch: {
457
+ position: "absolute",
458
+ bottom: px(100),
459
+ left: 0,
460
+ right: 0,
461
+ alignItems: "center",
462
+ },
404
463
  });
405
464
 
406
465
  export default HomeTabScreen;
@@ -44,6 +44,7 @@ function HomedLoginIndex(props) {
44
44
  navigation.goBack(backParams);
45
45
  }
46
46
  } else {
47
+ onScanBtnPress();
47
48
  setIsCheckingLogin(false);
48
49
  }
49
50
  // // 临时测试时放开,不要让页面跳回去
@@ -52,6 +52,7 @@ const errorCodeMap = {
52
52
  const appName =
53
53
  NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
54
54
 
55
+
55
56
  const envVersion = NativeModules?.RNToNativeEmitter?.serverCluster || "alpha";
56
57
 
57
58
  const packageName = NativeModules?.RNToNativeEmitter?.packageName;
@@ -176,7 +177,7 @@ function LoginScreen({ navigation, route }) {
176
177
  }
177
178
 
178
179
  const entranceSelect = await storage.get("entranceSelect");
179
- if (entranceSelect === "tyygq" && envVersion !== "release") {
180
+ if (entranceSelect === "tyygq" && envVersion !== "release" && !["禺乐慧家", "悦慧家", '吉柿果'].includes(appName)) {
180
181
  global.loading.showLoading("正在加载");
181
182
  await global.base.navigateModule({
182
183
  operatorId: "ipanel",
@@ -395,8 +396,8 @@ function LoginScreen({ navigation, route }) {
395
396
  const handleLogin = async () => {
396
397
  let adcode;
397
398
  let res;
398
- const appName =
399
- NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
399
+ // const appName =
400
+ // NativeModules?.RNToNativeEmitter?.appName || config.LOCALTEST_APP_NAME;
400
401
  // const appName = '遥控键码库';
401
402
  const { deviceModal } = NativeModules?.RNToNativeEmitter || {};
402
403
 
@@ -580,8 +581,8 @@ function LoginScreen({ navigation, route }) {
580
581
 
581
582
  console.log(activeType);
582
583
  console.log(envVersion);
583
- console.log(9999);
584
- if (activeType === "ajb" && envVersion !== "release") {
584
+ console.log(9999, appName);
585
+ if (activeType === "ajb" && envVersion !== "release" && !["禺乐慧家", "悦慧家", '吉柿果'].includes(appName)) {
585
586
  const entrance = await selectEntrance();
586
587
  await storage.set("entranceSelect", entrance);
587
588
  if (entrance === "tyygq") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ipanel-rnapp-ajb-base",
3
- "version": "1.0.31",
4
- "ipanelVersion": "1.0.379",
3
+ "version": "1.0.32",
4
+ "ipanelVersion": "1.0.384",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "keywords": [