|
@@ -34,23 +34,15 @@
|
|
|
let that = this;
|
|
|
uni.scanCode({
|
|
|
success: (res) => {
|
|
|
- let result = JSON.parse(res.result);
|
|
|
- if(res.errMsg==='scanCode:ok'){
|
|
|
- uni.navigateTo({
|
|
|
- url:'/pagesMy/scanResult?scanParams='+JSON.stringify(result)
|
|
|
- })
|
|
|
-
|
|
|
- // that.$api.post('/device/bind',{
|
|
|
- // ...result,
|
|
|
- // "type": "",
|
|
|
- // "userId": 0,
|
|
|
- // "agentId": ""
|
|
|
- // }).then(res=>{
|
|
|
- // if(res.data.code!==0) return that.$showToast(res.data.msg)
|
|
|
- // uni.navigateTo({
|
|
|
- // url:'/pagesMy/scanResult?deviceId='+res.data.data
|
|
|
- // })
|
|
|
- // })
|
|
|
+ try{
|
|
|
+ let result = JSON.parse(res.result);
|
|
|
+ if(res.errMsg==='scanCode:ok'){
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pagesMy/scanResult?scanParams='+JSON.stringify(result)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ that.$showModal('扫码失败,请检查设备二维码。')
|
|
|
}
|
|
|
}
|
|
|
})
|