react_hsbc_teller 0.0.3 → 0.0.7

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.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -33,20 +33,32 @@
33
33
  "@babel/plugin-proposal-class-properties": "^7.12.1",
34
34
  "@babel/plugin-syntax-jsx": "^7.12.1",
35
35
  "@babel/preset-react": "^7.12.1",
36
+ "@babel/preset-env": "^7.1.0",
37
+ "autoprefixer": "7.1.6",
36
38
  "babel-core": "6.26.0",
37
39
  "babel-eslint": "7.2.3",
38
40
  "babel-jest": "20.0.3",
39
41
  "babel-loader": "^8.1.0",
42
+ "babel-plugin-import": "^1.13.3",
40
43
  "babel-plugin-syntax-dynamic-import": "^6.18.0",
41
44
  "babel-plugin-transform-decorators-legacy": "^1.3.4",
42
45
  "babel-polyfill": "^6.26.0",
43
46
  "babel-preset-env": "^1.6.1",
47
+ "babel-preset-es2015": "^6.24.1",
48
+ "babel-preset-react": "^6.24.1",
44
49
  "babel-preset-react-app": "^3.1.0",
50
+ "babel-preset-stage-0": "^6.24.1",
45
51
  "babel-runtime": "6.26.0",
46
- "autoprefixer": "7.1.6",
47
52
  "classnames": "^2.2.6",
48
53
  "clean-webpack-plugin": "^3.0.0",
49
54
  "css-loader": "^5.0.0",
55
+ "eslint": "4.10.0",
56
+ "eslint-config-react-app": "^2.0.1",
57
+ "eslint-loader": "1.9.0",
58
+ "eslint-plugin-flowtype": "2.39.1",
59
+ "eslint-plugin-import": "2.8.0",
60
+ "eslint-plugin-jsx-a11y": "5.1.1",
61
+ "eslint-plugin-react": "7.4.0",
50
62
  "extract-text-webpack-plugin": "^4.0.0-beta.0",
51
63
  "file-loader": "^6.2.0",
52
64
  "gh-pages": "^3.1.0",
@@ -66,15 +78,8 @@
66
78
  "webpack": "^5.3.2",
67
79
  "webpack-cli": "^4.1.0",
68
80
  "webpack-dev-server": "^3.11.0",
69
- "webpackbar": "^4.0.0",
70
- "babel-plugin-import": "^1.13.3",
71
- "eslint": "4.10.0",
72
- "eslint-config-react-app": "^2.0.1",
73
- "eslint-loader": "1.9.0",
74
- "eslint-plugin-flowtype": "2.39.1",
75
- "eslint-plugin-import": "2.8.0",
76
- "eslint-plugin-jsx-a11y": "5.1.1",
77
- "eslint-plugin-react": "7.4.0"
81
+ "react-hot-loader": "^4.3.12",
82
+ "webpackbar": "^4.0.0"
78
83
  },
79
84
  "dependencies": {
80
85
  "antd": "^4.16.13",
@@ -27,31 +27,81 @@ class API extends Server{
27
27
  throw err;
28
28
  }
29
29
  }
