ipanel-rnapp-ajb-base 1.0.20 → 1.0.21
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/base.js
CHANGED
|
@@ -202,19 +202,17 @@ global.base.getIPanelCloudDomain = () => {
|
|
|
202
202
|
|
|
203
203
|
// 获取当前家庭云家服务实例名(如a2),跟当前登录的ipanelcloud用户有关
|
|
204
204
|
global.base.getHomeCloudServiceInstanceName = async () => {
|
|
205
|
-
|
|
205
|
+
const activeAddr = await storage.get('activeAddr');
|
|
206
|
+
const sub_domain = activeAddr?.sub_domain
|
|
207
|
+
return sub_domain ? sub_domain : (NativeModules?.RNToNativeEmitter?.appName === '禺乐慧家'
|
|
206
208
|
? 'a21'
|
|
207
|
-
: 'a2';
|
|
209
|
+
: 'a2');
|
|
208
210
|
};
|
|
209
211
|
|
|
210
212
|
// 获取当前`homed`域名(`正式homed用户`域名优先于`homed游客`域名)
|
|
211
213
|
global.base.getHomedDomain = async () => {
|
|
212
214
|
const activeAddr = await storage.get('activeAddr');
|
|
213
|
-
if (
|
|
214
|
-
activeAddr &&
|
|
215
|
-
activeAddr.domain &&
|
|
216
|
-
(await storage.get('homedAccessToken'))
|
|
217
|
-
) {
|
|
215
|
+
if (activeAddr?.domain) {
|
|
218
216
|
// console.log('正式homed用户域名', activeAddr.domain);
|
|
219
217
|
return activeAddr.domain;
|
|
220
218
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, {useEffect, useState} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import {WebView} from 'react-native-webview';
|
|
4
|
-
import {bindBossAccount, getUserInfo, getAssets} from '../../../api';
|
|
5
|
-
const {ScreenBackHeader} = global.base.commonComponents;
|
|
6
|
-
const {storage} = global.base;
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { WebView } from 'react-native-webview';
|
|
4
|
+
import { bindBossAccount, getUserInfo, getAssets } from '../../../api';
|
|
5
|
+
const { ScreenBackHeader } = global.base.commonComponents;
|
|
6
|
+
const { storage } = global.base;
|
|
7
7
|
|
|
8
|
-
export default ({navigation, route}) => {
|
|
8
|
+
export default ({ navigation, route }) => {
|
|
9
9
|
const module = route?.params?.module;
|
|
10
10
|
const [uri, setUri] = useState('');
|
|
11
11
|
const [state, setState] = useState('');
|
|
@@ -15,25 +15,26 @@ export default ({navigation, route}) => {
|
|
|
15
15
|
}, []);
|
|
16
16
|
const init = async () => {
|
|
17
17
|
const accountData = await storage.get('accountData');
|
|
18
|
-
const binding = 1; // 1:绑定,0
|
|
18
|
+
const binding = 1; // 1:绑定,0:解绑.
|
|
19
19
|
const redirect_uri =
|
|
20
20
|
'https://ipanelcloud2.ipanel.cn:50443/iapp/ajbstatic/bind_boss_account/'; // 绑定后跳转地址
|
|
21
21
|
const state2 = generateRandomString(8);
|
|
22
22
|
setState(state2);
|
|
23
23
|
setUri(
|
|
24
|
-
`https://boss.ipanel.cn/ipanelTask/api/cas_open/isport/Isport_cloud_mall_c/binding?agentid=
|
|
24
|
+
`https://boss.ipanel.cn/ipanelTask/api/cas_open/isport/Isport_cloud_mall_c/binding?agentid=133&oauth2_id=72d2453f689fc99548187dca4b922a5b&redirect_uri=${redirect_uri}&open_id=${accountData.user?.user_id}&binding=${binding}&scope=snsapi_base&response_type=code&state=${state2}`
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const onMessage = async e => {
|
|
28
|
+
const onMessage = async (e) => {
|
|
29
29
|
const data = JSON.parse(e.nativeEvent.data);
|
|
30
30
|
console.log('onMessage', data);
|
|
31
31
|
if (data.ret === 0 && data.code && data.state === state) {
|
|
32
32
|
global.loading.showLoading('正在绑定...');
|
|
33
33
|
const res = await bindBossAccount({
|
|
34
34
|
code: data.code,
|
|
35
|
-
oauth2: '
|
|
35
|
+
oauth2: '72d2453f689fc99548187dca4b922a5b',
|
|
36
36
|
});
|
|
37
|
+
console.log(res, 'bindBossAccount');
|
|
37
38
|
global.loading.hideLoading('正在绑定...');
|
|
38
39
|
if (res.code === 0) {
|
|
39
40
|
global.toast.showToast('绑定成功');
|
|
@@ -49,6 +50,7 @@ export default ({navigation, route}) => {
|
|
|
49
50
|
|
|
50
51
|
const get_user_info = async () => {
|
|
51
52
|
const res = await getUserInfo();
|
|
53
|
+
console.log(res, 'getUserInfo');
|
|
52
54
|
if (
|
|
53
55
|
res?.code === 0 &&
|
|
54
56
|
res.result?.user_list &&
|
|
@@ -58,7 +60,7 @@ export default ({navigation, route}) => {
|
|
|
58
60
|
// accountData.user.bind_list = res.result?.user_list[0].bind_list;
|
|
59
61
|
// await storage.set('accountData', accountData);
|
|
60
62
|
// const bossData = accountData.user.bind_list
|
|
61
|
-
const bossData = res.result?.user_list[0].bind_list.filter(item => {
|
|
63
|
+
const bossData = res.result?.user_list[0].bind_list.filter((item) => {
|
|
62
64
|
return item.third_type === 'boss';
|
|
63
65
|
});
|
|
64
66
|
console.log(bossData[0]);
|
|
@@ -84,14 +86,14 @@ export default ({navigation, route}) => {
|
|
|
84
86
|
if (appID) {
|
|
85
87
|
params.appid = appID;
|
|
86
88
|
}
|
|
87
|
-
getAssets(params).then(res => {
|
|
89
|
+
getAssets(params).then((res) => {
|
|
88
90
|
if (res?.code === 0) {
|
|
89
91
|
if (
|
|
90
92
|
res?.result &&
|
|
91
93
|
res?.result?.asset_list &&
|
|
92
94
|
res?.result?.asset_list?.length
|
|
93
95
|
) {
|
|
94
|
-
const current = res.result?.asset_list.filter(item => {
|
|
96
|
+
const current = res.result?.asset_list.filter((item) => {
|
|
95
97
|
return item.currency === 20000;
|
|
96
98
|
});
|
|
97
99
|
if (current.length) {
|
|
@@ -103,7 +105,7 @@ export default ({navigation, route}) => {
|
|
|
103
105
|
});
|
|
104
106
|
};
|
|
105
107
|
|
|
106
|
-
const generateRandomString = length => {
|
|
108
|
+
const generateRandomString = (length) => {
|
|
107
109
|
const characters =
|
|
108
110
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; // Add any additional special characters you want to include
|
|
109
111
|
let result = '';
|
|
@@ -115,17 +117,17 @@ export default ({navigation, route}) => {
|
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
return (
|
|
118
|
-
<View style={{flex: 1}}>
|
|
120
|
+
<View style={{ flex: 1 }}>
|
|
119
121
|
<ScreenBackHeader title="BOSS登录" />
|
|
120
|
-
<View style={{flex: 1}}>
|
|
122
|
+
<View style={{ flex: 1 }}>
|
|
121
123
|
<WebView
|
|
122
124
|
bounces={false}
|
|
123
|
-
domStorageEnabled={false}
|
|
125
|
+
// domStorageEnabled={false}
|
|
124
126
|
javaScriptEnabled
|
|
125
127
|
useWebKit
|
|
126
128
|
source={{
|
|
127
129
|
uri: uri,
|
|
128
|
-
headers: {'Cache-Control': 'no-store'},
|
|
130
|
+
headers: { 'Cache-Control': 'no-store' },
|
|
129
131
|
}}
|
|
130
132
|
incognito={true}
|
|
131
133
|
onMessage={onMessage}
|
|
@@ -98,10 +98,10 @@ export default class ScanQRCode extends Component {
|
|
|
98
98
|
if (data.includes('action=redirect')) {
|
|
99
99
|
/**
|
|
100
100
|
* action=redirect 重定向APP页面
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
mop=ipanel operatorId(模块运营商,未来有可能废弃)
|
|
102
|
+
m=shop 商城模块
|
|
103
|
+
s=detail screenName
|
|
104
|
+
a/b/c 传给商城模块的参数
|
|
105
105
|
*/
|
|
106
106
|
const querys = data.substring(data.indexOf('?') + 1).split('&');
|
|
107
107
|
const params = {};
|
|
@@ -179,10 +179,10 @@ export default class ScanQRCode extends Component {
|
|
|
179
179
|
if (data.includes('action=redirect')) {
|
|
180
180
|
/**
|
|
181
181
|
* action=redirect 重定向APP页面
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
mop=ipanel operatorId(模块运营商,未来有可能废弃)
|
|
183
|
+
m=shop 商城模块
|
|
184
|
+
s=detail screenName
|
|
185
|
+
a/b/c 传给商城模块的参数
|
|
186
186
|
*/
|
|
187
187
|
const querys = data.substring(data.indexOf('?') + 1).split('&');
|
|
188
188
|
const params = {};
|
|
@@ -254,7 +254,7 @@ export default class ScanQRCode extends Component {
|
|
|
254
254
|
flex: 1,
|
|
255
255
|
}}>
|
|
256
256
|
<View
|
|
257
|
-
style={{
|
|
257
|
+
style={{flex: 1, maxHeight: px(500), backgroundColor: 'rgba(34,34,34,0.7)'}}
|
|
258
258
|
/>
|
|
259
259
|
<View
|
|
260
260
|
style={{
|