- 当前 Bug 的表现(可附上截图)
扫码成功之后自动跳转到小程序首页,仅在苹果手机上出现,IOS版本12.1,
扫描二维码:
- 预期表现
停留在打开扫码框打开页面并对数据进行赋值
- 复现路径
微信登陆-》添加设备-》点击“扫描二维码添加设备”-》扫描上面提供的二维码
- 提供一个最简复现 Demo
AddScan: function () {
var that = this;
wx.scanCode({
scanType: [‘qrCode’],
success: (res) => {
var str = res.result.split(’=’);
if (str.length < 2) {
wx.showModal({
title: ‘错误提示’,
content: ‘二维码格式不正确!’,
confirmColor: ‘#9ca9e9’
});
return;
} else if (str[0] != ‘mac’) {
wx.showModal({
title: ‘错误提示’,
content: ‘二维码格式不正确!’,
confirmColor: ‘#9ca9e9’
});
return;
}
var strs = str[1]
if (res.errMsg == ‘scanCode:ok’) {
var params = new Object();
params.userId = wx.getStorageSync(‘userId’);
wx.request({
url: getApp().data.appserver + getApp().data.scan + strs,
method: ‘POST’,
header: {
‘content-type’: ‘application/x-www-form-urlencoded’,
‘token’: wx.getStorageSync(‘token’),
‘signCode’: wx.getStorageSync(‘signCode’)
},
data: {
params: JSON.stringify(params)
},
success: function (res) {
console.log(res)
if (res.data.code == “200”) {
console.log(‘come to here 11’)
that.setData({
deviceId: res.data.data.id,
options: true
})
console.log(‘come to here 22’)
}
},
fail: function (err) {
console.log(err)
}
})
}
},
fail: (res) => {
wx.showModal({
title: ‘错误提示’,
content: ‘绑定设备失败’
})
},
})
},
麻烦提供出现问题的机型和微信版本,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)