react_hsbc_teller 2.0.0 → 2.0.2-4.1
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/api/api.js +137 -2
- package/packages/assets/img/icon_asr.png +0 -0
- package/packages/assets/img/icon_env.png +0 -0
- package/packages/assets/img/icon_fail.jpg +0 -0
- package/packages/assets/img/icon_paper.png +0 -0
- package/packages/assets/img/icon_success.jpg +0 -0
- package/packages/assets/mp3/networkweak.mp3 +0 -0
- package/packages/assets/mp3/pip_close.mp3 +0 -0
- package/packages/assets/mp3/record_error.mp3 +0 -0
- package/packages/demo/demo.js +39 -15
- package/packages/demo/pdf.js +16 -1
- package/packages/pages/foot/foot.jsx +23 -1
- package/packages/pages/foot/foot.less +1 -0
- package/packages/pages/video/video.jsx +1729 -641
- package/packages/pages/video/video.less +42 -2
- package/packages/utils/utils.js +114 -0
- package/packages/common/JKL.js +0 -61
- package/packages/common/XML.js +0 -271
- package/packages/common/websocket.js +0 -267
- package/packages/utils/cell.js +0 -64
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import XML from './XML';
|
|
2
|
-
import JKL from './JKL';
|
|
3
|
-
|
|
4
|
-
let websock;
|
|
5
|
-
let id;
|
|
6
|
-
let fromHostName;
|
|
7
|
-
const xmlLang = 'zh';
|
|
8
|
-
const version = '1.0';
|
|
9
|
-
let islogin = false;
|
|
10
|
-
function initWebSocket(wsuri) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
websock = new WebSocket(wsuri, 'xmpp');
|
|
13
|
-
websock.onmessage = websocketonmessage;
|
|
14
|
-
websock.onopen = websocketonopen;
|
|
15
|
-
websock.onerror = websocketonerror;
|
|
16
|
-
websock.onclose = websocketclose;
|
|
17
|
-
}
|
|
18
|
-
const connectionState = ['正在连接..', '连接已建立', '正在关闭..', '已经关闭'];
|
|
19
|
-
// json转xml
|
|
20
|
-
function json2xml(jsonstring) {
|
|
21
|
-
const xotree = new XML.ObjTree();
|
|
22
|
-
const xml = xotree.writeXML(jsonstring);
|
|
23
|
-
return xml;
|
|
24
|
-
}
|
|
25
|
-
// xml转json
|
|
26
|
-
function xml2json(xmlstring) {
|
|
27
|
-
// 将xml字符串转为json
|
|
28
|
-
const xotree = new XML.ObjTree();
|
|
29
|
-
const json = xotree.parseXML(xmlstring);
|
|
30
|
-
// 将json对象转为格式化的字符串
|
|
31
|
-
const dumper = new JKL.Dumper();
|
|
32
|
-
const jsonText = dumper.dump(json);
|
|
33
|
-
return JSON.parse(jsonText);
|
|
34
|
-
}
|
|
35
|
-
function websocketonopen() { // 连接建立之后执行send方法发送数据
|
|
36
|
-
console.log('成功');
|
|
37
|
-
// 发送建立流请求
|
|
38
|
-
const steam = {
|
|
39
|
-
open: {
|
|
40
|
-
'-to': JSON.parse(window.sessionStorage.getItem('sigData')).hostname,
|
|
41
|
-
'-from': `${JSON.parse(window.sessionStorage.getItem('sigData')).account}@${JSON.parse(window.sessionStorage.getItem('sigData')).hostname}`,
|
|
42
|
-
'-xmlns': 'urn:ietf:params:xml:ns:xmpp-framing',
|
|
43
|
-
'-xml:lang': xmlLang,
|
|
44
|
-
'-version': version,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
websocketsend(json2xml(steam));
|
|
48
|
-
}
|
|
49
|
-
function websocketonerror() { // 连接建立失败重连
|
|
50
|
-
window.IMOpenfire({
|
|
51
|
-
status: 'error'
|
|
52
|
-
});
|
|
53
|
-
console.log('失败');
|
|
54
|
-
// initWebSocket()
|
|
55
|
-
}
|
|
56
|
-
function websocketonmessage(e) {
|
|
57
|
-
// console.log('收到消息', e);
|
|
58
|
-
// console.log('收到消息', e.data);
|
|
59
|
-
const jsondata = xml2json(e.data);
|
|
60
|
-
console.log('jsondata', jsondata);
|
|
61
|
-
if (undefined != jsondata.message) {
|
|
62
|
-
if (undefined != jsondata.message.body) {
|
|
63
|
-
// console.log('收到的消息:', jsondata.message.body);
|
|
64
|
-
const from = jsondata.message['-from'];
|
|
65
|
-
// console.log('from', from);
|
|
66
|
-
const type = jsondata.message['-type'];
|
|
67
|
-
// console.log('type', type);
|
|
68
|
-
if ((from.split('/').length > 0) && (from.split('/')[from.split('/').length - 1] == JSON.parse(window.sessionStorage.getItem('sigData')).account)) {
|
|
69
|
-
// 自己的消息不做处理
|
|
70
|
-
} else if ((type == 'chat' || type == 'groupchat') && jsondata.message.body.length > 0) {
|
|
71
|
-
// console.log('message', (jsondata.message.body.indexOf("IMVedio") != -1))
|
|
72
|
-
// if (jsondata.message.body.indexOf("IMVedio") != -1) {
|
|
73
|
-
// window.VedioEvt(jsondata.message.body)
|
|
74
|
-
// } else {
|
|
75
|
-
window.IMEvt(jsondata.message.body);
|
|
76
|
-
// }
|
|
77
|
-
}
|
|
78
|
-
} else if (undefined != jsondata.message.composing) {
|
|
79
|
-
console.log('对方正在输入');
|
|
80
|
-
} else if (undefined != jsondata.message.gone) {
|
|
81
|
-
console.log('对方已关闭和您的聊天');
|
|
82
|
-
} else if (undefined != jsondata.message.file) {
|
|
83
|
-
console.log('收到的文件:', jsondata.message);
|
|
84
|
-
} else {
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
} else if (undefined != jsondata.open) {
|
|
88
|
-
// 记录id
|
|
89
|
-
id = jsondata.open['-id'];
|
|
90
|
-
fromHostName = jsondata.open["-from"];
|
|
91
|
-
console.log('记录id',id,fromHostName);
|
|
92
|
-
} else if (undefined != jsondata['stream:features']) {
|
|
93
|
-
if (undefined != jsondata['stream:features'].mechanisms) {
|
|
94
|
-
// 获取登录验证方式
|
|
95
|
-
auth(jsondata['stream:features'].mechanisms.mechanism[0]);
|
|
96
|
-
} else if (undefined != jsondata['stream:features'].bind) {
|
|
97
|
-
bind();
|
|
98
|
-
} else {
|
|
99
|
-
// Do-nothing
|
|
100
|
-
}
|
|
101
|
-
} else if (undefined != jsondata.failure) {
|
|
102
|
-
islogin = false;
|
|
103
|
-
console.log('登录失败,用户名或者密码错误');
|
|
104
|
-
window.IMOpenfire({
|
|
105
|
-
status: 'error'
|
|
106
|
-
});
|
|
107
|
-
} else if (undefined != jsondata.success) {
|
|
108
|
-
islogin = true;
|
|
109
|
-
console.log('登录成功!');
|
|
110
|
-
window.IMOpenfire({
|
|
111
|
-
status: 'success'
|
|
112
|
-
});
|
|
113
|
-
// 发起新的流
|
|
114
|
-
newopen();
|
|
115
|
-
} else if (undefined != jsondata.iq) {
|
|
116
|
-
if (undefined != jsondata.iq.bind) {
|
|
117
|
-
// 获取session会话
|
|
118
|
-
getsession();
|
|
119
|
-
} else {
|
|
120
|
-
presence();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// 结束状态
|
|
125
|
-
function disconnect() {
|
|
126
|
-
const temp = {
|
|
127
|
-
close: {
|
|
128
|
-
'-xmlns': 'urn:ietf:params:xml:ns:xmpp-framing',
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
// 转化为xml
|
|
132
|
-
websocketsend(json2xml(temp));
|
|
133
|
-
}
|
|
134
|
-
// 获取session
|
|
135
|
-
function getsession() {
|
|
136
|
-
// <iq xmlns="jabber:client" id="ak014gz6x7" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>
|
|
137
|
-
const temp = {
|
|
138
|
-
iq: {
|
|
139
|
-
'-xmlns': 'jabber:client',
|
|
140
|
-
'-id': id,
|
|
141
|
-
'-type': 'set',
|
|
142
|
-
session: {
|
|
143
|
-
'-xmlns': 'urn:ietf:params:xml:ns:xmpp-session',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
// 转化为xml
|
|
148
|
-
websocketsend(json2xml(temp));
|
|
149
|
-
}
|
|
150
|
-
// 上线
|
|
151
|
-
function presence() {
|
|
152
|
-
// <presence id="ak014gz6x7"><status>Online</status><priority>1</priority></presence>
|
|
153
|
-
const temp = {
|
|
154
|
-
presence: {
|
|
155
|
-
'-id': id,
|
|
156
|
-
status: 'online',
|
|
157
|
-
priority: '1',
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
// 转化为xml
|
|
161
|
-
websocketsend(json2xml(temp));
|
|
162
|
-
}
|
|
163
|
-
// 发起新的流
|
|
164
|
-
function newopen() {
|
|
165
|
-
const temp = {
|
|
166
|
-
open: {
|
|
167
|
-
'-xmlns': 'jabber:client',
|
|
168
|
-
'-to': JSON.parse(window.sessionStorage.getItem('sigData')).hostname,
|
|
169
|
-
'-version': version,
|
|
170
|
-
'-from': `${JSON.parse(window.sessionStorage.getItem('sigData')).account}@${fromHostName}`,
|
|
171
|
-
'-id': id,
|
|
172
|
-
'-xml:lang': xmlLang,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
// 转化为xml
|
|
176
|
-
websocketsend(json2xml(temp));
|
|
177
|
-
}
|
|
178
|
-
// bind操作
|
|
179
|
-
function bind() {
|
|
180
|
-
const temp = {
|
|
181
|
-
iq: {
|
|
182
|
-
'-id': id,
|
|
183
|
-
'-type': 'set',
|
|
184
|
-
bind: {
|
|
185
|
-
'-xmlns': 'urn:ietf:params:xml:ns:xmpp-bind',
|
|
186
|
-
resource: 'appClient',
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
websocketsend(json2xml(temp));
|
|
191
|
-
}
|
|
192
|
-
function auth(val) {
|
|
193
|
-
// Base64编码
|
|
194
|
-
console.log('www');
|
|
195
|
-
const token = window.btoa(`${JSON.parse(window.sessionStorage.getItem('sigData')).account}@${fromHostName}\0` + `${JSON.parse(window.sessionStorage.getItem('sigData')).openfireToken}`);
|
|
196
|
-
const message = {
|
|
197
|
-
auth: {
|
|
198
|
-
'-xmlns': 'urn:ietf:params:xml:ns:xmpp-sasl',
|
|
199
|
-
'-mechanism': val,
|
|
200
|
-
'#text': token,
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
console.log(`Client: ${message}`);
|
|
204
|
-
websocketsend(json2xml(message));
|
|
205
|
-
}
|
|
206
|
-
function websocketsend(Data) { // 数据发送
|
|
207
|
-
console.log('data', Data);
|
|
208
|
-
websock.send(Data);
|
|
209
|
-
}
|
|
210
|
-
function websocketclose(e) { // 关闭
|
|
211
|
-
console.log('断开连接', e);
|
|
212
|
-
islogin = false;
|
|
213
|
-
window.IMOpenfire({
|
|
214
|
-
status: 'close'
|
|
215
|
-
})
|
|
216
|
-
}
|
|
217
|
-
// 发消息
|
|
218
|
-
// // 发送消息 to---接收者id,from---发送者id,type---消息类型(chat--单聊,groupchat--群聊)。message--发送的消息
|
|
219
|
-
function sendMessage(to, from, type, message) {
|
|
220
|
-
// console.log('发送聊天信息', to, from, type, message);
|
|
221
|
-
if (islogin) {
|
|
222
|
-
const temp = {
|
|
223
|
-
message: {
|
|
224
|
-
'-type': type,
|
|
225
|
-
'-from': from,
|
|
226
|
-
'-to': to,
|
|
227
|
-
subject: '标题',
|
|
228
|
-
body: message,
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
// 转化为xml
|
|
232
|
-
websocketsend(json2xml(temp));
|
|
233
|
-
} else {
|
|
234
|
-
console.log('请先登录!');
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
// 加入群 from---加入群的人的jid,to--群名称
|
|
238
|
-
function joinRoom(from, to) {
|
|
239
|
-
// 发送<presence>元素,加入房间
|
|
240
|
-
console.log('from', from);
|
|
241
|
-
console.log('to', to);
|
|
242
|
-
if (islogin) {
|
|
243
|
-
const temp = {
|
|
244
|
-
presence: {
|
|
245
|
-
'-from': from,
|
|
246
|
-
'-id': id,
|
|
247
|
-
'-to': `${to}/${from.substring(0, from.indexOf('@'))}`,
|
|
248
|
-
x: {
|
|
249
|
-
'-xmlns': 'http://jabber.org/protocol/muc',
|
|
250
|
-
},
|
|
251
|
-
history: {
|
|
252
|
-
'maxstanzas': '0'
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
// 转化为xml
|
|
257
|
-
websocketsend(json2xml(temp));
|
|
258
|
-
} else {
|
|
259
|
-
console.log('请先登录!');
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
export {
|
|
263
|
-
initWebSocket,
|
|
264
|
-
sendMessage,
|
|
265
|
-
disconnect,
|
|
266
|
-
joinRoom
|
|
267
|
-
}
|
package/packages/utils/cell.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* eslint-disable eqeqeq */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
import {sendMessage} from '../common/websocket';
|
|
4
|
-
var index = 0
|
|
5
|
-
var maxIndex = 10
|
|
6
|
-
var callbackRegister = new Map()
|
|
7
|
-
function callNimIM(method, json, callback) {
|
|
8
|
-
// 回调处理
|
|
9
|
-
const fn = function(status, resData) {
|
|
10
|
-
// 回调
|
|
11
|
-
if (callback) {
|
|
12
|
-
// -----------------------//
|
|
13
|
-
// 根据第一个字段code来判断调用是否成功,成功取值data中的数据,失败取值message中的数据
|
|
14
|
-
// 可以根据需要,在公共层判断,还是逻辑层判断
|
|
15
|
-
// -----------------------//
|
|
16
|
-
console.log('resData.code---' + resData.code)
|
|
17
|
-
if (resData.code !== 0) {
|
|
18
|
-
alert('调用失败,message=' + resData.message)
|
|
19
|
-
}
|
|
20
|
-
callback(resData.code, resData.message, resData.data)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const callId = _generateId()
|
|
25
|
-
|
|
26
|
-
callbackRegister.set(callId, fn)
|
|
27
|
-
if (method == 'sendChatMsg') {
|
|
28
|
-
sendMessage(json.customId, (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'chat', json.content)
|
|
29
|
-
} else if (method == 'sendCustomCmdMsg') {
|
|
30
|
-
sendMessage(json.customId, (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'groupchat', json.content)
|
|
31
|
-
} else if (method == 'transfer' || method == 'transferreject' || method == 'transferagree') {
|
|
32
|
-
// 发起转接或者邀请
|
|
33
|
-
json.event = 'IMVedio'
|
|
34
|
-
if (method == 'transfer') {
|
|
35
|
-
json.command = 'transfer'
|
|
36
|
-
} else if (method == 'transferagree') {
|
|
37
|
-
json.command = 'transfer_agree'
|
|
38
|
-
} else if (method == 'transferreject') {
|
|
39
|
-
json.command = 'transfer_reject'
|
|
40
|
-
}
|
|
41
|
-
console.log('json', json)
|
|
42
|
-
sendMessage((json.distUserId + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'chat', JSON.stringify(json))
|
|
43
|
-
}
|
|
44
|
-
// window.RemoteShellBridge.callNimIM(method, JSON.stringify(json), callId)
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 生成索引ID
|
|
48
|
-
* @returns {string}
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
function _generateId() {
|
|
52
|
-
// 增加索引
|
|
53
|
-
index++
|
|
54
|
-
// 超出最大值后,循环
|
|
55
|
-
if (index >= maxIndex) {
|
|
56
|
-
index = 0
|
|
57
|
-
}
|
|
58
|
-
// 返回id
|
|
59
|
-
return 'remote_' + index
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
_generateId,
|
|
63
|
-
callNimIM,
|
|
64
|
-
}
|