Commit 24d76fdc by zhuxiaomei

条码扫描

parent 68123ecd
......@@ -57,13 +57,17 @@
barcode = null;
let that = this;
if (!barcode) {
barcode = new plus.barcode.Barcode('bcid', [plus.barcode.CODE128], {
barcode = new plus.barcode.Barcode('bcid', [plus.barcode.EAN13], {
frameColor: '#00FF00',
scanbarColor: '#00FF00'
});
barcode.onmarked = function (type, result) {
if (type === plus.barcode.CODE128) {
if (type === plus.barcode.EAN13) {
that._getSample(result)
}else{
that.$toast('扫描失败!')
barcode.close()
that._open()
}
};
plus.webview.currentWebview().append(barcode);
......@@ -71,17 +75,14 @@
barcode.start();
})
},
_getSample: async function (data) {
console.log(data,'data')
let res = await samplingSample.scanSample({qrcode: '123456'})
_getSample: async function (qrcode) {
let res = await samplingSample.scanSample({qrcode: qrcode})
if (res) {
this.$emit('on-result-change', res)
barcode.close();
this.showScan = false
} else {
this.$toast('扫描失败!')
barcode.close()
this._open()
this.$emit('on-result-change', {qrcode:qrcode})
}
},
_cancelScan() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment