|
扫描的时候苹果手机有3-4秒的停顿,安卓手机没有停顿的情况;
这是我的代码:
FNScanner = api.require('FNScanner');
FNScanner.openView({
fixedOn: api.frameName,
sound: 'widget://res/music/canner.wav', // 扫描结束后的提示音文件路径,推荐使用 wav 格式的短音频文件,
autorotation: false, // 扫描页面是否自动旋转(横竖屏)
saveToAlbum: false, // 扫描的二维码/条形码图片是否自动保存到相册
interval:3,
rect: {
x: 0,
y: headerH,
w: api.frameWidth,
h: 200,//api.frameHeight
}
}, function (ret, err) {
if (ret) {
if (ret.eventType == 'success' && ret.content != '') {
fnOpenCouple(ret.content);
return;
}
if (ret.eventType == 'cameraError') {
api.toast({
msg: '请开启app访问手机摄像头权限',
duration: 2000,
location: 'bottom'
});
return;
}
if (ret.eventType == 'albumError') {
api.toast({
msg: '请开启app访问手机相册权限',
duration: 2000,
location: 'bottom'
});
return;
}
if (ret.eventType == 'fail') {
api.toast({
msg: '扫码失败,请从新扫码',
duration: 2000,
location: 'bottom'
});
}
} else {
api.toast({
msg: '扫码错误请稍后再试',
duration: 2000,
location: 'bottom'
});
}
});
setTimeout(function () {
// 打开扫码动画frm页面
api.openFrame({
name: 'add_frm',
url: 'widget://html/scanner/add_frm.html',
rect: {
x: 0, y: headerH, w: api.frameWidth, h: 200
},
//bgColor:'#FFFFFF',
bgColor: 'rgba(0,0,0,0)',
});
}, 300);
|
|