wx.ready(function() {
document.getElementById("number").focus(); //打test.htm这个页面后,焦点自动定到 addInput("number","扫描录入","text") 这个输入框里
document.getElementById('scan').onclick = function() {
wx.scanQRCode({
needResult: 1,
scanType: ['qrCode', 'barCode'],
success: function(res) {
var code = res.resultStr;
//alert(code)
if (code.indexOf(",") >= 0) {
code = code.split(",")[1];
}
//alert(code)
document.getElementById('number').value = code;
var result = submitAjaxFileds('itsbscangetname.htm', '', 'number', false);
//alert(result)
if (result) {
var vals = result.split("||");
//if(vals.length==6){
if (6 == 6) {
document.getElementById("lbh").value = vals[0];
document.getElementById("sbfl").value = vals[1];
document.getElementById("sbmc").value = vals[2];
document.getElementById("ggxh").value = vals[3];
document.getElementById("xlh").value = vals[4];
document.getElementById("xzrgs").value = vals[6];
document.getElementById("xzrbm").value = vals[5];
document.getElementById("xzrr").value = vals[7];
document.getElementById("ccpz").value = vals[8];
document.getElementById("bz").value = vals[9];
}
}
}
});
};
document.getElementById('scan1').onclick = function() {
wx.scanQRCode({
needResult: 1,
scanType: ['qrCode', 'barCode'],
success: function(res1) {
var code1 = res1.resultStr;
//alert(code)
if (code1.indexOf(",") >= 0) {
code1 = code1.split(",")[1];
}
alert(code);
document.getElementById('number1').value = code1;
}
})
}
});
wx.error(function(res) {
//alert(res.errMsg);
});
[此贴子已经被作者于2019/3/4 11:10:36编辑过]