30
- // /**
31
- // * 用途:上传图片
32
- // * @url https://elm.cangdu.org/v1/addimg/shop
33
- // * 返回status1表示成功
34
- // * @method post
35
- // * @return {promise}
36
- // */
37
- // async uploadImg(params = {}){
38
- // try{
39
- // let result = await this.axios('post', '//elm.cangdu.org/v1/addimg/shop', params);
40
- // if(result && result.status === 1){
41
- // return result;
42
- // }else{
43
- // let err = {
44
- // tip: '上传图片失败',
45
- // response: result,
46
- // data: params,
47
- // url: '//elm.cangdu.org/v1/addimg/shop',
48
- // }
49
- // throw err;
50
- // }
51
- // }catch(err){
52
- // throw err;
53
- // }
54
- // }
30
+ /**
31
+ * 用途:创建房间成功后回调后台
32
+ * @url https://api.cangdu.org/shopro/data/products
33
+ * 返回http_code200表示成功
34
+ * @method post
35
+ * @return {promise}
36
+ */
37
+ async createRoom(params = {}){
38
+ console.log(params)
39
+ try{
40
+ let result = await this.axios('post', '/hsbc/createRoom/callback', params);
41
+ if(result && (result.data instanceof Object) && result.code === 200){
42
+ return result.data||[];
43
+ }else{
44
+ let err = {
45
+ tip: '服务异常',
46
+ response: result,
47
+ data: params,
48
+ // url: 'https://api.cangdu.org/shopro/data/products',
49
+ }
50
+ throw err;
51
+ }
52
+ }catch(err){
53
+ throw err;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * 用途:人脸识别
59
+ * @url https://elm.cangdu.org/v1/addimg/shop
60
+ * 返回status为200表示成功
61
+ * @method post
62
+ * @return {promise}
63
+ */
64
+ async contrastFaceVerify(params = {}){
65
+ try{
66
+ let result = await this.axios('post', '/hsbc/contrastFaceVerify', params);
67
+ if(result && result.code === 200){
68
+ return result;
69
+ }else{
70
+ let err = {
71
+ tip: '上传图片失败',
72
+ response: result,
73
+ data: params,
74
+ }
75
+ throw err;
76
+ }
77
+ }catch(err){
78
+ throw err;
79
+ }
80
+ }
81
+ /**
82
+ * 用途:上传图片
83
+ * @url https://elm.cangdu.org/v1/addimg/shop
84
+ * 返回status为200表示成功
85
+ * @method post
86
+ * @return {promise}
87
+ */
88
+ async uploadImg(params = {}){
89
+ try{
90
+ let result = await this.axios('post', '/file/ossUpload', params);
91
+ if(result && result.code === 200){
92
+ return result;
93
+ }else{
94
+ let err = {
95
+ tip: '上传图片失败',
96
+ response: result,
97
+ data: params,
98
+ }
99
+ throw err;
100
+ }
101
+ }catch(err){
102
+ throw err;
103
+ }
104
+ }
55
105
 
56
106
  // /**
57
107
  // * 用途:获取记录数据
@@ -37,7 +37,7 @@ class Video extends Component {
37
37
  voiceStatue: false,
38
38
  voiceImg: voiceImgOpen,
39
39
  isBigVideo: 'video1',
40
- isCustomer: true,
40
+ isCustomer: false,
41
41
  publishDevic: 1,
42
42
  isSharedScreen: false,
43
43
  isSuspend: false,
@@ -45,10 +45,7 @@ class Video extends Component {
45
45
  customAudioed: false,
46
46
  recordId: '', // 录制id
47
47
  contentDress: '', // 地理位置
48
- callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',// 回调地址外部
49
- businessNumber: '', // 外部传入的流水号
50
48
  workSpaceId: '',
51
- tellerId: 'ts001',
52
49
  bizName: '',
53
50
  appId: '',
54
51
  // room_server_url: 'wss://cn-hangzhou-mrtc.cloud.alipay.com/ws',
@@ -65,13 +62,12 @@ class Video extends Component {
65
62
  * 创建房间成功后回调后台
66
63
  * @param {JSON} data 数据类型
67
64
  */
68
- createRoom = async data => {
69
- console.log(data);
65
+ createRoom = async () => {
70
66
  try {
71
67
  let result = await API.createRoom({
72
- tellerAccount: this.state.tellerId,
73
- businessNumber: this.state.businessNumber,
74
- callbackUrl: this.state.callbackUrl,
68
+ tellerAccount: this.props.tellerAccount,
69
+ businessNumber: this.props.businessNumber,
70
+ callbackUrl: this.props.callbackUrl,
75
71
  roomId: this.state.channelId,
76
72
  mtoken: this.state.rtoken
77
73
  });
@@ -83,7 +79,7 @@ class Video extends Component {
83
79
  sessionId: result.sessionId
84
80
  });
85
81
  // eslint-disable-next-line no-undef
86
- joinRoom((this.state.tellerId + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
82
+ joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
87
83
  } catch (err) {
88
84
  console.error(err);
89
85
  }
@@ -124,7 +120,7 @@ class Video extends Component {
124
120
  initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
125
121
  const config_param = {};
126
122
  config_param.workspaceId = this.state.workSpaceId;
127
- config_param.uid = this.state.tellerId;
123
+ config_param.uid = this.props.tellerAccount;
128
124
  config_param.biz_name = this.state.bizName; // 'demo'
129
125
  config_param.appId = this.state.appId;
130
126
 
@@ -365,7 +361,7 @@ class Video extends Component {
365
361
  'typeId': 2030,
366
362
  'sessionId': this.state.sessionId,
367
363
  'sharedScreen': 1,
368
- 'tellerId': this.state.tellerId
364
+ 'tellerId': this.props.tellerAccount
369
365
  })
370
366
  });
371
367
  if (this.isFileSuccuse()) {
@@ -461,7 +457,7 @@ class Video extends Component {
461
457
  };
462
458
 
463
459
  let data = {
464
- account: this.state.tellerId,
460
+ account: this.props.tellerAccount,
465
461
  type: '2',
466
462
  sigType: 1
467
463
  };
@@ -835,7 +831,7 @@ class Video extends Component {
835
831
  'typeId': 2030,
836
832
  'sessionId': this.state.sessionId,
837
833
  'sharedScreen': 1,
838
- 'tellerId': this.state.tellerId
834
+ 'tellerId': this.props.tellerAccount
839
835
  })
840
836
  });
841
837
  this.setState({
@@ -857,7 +853,7 @@ class Video extends Component {
857
853
  'typeId': 2030,
858
854
  'sessionId': this.state.sessionId,
859
855
  'sharedScreen': 0,
860
- 'tellerId': this.state.tellerId
856
+ 'tellerId': this.props.tellerAccount
861
857
  })
862
858
  })
863
859
  }
@@ -962,7 +958,7 @@ class Video extends Component {
962
958
  'typeId': 1012,
963
959
  'state': 0,
964
960
  'sessionId': this.state.sessionId,
965
- 'userId': this.state.tellerId
961
+ 'userId': this.props.tellerAccount
966
962
  })
967
963
  }, function (code, message, data) {
968
964
  console.log(data)
@@ -986,7 +982,7 @@ class Video extends Component {
986
982
  'typeId': 1012,
987
983
  'state': 1,
988
984
  'sessionId': this.state.sessionId,
989
- 'userId': this.state.tellerId
985
+ 'userId': this.props.tellerAccount
990
986
  })
991
987
  }, function (code, message, data) {
992
988
  console.log(data)
@@ -1064,7 +1060,7 @@ class Video extends Component {
1064
1060
  'typeId': 1011,
1065
1061
  'state': 1,
1066
1062
  'sessionId': this.state.sessionId,
1067
- 'userId': this.state.tellerId
1063
+ 'userId': this.props.tellerAccount
1068
1064
  })
1069
1065
  }, function (code, message, data) {
1070
1066
  console.log(data)
@@ -1084,7 +1080,7 @@ class Video extends Component {
1084
1080
  'typeId': 1012,
1085
1081
  'state': 1,
1086
1082
  'sessionId': this.state.sessionId,
1087
- 'userId': this.state.tellerId
1083
+ 'userId': this.props.tellerAccount
1088
1084
  })
1089
1085
  }, function (code, message, data) {
1090
1086
  console.log(data)
@@ -1101,7 +1097,7 @@ class Video extends Component {
1101
1097
  'typeId': 1011,
1102
1098
  'state': 0,
1103
1099
  'sessionId': this.state.sessionId,
1104
- 'userId': this.state.tellerId
1100
+ 'userId': this.props.tellerAccount
1105
1101
  })
1106
1102
  }, function (code, message, data) {
1107
1103
  console.log(data)
@@ -1174,22 +1170,6 @@ class Video extends Component {
1174
1170
  })
1175
1171
  }
1176
1172
  render() {
1177
- const { tellerAccount, businessNumber, callbackUrl} = this.props
1178
- if(tellerAccount) {
1179
- this.setState({
1180
- tellerId: tellerAccount
1181
- })
1182
- }
1183
- if(businessNumber) {
1184
- this.setState({
1185
- tellerId: businessNumber
1186
- })
1187
- }
1188
- if(callbackUrl) {
1189
- this.setState({
1190
- tellerId: callbackUrl
1191
- })
1192
- }
1193
1173
  return (
1194
1174
  <div className="all">
1195
1175
  <Header></Header>
@@ -1377,5 +1357,9 @@ class Video extends Component {
1377
1357
  );
1378
1358
  }
1379
1359
  }
1380
-
1360
+ Video.defaultProps = {
1361
+ tellerAccount: 't001',
1362
+ businessNumber: '123',
1363
+ callbackUrl:'http://47.102.126.132:8720/hsbc/callback'
1364
+ }
1381
1365
  export default Video;
package/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import "./index.less";
4
- // import { HSBC } from "../lib/hsbc";
5
- import {HSBC} from "../packages";
4
+ import { HSBC } from "../lib/hsbc";
5
+ // import {HSBC} from "../packages";
6
6
 
7
7
  ReactDOM.render(
8
8
  <div className="hsbc"><HSBC></HSBC></div>,