<view class="uni-btn">
<button type="primary" @tap="scarn">扫一扫</button>
</view>
scarn:function(){
var that = this;
var show;
uni.scanCode({
success: (res) => {
console.log('kkk')
that.show = res.result;
uni.showModal({
title: '提示',
content: '您当前所选用户:' + that.data.cityname,
success(res) {
if (res.confirm) {
// 向后台发送请求
uni.request({
url: 'https://www.globalbigdata.cn/zhp/app/devInput',
method: 'GET',
data: {
deviceCode: that.show,
ownedId: that.data.idArr[that.data.index]
},
success: function (res) {
uni.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
fail: (res) => {
console.log(res)
uni.showToast({
title: '扫码失败',
icon: 'success',
duration: 2000
})
},
complete: (res) => { }
})
}
扫码的结果总是失败:
errMsg: "scanCode:fail 系统错误,错误码:1, [20200810 14:20:52][touristappid]"