ipanel-rnapp-ajb-base 1.0.16 → 1.0.19
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/README.md +1 -1
- package/app/App.js +10 -1
- package/app/api/homedApi.js +5 -2
- package/app/api/ipanelCloudApi.js +40 -5
- package/app/components/common/Dialog/index.js +1 -3
- package/app/components/common/PickerV2/index.js +43 -35
- package/app/components/common/PickerV2Base/picker/Picker.tsx +1 -1
- package/app/components/common/PickerV2Base/picker/Popup.tsx +6 -3
- package/app/components/common/PickerV2Base/picker-view/Wheel.tsx +2 -1
- package/app/components/common/PickerV2Base/picker-view/picker-view.tsx +1 -1
- package/app/components/common/PickerV2Base/picker-view/style/index.tsx +2 -0
- package/app/components/common/SheetManage/index.js +36 -13
- package/app/hooks/shopMessageManager.js +22 -85
- package/app/screens/BaseScreen.js +2 -0
- package/app/screens/CommonScreens/DeviceFeedbackScreen/index.js +4 -1
- package/app/screens/CommonScreens/TvAlbumScreen/index.js +11 -11
- package/app/screens/LoginScreen/indexNew.js +47 -5
- package/app/screens/RegisteCountScreen/index.js +1061 -0
- package/app/utils/common.js +14 -8
- package/app/utils/config.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
package/app/App.js
CHANGED
|
@@ -61,6 +61,8 @@ import useDebounceFn from './hooks/useDebounceFn';
|
|
|
61
61
|
import useUser from './hooks/useUser';
|
|
62
62
|
import useKeyboard from './hooks/useKeyboard';
|
|
63
63
|
|
|
64
|
+
import RegisteCountScreen from './screens/RegisteCountScreen'
|
|
65
|
+
|
|
64
66
|
LogBox.ignoreLogs([
|
|
65
67
|
'ViewPropTypes will be removed',
|
|
66
68
|
'ColorPropType will be removed',
|
|
@@ -127,6 +129,13 @@ const CommonScreens = {
|
|
|
127
129
|
headerShown: false,
|
|
128
130
|
},
|
|
129
131
|
},
|
|
132
|
+
RegisteCountScreen: {
|
|
133
|
+
component: RegisteCountScreen,
|
|
134
|
+
screenOptions: {
|
|
135
|
+
title: '注册',
|
|
136
|
+
headerShown: false,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
130
139
|
ScanQRCodeScreen: {
|
|
131
140
|
component: ScanQRCodeScreen,
|
|
132
141
|
screenOptions: {
|
|
@@ -387,7 +396,7 @@ const App = () => {
|
|
|
387
396
|
allStackScreens[routeName]?.screenOptions?.includeBottom || false,
|
|
388
397
|
);
|
|
389
398
|
/* 加载之后每次navigate都鉴权一把登录状态(重置密码不需要检测) */
|
|
390
|
-
if (routeName !== 'ResePasswordScreen') {
|
|
399
|
+
if (routeName !== 'ResePasswordScreen' && routeName !== 'RegisteCountScreen') {
|
|
391
400
|
checkLogin();
|
|
392
401
|
}
|
|
393
402
|
|
package/app/api/homedApi.js
CHANGED
|
@@ -19,8 +19,10 @@ export const getHomedUserInfo = async data => {
|
|
|
19
19
|
|
|
20
20
|
// /account/device/get_list
|
|
21
21
|
export const getUserList = async data => {
|
|
22
|
+
const domain = await global.base.getHomedDomain()
|
|
23
|
+
const host = domain === 'pyitv.com' ? 12690 : 80
|
|
22
24
|
return homedHttp({
|
|
23
|
-
url: `http://access.${
|
|
25
|
+
url: `http://access.${domain}:${host}/account/user/get_list`,
|
|
24
26
|
method: 'GET',
|
|
25
27
|
data,
|
|
26
28
|
});
|
|
@@ -34,8 +36,9 @@ export const getRegionList = async data => {
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
export const getAccessToken = async (data, domain) => {
|
|
39
|
+
const host = domain === 'pyitv.com' ? 12690 : 80
|
|
37
40
|
return homedHttp({
|
|
38
|
-
url: `http://access.${domain}/account/get_accesstoken`,
|
|
41
|
+
url: `http://access.${domain}:${host}/account/get_accesstoken`,
|
|
39
42
|
method: 'POST',
|
|
40
43
|
data,
|
|
41
44
|
});
|
|
@@ -142,6 +142,20 @@ export const accountLogin = (data, type) => {
|
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
|
|
146
|
+
//账号注册
|
|
147
|
+
export const accountRegiste = (data, type) => {
|
|
148
|
+
return request({
|
|
149
|
+
url: type === 'adg' ? ADG_SERVICE : ACCOUNT_SERVICE,
|
|
150
|
+
method: 'POST',
|
|
151
|
+
data: {
|
|
152
|
+
action: 'account_register',
|
|
153
|
+
...data,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
|
|
145
159
|
export const obtainThirdToken = data => {
|
|
146
160
|
return request({
|
|
147
161
|
url: ACCOUNT_SERVICE,
|
|
@@ -659,38 +673,47 @@ export const getAddressUser = data => {
|
|
|
659
673
|
method: 'POST',
|
|
660
674
|
data: {
|
|
661
675
|
action: 'get_address_user',
|
|
676
|
+
detail: true,
|
|
662
677
|
...data,
|
|
663
678
|
},
|
|
664
679
|
});
|
|
665
680
|
};
|
|
666
681
|
|
|
667
682
|
export const getCloudInfo = async data => {
|
|
683
|
+
const domain = await global.base.getHomedDomain()
|
|
684
|
+
const host = domain === 'pyitv.com' ? 14890 : 80
|
|
668
685
|
return homedHttp({
|
|
669
|
-
url: `http://izone.${
|
|
686
|
+
url: `http://izone.${domain}:${host}/account/cloud/get_info`,
|
|
670
687
|
method: 'GET',
|
|
671
688
|
data,
|
|
672
689
|
});
|
|
673
690
|
};
|
|
674
691
|
|
|
675
692
|
export const getCloudFileList = async data => {
|
|
693
|
+
const domain = await global.base.getHomedDomain()
|
|
694
|
+
const host = domain === 'pyitv.com' ? 14890 : 80
|
|
676
695
|
return homedHttp({
|
|
677
|
-
url: `http://izone.${
|
|
696
|
+
url: `http://izone.${domain}:${host}/account/cloud/file/get_list`,
|
|
678
697
|
method: 'GET',
|
|
679
698
|
data,
|
|
680
699
|
});
|
|
681
700
|
};
|
|
682
701
|
|
|
683
702
|
export const openCloudService = async data => {
|
|
703
|
+
const domain = await global.base.getHomedDomain()
|
|
704
|
+
const host = domain === 'pyitv.com' ? 14890 : 80
|
|
684
705
|
return homedHttp({
|
|
685
|
-
url: `http://izone.${
|
|
706
|
+
url: `http://izone.${domain}:${host}/account/cloud/open`,
|
|
686
707
|
method: 'POST',
|
|
687
708
|
data,
|
|
688
709
|
});
|
|
689
710
|
};
|
|
690
711
|
|
|
691
712
|
export const deleteCloudFile = async data => {
|
|
713
|
+
const domain = await global.base.getHomedDomain()
|
|
714
|
+
const host = domain === 'pyitv.com' ? 14890 : 80
|
|
692
715
|
return homedHttp({
|
|
693
|
-
url: `http://izone.${
|
|
716
|
+
url: `http://izone.${domain}:${host}/account/cloud/file/delete`,
|
|
694
717
|
method: 'POST',
|
|
695
718
|
data,
|
|
696
719
|
});
|
|
@@ -699,7 +722,7 @@ export const deleteCloudFile = async data => {
|
|
|
699
722
|
// 根据设备对应id获取题库
|
|
700
723
|
export const getProductAnswers = questionId => {
|
|
701
724
|
return request({
|
|
702
|
-
url: `https
|
|
725
|
+
url: `https://${appName === '禺乐慧家' ? 'szjtyfw.panyu.gd.cn:50443' : 'api.cloud.ipanel.cn'}/vgatehelp/ajb/getProductAnswers/${questionId}`,
|
|
703
726
|
method: 'GET',
|
|
704
727
|
});
|
|
705
728
|
};
|
|
@@ -794,3 +817,15 @@ export const changePwdByPhone = data => {
|
|
|
794
817
|
},
|
|
795
818
|
});
|
|
796
819
|
};
|
|
820
|
+
|
|
821
|
+
//查询账号
|
|
822
|
+
export const queryCountByName = data => {
|
|
823
|
+
return request({
|
|
824
|
+
url: ACCOUNT_SERVICE,
|
|
825
|
+
method: 'POST',
|
|
826
|
+
data: {
|
|
827
|
+
action: 'query_account_by_name',
|
|
828
|
+
...data,
|
|
829
|
+
},
|
|
830
|
+
});
|
|
831
|
+
};
|
|
@@ -65,9 +65,7 @@ const Index = ({steps, active, onRef}) => {
|
|
|
65
65
|
animationType="fade"
|
|
66
66
|
transparent={true}
|
|
67
67
|
visible={modalVisible}
|
|
68
|
-
onRequestClose={() => {
|
|
69
|
-
setModalVisible(!modalVisible);
|
|
70
|
-
}}>
|
|
68
|
+
onRequestClose={() => {}}>
|
|
71
69
|
<TouchableOpacity
|
|
72
70
|
style={styles.centeredView}
|
|
73
71
|
activeOpacity={1}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import React,{useEffect, useState} from 'react';
|
|
2
|
-
import {View, Text, StyleSheet} from 'react-native';
|
|
2
|
+
import {View, Text, StyleSheet,Platform} from 'react-native';
|
|
3
3
|
import Picker from '../PickerV2Base/picker';
|
|
4
4
|
import px from '../../../utils/scaleSize';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
//import { transform } from '@babel/core';
|
|
6
|
+
////// import {
|
|
7
|
+
// useAnimatedStyle,
|
|
8
|
+
// withSpring,
|
|
9
|
+
// } from 'react-native-reanimated';
|
|
9
10
|
const pickerStyles = {
|
|
10
11
|
okView:{borderLeftColor:'#F0F0F0',borderLeftWidth:1},
|
|
11
12
|
okText: {color: '#E86003',width:px(500)},
|
|
12
13
|
dismissText: {color: '#666',width:px(500),},
|
|
13
14
|
container:{borderTopLeftRadius:px(20),borderTopRightRadius:px(20)},
|
|
14
|
-
|
|
15
|
+
wheelWrapperAdd:{paddingVertical:px(60)},
|
|
15
16
|
headerItem:{flex:0},
|
|
16
17
|
header:{
|
|
18
|
+
height:Platform.OS !== 'android' ? px(180):px(150),
|
|
19
|
+
paddingBottom:Platform.OS !== 'android' ? px(30):px(0),
|
|
17
20
|
borderBottomWidth:px(0),
|
|
18
21
|
borderTopWidth:1,
|
|
19
22
|
borderTopColor:'#F0F0F0',
|
|
@@ -22,19 +25,17 @@ header:{
|
|
|
22
25
|
maskMiddle:{borderColor:'transparent'},
|
|
23
26
|
titleBox:{
|
|
24
27
|
width:'100%',
|
|
25
|
-
height:px(
|
|
28
|
+
height:px(190),
|
|
26
29
|
backgroundColor:'#fff',
|
|
27
|
-
top:px(
|
|
28
|
-
|
|
29
|
-
titleContent:{
|
|
30
|
-
width:'100%',height:px(190),borderBottomColor:'#f0f0f0',borderBottomWidth:1,
|
|
31
|
-
borderTopRightRadius:px(20),borderTopLeftRadius:px(20)
|
|
30
|
+
top:px(0),
|
|
31
|
+
borderTopRightRadius:px(20),borderTopLeftRadius:px(20),
|
|
32
32
|
},
|
|
33
|
+
titleContent:{},
|
|
33
34
|
titleText:{
|
|
34
35
|
fontSize:px(48),color:'#333',textAlign:'center',lineHeight:px(190)
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
const pickerStyle = {height:px(
|
|
38
|
+
// const pickerStyle = {height:px(350)}
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
const PickerV2 = ({
|
|
@@ -42,7 +43,7 @@ const PickerV2 = ({
|
|
|
42
43
|
renderMaskBottom=()=>{return <View></View>},
|
|
43
44
|
styles={},
|
|
44
45
|
style={},
|
|
45
|
-
itemHeight=px(
|
|
46
|
+
itemHeight=px(120),
|
|
46
47
|
visible=false,
|
|
47
48
|
pickerData = [],
|
|
48
49
|
dealPickerCommit=()=>{},
|
|
@@ -53,23 +54,26 @@ const PickerV2 = ({
|
|
|
53
54
|
changePickedIndex=()=>{},
|
|
54
55
|
animatedStartValue,
|
|
55
56
|
animationEffects = {},
|
|
56
|
-
title
|
|
57
|
+
title,
|
|
58
|
+
dataLength=0
|
|
57
59
|
}) => {
|
|
60
|
+
|
|
61
|
+
// console.log(defaultValue)
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
const customSpringStyles = useAnimatedStyle(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
63
|
+
////// console.log(title)
|
|
64
|
+
// const customSpringStyles = useAnimatedStyle(() => {
|
|
65
|
+
// return {
|
|
66
|
+
// transform: [
|
|
67
|
+
// {
|
|
68
|
+
// translateY: withSpring(animatedStartValue, {...{
|
|
69
|
+
// damping: 20,
|
|
70
|
+
// stiffness: 100,
|
|
71
|
+
// mass:0.5
|
|
72
|
+
// },...animationEffects}),
|
|
73
|
+
// },
|
|
74
|
+
// ],
|
|
75
|
+
// };
|
|
76
|
+
// });
|
|
73
77
|
|
|
74
78
|
// console.log(defaultValue)
|
|
75
79
|
const handlePickerChange=(item)=>{
|
|
@@ -94,7 +98,8 @@ const PickerV2 = ({
|
|
|
94
98
|
key={index}
|
|
95
99
|
style={[styless.pickerItemCom,
|
|
96
100
|
index===pickedIndex?styless.pickedPicker:
|
|
97
|
-
{fontSize: px(
|
|
101
|
+
{fontSize: px(44),color:Math.abs(index-pickedIndex)===1?'#999':'#eee',},
|
|
102
|
+
dataLength>3?{height:'100%'}:{}
|
|
98
103
|
]}
|
|
99
104
|
>
|
|
100
105
|
{item.label}
|
|
@@ -109,11 +114,14 @@ const PickerV2 = ({
|
|
|
109
114
|
title={title}
|
|
110
115
|
renderMaskTop={renderMaskTop}
|
|
111
116
|
renderMaskBottom={renderMaskBottom}
|
|
112
|
-
styles={{...pickerStyles,...
|
|
117
|
+
styles={{...pickerStyles,...{wrappper:Boolean(title)?{
|
|
118
|
+
borderTopColor:'#f0f0f0',borderTopWidth:1
|
|
119
|
+
}:{borderTopLeftRadius:px(20),borderTopRightRadius:px(20)}},...styles}}
|
|
113
120
|
renderLabel={renderItem||renderLabel}
|
|
114
|
-
style={{...
|
|
121
|
+
style={{...{height:dataLength<3?px(360):dataLength===3?px(480):px(600)},...style}}
|
|
115
122
|
itemHeight={itemHeight}
|
|
116
|
-
defaultValue = {defaultValue}
|
|
123
|
+
// defaultValue = {defaultValue}
|
|
124
|
+
value={[pickerData[pickedIndex]?.value]}
|
|
117
125
|
onPickerChange={handlePickerChange}
|
|
118
126
|
onOk={handlePikerCommit}
|
|
119
127
|
onDismiss={handlePickerCancel}
|
|
@@ -130,8 +138,8 @@ const styless = StyleSheet.create({
|
|
|
130
138
|
},
|
|
131
139
|
pickedPicker:{
|
|
132
140
|
color: '#333',
|
|
133
|
-
fontSize:px(
|
|
134
|
-
fontWeight:'
|
|
141
|
+
fontSize:px(56),
|
|
142
|
+
fontWeight:'500',
|
|
135
143
|
},
|
|
136
144
|
});
|
|
137
145
|
export default PickerV2;
|
|
@@ -197,7 +197,7 @@ const RMCPicker = forwardRef<PickerRef, RMCPickerProps>((props, ref) => {
|
|
|
197
197
|
>
|
|
198
198
|
{/* TODO: 组件卸载是在visible更新fasle之后,需要前置 */}
|
|
199
199
|
{/* 否则会无效执行onPickerChange */}
|
|
200
|
-
{
|
|
200
|
+
{(innerVisible && Boolean(title))&&<View style={props.styles.titleBox}>
|
|
201
201
|
<View style={props.styles.titleContent}>
|
|
202
202
|
<Text style={props.styles.titleText}>{title}</Text>
|
|
203
203
|
</View>
|
|
@@ -2,7 +2,8 @@ import React, { memo } from 'react'
|
|
|
2
2
|
import { Text, TouchableHighlight, View,Modal,TouchableOpacity } from 'react-native'
|
|
3
3
|
// import Modal from '../modal/ModalView'
|
|
4
4
|
import { PopupPickerProps } from './PopupPickerTypes'
|
|
5
|
-
import Animated from 'react-native-reanimated';
|
|
5
|
+
//////import Animated from 'react-native-reanimated';
|
|
6
|
+
import * as Animatable from 'react-native-animatable';
|
|
6
7
|
|
|
7
8
|
const PopupPicker = memo((props: PopupPickerProps) => {
|
|
8
9
|
const {
|
|
@@ -51,7 +52,9 @@ const PopupPicker = memo((props: PopupPickerProps) => {
|
|
|
51
52
|
style={[{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:999},styles.maskColor]}
|
|
52
53
|
onPress={onClose}
|
|
53
54
|
></TouchableOpacity>
|
|
54
|
-
<
|
|
55
|
+
<Animatable.View
|
|
56
|
+
animation="slideInUp" easing="ease" iterationCount={1} duration={600}
|
|
57
|
+
style={[{position:'absolute',left:0,right:0,bottom:0,zIndex:1000},customSpringStyles]}>
|
|
55
58
|
{children}
|
|
56
59
|
<View style={[styles.header]}>
|
|
57
60
|
<TouchableHighlight
|
|
@@ -72,7 +75,7 @@ const PopupPicker = memo((props: PopupPickerProps) => {
|
|
|
72
75
|
{okEl}
|
|
73
76
|
</TouchableHighlight>
|
|
74
77
|
</View>
|
|
75
|
-
</
|
|
78
|
+
</Animatable.View>
|
|
76
79
|
</Modal>
|
|
77
80
|
)
|
|
78
81
|
})
|
|
@@ -159,7 +159,8 @@ class Wheel extends React.Component<Props> {
|
|
|
159
159
|
return (
|
|
160
160
|
<View
|
|
161
161
|
style={{
|
|
162
|
-
paddingVertical: (wheelHeight - itemHeight) /
|
|
162
|
+
paddingVertical: (wheelHeight - itemHeight) / (this.props.column.length===3?3:
|
|
163
|
+
this.props.column.length>3?3:8),
|
|
163
164
|
}}>
|
|
164
165
|
{column.map((item, index) => renderLabel(item, index))}
|
|
165
166
|
</View>
|
|
@@ -130,7 +130,7 @@ export default class RMCPickerView extends React.Component<
|
|
|
130
130
|
<View
|
|
131
131
|
style={[{ height: 7 * itemHeight }, s.wrappper, style]}
|
|
132
132
|
onLayout={this.wrapperMeasure}>
|
|
133
|
-
<View style={[s.wheelWrapper, { height: wheelHeight }]}>
|
|
133
|
+
<View style={[s.wheelWrapper, s.wheelWrapperAdd,{ height: wheelHeight }]}>
|
|
134
134
|
{(loading || columns?.length === 0) && loading !== false
|
|
135
135
|
? loadingContent || (
|
|
136
136
|
<View style={{ flex: 1, alignSelf: 'center' }}>
|
|
@@ -3,6 +3,7 @@ import { StyleSheet, ViewStyle } from 'react-native'
|
|
|
3
3
|
export interface PickerViewStyle {
|
|
4
4
|
wrappper: ViewStyle
|
|
5
5
|
wheelWrapper: ViewStyle
|
|
6
|
+
wheelWrapperAdd:ViewStyle
|
|
6
7
|
mask: ViewStyle
|
|
7
8
|
maskTop: ViewStyle
|
|
8
9
|
maskMiddle: ViewStyle
|
|
@@ -22,6 +23,7 @@ export default () =>
|
|
|
22
23
|
display: 'flex',
|
|
23
24
|
flexDirection: 'row',
|
|
24
25
|
},
|
|
26
|
+
wheelWrapperAdd:{},
|
|
25
27
|
mask: {
|
|
26
28
|
position: 'absolute',
|
|
27
29
|
zIndex: 10000,
|
|
@@ -1,32 +1,54 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// const Home = () => {
|
|
5
|
+
// return <View><Text>Home</Text></View>
|
|
6
|
+
// }
|
|
7
|
+
// const styles = StyleSheet.create({});
|
|
8
|
+
// export default Home;
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
import React,{useState,useImperativeHandle,useRef} from 'react';
|
|
2
12
|
import {View, Text, StyleSheet} from 'react-native';
|
|
3
13
|
import PickerV2 from '../PickerV2';
|
|
4
|
-
import {useSharedValue} from 'react-native-reanimated';
|
|
14
|
+
//////import {useSharedValue} from 'react-native-reanimated';
|
|
5
15
|
|
|
6
16
|
const Home = ({steps, active, onRef}) => {
|
|
7
17
|
let backResult = useRef()
|
|
8
|
-
const animatedStartValue = useSharedValue(700);
|
|
18
|
+
//////const animatedStartValue = useSharedValue(700);
|
|
9
19
|
const [visible, setPickerVisible] = useState(false);
|
|
10
20
|
const [pickerData, setPickerData] = useState([]);
|
|
11
21
|
const [pickerTitle,setPickerTitle] = useState()
|
|
12
|
-
const [defaultIndex,setDefaultIndex] = useState(0)
|
|
13
|
-
const [pickedIndex, setPickedIndex] = useState(
|
|
14
|
-
|
|
15
|
-
});
|
|
22
|
+
//const [defaultIndex,setDefaultIndex] = useState(0)
|
|
23
|
+
const [pickedIndex, setPickedIndex] = useState();
|
|
24
|
+
const [dataLength,setDataLength] = useState(0)
|
|
16
25
|
useImperativeHandle(onRef, () => {
|
|
17
26
|
return {
|
|
18
27
|
show: (str,data) => {
|
|
28
|
+
setDataLength(data?.payload?.columns.length||0)
|
|
19
29
|
if(data?.payload?.columns.length){
|
|
20
30
|
setPickerTitle(data?.payload?.title)
|
|
21
|
-
setPickerData(data?.payload?.columns.map(item=>{
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
setPickerData(data?.payload?.columns.map((item)=>{
|
|
32
|
+
if(data?.payload?.nameProp){
|
|
33
|
+
item.label = item[data?.payload?.nameProp]
|
|
34
|
+
item.value = item?.label;
|
|
35
|
+
}else if(typeof item !== 'object'){
|
|
36
|
+
return {
|
|
37
|
+
label:item,
|
|
38
|
+
value:item,
|
|
39
|
+
tag:'noNameProp'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
24
42
|
return item})||[]);
|
|
25
43
|
// console.log(data)
|
|
44
|
+
setPickedIndex(data?.payload?.defaultIndex||0)
|
|
26
45
|
setPickerVisible(true);
|
|
27
|
-
animatedStartValue.value = 0;
|
|
46
|
+
//////animatedStartValue.value = 0;
|
|
28
47
|
return new Promise((resolve,reject)=>{
|
|
29
48
|
backResult.current = (res)=>{
|
|
49
|
+
if(res?.data?.tag === 'noNameProp'){
|
|
50
|
+
res.data = res?.data.value
|
|
51
|
+
}
|
|
30
52
|
resolve(res)
|
|
31
53
|
}
|
|
32
54
|
})
|
|
@@ -38,7 +60,7 @@ const Home = ({steps, active, onRef}) => {
|
|
|
38
60
|
setPickedIndex(index);
|
|
39
61
|
};
|
|
40
62
|
const dealPickerCommit = (value) =>{
|
|
41
|
-
animatedStartValue.value = 700;
|
|
63
|
+
//////animatedStartValue.value = 700;
|
|
42
64
|
setPickerTitle()
|
|
43
65
|
setPickerVisible(false);
|
|
44
66
|
setPickedIndex(0);
|
|
@@ -52,6 +74,7 @@ const Home = ({steps, active, onRef}) => {
|
|
|
52
74
|
backResult.current({data,index})
|
|
53
75
|
}
|
|
54
76
|
return <PickerV2
|
|
77
|
+
dataLength={dataLength}
|
|
55
78
|
pickerData={pickerData}
|
|
56
79
|
visible={visible}
|
|
57
80
|
// defaultValue={[pickerData[defaultIndex]?.value]}
|
|
@@ -60,12 +83,12 @@ const Home = ({steps, active, onRef}) => {
|
|
|
60
83
|
changePickedIndex={index => changePickedIndex(index)}
|
|
61
84
|
dealPickerCommit={item => dealPickerCommit(item)}
|
|
62
85
|
dealPickerCancel={() => {
|
|
63
|
-
|
|
86
|
+
////// animatedStartValue.value = 700;
|
|
64
87
|
setPickerTitle()
|
|
65
88
|
setPickerVisible(false);
|
|
66
89
|
setPickedIndex(0);
|
|
67
90
|
}}
|
|
68
|
-
animatedStartValue={animatedStartValue.value}
|
|
91
|
+
//////animatedStartValue={animatedStartValue.value}
|
|
69
92
|
/>
|
|
70
93
|
};
|
|
71
94
|
const styles = StyleSheet.create({});
|
|
@@ -34,13 +34,6 @@ let seq_id = 0;
|
|
|
34
34
|
// global.base.shopMessageManager.messages = msgList || [];
|
|
35
35
|
// });
|
|
36
36
|
|
|
37
|
-
// 当前是否处于智能客服转人工
|
|
38
|
-
// let isManualCustomServiceActive = false;
|
|
39
|
-
// // 当前人工客服
|
|
40
|
-
// let currentCustomStaff = {};
|
|
41
|
-
// // 用户长时间没有发送消息后自动退出转人工的定时器
|
|
42
|
-
// let manualCustomServiceTimer;
|
|
43
|
-
|
|
44
37
|
// TODO 定期轮询检查消息过期
|
|
45
38
|
|
|
46
39
|
const ShopMessageManager = () => {
|
|
@@ -111,17 +104,18 @@ const ShopMessageManager = () => {
|
|
|
111
104
|
];
|
|
112
105
|
|
|
113
106
|
// 缓存全局商城客服websocket连接
|
|
114
|
-
global.shopMessageWebsocketRef = ws;
|
|
115
107
|
global.base.shopMessageManager.wsRef = ws;
|
|
108
|
+
global.base.shopMessageManager.connectMsgServer = connectMsgServer;
|
|
109
|
+
global.base.shopMessageManager.closeMsgConnection = closeMsgConnection;
|
|
116
110
|
ws.current = new WebSocket(
|
|
117
111
|
encodeURI(`${wsUrl}?${connectParams.join('&')}`),
|
|
118
112
|
);
|
|
119
113
|
ws.current.onopen = () => {
|
|
120
114
|
console.log('商城客服已连接ws shop open');
|
|
121
|
-
connectCallback && connectCallback(null); // success
|
|
122
115
|
connectStatus = 0;
|
|
123
116
|
eventBus.emit(EVENTS.SHOPMESSAGE.CONNECT_STATUS_CHANGE, connectStatus);
|
|
124
117
|
getUserUid();
|
|
118
|
+
connectCallback && connectCallback(null); // success
|
|
125
119
|
};
|
|
126
120
|
ws.current.onmessage = ({data}) => {
|
|
127
121
|
const msgData = JSON.parse(data);
|
|
@@ -162,14 +156,29 @@ const ShopMessageManager = () => {
|
|
|
162
156
|
}
|
|
163
157
|
};
|
|
164
158
|
ws.current.onerror = err => {
|
|
165
|
-
console.log('onerror', err);
|
|
159
|
+
console.log('shopMessageManager ws onerror', err);
|
|
160
|
+
connectStatus = 1;
|
|
161
|
+
eventBus.emit(EVENTS.SHOPMESSAGE.CONNECT_STATUS_CHANGE, connectStatus);
|
|
166
162
|
};
|
|
167
163
|
ws.current.onclose = event => {
|
|
168
|
-
console.log('onclose', event);
|
|
164
|
+
console.log('shopMessageManager ws onclose', event);
|
|
165
|
+
global.base.shopMessageManager.wsRef.current = null;
|
|
166
|
+
connectStatus = 1;
|
|
167
|
+
eventBus.emit(EVENTS.SHOPMESSAGE.CONNECT_STATUS_CHANGE, connectStatus);
|
|
169
168
|
reConnect(connectCallback);
|
|
170
169
|
};
|
|
171
170
|
};
|
|
172
171
|
|
|
172
|
+
const closeMsgConnection = () => {
|
|
173
|
+
console.log('shopMessageManager closeMsgConnection');
|
|
174
|
+
|
|
175
|
+
// 正常主动关闭连接,重置重连次数
|
|
176
|
+
tryConnectTimes = 5;
|
|
177
|
+
|
|
178
|
+
global.base.shopMessageManager.wsRef.current &&
|
|
179
|
+
global.base.shopMessageManager.wsRef.current.close();
|
|
180
|
+
};
|
|
181
|
+
|
|
173
182
|
const reConnect = async callback => {
|
|
174
183
|
if (tryConnectTimes < 5) {
|
|
175
184
|
// 重连ws
|
|
@@ -184,75 +193,6 @@ const ShopMessageManager = () => {
|
|
|
184
193
|
}
|
|
185
194
|
};
|
|
186
195
|
|
|
187
|
-
// const [onlineUser, setOnlineUser] = useState([]); // 在线用户列表
|
|
188
|
-
// const nameRef = useRef('');
|
|
189
|
-
// // 请求到客服列表的回调
|
|
190
|
-
// const handleGetOnlineUserList = async data => {
|
|
191
|
-
// if (isManualCustomServiceActive) {
|
|
192
|
-
// return;
|
|
193
|
-
// }
|
|
194
|
-
// const accountData = await storage.get('accountData');
|
|
195
|
-
// console.log('handleGetOnlineUserList', data);
|
|
196
|
-
// let dataList = data?.list.filter(val => {
|
|
197
|
-
// return val.nick_name !== nameRef.current;
|
|
198
|
-
// });
|
|
199
|
-
// // // console.log(dataList, nameRef.current);
|
|
200
|
-
// setOnlineUser(dataList);
|
|
201
|
-
|
|
202
|
-
// if (dataList.length === 0) {
|
|
203
|
-
// global.toast.showToast('当前没有人工客服在线,请稍候再试!');
|
|
204
|
-
// return;
|
|
205
|
-
// }
|
|
206
|
-
|
|
207
|
-
// console.log('当前商城客服列表:', dataList);
|
|
208
|
-
// // 分配一个人工客服
|
|
209
|
-
// currentCustomStaff =
|
|
210
|
-
// dataList.find(user => user.nick_name === '壮壮') || dataList[0];
|
|
211
|
-
// console.log('已分配商城智能客服人工客服:', currentCustomStaff.nick_name);
|
|
212
|
-
|
|
213
|
-
// // 设置当前处于人工客服的标志
|
|
214
|
-
// isManualCustomServiceActive = true;
|
|
215
|
-
// eventBus.emit(EVENTS.SHOPMESSAGE.CUSTOM_SERVICE_CONNECT_CHANGE, true);
|
|
216
|
-
|
|
217
|
-
// // 显示消息
|
|
218
|
-
// handleShopTextSubmit(
|
|
219
|
-
// `您好,客服“${currentCustomStaff.nick_name}”为您服务!`,
|
|
220
|
-
// currentCustomStaff?.user_id,
|
|
221
|
-
// `${accountData.user?.user_id}-${currentCustomStaff.user_id}-shop`,
|
|
222
|
-
// );
|
|
223
|
-
|
|
224
|
-
// resetManualCustomServiceExitTimer();
|
|
225
|
-
// };
|
|
226
|
-
// const resetManualCustomServiceExitTimer = () => {
|
|
227
|
-
// // 10分钟没发消息后自动退出人工
|
|
228
|
-
// clearTimeout(manualCustomServiceTimer);
|
|
229
|
-
// manualCustomServiceTimer = setTimeout(() => {
|
|
230
|
-
// exitShopManualCustomService(true);
|
|
231
|
-
// }, 600000);
|
|
232
|
-
// };
|
|
233
|
-
// // 请求转人工
|
|
234
|
-
// const requestShopManualCustomService = async () => {
|
|
235
|
-
// const user = await storage.get('accountData');
|
|
236
|
-
// nameRef.current = user.user?.nickname;
|
|
237
|
-
// // 发送获取客服列表消息,在EVENTS.SHOPMESSAGE.ONLINE_LIST事件回调中处理获取到的客服列表数据
|
|
238
|
-
// getOnlineUser();
|
|
239
|
-
// };
|
|
240
|
-
// const exitShopManualCustomService = async timeout => {
|
|
241
|
-
// isManualCustomServiceActive = false;
|
|
242
|
-
// eventBus.emit(EVENTS.SHOPMESSAGE.CUSTOM_SERVICE_CONNECT_CHANGE, false);
|
|
243
|
-
// console.log('退出商城智能客服人工客服');
|
|
244
|
-
|
|
245
|
-
// // 显示消息
|
|
246
|
-
// const accountData = await storage.get('accountData');
|
|
247
|
-
// handleShopTextSubmit(
|
|
248
|
-
// timeout
|
|
249
|
-
// ? '您已经很长时间没说话了,已自动退出人工客服,如有需要请再次联系'
|
|
250
|
-
// : '您已退出人工客服。',
|
|
251
|
-
// currentCustomStaff?.user_id,
|
|
252
|
-
// `${accountData.user?.user_id}-${currentCustomStaff.user_id}-shop`,
|
|
253
|
-
// );
|
|
254
|
-
// };
|
|
255
|
-
|
|
256
196
|
useEffect(() => {
|
|
257
197
|
const onMessageAdd = msg => {
|
|
258
198
|
msg.MsgId =
|
|
@@ -335,18 +275,15 @@ const ShopMessageManager = () => {
|
|
|
335
275
|
[],
|
|
336
276
|
);
|
|
337
277
|
|
|
338
|
-
|
|
339
|
-
// isManualCustomServiceActive;
|
|
278
|
+
const getConnectStatus = () => connectStatus;
|
|
340
279
|
|
|
341
280
|
return {
|
|
342
281
|
sendMessage,
|
|
343
282
|
sendShopImMessage,
|
|
344
283
|
getOnlineUser,
|
|
345
|
-
// requestShopManualCustomService,
|
|
346
|
-
// exitShopManualCustomService,
|
|
347
|
-
// getShopManualCustomServiceActiveFlag,
|
|
348
284
|
handleShopTextSubmit,
|
|
349
285
|
handleShopMediaSelect,
|
|
286
|
+
getConnectStatus,
|
|
350
287
|
};
|
|
351
288
|
};
|
|
352
289
|
|
|
@@ -300,11 +300,13 @@ function HomeTabScreen({navigation, route}) {
|
|
|
300
300
|
handleShopMediaSelect,
|
|
301
301
|
getOnlineUser,
|
|
302
302
|
sendShopImMessage,
|
|
303
|
+
getConnectStatus,
|
|
303
304
|
} = ShopMessageManager();
|
|
304
305
|
global.base.shopMessageManager.handleShopTextSubmit = handleShopTextSubmit;
|
|
305
306
|
global.base.shopMessageManager.handleShopMediaSelect = handleShopMediaSelect;
|
|
306
307
|
global.base.shopMessageManager.getOnlineUser = getOnlineUser;
|
|
307
308
|
global.base.shopMessageManager.sendShopImMessage = sendShopImMessage;
|
|
309
|
+
global.base.shopMessageManager.getConnectStatus = getConnectStatus;
|
|
308
310
|
const renderCustomTabBar = props => {
|
|
309
311
|
return <CustomTabBar {...props} />;
|
|
310
312
|
};
|