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
0dab6a95
Commit
0dab6a95
authored
Feb 27, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容摄像头扫描
parent
cdd140bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
scan.js
utils/scan.js
+13
-1
No files found.
utils/scan.js
View file @
0dab6a95
...
@@ -7,10 +7,20 @@ export default class scan {
...
@@ -7,10 +7,20 @@ export default class scan {
page
[
f
]
=
(...
args
)
=>
{
page
[
f
]
=
(...
args
)
=>
{
if
(
f
===
'onShow'
)
{
if
(
f
===
'onShow'
)
{
if
(
!
page
.
_keyEventListener
)
{
if
(
!
page
.
_keyEventListener
)
{
//摄像头
my
.
ix
.
onCodeScan
((
r
)
=>
{
if
(
r
.
success
){
let
cur
=
getCurrentPages
().
slice
(
-
1
)[
0
];
cur
.
onKeyPress
.
call
(
cur
,
code
);
}
console
.
log
(
'code: '
+
r
.
code
);
});
//物理扫码枪
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
)
{
if
(
isScaning
==
false
)
{
isScaning
=
true
isScaning
=
true
code
=
(
r
.
keyCode
-
7
)
+
''
code
=
(
r
.
keyCode
-
7
)
+
''
...
@@ -34,6 +44,8 @@ export default class scan {
...
@@ -34,6 +44,8 @@ export default class scan {
if
(
page
.
_keyEventListener
)
{
if
(
page
.
_keyEventListener
)
{
my
.
ix
.
offKeyEventChange
(
page
.
_keyEventListener
);
my
.
ix
.
offKeyEventChange
(
page
.
_keyEventListener
);
page
.
_keyEventListener
=
null
;
page
.
_keyEventListener
=
null
;
//摄像头资源释放
my
.
ix
.
offCodeScan
();
}
}
}
}
if
(
raw
instanceof
Function
)
{
if
(
raw
instanceof
Function
)
{
...
...
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