Commit ae1a50ed authored by jiangjiantao's avatar jiangjiantao

bugfixed

parent c12868bd
...@@ -20,22 +20,36 @@ export default class scan { ...@@ -20,22 +20,36 @@ export default class scan {
my.ix.onKeyEventChange(page._keyEventListener = (r) => { my.ix.onKeyEventChange(page._keyEventListener = (r) => {
let cur = getCurrentPages().slice(-1)[0]; let cur = getCurrentPages().slice(-1)[0];
if (cur && cur.onKeyPress) { if (cur && cur.onKeyPress) {
if (isScaning == false) {
isScaning = true if (k >= 7 && k <= 16) {
code = (r.keyCode - 7) + '' // 将 keyCode 的值转换为扫描的实际数值。
setTimeout(() => { if (this._barcode === undefined)
//兼容扫描枪 code = '';
if(code.endsWith("5913")){ code += (k - 7).toString();
code = code.substring(0,code.length - 4) return;
} } else if (k === 66) {
cur.onKeyPress.call(cur, code); // 末尾追加 Enter 确认。
isScaning = false console.log('Scan Barcode', code);
}, 700); code = '';
} else { return;
//特殊处理 keycode需要减7
code = code + (r.keyCode - 7)
} }
// if (isScaning == false) {
// isScaning = true
// code = (r.keyCode - 7) + ''
// setTimeout(() => {
// //兼容扫描枪
// if(code.endsWith("5913")){
// code = code.substring(0,code.length - 4)
// }
// cur.onKeyPress.call(cur, code);
// isScaning = false
// }, 700);
// } else {
// //特殊处理 keycode需要减7
// code = code + (r.keyCode - 7)
// }
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment