Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
e3989226
Commit
e3989226
authored
Feb 27, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容摄像头
parent
ae1a50ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
35 deletions
+19
-35
home.js
pages/home/home.js
+6
-6
scan.js
utils/scan.js
+13
-29
No files found.
pages/home/home.js
View file @
e3989226
...
...
@@ -38,12 +38,12 @@ Page({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_GO_SCAN
)
{
if
(
res
.
data
.
printEnabled
!=
null
)
{
my
.
setStorageSync
({
key
:
'printEnabled'
,
data
:
{
enabled
:
res
.
data
.
printEnabled
}
})
}
//
if (res.data.printEnabled != null) {
//
my.setStorageSync({
//
key: 'printEnabled',
//
data: { enabled: res.data.printEnabled }
//
})
//
}
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
...
...
utils/scan.js
View file @
e3989226
...
...
@@ -20,36 +20,20 @@ export default class scan {
my
.
ix
.
onKeyEventChange
(
page
.
_keyEventListener
=
(
r
)
=>
{
let
cur
=
getCurrentPages
().
slice
(
-
1
)[
0
];
if
(
cur
&&
cur
.
onKeyPress
)
{
if
(
k
>=
7
&&
k
<=
16
)
{
// 将 keyCode 的值转换为扫描的实际数值。
if
(
this
.
_barcode
===
undefined
)
code
=
''
;
code
+=
(
k
-
7
).
toString
();
return
;
}
else
if
(
k
===
66
)
{
// 末尾追加 Enter 确认。
console
.
log
(
'Scan Barcode'
,
code
);
code
=
''
;
return
;
if
(
isScaning
==
false
)
{
isScaning
=
true
code
=
(
r
.
keyCode
-
7
)
+
''
setTimeout
(()
=>
{
//兼容扫描枪
cur
.
onKeyPress
.
call
(
cur
,
code
);
isScaning
=
false
},
700
);
}
else
{
//特殊处理 keycode需要减7
if
(
r
.
keyCode
>=
7
&&
r
.
keyCode
<=
16
)
{
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)
// }
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment