@cniot/android-pda-components 0.2.20 → 0.2.21

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 (113) hide show
  1. package/README.md +4 -21
  2. package/build/assets/index.51a8714a.css +1 -0
  3. package/build/assets/{index.66cd7994.js → index.b428d9a3.js} +16 -16
  4. package/build/assets/vendor.999402d8.js +40 -0
  5. package/build/index.html +3 -3
  6. package/package.json +1 -1
  7. package/packages/AppList/doc.jsx +138 -0
  8. package/packages/AppList/index.jsx +33 -0
  9. package/packages/AppList/index.less +52 -0
  10. package/packages/BaseLayout/BarcodeScan.jsx +88 -0
  11. package/packages/BaseLayout/BaseLayoutContainer.jsx +208 -0
  12. package/packages/BaseLayout/RfidOnce.jsx +106 -0
  13. package/packages/BaseLayout/RfidScan.jsx +118 -0
  14. package/packages/BaseLayout/doc.jsx +177 -0
  15. package/packages/BaseLayout/index.jsx +52 -0
  16. package/packages/BaseLayout/index.less +47 -0
  17. package/packages/Button/doc.jsx +62 -0
  18. package/packages/Button/index.jsx +27 -0
  19. package/packages/Button/index.less +62 -0
  20. package/packages/Confirm/doc.jsx +147 -0
  21. package/packages/Confirm/index.jsx +71 -0
  22. package/packages/Confirm/index.less +55 -0
  23. package/packages/Header/doc.jsx +171 -0
  24. package/packages/Header/index.jsx +191 -0
  25. package/packages/Header/index.less +71 -0
  26. package/packages/InfoCard/doc.jsx +244 -0
  27. package/packages/InfoCard/index.jsx +67 -0
  28. package/packages/InfoCard/index.less +111 -0
  29. package/packages/List/doc.jsx +89 -0
  30. package/packages/List/index.jsx +54 -0
  31. package/packages/List/index.less +43 -0
  32. package/packages/Overlay/doc.jsx +103 -0
  33. package/packages/Overlay/index.jsx +42 -0
  34. package/packages/Overlay/index.less +28 -0
  35. package/packages/PdaActionSheet/doc.jsx +193 -0
  36. package/packages/PdaActionSheet/index.jsx +44 -0
  37. package/packages/PdaActionSheet/index.less +65 -0
  38. package/packages/PdaDistanceCard/doc.jsx +62 -0
  39. package/packages/PdaDistanceCard/index.jsx +35 -0
  40. package/packages/PdaDistanceCard/index.less +42 -0
  41. package/packages/PdaFinishCard/doc.jsx +111 -0
  42. package/packages/PdaFinishCard/index.jsx +62 -0
  43. package/packages/PdaFinishCard/index.less +62 -0
  44. package/packages/PdaInfiniteScroll/doc.jsx +121 -0
  45. package/packages/PdaInfiniteScroll/index.jsx +114 -0
  46. package/packages/PdaInfiniteScroll/index.less +12 -0
  47. package/packages/PdaInfiniteScroll/utils.jsx +25 -0
  48. package/packages/PdaSteps/PdaStep/index.jsx +38 -0
  49. package/packages/PdaSteps/PdaStep/index.less +70 -0
  50. package/packages/PdaSteps/PdaSteps/index.jsx +33 -0
  51. package/packages/PdaSteps/PdaSteps/index.less +0 -0
  52. package/packages/PdaSteps/doc.jsx +131 -0
  53. package/packages/PdaSteps/index.jsx +5 -0
  54. package/packages/PdaTitle/doc.jsx +102 -0
  55. package/packages/PdaTitle/index.jsx +51 -0
  56. package/packages/Presentation/doc.jsx +72 -0
  57. package/packages/Presentation/index.jsx +25 -0
  58. package/packages/Presentation/index.less +31 -0
  59. package/packages/SelectCard/doc.jsx +57 -0
  60. package/packages/SelectCard/index.jsx +13 -0
  61. package/packages/SelectCard/index.less +30 -0
  62. package/packages/SimpleCard/doc.jsx +59 -0
  63. package/packages/SimpleCard/index.jsx +13 -0
  64. package/packages/SimpleCard/index.less +38 -0
  65. package/packages/SimpleCardBlock/doc.jsx +77 -0
  66. package/packages/SimpleCardBlock/index.jsx +43 -0
  67. package/packages/SimpleCardBlock/index.less +26 -0
  68. package/packages/SubCard/doc.jsx +63 -0
  69. package/packages/SubCard/index.jsx +28 -0
  70. package/packages/SubCard/index.less +64 -0
  71. package/packages/Tag/doc.jsx +47 -0
  72. package/packages/Tag/index.jsx +12 -0
  73. package/packages/Tag/index.less +22 -0
  74. package/packages/TaskCard/doc.jsx +151 -0
  75. package/packages/TaskCard/index.jsx +65 -0
  76. package/packages/TaskCard/index.less +101 -0
  77. package/packages/Toast/doc.jsx +112 -0
  78. package/packages/Toast/index.jsx +7 -0
  79. package/packages/Toast/index.less +23 -0
  80. package/packages/Toast/methods.jsx +77 -0
  81. package/packages/Toast/toast.jsx +96 -0
  82. package/packages/WakeKeyborard/doc.jsx +170 -0
  83. package/packages/WakeKeyborard/index.jsx +61 -0
  84. package/packages/WakeKeyborard/index.less +55 -0
  85. package/packages/WakeKeyborard/keyborard.jsx +61 -0
  86. package/packages/doc.jsx +19 -0
  87. package/packages/global.less +7 -0
  88. package/packages/index.jsx +60 -0
  89. package/packages/index.less +3 -0
  90. package/packages/pageflow-system-pages/alert/doc.jsx +70 -0
  91. package/packages/pageflow-system-pages/alert/index.jsx +22 -0
  92. package/packages/pageflow-system-pages/confirm/doc.jsx +118 -0
  93. package/packages/pageflow-system-pages/confirm/index.jsx +31 -0
  94. package/packages/pageflow-system-pages/debug/index.jsx +27 -0
  95. package/packages/pageflow-system-pages/debug/index.less +5 -0
  96. package/packages/pageflow-system-pages/index.jsx +38 -0
  97. package/packages/pageflow-system-pages/loading/index.jsx +37 -0
  98. package/packages/pageflow-system-pages/not-found/index.jsx +12 -0
  99. package/packages/pageflow-system-pages/not-found/index.less +26 -0
  100. package/packages/pageflow-system-pages/prompt/doc.jsx +95 -0
  101. package/packages/pageflow-system-pages/prompt/index.jsx +43 -0
  102. package/packages/pageflow-system-pages/prompt/index.less +44 -0
  103. package/packages/pageflow-system-pages/start/index.jsx +28 -0
  104. package/packages/pageflow-system-pages/start/index.less +12 -0
  105. package/packages/pageflow-system-pages/toast/doc.jsx +76 -0
  106. package/packages/pageflow-system-pages/toast/index.jsx +42 -0
  107. package/packages/utils/index.js +56 -0
  108. package/packages/variable.less +4 -0
  109. package/build/assets/index.b8d6d64c.css +0 -1
  110. package/build/assets/vendor.5080796b.js +0 -40
  111. package/es/index.cjs.js +0 -7
  112. package/es/index.es.js +0 -2194
  113. package/es/style.css +0 -1
