|
FNScanner.open({
autorotation: true
}, function(ret,err) {
if (ret) {
alert(JSON.stringify(ret)+'-----------扫码')
if(ret.eventType=="success"){
var url=ret.content,
yqmindex=url.indexOf("yqm");
if(yqmindex!=-1){
var query = url.split("?")[1],
yqm=query.split("=")[1];
if(yqm!=""&&yqm!=null){
$api.val($api.byId("superior_yqm"),yqm);
$api.css($api.byId("superior_yqm"),"color","#999999");
$api.attr($api.byId("superior_yqm"),"readonly","readonly");
}
console.log(yqm)
}else{
alert("这不是正规的二维码");
}
}else if(ret.eventType=="cameraError"){
toastFn("APP未获取摄像头权限,请前去应用权限设置");
}else if(ret.eventType=="albumError"){
toastFn("APP未获取摄像头权限,请前去应用权限设置");
}
// alert(JSON.stringify(ret));
}else{
toastFn(JSON.stringify(err));
}
}); |
|