| | |
| | | this.basePORT = UPORT |
| | | }, |
| | | methods: { |
| | | async scan() { |
| | | // #ifdef APP-PLUS |
| | | let status = await this.checkPermission(); |
| | | if (status !== 1) { |
| | | return; |
| | | } |
| | | // #endif |
| | | uni.scanCode({ |
| | | success: (res) => { |
| | | this.matnr = res.result |
| | | this.findMat(this.matnr) |
| | | }, |
| | | fail: (err) => { |
| | | // 需要注意的是小程序扫码不需要申请相机权限 |
| | | } |
| | | }); |
| | | } |
| | | // #ifdef APP-PLUS |
| | | , |
| | | async checkPermission(code) { |
| | | let status = permision.isIOS ? await permision.requestIOS('camera') : |
| | | await permision.requestAndroid('android.permission.CAMERA'); |
| | | |
| | | if (status === null || status === 1) { |
| | | status = 1; |
| | | } else { |
| | | uni.showModal({ |
| | | content: "需要相机权限", |
| | | confirmText: "设置", |
| | | success: function(res) { |
| | | if (res.confirm) { |
| | | permision.gotoAppSetting(); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | return status; |
| | | } |
| | | // #endif |
| | | , |
| | | resst() { |
| | | this.matList = [] |
| | | this.barcode = '' |