@@ -0,0 +1,88 @@
1
+ import React from "react";
2
+ import BaseLayoutContainer from './BaseLayoutContainer'
3
+ import classNames from "classnames";
4
+ import { playSound } from "../utils";
5
+
6
+ const blankFunc = () => { };
7
+
8
+ // onBarcodeScan 按下键才开始监听
9
+ // onScanBarcode 一直监听
10
+ export default class BarcodeScan extends React.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ this._barcodeBeginScan = false;
14
+ this._handleBarcodeScan = e => {
15
+ const { onBarcodeScan } = this.props;
16
+ this._stopWork();
17
+ playSound('scan');
18
+ onBarcodeScan && onBarcodeScan(e.param);
19
+ }
20
+ this._startWork = e => {
21
+ document.addEventListener('BarcodeScan', this._handleBarcodeScan);
22
+ this._barcodeBeginScan = true;
23
+ }
24
+ this._stopWork = e => {
25
+ document.removeEventListener('BarcodeScan', this._handleBarcodeScan);
26
+ }
27
+ this._handleKeyDown = e => {
28
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
29
+ // console.log('keydown code: ', code, keyCode, key);
30
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
31
+ if (!this._barcodeBeginScan) {
32
+ this._startWork();
33
+ }
34
+ }
35
+ }
36
+ this._handleKeyUp = e => {
37
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
38
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
39
+ this._stopWork();
40
+ this._barcodeBeginScan = false;
41
+ }
42
+ }
43
+
44
+ this.onScanBarcode = this.onScanBarcode.bind(this);
45
+ }
46
+
47
+ onScanBarcode(e){
48
+ this.props.onScanBarcode && this.props.onScanBarcode(e.param);
49
+ }
50
+
51
+ componentDidMount() {
52
+ const {onBarcodeScan} = this.props;
53
+ if(onBarcodeScan){
54
+ document.addEventListener('keydown', this._handleKeyDown);
55
+ document.addEventListener('keyup', this._handleKeyUp);
56
+ }
57
+ document.addEventListener('BarcodeScan', this.onScanBarcode);
58
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'barcode'}}", function (e) {
59
+ // alert('success ' + JSON.stringify(e));
60
+ }, function (e) {
61
+ // alert('failure ' + JSON.stringify(e));
62
+ });
63
+ }
64
+ componentWillUnmount() {
65
+ const {onBarcodeScan} = this.props;
66
+ if(onBarcodeScan){
67
+ document.removeEventListener('keydown', this._handleKeyDown);
68
+ document.removeEventListener('keyup', this._handleKeyUp);
69
+ }
70
+ document.removeEventListener('BarcodeScan', this.onScanBarcode)
71
+ }
72
+
73
+
74
+ render() {
75
+ // console.log('onBarcode render');
76
+
77
+ const props = this.props;
78
+ const { onBarcodeScan = blankFunc, ...opts } = props;
79
+
80
+ return (
81
+ <BaseLayoutContainer
82
+ {...opts}
83
+ />
84
+ )
85
+ }
86
+ }
87
+
88
+
@@ -0,0 +1,208 @@
1
+ import React from "react";
2
+ import "./index.less";
3
+ import classNames from "classnames";
4
+ import { WindVaneLog } from '../utils';
5
+
6
+ const blankFunc = () => { };
7
+
8
+ export default class BaseLayoutContainer extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.state = {
12
+ showLoading: false,
13
+ }
14
+ this._handleKeyUp = e => {
15
+ const { onScan = blankFunc, onEnter = blankFunc, onEsc = blankFunc, onDelete = blankFunc, scanMode = null } = this.props;
16
+
17
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
18
+ if (code === 'Enter') {
19
+ e.preventDefault();
20
+ onEnter(e);
21
+ return;
22
+ }
23
+ if (code === 'Delete') {
24
+ e.preventDefault();
25
+ onDelete(e);
26
+ return;
27
+ }
28
+ if (code === 'Esc') {
29
+ e.preventDefault();
30
+ onEsc(e);
31
+ return;
32
+ }
33
+ }
34
+ this._handleBeforeUnload = e => {
35
+ e.returnValue = ("确定离开当前页面吗?");
36
+ return true;
37
+ }
38
+ this._handleUnload = e => {
39
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function (e) {
40
+ // alert('success ' + JSON.stringify(e));
41
+ }, function (e) {
42
+ // alert('failure ' + JSON.stringify(e));
43
+ });
44
+ const stopParam = {
45
+ tag: 'stopRfid',
46
+ level: 'd',
47
+ message: 'stop rfid scan!!!'
48
+ };
49
+ WindVaneLog(stopParam);
50
+
51
+ const leaveParam = {
52
+ tag: 'leavePage',
53
+ level: 'd',
54
+ message: 'leave page: ' + window.location.href,
55
+ }
56
+ WindVaneLog(stopParam);
57
+ }
58
+ }
59
+ componentDidMount() {
60
+ // console.log('这里增加监听');
61
+ // window.onbeforeunload = this._handleBeforeUnload;
62
+ window.onunload = this._handleUnload;
63
+ document.addEventListener('keyup', this._handleKeyUp);
64
+ }
65
+ componentWillUnmount() {
66
+ // console.log('这里关闭页面了');
67
+ window.onbeforeunload = null;
68
+ window.onunload = null;
69
+ document.removeEventListener('keyup', this._handleKeyUp)
70
+ }
71
+ shouldComponentUpdate(nextProps, nextState) {
72
+ if(nextProps.loading && !this.props.loading) {
73
+ this.setState({
74
+ showLoading: true,
75
+ })
76
+ if(nextProps.loadingTimeout) {
77
+ setTimeout(() => {
78
+ this.setState({
79
+ showLoading: false,
80
+ });
81
+ }, nextProps.loadingTimeout);
82
+ }
83
+ }
84
+ if(!nextProps.loading && this.state.showLoading) {
85
+ this.setState({
86
+ showLoading: false,
87
+ })
88
+ }
89
+ return true;
90
+ }
91
+
92
+ render() {
93
+ const props = this.props;
94
+ const { style = {}, header, footer, loading } = this.props;
95
+
96
+ return (
97
+ <div
98
+ className={classNames({ 'baselayout-wrapper': true, })} style={style}
99
+ >
100
+ {
101
+ header && <div className={classNames({ 'baselayout-header': true })}>
102
+ {header}
103
+ </div>
104
+ }
105
+ <div className={classNames({ 'baselayout-container': true })}>
106
+ {props.children}
107
+ </div>
108
+ {
109
+ footer && <div className={classNames({ 'baselayout-footer': true })}>
110
+ {footer}
111
+ </div>
112
+ }
113
+ {
114
+ this.state.showLoading ? (
115
+ <div className="loading">
116
+ {/* 加载中 */}
117
+ </div>
118
+ ) : null
119
+ }
120
+
121
+ </div>
122
+ )
123
+ }
124
+ }
125
+
126
+
127
+ // export default function BaseLayout(props) {
128
+ // console.log('render baseLayout:', props);
129
+
130
+ // const { style = {}, header, footer, continuousRfidScan = false, onRfidScan = blankFunc, onScan = blankFunc, onEnter = blankFunc, onEsc = blankFunc, onDelete = blankFunc } = props;
131
+
132
+ // // const [continuousRfidScanState, setContinuousRfidScanState] = useState(continuousRfidScan)
133
+
134
+ // // 监听按键事件
135
+ // useEffect(() => {
136
+ // const handleKeyUp = e => {
137
+ // // console.log(e);
138
+ // e.preventDefault();
139
+ // const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
140
+ // if (code === 'F23' || code === 'F24') {
141
+ // // console.log('scan');
142
+ // onScan(e);
143
+ // return;
144
+ // }
145
+ // if (code === 'Enter') {
146
+ // onEnter(e);
147
+ // return;
148
+ // }
149
+ // if (code === 'Delete') {
150
+ // onDelete(e);
151
+ // return;
152
+ // }
153
+ // if (code === 'Esc') {
154
+ // onEsc(e);
155
+ // return;
156
+ // }
157
+ // }
158
+ // document.addEventListener('keyup', handleKeyUp);
159
+ // return () => {
160
+ // document.removeEventListener('keyup', handleKeyUp);
161
+ // }
162
+ // }, [])
163
+
164
+ // // 监听连扫
165
+ // useEffect(() => {
166
+ // const handleContinuousRfidScan = (ev) => {
167
+ // onRfidScan(ev.param);
168
+ // }
169
+ // if(continuousRfidScan) {
170
+ // document.addEventListener('ContinuousRfidScan', handleContinuousRfidScan, false);
171
+ // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function (e) {
172
+ // // console.log('start success ' + JSON.stringify(e));
173
+ // }, function (e) {
174
+ // console.log('failure-1 ' + JSON.stringify(e));
175
+ // });
176
+ // }
177
+
178
+ // return () => {
179
+ // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopScan', 'params':null}", function (e) {
180
+ // // console.log('stop success ' + JSON.stringify(e));
181
+ // }, function (e) {
182
+ // console.log('failure-2 ' + JSON.stringify(e));
183
+ // });
184
+ // document.removeEventListener('ContinuousRfidScan', handleContinuousRfidScan, false)
185
+ // }
186
+ // }, [])
187
+
188
+ // return (
189
+ // <div
190
+ // className={classNames({ 'baselayout-wrapper': true, })} style={style}
191
+ // >
192
+ // {
193
+ // header && <div className={classNames({ 'baselayout-header': true })}>
194
+ // {header}
195
+ // </div>
196
+ // }
197
+ // <div className={classNames({ 'baselayout-container': true })}>
198
+ // {props.children}
199
+ // </div>
200
+ // {
201
+ // footer && <div className={classNames({ 'baselayout-footer': true })}>
202
+ // {footer}
203
+ // </div>
204
+ // }
205
+ // {/* <div className="baselayout-paddingbottom"></div> */}
206
+ // </div>
207
+ // )
208
+ // }
@@ -0,0 +1,106 @@
1
+ import React from "react";
2
+ import BaseLayoutContainer from './BaseLayoutContainer'
3
+ import classNames from "classnames";
4
+ import { playSound } from "../utils";
5
+
6
+ const blankFunc = () => { };
7
+
8
+ export default class RfidOnce extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this._rfidBeginScan = false;
12
+ this._handleRfidScan = e => {
13
+ const { onRfidOnce, onRfidBoxOnce, onRfidPalletOnce } = this.props;
14
+ const data = e.param;
15
+ const isBox = data.rfidData.startsWith("0F006");
16
+ const isPallet = data.rfidData.startsWith("0F011");
17
+
18
+ playSound('single_recog');
19
+
20
+ if(isPallet) {
21
+ let rfidData = data.rfidData;
22
+ data.originData = rfidData;
23
+ data.rfidData = rfidData.substr(5, 12)
24
+ }
25
+
26
+ if(onRfidBoxOnce && isBox) {
27
+ this._stopWork();
28
+ onRfidBoxOnce(data);
29
+ } else if(onRfidPalletOnce && isPallet) {
30
+ this._stopWork();
31
+ onRfidPalletOnce(data);
32
+ }
33
+ if(onRfidOnce){
34
+ this._stopWork();
35
+ onRfidOnce(data);
36
+ }
37
+ }
38
+ this._startWork = e => {
39
+ // console.log('start work');
40
+ document.addEventListener('ContinuousRfidScan', this._handleRfidScan);
41
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e) {
42
+ // alert('success ' + JSON.stringify(e));
43
+ }, function(e) {
44
+ // alert('failure ' + JSON.stringify(e));
45
+ });
46
+ this._rfidBeginScan = true;
47
+ }
48
+ this._stopWork = e => {
49
+ // console.log('stop work');
50
+ document.removeEventListener('ContinuousRfidScan', this._handleRfidScan);
51
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e) {
52
+ }, function(e) {
53
+ });
54
+ }
55
+ this._handleKeyDown = e => {
56
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
57
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
58
+ // console.log('keydown', this._rfidBeginScan);
59
+ if (!this._rfidBeginScan) {
60
+ this._startWork();
61
+ }
62
+ }
63
+ }
64
+ this._handleKeyUp = e => {
65
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
66
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
67
+ // console.log('keyup stop');
68
+ this._stopWork();
69
+ this._rfidBeginScan = false;
70
+ }
71
+ }
72
+ }
73
+
74
+ componentDidMount() {
75
+ document.addEventListener('keydown', this._handleKeyDown);
76
+ document.addEventListener('keyup', this._handleKeyUp);
77
+ // document.addEventListener('ContinuousRfidScan', function (data) {
78
+ // // console.log(JSON.stringify(data));
79
+ // // console.log(data);
80
+ // }, false);
81
+
82
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function (e) {
83
+ // alert('success ' + JSON.stringify(e));
84
+ }, function (e) {
85
+ // alert('failure ' + JSON.stringify(e));
86
+ });
87
+ }
88
+ componentWillUnmount() {
89
+ document.removeEventListener('keydown', this._handleKeyDown);
90
+ document.removeEventListener('keyup', this._handleKeyUp);
91
+ this._stopWork();
92
+ }
93
+
94
+ render() {
95
+ // console.log('onRfidOnce render');
96
+
97
+ const props = this.props;
98
+ const { onRfidOnce = blankFunc, ...opts } = props;
99
+
100
+ return (
101
+ <BaseLayoutContainer
102
+ {...opts}
103
+ />
104
+ )
105
+ }
106
+ }
@@ -0,0 +1,118 @@
1
+ import React from "react";
2
+ import BaseLayoutContainer from './BaseLayoutContainer'
3
+ import classNames from "classnames";
4
+
5
+ const blankFunc = () => { };
6
+
7
+ export default class RfidOnce extends React.Component {
8
+ static defaultProps = {
9
+ rfidReaderSleep: false,
10
+ }
11
+ constructor(props) {
12
+ super(props);
13
+ this._rfidBeginScan = false;
14
+ this._handleRfidScan = e => {
15
+ const { onRfidScan, onRfidBoxScan, onRfidPalletScan } = this.props;
16
+ const data = e.param;
17
+ const isBox = data.rfidData.startsWith("0F006");
18
+ const isPallet = data.rfidData.startsWith("0F011");
19
+ if(isPallet) {
20
+ let rfidData = data.rfidData;
21
+ data.originData = rfidData;
22
+ data.rfidData = rfidData.substr(5, 12)
23
+ }
24
+
25
+ if(isBox && onRfidBoxScan) {
26
+ onRfidBoxScan(data);
27
+ } else if(isPallet && onRfidPalletScan) {
28
+ onRfidPalletScan(data);
29
+ }
30
+ if(onRfidScan) {
31
+ onRfidScan(data);
32
+ }
33
+ }
34
+ this._startWork = e => {
35
+ document.addEventListener('ContinuousRfidScan', this._handleRfidScan);
36
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'startScan', 'params': null}", function(e) {
37
+
38
+ }, function(e) {
39
+
40
+ });
41
+ this._rfidBeginScan = true;
42
+ }
43
+ this._stopWork = e => {
44
+ document.removeEventListener('ContinuousRfidScan', this._handleRfidScan);
45
+ // WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopScan', 'params':null}", function(e) {
46
+ // }, function(e) {
47
+ // });
48
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'rfid', 'method': 'stopRfidScan', 'params':null}", function(e) {
49
+ }, function(e) {
50
+ });
51
+ }
52
+ this._handleKeyDown = e => {
53
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
54
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
55
+ if (!this._rfidBeginScan) {
56
+ this._startWork();
57
+ }
58
+ }
59
+ }
60
+ this._handleKeyUp = e => {
61
+ const { code, keyCode, key } = e; // code: F23/F24; keyCode: 0; key: uniden...
62
+ if (code === 'F22' || code === 'F23' || code === 'F24' || code === 'F9' || code ==='F16') {
63
+ this._stopWork();
64
+ this._rfidBeginScan = false;
65
+ }
66
+ }
67
+ }
68
+
69
+ componentDidMount() {
70
+ // console.log('Rfid Scan didMount');
71
+ const { autoRfidScan = false, rfidReaderSleep } = this.props;
72
+
73
+ WindVane.call('WindvanePlugin', 'invoke', "{'domain': 'keyboard', 'method': 'changeScanMode', 'params': {'scanMode': 'RFID'}}", function (e) {
74
+ // alert('success ' + JSON.stringify(e));
75
+ }, function (e) {
76
+ // alert('failure ' + JSON.stringify(e));
77
+ });
78
+
79
+ if(!autoRfidScan) {
80
+ document.addEventListener('keydown', this._handleKeyDown);
81
+ document.addEventListener('keyup', this._handleKeyUp);
82
+ } else {
83
+ if(!rfidReaderSleep) {
84
+ this._startWork();
85
+ }
86
+ }
87
+ }
88
+ componentWillUnmount() {
89
+ // const { autoRfidScan = false } = this.props;
90
+ document.removeEventListener('keydown', this._handleKeyDown);
91
+ document.removeEventListener('keyup', this._handleKeyUp);
92
+ this._stopWork();
93
+ }
94
+ shouldComponentUpdate(nextProps, nextState) {
95
+ if(this.props.autoRfidScan && (this.props.rfidReaderSleep !== nextProps.rfidReaderSleep) ) {
96
+ if(!nextProps.rfidReaderSleep) {
97
+ this._startWork();
98
+ } else {
99
+ this._stopWork();
100
+ }
101
+ }
102
+ return true;
103
+ }
104
+
105
+
106
+ render() {
107
+ // console.log('onRfidScan render');
108
+
109
+ const props = this.props;
110
+ const { onRfidScan = blankFunc, autoRfidScan, ...opts } = props;
111
+
112
+ return (
113
+ <BaseLayoutContainer
114
+ {...opts}
115
+ />
116
+ )
117
+ }
118
+ }
@@ -0,0 +1,177 @@
1
+ import React, {useState} from "react";
2
+ import BaseLayout from "./index";
3
+ import Title from '../PdaTitle';
4
+ import InfoCard from '../InfoCard';
5
+ import Button from '../Button';
6
+ import Presentation from '../Presentation';
7
+
8
+ // const ButtonGroup = Button.Group;
9
+
10
+ export default function () {
11
+ const [loading, setLoading] = useState(false);
12
+
13
+ const header = <Title></Title>;
14
+ const footer = (
15
+ <Button.Group>
16
+ <Button type="cutout" onClick={e => {
17
+ console.log('cancle')
18
+ setLoading(true);
19
+ if(!loading) {
20
+ setTimeout(() => {
21
+ setLoading(false);
22
+ }, 2000);
23
+ }
24
+ }}>取消</Button>
25
+ <Button type="primary">确认</Button>
26
+ </Button.Group>
27
+ )
28
+ const infoCard = [{}, {}, {}]
29
+
30
+ return (
31
+ <div>
32
+ <h1>Scan</h1>
33
+ <p>扫码组件</p>
34
+ <h2>示例</h2>
35
+ {/* const { type="default", width, style = {}, onClick } = this.props; */}
36
+ <div className="light-block" style={{display: 'flex'}}>
37
+ <div style={{width: 480, height: 800, position: 'relative'}}>
38
+ <BaseLayout
39
+ style={{backgroundColor: 'black', marginRight: 20,}}
40
+ header={header}
41
+ footer={footer}
42
+ loading={loading}
43
+ // loadingTimeout={2000}
44
+ >
45
+ <Presentation text="请靠近箱码进行识别" ></Presentation>
46
+
47
+ </BaseLayout>
48
+ </div>
49
+ <div style={{width: 480, height: 800, position: 'relative'}}>
50
+ <BaseLayout
51
+ style={{backgroundColor: 'black'}}
52
+ header={header}
53
+ footer={footer}
54
+ >
55
+ {
56
+ infoCard.map((item, index) => {
57
+ return <InfoCard
58
+ key={index}
59
+ title="待拣件数"
60
+ highlightInfo="800"
61
+ highlightInfoCN = "件"
62
+ highlightSubInfo="/800"
63
+ highlightSubInfoCN="件"
64
+ boldInfo="加粗显示:512/五厂综包一楼,这是加粗显示的货品名称可能有多行"
65
+ style={{
66
+ width: '400px',
67
+ backgroundColor: 'black',
68
+ }}
69
+ theme='dark'
70
+ infoList={
71
+ [
72
+ {label: '商品条码', content: '623126388798'},
73
+ {label: '截止日期', content: '2022-07-25'},
74
+ {label: '产品名称', content: '商品的名称'},
75
+ {label: '品号', content: '12398765423'},
76
+ ]
77
+ }
78
+ />
79
+ })
80
+ }
81
+ </BaseLayout>
82
+ </div>
83
+ </div>
84
+ <code className="code">{`
85
+ const header = <Title></Title>;
86
+ const footer = (
87
+ <Button.Group>
88
+ <Button type="cutout" onClick={e => console.log('cancle')}>取消</Button>
89
+ <Button type="primary">确认</Button>
90
+ </Button.Group>
91
+ )
92
+
93
+ <BaseLayout
94
+ header={header}
95
+ footer={footer}
96
+ >
97
+ <Presentation text="请靠近箱码进行识别" ></Presentation>
98
+ </BaseLayout>
99
+ `}</code>
100
+ <h2>参数</h2>
101
+ <table className="pure-table pure-table-bordered">
102
+ <thead>
103
+ <tr>
104
+ <th>属性</th>
105
+ <th>说明</th>
106
+ <th>类型</th>
107
+ <th>默认值</th>
108
+ </tr>
109
+ </thead>
110
+ <tbody>
111
+ <tr>
112
+ <td>header</td>
113
+ <td>吸顶组件</td>
114
+ <td></td>
115
+ <td></td>
116
+ </tr>
117
+ <tr>
118
+ <td>footer</td>
119
+ <td>吸底组件</td>
120
+ <td></td>
121
+ <td></td>
122
+ </tr>
123
+ <tr>
124
+ <td>onBarcodeScan</td>
125
+ <td>注册扫描二维码/条形码[徐福记项目专用]</td>
126
+ <td>Function</td>
127
+ <td>data => data.scanData</td>
128
+ </tr>
129
+
130
+ <tr>
131
+ <td>onScanBarcode</td>
132
+ <td>注册扫描二维码/条形码[推荐使用]</td>
133
+ <td>Function</td>
134
+ <td>data => data.scanData</td>
135
+ </tr>
136
+
137
+ <tr>
138
+ <td>onRfidOnce</td>
139
+ <td>按键按下/抬起,只触发第一个rfid码</td>
140
+ <td>Function</td>
141
+ <td>data => {}</td>
142
+ </tr>
143
+ <tr>
144
+ <td>onRfidBoxOnce</td>
145
+ <td>按键按下/抬起,只触发第一个 rfid 箱码</td>
146
+ <td>Function</td>
147
+ <td>data => {}</td>
148
+ </tr>
149
+ <tr>
150
+ <td>onRfidPalletOnce</td>
151
+ <td>按键按下/抬起,只触发第一个 rfid 栈板码</td>
152
+ <td>Function</td>
153
+ <td>data => {}</td>
154
+ </tr>
155
+ <tr>
156
+ <td>onRfidScan</td>
157
+ <td>按键按下/抬起触发 rfid 连续扫描</td>
158
+ <td>Function</td>
159
+ <td>data => {}</td>
160
+ </tr>
161
+ <tr>
162
+ <td>onRfidBoxScan</td>
163
+ <td>按键按下/抬起触发 rfid 箱码连续扫描</td>
164
+ <td>Function</td>
165
+ <td>data => {}</td>
166
+ </tr>
167
+ <tr>
168
+ <td>onRfidPalletScan</td>
169
+ <td>按键按下/抬起触发 rfid 栈板码连续扫描</td>
170
+ <td>Function</td>
171
+ <td>data => {}</td>
172
+ </tr>
173
+ </tbody>
174
+ </table>
175
+ </div>
176
+ );
177
+ }