|
@@ -75,11 +75,17 @@
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
|
- // 初始化摄像头
|
|
|
- this.init()
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: '扫描条形码—' +this.layer+'层'
|
|
|
})
|
|
|
+ // 设置高度
|
|
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
+ query.select('#barcode').boundingClientRect(data => {
|
|
|
+ this.barcode.setStyle({
|
|
|
+ width: data.width + 'px',
|
|
|
+ height: data.height + 'px' // 调整扫码控件的位置
|
|
|
+ })
|
|
|
+ }).exec()
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.shelfSn = options.shelfSn
|
|
@@ -87,6 +93,8 @@
|
|
|
this.shelfName = options.shelfName
|
|
|
this.customerSn = options.customerSn
|
|
|
this.fromPage = options.from
|
|
|
+ // 初始化摄像头
|
|
|
+ this.init()
|
|
|
},
|
|
|
onBackPress(e) {
|
|
|
uni.$emit("updateTempHw")
|
|
@@ -191,7 +199,17 @@
|
|
|
init(){
|
|
|
const _this = this
|
|
|
// 初始化
|
|
|
- this.barcode = plus.barcode.create('barcode', [], {
|
|
|
+ this.barcode = plus.barcode.create('barcode', [
|
|
|
+ plus.barcode.QR,
|
|
|
+ plus.barcode.EAN13,
|
|
|
+ plus.barcode.EAN8,
|
|
|
+ plus.barcode.UPCA,
|
|
|
+ plus.barcode.UPCE,
|
|
|
+ plus.barcode.CODABAR,
|
|
|
+ plus.barcode.CODE39,
|
|
|
+ plus.barcode.CODE128,
|
|
|
+ plus.barcode.ITF
|
|
|
+ ], {
|
|
|
top:'0px',
|
|
|
left:'0px',
|
|
|
width: '100%',
|
|
@@ -200,14 +218,6 @@
|
|
|
frameColor: '#00aaff',
|
|
|
scanbarColor: '#00aaff'
|
|
|
})
|
|
|
- // 设置高度
|
|
|
- const query = uni.createSelectorQuery().in(this);
|
|
|
- query.select('#barcode').boundingClientRect(data => {
|
|
|
- this.barcode.setStyle({
|
|
|
- width: data.width + 'px',
|
|
|
- height: data.height + 'px' // 调整扫码控件的位置
|
|
|
- })
|
|
|
- }).exec()
|
|
|
|
|
|
// 扫码成功后
|
|
|
this.barcode.onmarked = function(type, result) {
|