react_hsbc_teller 1.9.8 → 1.9.81

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.
Files changed (38) hide show
  1. package/.babelrc +39 -39
  2. package/README.en.md +36 -36
  3. package/README.md +52 -52
  4. package/config/webpack.config.js +119 -119
  5. package/config/webpack.dev.js +108 -108
  6. package/config/webpack.prod.js +104 -104
  7. package/lib/hsbc.js +1 -1
  8. package/package.json +108 -108
  9. package/packages/api/api.js +553 -553
  10. package/packages/api/server.js +50 -50
  11. package/packages/common/JKL.js +61 -61
  12. package/packages/common/XML.js +271 -271
  13. package/packages/common/index.esm.js +374 -374
  14. package/packages/common/websocket.js +267 -267
  15. package/packages/demo/demo.js +279 -279
  16. package/packages/demo/index.js +3 -3
  17. package/packages/demo/pdf.js +79 -79
  18. package/packages/envconfig/envconfig.js +12 -12
  19. package/packages/index.js +2 -2
  20. package/packages/pages/foot/foot.jsx +212 -212
  21. package/packages/pages/foot/foot.less +84 -84
  22. package/packages/pages/header/header.jsx +15 -15
  23. package/packages/pages/header/header.less +51 -51
  24. package/packages/pages/index.jsx +52 -52
  25. package/packages/pages/sign/signMy.jsx +221 -221
  26. package/packages/pages/sign/signMy.less +129 -129
  27. package/packages/pages/video/video.jsx +6768 -6756
  28. package/packages/pages/video/video.less +616 -616
  29. package/packages/style/index.less +1 -1
  30. package/packages/style/reset.less +345 -345
  31. package/packages/utils/asyncComponent.jsx +26 -26
  32. package/packages/utils/cell.js +64 -64
  33. package/packages/utils/mixin.js +27 -27
  34. package/packages/utils/setRem.js +10 -10
  35. package/public/index.html +77 -77
  36. package/src/index.js +11 -11
  37. package/src/index.less +5 -5
  38. package/tsconfig.json +11 -11
@@ -1,267 +1,267 @@
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
- }
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
+ }