上次使用QRCode.js可以来生成二维码,但是我没有找到有文档说明可以对存在的二维码进行扫描解析其中的内容。
幸亏查找到了可行的解决方案,而且很好使哦!就是reqrcode.js
地址:https://gitee.com/weijunw/erweima/tree/master
reqrcode.js
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
var
_aa={};_aa._ab=
function
(f,e){
var
d=qrcode.width;
var
b=qrcode.height;
var
c=
true
;
for
(
var
g=
0
;g<e.length&&c;g+=
2
){
var
a=Math.floor(e[g]);
var
h=Math.floor(e[g+
1
]);
if
(a<-1||a>d||h<-1||h>b){
throw
"Error._ab "
}c=
false
;
if
(a==-
1
){e[g]=
0
;c=
true
}
else
{
if
(a==d){e[g]=d-
1
;c=
true
}}
if
(h==-
1
){e[g+
1
]=
0
;c=
true
}
else
{
if
(h==b){e[g+
1
]=b-
1
;c=
true
}}}c=
true
;
for
(
var
g=e.length-
2
;g>=
0
&&c;g-=
2
){
var
a=Math.floor(e[g]);
var
h=Math.floor(e[g+
1
]);
if
(a<-1||a>d||h<-1||h>b){
throw
"Error._ab "
}c=
false
;
if
(a==-
1
){e[g]=
0
;c=
true
}
else
{
if
(a==d){e[g]=d-
1
;c=
true
}}
if
(h==-
1
){e[g+
1
]=
0
;c=
true
}
else
{
if
(h==b){e[g+
1
]=b-
1
;c=
true
}}}};_aa._af=
function
(b,d,a){
var
k=
new
_ac(d);
var
j=
new
Array(d<<
1
);
for
(
var
f=
0
;f<d;f++){
var
g=j.length;
var
i=f+
0
.
5
;
for
(
var
h=
0
;h<g;h+=
2
){j[h]=(h>>
1
)+
0
.
5
;j[h+
1
]=i}a._ad(j);_aa._ab(b,j);
try
{
for
(
var
h=
0
;h<g;h+=
2
){
var
e=b[Math.floor(j[h])+qrcode.width*Math.floor(j[h+
1
])];
if
(e){k._dq(h>>
1
,f)}}}
catch
(c){
throw
"Error._ab"
}}
return
k};_aa._ah=
function
(h,o,l,k,q,p,b,a,f,e,n,m,s,r,d,c,j,i){
var
g=_ae._ag(l,k,q,p,b,a,f,e,n,m,s,r,d,c,j,i);
return
_aa._af(h,o,g)};
function
_a1(b,a){
this
.count=b;
this
._fc=a;
this
.__defineGetter__(
"Count"
,
function
(){
return
this
.count});
this
.__defineGetter__(
"_dm"
,
function
(){
return
this
._fc})}
function
_a2(a,c,b){
this
._bm=a;
if
(b){
this
._do=
new
Array(c,b)}
else
{
this
._do=
new
Array(c)}
this
.__defineGetter__(
"_bo"
,
function
(){
return
this
._bm});
this
.__defineGetter__(
"_dn"
,
function
(){
return
this
._bm*
this
._fo});
this
.__defineGetter__(
"_fo"
,
function
(){
var
e=
0
;
for
(
var
d=
0
;d<
this
._do.length;d++){e+=
this
._do[d].length}
return
e});
this
._fb=
function
(){
return
this
._do}}
function
_a3(k,l,h,g,f,e){
this
._bs=k;
this
._ar=l;
this
._do=
new
Array(h,g,f,e);
var
j=
0
;
var
b=h._bo;
var
a=h._fb();
for
(
var
d=
0
;d<a.length;d++){
var
c=a[d];j+=c.Count*(c._dm+b)}
this
._br=j;
this
.__defineGetter__(
"_fd"
,
function
(){
return
this
._bs});
this
.__defineGetter__(
"_as"
,
function
(){
return
this
._ar});
this
.__defineGetter__(
"_dp"
,
function
(){
return
this
._br});
this
.__defineGetter__(
"_cr"
,
function
(){
return
17
+
4
*
this
._bs});
this
._aq=
function
(){
var
q=
this
._cr;
var
o=
new
_ac(q);o._bq(
0
,
0
,
9
,
9
);o._bq(q-
8
, 0 , 8 , 9 );o._bq( 0 ,q- 8 , 9 , 8 ); var n= this ._ar.length; for ( var m= 0 ;m<n;m++){ var p= this ._ar[m]- 2 ; for ( var r= 0 ;r<n;r++){ if ((m== 0 &&(r==0||r==n- 1 ))||(m==n- 1 &&r== 0 )){ continue }o._bq( this ._ar[r]- 2 ,p, 5 , 5 )}}o._bq( 6 , 9 , 1 ,q- 17 );o._bq( 9 , 6 ,q- 17 , 1 ); if ( this ._bs> 6 ){o._bq(q- 11 , 0 , 3 , 6 );o._bq( 0 ,q- 11 , 6 , 3 )} return o}; this ._bu= function (i){ return this ._do[i.ordinal()]}}_a3._bv= new Array( 31892 , 34236 , 39577 , 42195 , 48118 , 51042 , 55367 , 58893 , 63784 , 68472 , 70749 , 76311 , 79154 , 84390 , 87683 , 92361 , 96236 , 102084 , 102881 , 110507 , 110734 , 117786 , 119615 , 126325 , 127568 , 133589 , 136944 , 141498 , 145311 , 150283 , 152622 , 158308 , 161089 , 167017 );_a3.VERSIONS=_ay();_a3._av= function (a){ if (a<1||a> 40 ){ throw "bad arguments" } return _a3.VERSIONS[a- 1 ]};_a3._at= function (b){ if (b% 4 != 1 ){ throw "Error _at" } try { return _a3._av((b- 17 )>> 2 )} catch (a){ throw "Error _av" }};_a3._aw= function (d){ var b= 4294967295 ; var f= 0 ; for ( var c= 0 ;c<_a3._bv.length;c++){ var a=_a3._bv[c]; if (a==d){ return this ._av(c+ 7 )} var e=_ax._gj(d,a); if (e<b){f=c+ 7 ;b=e}} if (b<= 3 ){ return this ._av(f)} return null }; function _ay(){ return new Array( new _a3( 1 , new Array(), new _a2( 7 , new _a1( 1 , 19 )), new _a2( 10 , new _a1( 1 , 16 )), new _a2( 13 , new _a1( 1 , 13 )), new _a2( 17 , new _a1( 1 , 9 ))), new _a3( 2 , new Array( 6 , 18 ), new _a2( 10 , new _a1( 1 , 34 )), new _a2( 16 , new _a1( 1 , 28 )), new _a2( 22 , new _a1( 1 , 22 )), new _a2( 28 , new _a1( 1 , 16 ))), new _a3( 3 , new Array( 6 , 22 ), new _a2( 15 , new _a1( 1 , 55 )), new _a2( 26 , new _a1( 1 , 44 )), new _a2( 18 , new _a1( 2 , 17 )), new _a2( 22 , new _a1( 2 , 13 ))), new _a3( 4 , new Array( 6 , 26 ), new _a2( 20 , new _a1( 1 , 80 )), new _a2( 18 , new _a1( 2 , 32 )), new _a2( 26 , new _a1( 2 , 24 )), new _a2( 16 , new _a1( 4 , 9 ))), new _a3( 5 , new Array( 6 , 30 ), new _a2( 26 , new _a1( 1 , 108 )), new _a2( 24 , new _a1( 2 , 43 )), new _a2( 18 , new _a1( 2 , 15 ), new _a1( 2 , 16 )), new _a2( 22 , new _a1( 2 , 11 ), new _a1( 2 , 12 ))), new _a3( 6 , new Array( 6 , 34 ), new _a2( 18 , new _a1( 2 , 68 )), new _a2( 16 , new _a1( 4 , 27 )), new _a2( 24 , new _a1( 4 , 19 )), new _a2( 28 , new _a1( 4 , 15 ))), new _a3( 7 , new Array( 6 , 22 , 38 ), new _a2( 20 , new _a1( 2 , 78 )), new _a2( 18 , new _a1( 4 , 31 )), new _a2( 18 , new _a1( 2 , 14 ), new _a1( 4 , 15 )), new _a2( 26 , new _a1( 4 , 13 ), new _a1( 1 , 14 ))), new _a3( 8 , new Array( 6 , 24 , 42 ), new _a2( 24 , new _a1( 2 , 97 )),ne w _a2( 22 , new _a1( 2 , 38 ), new _a1( 2 , 39 )), new _a2( 22 , new _a1( 4 , 18 ), new _a1( 2 , 19 )), new _a2( 26 , new _a1( 4 , 14 ), new _a1( 2 , 15 ))), new _a3( 9 , new Array( 6 , 26 , 46 ), new _a2( 30 , new _a1( 2 , 116 )), new _a2( 22 , new _a1( 3 , 36 ), new _a1( 2 , 37 )), new _a2( 20 , new _a1( 4 , 16 ), new _a1( 4 , 17 )), new _a2( 24 , new _a1( 4 , 12 ), new _a1( 4 , 13 ))), new _a3( 10 , new Array( 6 , 28 , 50 ), new _a2( 18 , new _a1( 2 , 68 ), new _a1( 2 , 69 )), new _a2( 26 , new _a1( 4 , 43 ), new _a1( 1 , 44 )), new _a2( 24 , new _a1( 6 , 19 ), new _a1( 2 , 20 )), new _a2( 28 , new _a1( 6 , 15 ), new _a1( 2 , 16 ))), new _a3( 11 , new Array( 6 , 30 , 54 ), new _a2( 20 , new _a1( 4 , 81 )), new _a2( 30 , new _a1( 1 , 50 ), new _a1( 4 , 51 )), new _a2( 28 , new _a1( 4 , 22 ), new _a1( 4 , 23 )), new _a2( 24 , new _a1( 3 , 12 ), new _a1( 8 , 13 ))), new _a3( 12 , new Array( 6 , 32 , 58 ), new _a2( 24 , new _a1( 2 , 92 ), new _a1( 2 , 93 )), new _a2( 22 , new _a1( 6 , 36 ), new _a1( 2 , 37 )), new _a2( 26 , new _a1( 4 , 20 ), new _a1( 6 , 21 )), new _a2( 28 , new _a1( 7 , 14 ), new _a1( 4 , 15 ))), new _a3( 13 , new Array( 6 , 34 , 62 ), new _a2( 26 , new _a1( 4 , 107 )), new _a2( 22 , new _a1( 8 , 37 ), new _a1( 1 , 38 )), new _a2( 24 , new _a1( 8 , 20 ), new _a1( 4 , 21 )), new _a2( 22 , new _a1( 12 , 11 ), new _a1( 4 , 12 ))), new _a3( 14 , new Array( 6 , 26 , 46 , 66 ), new _a2( 30 , new _a1( 3 , 115 ), new _a1( 1 , 116 )), new _a2( 24 , new _a1( 4 , 40 ), new _a1( 5 , 41 )), new _a2( 20 , new _a1( 11 , 16 ), new _a1( 5 , 17 )), new _a2( 24 , new _a1( 11 , 12 ), new _a1( 5 , 13 ))), new _a3( 15 , new Array( 6 , 26 , 48 , 70 ), new _a2( 22 , new _a1( 5 , 87 ), new _a1( 1 , 88 )), new _a2( 24 , new _a1( 5 , 41 ), new _a1( 5 , 42 )), new _a2( 30 , new _a1( 5 , 24 ), new _a1( 7 , 25 )), new _a2( 24 , new _a1( 11 , 12 ), new _a1( 7 , 13 ))), new _a3( 16 , new Array( 6 , 26 , 50 , 74 ), new _a2( 24 , new _a1( 5 , 98 ), new _a1( 1 , 99 )), new _a2( 28 , new _a1( 7 , 45 ), new _a1( 3 , 46 )), new _a2( 24 , new _a1( 15 , 19 ), new _a1( 2 , 20 )), new _a2( 30 , new _a1( 3 , 15 ), new _a1( 13 , 16 ))), new _a3( 17 , new Array( 6 , 30 , 54 , 78 ), new _a2( 28 , new _a1( 1 , 107 ), new _a1( 5 , 108 )), new _a2( 28 , new _a1( 10 , 46 ), new _a1( 1 , 47 )), new _a2( 28 , new _a1( 1 , 22 ), new _a1( 15 , 23 )), new _a2( 28 , new _a1( 2 , 14 ), new _a1( 17 , 15 ))), new _a3( 18 , new Array( 6 , 30 , 56 , 82 ), new _a2( 30 , new _a1( 5 , 120 ), new _a1( 1 , 121 )), new _a2( 26 , new _a1( 9 , 43 ), new _a1( 4 , 44 )), new _a2( 28 , new _a1( 17 , 22 ), new _a1( 1 , 23 )), new _a2( 28 , new _a1( 2 , 14 ), new _a1( 19 , 15 ))), new _a3( 19 , new Array( 6 , 30 , 5 8 , 86 ), new _a2( 28 , new _a1( 3 , 113 ), new _a1( 4 , 114 )), new _a2( 26 , new _a1( 3 , 44 ), new _a1( 11 , 45 )), new _a2( 26 , new _a1( 17 , 21 ), new _a1( 4 , 22 )), new _a2( 26 , new _a1( 9 , 13 ), new _a1( 16 , 14 ))), new _a3( 20 , new Array( 6 , 34 , 62 , 90 ), new _a2( 28 , new _a1( 3 , 107 ), new _a1( 5 , 108 )), new _a2( 26 , new _a1( 3 , 41 ), new _a1( 13 , 42 )), new _a2( 30 , new _a1( 15 , 24 ), new _a1( 5 , 25 )), new _a2( 28 , new _a1( 15 , 15 ), new _a1( 10 , 16 ))), new _a3( 21 , new Array( |