react_hsbc_teller 0.9.9 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react_hsbc_teller",
3
- "version": "0.9.9",
3
+ "version": "1.0.3",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -1,27 +1,197 @@
1
1
  import React, { Component } from "react";
2
- import PropTypes from "prop-types";
2
+ import HSBC from "../pages/index";
3
3
 
4
4
  class Demo extends Component {
5
- constructor(props) {
6
- super(props);
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
- 演示文件1
12
- </div>
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
@@ -1,2 +1,3 @@
1
1
  import "./style/index.less";
2
2
  export { default as HSBC } from "./pages/index";
3
+ // export { default as HSBC } from "./demo/demo";