ipanel-rnapp-ajb-base 1.0.15 → 1.0.17
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 +2 -0
- package/app/api/ipanelCloudApi.js +4 -4
- package/app/components/common/PickerV2/index.js +47 -5
- package/app/components/common/PickerV2Base/picker/Picker.tsx +12 -3
- package/app/components/common/PickerV2Base/picker/Popup.tsx +4 -2
- package/app/components/common/PickerV2Base/picker/PopupPickerTypes.tsx +1 -0
- package/app/components/common/PickerV2Base/picker/style/index.tsx +7 -1
- package/app/components/common/SheetManage/index.js +82 -0
- package/app/components/index.js +2 -2
- package/app/hooks/shopMessageManager.js +22 -85
- package/app/screens/BaseScreen.js +2 -0
- package/app/screens/CommonScreens/TvAlbumScreen/index.js +4 -2
- package/package.json +2 -2
package/app/App.js
CHANGED
|
@@ -35,6 +35,7 @@ import Loading from './components/common/Loading';
|
|
|
35
35
|
import Toast from './components/common/Toast';
|
|
36
36
|
import Dialog from './components/common/Dialog';
|
|
37
37
|
import Notify from './components/common/Notify';
|
|
38
|
+
// import SheetManage from './components/common/SheetManage';
|
|
38
39
|
import storage from './storage';
|
|
39
40
|
|
|
40
41
|
import {navigationRef} from './utils/RootNavigation';
|
|
@@ -439,6 +440,7 @@ const App = () => {
|
|
|
439
440
|
<Toast onRef={ref => (global.toast = ref)} />
|
|
440
441
|
<Notify onRef={ref => (global.notify = ref)} />
|
|
441
442
|
<Dialog onRef={ref => (global.dialog = ref)} />
|
|
443
|
+
{/* <SheetManage onRef={ref => (global.sheetManager = ref)} /> */}
|
|
442
444
|
{versionUpdateConfirmVisible && (
|
|
443
445
|
<VersionUpdateConfirm
|
|
444
446
|
onVisibleChange={setVersionUpdateConfirmVisible}
|
|
@@ -666,7 +666,7 @@ export const getAddressUser = data => {
|
|
|
666
666
|
|
|
667
667
|
export const getCloudInfo = async data => {
|
|
668
668
|
return homedHttp({
|
|
669
|
-
url: `http://izone.${await global.base.getHomedDomain()}/account/cloud/get_info`,
|
|
669
|
+
url: `http://izone.${appName === '禺乐慧家' ? await global.base.getHomedDomain() : 'homed.tv'}/account/cloud/get_info`,
|
|
670
670
|
method: 'GET',
|
|
671
671
|
data,
|
|
672
672
|
});
|
|
@@ -674,7 +674,7 @@ export const getCloudInfo = async data => {
|
|
|
674
674
|
|
|
675
675
|
export const getCloudFileList = async data => {
|
|
676
676
|
return homedHttp({
|
|
677
|
-
url: `http://izone.${await global.base.getHomedDomain()}/account/cloud/file/get_list`,
|
|
677
|
+
url: `http://izone.${appName === '禺乐慧家' ? await global.base.getHomedDomain() : 'homed.tv'}/account/cloud/file/get_list`,
|
|
678
678
|
method: 'GET',
|
|
679
679
|
data,
|
|
680
680
|
});
|
|
@@ -682,7 +682,7 @@ export const getCloudFileList = async data => {
|
|
|
682
682
|
|
|
683
683
|
export const openCloudService = async data => {
|
|
684
684
|
return homedHttp({
|
|
685
|
-
url: `http://izone.${await global.base.getHomedDomain()}/account/cloud/open`,
|
|
685
|
+
url: `http://izone.${appName === '禺乐慧家' ? await global.base.getHomedDomain() : 'homed.tv'}/account/cloud/open`,
|
|
686
686
|
method: 'POST',
|
|
687
687
|
data,
|
|
688
688
|
});
|
|
@@ -690,7 +690,7 @@ export const openCloudService = async data => {
|
|
|
690
690
|
|
|
691
691
|
export const deleteCloudFile = async data => {
|
|
692
692
|
return homedHttp({
|
|
693
|
-
url: `http://izone.${await global.base.getHomedDomain()}/account/cloud/file/delete`,
|
|
693
|
+
url: `http://izone.${appName === '禺乐慧家' ? await global.base.getHomedDomain() : 'homed.tv'}/account/cloud/file/delete`,
|
|
694
694
|
method: 'POST',
|
|
695
695
|
data,
|
|
696
696
|
});
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import React,{useState} from 'react';
|
|
1
|
+
import React,{useEffect, useState} from 'react';
|
|
2
2
|
import {View, Text, StyleSheet} from 'react-native';
|
|
3
3
|
import Picker from '../PickerV2Base/picker';
|
|
4
4
|
import px from '../../../utils/scaleSize';
|
|
5
|
+
// import {
|
|
6
|
+
// useAnimatedStyle,
|
|
7
|
+
// withSpring,
|
|
8
|
+
// } from 'react-native-reanimated';
|
|
5
9
|
const pickerStyles = {
|
|
6
|
-
okView:{borderLeftColor:'#F0F0F0',borderLeftWidth:1},
|
|
10
|
+
okView:{borderLeftColor:'#F0F0F0',borderLeftWidth:1},
|
|
7
11
|
okText: {color: '#E86003',width:px(500)},
|
|
8
|
-
dismissText: {color: '#
|
|
12
|
+
dismissText: {color: '#666',width:px(500),},
|
|
9
13
|
container:{borderTopLeftRadius:px(20),borderTopRightRadius:px(20)},
|
|
10
14
|
wrappper:{borderTopLeftRadius:px(20),borderTopRightRadius:px(20)},
|
|
11
15
|
headerItem:{flex:0},
|
|
@@ -16,9 +20,23 @@ header:{
|
|
|
16
20
|
backgroundColor: '#fff'
|
|
17
21
|
},
|
|
18
22
|
maskMiddle:{borderColor:'transparent'},
|
|
23
|
+
titleBox:{
|
|
24
|
+
width:'100%',
|
|
25
|
+
height:px(205),
|
|
26
|
+
backgroundColor:'#fff',
|
|
27
|
+
top:px(15),
|
|
28
|
+
borderTopRightRadius:px(20),borderTopLeftRadius:px(20)
|
|
29
|
+
},
|
|
30
|
+
titleContent:{
|
|
31
|
+
width:'100%',height:px(190),borderBottomColor:'#f0f0f0',borderBottomWidth:1
|
|
32
|
+
},
|
|
33
|
+
titleText:{
|
|
34
|
+
fontSize:px(48),color:'#333',textAlign:'center',lineHeight:px(190)
|
|
35
|
+
}
|
|
19
36
|
}
|
|
20
37
|
const pickerStyle = {height:px(700)}
|
|
21
38
|
|
|
39
|
+
|
|
22
40
|
const PickerV2 = ({
|
|
23
41
|
renderMaskTop=()=>{return <View></View>},
|
|
24
42
|
renderMaskBottom=()=>{return <View></View>},
|
|
@@ -32,8 +50,28 @@ const PickerV2 = ({
|
|
|
32
50
|
renderItem,
|
|
33
51
|
defaultValue = [],
|
|
34
52
|
pickedIndex=0,
|
|
35
|
-
changePickedIndex=()=>{}
|
|
53
|
+
changePickedIndex=()=>{},
|
|
54
|
+
animatedStartValue,
|
|
55
|
+
animationEffects = {},
|
|
56
|
+
title
|
|
36
57
|
}) => {
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// console.log(title)
|
|
61
|
+
// const customSpringStyles = useAnimatedStyle(() => {
|
|
62
|
+
// return {
|
|
63
|
+
// transform: [
|
|
64
|
+
// {
|
|
65
|
+
// translateY: withSpring(animatedStartValue, {...{
|
|
66
|
+
// damping: 20,
|
|
67
|
+
// stiffness: 100,
|
|
68
|
+
// mass:0.5
|
|
69
|
+
// },...animationEffects}),
|
|
70
|
+
// },
|
|
71
|
+
// ],
|
|
72
|
+
// };
|
|
73
|
+
// });
|
|
74
|
+
|
|
37
75
|
// console.log(defaultValue)
|
|
38
76
|
const handlePickerChange=(item)=>{
|
|
39
77
|
// console.log(item)
|
|
@@ -44,12 +82,14 @@ const PickerV2 = ({
|
|
|
44
82
|
changePickedIndex(index)
|
|
45
83
|
}
|
|
46
84
|
const handlePikerCommit = (item) => {
|
|
85
|
+
// console.log(item)
|
|
47
86
|
dealPickerCommit(item)
|
|
48
87
|
}
|
|
49
88
|
const handlePickerCancel = () => {
|
|
50
89
|
dealPickerCancel()
|
|
51
90
|
}
|
|
52
91
|
const renderLabel = (item, index) => {
|
|
92
|
+
// console.log(item)
|
|
53
93
|
return (
|
|
54
94
|
<Text
|
|
55
95
|
key={index}
|
|
@@ -58,7 +98,7 @@ const PickerV2 = ({
|
|
|
58
98
|
{fontSize: px(50),color:Math.abs(index-pickedIndex)===1?'#999':'#eee'},
|
|
59
99
|
]}
|
|
60
100
|
>
|
|
61
|
-
{item.
|
|
101
|
+
{item.label}
|
|
62
102
|
</Text>
|
|
63
103
|
);
|
|
64
104
|
};
|
|
@@ -67,6 +107,7 @@ const PickerV2 = ({
|
|
|
67
107
|
<Picker
|
|
68
108
|
data={pickerData}
|
|
69
109
|
visible={visible}
|
|
110
|
+
title={title}
|
|
70
111
|
renderMaskTop={renderMaskTop}
|
|
71
112
|
renderMaskBottom={renderMaskBottom}
|
|
72
113
|
styles={{...pickerStyles,...styles}}
|
|
@@ -78,6 +119,7 @@ const PickerV2 = ({
|
|
|
78
119
|
onOk={handlePikerCommit}
|
|
79
120
|
onDismiss={handlePickerCancel}
|
|
80
121
|
onClose={handlePickerCancel}
|
|
122
|
+
customSpringStyles={typeof animatedStartValue !== 'undefined'?customSpringStyles:{}}
|
|
81
123
|
>
|
|
82
124
|
</Picker>
|
|
83
125
|
</View>
|
|
@@ -10,7 +10,7 @@ import React, {
|
|
|
10
10
|
} from 'react'
|
|
11
11
|
import { Omit } from 'utility-types'
|
|
12
12
|
|
|
13
|
-
import { Keyboard } from 'react-native'
|
|
13
|
+
import { Keyboard,View,Text } from 'react-native'
|
|
14
14
|
import { getComponentLocale } from '../_util/getLocale'
|
|
15
15
|
import DisabledContext from '../config-provider/DisabledContext'
|
|
16
16
|
import { LocaleContext } from '../locale-provider'
|
|
@@ -35,6 +35,7 @@ export interface RMCPickerProps
|
|
|
35
35
|
innerValue: PickerValue[]
|
|
36
36
|
columns: PickerColumn[]
|
|
37
37
|
handleSelect: (value: PickerValue, index: number) => void
|
|
38
|
+
customSpringStyles?:any
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
const RMCPicker = forwardRef<PickerRef, RMCPickerProps>((props, ref) => {
|
|
@@ -59,6 +60,7 @@ const RMCPicker = forwardRef<PickerRef, RMCPickerProps>((props, ref) => {
|
|
|
59
60
|
innerValue,
|
|
60
61
|
columns,
|
|
61
62
|
handleSelect,
|
|
63
|
+
customSpringStyles,
|
|
62
64
|
...restProps
|
|
63
65
|
} = props
|
|
64
66
|
|
|
@@ -177,22 +179,29 @@ const RMCPicker = forwardRef<PickerRef, RMCPickerProps>((props, ref) => {
|
|
|
177
179
|
styles: props.styles,
|
|
178
180
|
themeStyles: PickerStyles,
|
|
179
181
|
})
|
|
182
|
+
// console.log(props.styles)
|
|
180
183
|
|
|
181
184
|
return (
|
|
182
185
|
<>
|
|
183
186
|
<PopupPicker
|
|
184
187
|
styles={styles}
|
|
185
188
|
visible={innerVisible}
|
|
186
|
-
title={title}
|
|
187
189
|
okText={okText || _locale.okText}
|
|
188
190
|
onOk={handleOk}
|
|
189
191
|
dismissText={dismissText || _locale.dismissText}
|
|
190
192
|
onDismiss={handleDismiss}
|
|
191
193
|
onClose={actions.close}
|
|
192
194
|
okButtonProps={okButtonProps}
|
|
193
|
-
dismissButtonProps={dismissButtonProps}
|
|
195
|
+
dismissButtonProps={dismissButtonProps}
|
|
196
|
+
customSpringStyles={customSpringStyles}
|
|
197
|
+
>
|
|
194
198
|
{/* TODO: 组件卸载是在visible更新fasle之后,需要前置 */}
|
|
195
199
|
{/* 否则会无效执行onPickerChange */}
|
|
200
|
+
{typeof title !== 'undefined'&&<View style={props.styles.titleBox}>
|
|
201
|
+
<View style={props.styles.titleContent}>
|
|
202
|
+
<Text style={props.styles.titleText}>{title}</Text>
|
|
203
|
+
</View>
|
|
204
|
+
</View>}
|
|
196
205
|
{innerVisible && (
|
|
197
206
|
<RMCPickerView
|
|
198
207
|
{...restProps}
|
|
@@ -2,6 +2,7 @@ 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
6
|
|
|
6
7
|
const PopupPicker = memo((props: PopupPickerProps) => {
|
|
7
8
|
const {
|
|
@@ -14,6 +15,7 @@ const PopupPicker = memo((props: PopupPickerProps) => {
|
|
|
14
15
|
onOk,
|
|
15
16
|
onClose,
|
|
16
17
|
children,
|
|
18
|
+
customSpringStyles={},
|
|
17
19
|
} = props
|
|
18
20
|
|
|
19
21
|
const titleEl =
|
|
@@ -49,7 +51,7 @@ const PopupPicker = memo((props: PopupPickerProps) => {
|
|
|
49
51
|
style={[{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:999},styles.maskColor]}
|
|
50
52
|
onPress={onClose}
|
|
51
53
|
></TouchableOpacity>
|
|
52
|
-
<View style={{position:'absolute',left:0,right:0,bottom:0,zIndex:1000}}>
|
|
54
|
+
<Animated.View style={[{position:'absolute',left:0,right:0,bottom:0,zIndex:1000},customSpringStyles]}>
|
|
53
55
|
{children}
|
|
54
56
|
<View style={[styles.header]}>
|
|
55
57
|
<TouchableHighlight
|
|
@@ -70,7 +72,7 @@ const PopupPicker = memo((props: PopupPickerProps) => {
|
|
|
70
72
|
{okEl}
|
|
71
73
|
</TouchableHighlight>
|
|
72
74
|
</View>
|
|
73
|
-
</View>
|
|
75
|
+
</Animated.View>
|
|
74
76
|
</Modal>
|
|
75
77
|
)
|
|
76
78
|
})
|
|
@@ -12,6 +12,9 @@ export interface PickerStyle {
|
|
|
12
12
|
maskColor:ViewStyle
|
|
13
13
|
okView:ViewStyle
|
|
14
14
|
dismissView:ViewStyle
|
|
15
|
+
titleBox:ViewStyle
|
|
16
|
+
titleContent:ViewStyle
|
|
17
|
+
titleText:TextStyle
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export default () =>
|
|
@@ -53,5 +56,8 @@ export default () =>
|
|
|
53
56
|
},
|
|
54
57
|
maskColor:{
|
|
55
58
|
backgroundColor: 'rgba(0,0,0,.6)'
|
|
56
|
-
}
|
|
59
|
+
},
|
|
60
|
+
titleBox:{},
|
|
61
|
+
titleContent:{},
|
|
62
|
+
titleText:{}
|
|
57
63
|
})
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
|
|
11
|
+
// import React,{useState,useImperativeHandle,useRef} from 'react';
|
|
12
|
+
// import {View, Text, StyleSheet} from 'react-native';
|
|
13
|
+
// import PickerV2 from '../PickerV2';
|
|
14
|
+
// import {useSharedValue} from 'react-native-reanimated';
|
|
15
|
+
|
|
16
|
+
// const Home = ({steps, active, onRef}) => {
|
|
17
|
+
// let backResult = useRef()
|
|
18
|
+
// const animatedStartValue = useSharedValue(700);
|
|
19
|
+
// const [visible, setPickerVisible] = useState(false);
|
|
20
|
+
// const [pickerData, setPickerData] = useState([]);
|
|
21
|
+
// const [pickerTitle,setPickerTitle] = useState()
|
|
22
|
+
// const [defaultIndex,setDefaultIndex] = useState(0)
|
|
23
|
+
// const [pickedIndex, setPickedIndex] = useState(() => {
|
|
24
|
+
// return defaultIndex;
|
|
25
|
+
// });
|
|
26
|
+
// useImperativeHandle(onRef, () => {
|
|
27
|
+
// return {
|
|
28
|
+
// show: (str,data) => {
|
|
29
|
+
// if(data?.payload?.columns.length){
|
|
30
|
+
// setPickerTitle(data?.payload?.title)
|
|
31
|
+
// setPickerData(data?.payload?.columns.map(item=>{
|
|
32
|
+
// item.label = item[data?.payload?.nameProp]
|
|
33
|
+
// item.value = item?.label;
|
|
34
|
+
// return item})||[]);
|
|
35
|
+
// // console.log(data)
|
|
36
|
+
// setPickerVisible(true);
|
|
37
|
+
// animatedStartValue.value = 0;
|
|
38
|
+
// return new Promise((resolve,reject)=>{
|
|
39
|
+
// backResult.current = (res)=>{
|
|
40
|
+
// resolve(res)
|
|
41
|
+
// }
|
|
42
|
+
// })
|
|
43
|
+
// }
|
|
44
|
+
// },
|
|
45
|
+
// };
|
|
46
|
+
// });
|
|
47
|
+
// const changePickedIndex = index => {
|
|
48
|
+
// setPickedIndex(index);
|
|
49
|
+
// };
|
|
50
|
+
// const dealPickerCommit = (value) =>{
|
|
51
|
+
// animatedStartValue.value = 700;
|
|
52
|
+
// setPickerTitle()
|
|
53
|
+
// setPickerVisible(false);
|
|
54
|
+
// setPickedIndex(0);
|
|
55
|
+
// // console.log(value);
|
|
56
|
+
// const data = pickerData.find(item => {
|
|
57
|
+
// return value[0] === item.value;
|
|
58
|
+
// });
|
|
59
|
+
// const index = pickerData.findIndex(item => {
|
|
60
|
+
// return value[0] === item.value;
|
|
61
|
+
// })
|
|
62
|
+
// backResult.current({data,index})
|
|
63
|
+
// }
|
|
64
|
+
// return <PickerV2
|
|
65
|
+
// pickerData={pickerData}
|
|
66
|
+
// visible={visible}
|
|
67
|
+
// // defaultValue={[pickerData[defaultIndex]?.value]}
|
|
68
|
+
// title={pickerTitle}
|
|
69
|
+
// pickedIndex={pickedIndex}
|
|
70
|
+
// changePickedIndex={index => changePickedIndex(index)}
|
|
71
|
+
// dealPickerCommit={item => dealPickerCommit(item)}
|
|
72
|
+
// dealPickerCancel={() => {
|
|
73
|
+
// animatedStartValue.value = 700;
|
|
74
|
+
// setPickerTitle()
|
|
75
|
+
// setPickerVisible(false);
|
|
76
|
+
// setPickedIndex(0);
|
|
77
|
+
// }}
|
|
78
|
+
// animatedStartValue={animatedStartValue.value}
|
|
79
|
+
// />
|
|
80
|
+
// };
|
|
81
|
+
// const styles = StyleSheet.create({});
|
|
82
|
+
// export default Home;
|
package/app/components/index.js
CHANGED
|
@@ -6,5 +6,5 @@ export ActionPicker from './common/ActionPicker';
|
|
|
6
6
|
export ScreenBackHeader from './common/ScreenBackHeader';
|
|
7
7
|
export CustomDialog from './common/CustomDialog';
|
|
8
8
|
export OnceTouchable from './common/OnceTouchable';
|
|
9
|
-
export PickerV2 from './common/PickerV2';
|
|
10
|
-
export PickerV1 from "./common/PickerV1";
|
|
9
|
+
// export PickerV2 from './common/PickerV2';
|
|
10
|
+
// export PickerV1 from "./common/PickerV1";
|
|
@@ -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
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Modal,
|
|
8
8
|
FlatList,
|
|
9
9
|
TouchableOpacity,
|
|
10
|
-
Platform,
|
|
10
|
+
Platform, NativeModules,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import {CheckBox, Icon, Text} from '@rneui/themed';
|
|
13
13
|
import {
|
|
@@ -24,6 +24,8 @@ import {showLoading, hideLoading} from '../../../utils/notice';
|
|
|
24
24
|
|
|
25
25
|
const {storage} = global.base;
|
|
26
26
|
|
|
27
|
+
const appName = NativeModules?.RNToNativeEmitter?.appName;
|
|
28
|
+
|
|
27
29
|
function TvAlbumScreen() {
|
|
28
30
|
const [cloudInfo, setCloudInfo] = useState({});
|
|
29
31
|
const [cloudServiceOpened, setCloudServiceOpened] = useState(true);
|
|
@@ -46,7 +48,7 @@ function TvAlbumScreen() {
|
|
|
46
48
|
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
(async () => {
|
|
49
|
-
domain.current = await global.base.getHomedDomain();
|
|
51
|
+
domain.current = appName === '禺乐慧家' ? await global.base.getHomedDomain() : 'homed.tv';
|
|
50
52
|
await getToken();
|
|
51
53
|
checkCloudService();
|
|
52
54
|
})();
|