react_hsbc_teller 1.0.2 → 1.0.3
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/lib/hsbc.js +1 -1
- package/package.json +1 -1
- package/packages/demo/demo.js +186 -16
- package/packages/index.js +1 -0
- package/packages/pages/video/video.jsx +10 -7
package/package.json
CHANGED
package/packages/demo/demo.js
CHANGED
|
@@ -1,27 +1,197 @@
|
|
|
1
1
|
import React, { Component } from "react";
|
|
2
|
-
import
|
|
2
|
+
import HSBC from "../pages/index";
|
|
3
3
|
|
|
4
4
|
class Demo extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
state = {
|
|
6
|
+
// imRoomId: "9K9ea1vOM@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
|
|
7
|
+
// sessionId: "9K9ea1vOM",
|
|
8
|
+
// mtoken: "d4e648858b03",
|
|
9
|
+
// roomId: "645110140224386",
|
|
10
|
+
roomId: '645515863322767',
|
|
11
|
+
mtoken: 'bae147019f8a',
|
|
12
|
+
imRoomId: 'Ma9XWgf2k@conference.openfire2.leimondata.cn',
|
|
13
|
+
sessionId: 'Ma9XWgf2k',
|
|
14
|
+
isVideo: false,
|
|
15
|
+
tellerAccount: '00000000',
|
|
16
|
+
callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',
|
|
17
|
+
businessNumber: '',
|
|
18
|
+
lang: 'zh',
|
|
19
|
+
roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
|
|
20
|
+
baseURL:'https://counter-web.leimondata.cn:18082/api/leimon-counter-api',
|
|
21
|
+
resourcePath: 'https://counter-web.leimondata.cn:7199',
|
|
22
|
+
// roomServerUrl: 'wss://app.uat.dsp.hsbcfts.com.cn/mpaas/mrtc/ws',
|
|
23
|
+
// baseURL:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
|
|
24
|
+
// resourcePath:'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
|
|
25
|
+
prohibitPrompt: '无客户',
|
|
26
|
+
voiceColor: '#333',
|
|
27
|
+
titleBackground: '#40a9ff',
|
|
28
|
+
titleColor: '#faad14',
|
|
29
|
+
microphoneSize: 50,
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
fontFamily: 'auto'
|
|
32
|
+
}
|
|
33
|
+
componentWillMount() {
|
|
34
|
+
if(window.localStorage.getItem('roomId')) {
|
|
35
|
+
this.setState({roomId: window.localStorage.getItem('roomId')});
|
|
36
|
+
}
|
|
37
|
+
if(window.localStorage.getItem('mtoken')) {
|
|
38
|
+
this.setState({mtoken: window.localStorage.getItem('mtoken')});
|
|
39
|
+
}
|
|
40
|
+
if(window.localStorage.getItem('sessionId')) {
|
|
41
|
+
this.setState({sessionId: window.localStorage.getItem('sessionId')});
|
|
42
|
+
}
|
|
43
|
+
if(window.localStorage.getItem('imRoomId')) {
|
|
44
|
+
this.setState({imRoomId: window.localStorage.getItem('imRoomId')});
|
|
45
|
+
this.startVideo()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
handleChangeRoomId = (event) => {
|
|
50
|
+
this.setState({roomId: event.target.value});
|
|
51
|
+
window.localStorage.setItem('roomId', event.target.value)
|
|
52
|
+
}
|
|
53
|
+
handleChangeRToken = (event) => {
|
|
54
|
+
this.setState({mtoken: event.target.value});
|
|
55
|
+
window.localStorage.setItem('mtoken', event.target.value)
|
|
7
56
|
}
|
|
57
|
+
handleChangeSessionId = (event) => {
|
|
58
|
+
this.setState({sessionId: event.target.value});
|
|
59
|
+
window.localStorage.setItem('sessionId', event.target.value)
|
|
60
|
+
}
|
|
61
|
+
handleChangeImRoomId = (event) => {
|
|
62
|
+
this.setState({imRoomId: event.target.value});
|
|
63
|
+
window.localStorage.setItem('imRoomId', event.target.value)
|
|
64
|
+
}
|
|
65
|
+
startVideo = () => {
|
|
66
|
+
this.setState({
|
|
67
|
+
isVideo: true
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
onLeaveRoom = (val) => {
|
|
71
|
+
console.log(val)
|
|
72
|
+
this.setState({
|
|
73
|
+
isVideo: false
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
handleChangeTeller = (event) => {
|
|
77
|
+
this.setState({
|
|
78
|
+
tellerAccount: event.target.value
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
handleChangeCall = (event) => {
|
|
82
|
+
this.setState({
|
|
83
|
+
callbackUrl: event.target.value
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
handleChangeBysiness = (event) => {
|
|
87
|
+
this.setState({
|
|
88
|
+
businessNumber: event.target.value
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleRoomServerUrl = (event) => {
|
|
93
|
+
this.setState({
|
|
94
|
+
roomServerUrl: event.target.value
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
handleBaseURL = (event) => {
|
|
98
|
+
this.setState({
|
|
99
|
+
baseURL: event.target.value
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
handleResourcePath = (event) => {
|
|
103
|
+
this.setState({
|
|
104
|
+
resourcePath: event.target.value
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
createRoomCallback=(data)=>{
|
|
108
|
+
console.log('createRoomCallback', data)
|
|
109
|
+
this.setState({roomId: data.data.roomId});
|
|
110
|
+
window.localStorage.setItem('roomId', data.data.roomId)
|
|
111
|
+
this.setState({mtoken: data.data.mtoken});
|
|
112
|
+
window.localStorage.setItem('mtoken', data.data.mtoken)
|
|
113
|
+
this.setState({sessionId:data.data.sessionId});
|
|
114
|
+
window.localStorage.setItem('sessionId',data.data.sessionId)
|
|
115
|
+
this.setState({imRoomId: data.data.imRoomId});
|
|
116
|
+
window.localStorage.setItem('imRoomId', data.data.imRoomId)
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
joinRoomCallback=(data)=>{
|
|
120
|
+
console.log('joinRoomCallback', data)
|
|
121
|
+
}
|
|
8
122
|
render() {
|
|
9
123
|
return (
|
|
10
|
-
<div>
|
|
11
|
-
|
|
12
|
-
|
|
124
|
+
<div className="test">
|
|
125
|
+
{
|
|
126
|
+
this.state.isVideo ?
|
|
127
|
+
<HSBC
|
|
128
|
+
roomId={this.state.roomId}
|
|
129
|
+
mtoken={this.state.mtoken}
|
|
130
|
+
sessionId={this.state.sessionId}
|
|
131
|
+
imRoomId={this.state.imRoomId}
|
|
132
|
+
prohibitPrompt={this.state.prohibitPrompt}
|
|
133
|
+
voiceColor={this.state.voiceColor}
|
|
134
|
+
titleBackground={this.state.titleBackground}
|
|
135
|
+
titleColor={this.state.titleColor}
|
|
136
|
+
microphoneSize={this.state.microphoneSize}
|
|
137
|
+
fontSize={this.state.fontSize}
|
|
138
|
+
fontFamily={this.state.fontFamily}
|
|
139
|
+
tellerAccount={this.state.tellerAccount}
|
|
140
|
+
callbackUrl={this.state.callbackUrl}
|
|
141
|
+
businessNumber={this.state.businessNumber}
|
|
142
|
+
lang={this.state.lang}
|
|
143
|
+
roomServerUrl={this.state.roomServerUrl}
|
|
144
|
+
baseURL={this.state.baseURL}
|
|
145
|
+
resourcePath={this.state.resourcePath}
|
|
146
|
+
onLeaveRoom={this.onLeaveRoom}
|
|
147
|
+
createRoomCallback={this.createRoomCallback}
|
|
148
|
+
joinRoomCallback={this.joinRoomCallback}>
|
|
149
|
+
{/* <Pdf></Pdf> */}
|
|
150
|
+
</HSBC>
|
|
151
|
+
:
|
|
152
|
+
<div>
|
|
153
|
+
坐席账号:<input placeholder="请输入坐席账号" value={this.state.tellerAccount} onChange={e => this.handleChangeTeller(e)}></input>
|
|
154
|
+
回调地址:<input placeholder="请输入回调地址" value={this.state.callbackUrl} onChange={e => this.handleChangeCall(e)}></input>
|
|
155
|
+
全局流水号:<input placeholder="请输入全局流水号" value={this.state.businessNumber} onChange={e => this.handleChangeBysiness(e)}></input>
|
|
156
|
+
阿里服务器地址:<input placeholder="请输入阿里服务器地址" value={this.state.roomServerUrl} onChange={e => this.handleRoomServerUrl(e)}></input>
|
|
157
|
+
接口地址:<input placeholder="请输入接口地址" value={this.state.baseURL} onChange={e => this.handleBaseURL(e)}></input>
|
|
158
|
+
阿里资源服务地址:<input placeholder="请输入阿里资源服务地址" value={this.state.resourcePath} onChange={e => this.handleResourcePath(e)}></input>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<div>roomId: <input type="text" value={this.state.roomId} onChange={this.handleChangeRoomId} /></div>
|
|
162
|
+
<div>rtoken: <input type="text" value={this.state.mtoken} onChange={this.handleChangeRToken} /></div>
|
|
163
|
+
<div>sessionId: <input type="text" value={this.state.sessionId} onChange={this.handleChangeSessionId} /></div>
|
|
164
|
+
<div>imRoomId: <input type="text" value={this.state.imRoomId} onChange={this.handleChangeImRoomId} /></div>
|
|
165
|
+
<button className="button" onClick={this.startVideo.bind(this)}>开启视频</button>
|
|
166
|
+
</div>
|
|
167
|
+
}
|
|
168
|
+
</div>
|
|
169
|
+
// <div>
|
|
170
|
+
// { this.state.isPlay?
|
|
171
|
+
// <HSBC
|
|
172
|
+
// tellerAccount={this.state.tellerAccount}
|
|
173
|
+
// roomId={this.state.roomId}
|
|
174
|
+
// mtoken={this.state.mtoken}
|
|
175
|
+
// sessionId={this.state.sessionId}
|
|
176
|
+
// imRoomId={this.state.imRoomId}
|
|
177
|
+
// name={this.state.name}
|
|
178
|
+
// lang={this.state.lang}
|
|
179
|
+
// onLeaveRoom={this.exitRoom}
|
|
180
|
+
// />
|
|
181
|
+
// :
|
|
182
|
+
// <div style={{padding: '20px'}}>
|
|
183
|
+
// <div>账号: <input type="text" value={this.state.tellerAccount} onChange={this.handleChangeAccount} /></div>
|
|
184
|
+
// <div>roomId: <input type="text" value={this.state.roomId} onChange={this.handleChangeRoomId} /></div>
|
|
185
|
+
// <div>rtoken: <input type="text" value={this.state.mtoken} onChange={this.handleChangeRToken} /></div>
|
|
186
|
+
// <div>sessionId: <input type="text" value={this.state.sessionId} onChange={this.handleChangeSessionId} /></div>
|
|
187
|
+
// <div>imRoomId: <input type="text" value={this.state.imRoomId} onChange={this.handleChangeImRoomId} /></div>
|
|
188
|
+
// <div>姓名(非必填): <input type="text" value={this.state.name} onChange={this.handleChangeName} /></div>
|
|
189
|
+
// <div>系统语言: <input type="text" value={this.state.lang} onChange={this.handleChangeLang} /></div>
|
|
190
|
+
// <div><button onClick={this.joinRoom} >加入房间</button></div>
|
|
191
|
+
// </div>}
|
|
192
|
+
// </div>
|
|
13
193
|
);
|
|
14
194
|
}
|
|
15
195
|
}
|
|
16
196
|
|
|
17
|
-
// 指定 props 的默认值:
|
|
18
|
-
Demo.defaultProps = {
|
|
19
|
-
type: "default",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Demo.propTypes = {
|
|
23
|
-
type: PropTypes.string,
|
|
24
|
-
onClick: PropTypes.func,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
197
|
export default Demo;
|
package/packages/index.js
CHANGED
|
@@ -1322,12 +1322,14 @@ class Video extends Component {
|
|
|
1322
1322
|
this.state.sessionType = false
|
|
1323
1323
|
this.roomCallBack(2, 'im建立连接失败',5)
|
|
1324
1324
|
} else {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
this.state.
|
|
1329
|
-
|
|
1330
|
-
|
|
1325
|
+
this.state.imStatus = msg
|
|
1326
|
+
setTimeout(() => {
|
|
1327
|
+
if(this.state.imRoomId && !this.state.imJoinRoom) {
|
|
1328
|
+
joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
|
|
1329
|
+
this.state.imJoinRoom =true
|
|
1330
|
+
console.log('IMOpenfire 加入im房间')
|
|
1331
|
+
}
|
|
1332
|
+
}, 200);
|
|
1331
1333
|
}
|
|
1332
1334
|
|
|
1333
1335
|
}
|
|
@@ -2468,6 +2470,7 @@ class Video extends Component {
|
|
|
2468
2470
|
this.test_controller.Disconnect()
|
|
2469
2471
|
}
|
|
2470
2472
|
if(this.state.imStatus) {
|
|
2473
|
+
console.log('disconnect断开连接')
|
|
2471
2474
|
disconnect();
|
|
2472
2475
|
}
|
|
2473
2476
|
|
|
@@ -2583,7 +2586,7 @@ class Video extends Component {
|
|
|
2583
2586
|
this.props.resourcePath + "/beauty/backgroundBlur.js",
|
|
2584
2587
|
this.props.resourcePath + "/adapter.js",
|
|
2585
2588
|
this.props.resourcePath + "/getMediaInfo.js",
|
|
2586
|
-
this.props.resourcePath + "/pdf.js",
|
|
2589
|
+
// this.props.resourcePath + "/pdf.js",
|
|
2587
2590
|
this.props.resourcePath + "/EBML.js",
|
|
2588
2591
|
this.props.resourcePath + "/mcu.js",
|
|
2589
2592
|
this.props.resourcePath + "/meeting_desk_stream.js",
|