|
@@ -22,13 +22,27 @@ import { debounce } from 'lodash'
|
|
|
window.__scanCallback = function (data) {
|
|
|
console.log('__scanCallback')
|
|
|
console.log(data)
|
|
|
- alert(data.text)
|
|
|
- // 返回的有text,设施扫码结果
|
|
|
- if (data?.text) {
|
|
|
- store.commit('SCANASSETID', data.text)
|
|
|
- } else {
|
|
|
- store.commit('SCANASSETID', null)
|
|
|
- Toast('扫码错误')
|
|
|
+ switch (data.code) {
|
|
|
+ // 扫描的⾮设备⼆维码
|
|
|
+ case 0:
|
|
|
+ case '0':
|
|
|
+ Toast('扫描的⾮设备⼆维码')
|
|
|
+ store.commit('SCANASSETID', null)
|
|
|
+ break
|
|
|
+ // 扫码的是设备二维码
|
|
|
+ case 1:
|
|
|
+ case '1':
|
|
|
+ store.commit('SCANASSETID', data.text)
|
|
|
+ break
|
|
|
+ // 扫码失败
|
|
|
+ case -1:
|
|
|
+ case '-1':
|
|
|
+ store.commit('SCANASSETID', null)
|
|
|
+ Toast('扫码出错')
|
|
|
+ break
|
|
|
+
|
|
|
+ default:
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
export default {
|
|
@@ -41,6 +55,7 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters(['appTitle', 'scanAssetid']),
|
|
|
},
|
|
|
+ watch: {},
|
|
|
beforeMount() {},
|
|
|
mounted() {},
|
|
|
methods: {
|