3,143
社区成员
发帖
与我相关
我的任务
分享
const base64 = require("../../utils/base64.js");
var app = getApp();
Page({
data:{
banquan: app.globalData.banquan,
ip: '',
show_r: '',
show_img: 'yes',
imageBase64Str: '',
location: '',
height: '100%',
},
banquan: function () {
},
queryIp: function (res,options) {
let that = this;
// 允许从相机和相册扫码
wx.scanCode({
success(res) {
console.log(res);
var location_text = "";
if (res.result == "*" || res.result == ""){
location_text = "【解码后内容】:" + base64.decode(res.rawData);
}else{
location_text = "【解码后内容】:" + res.result;
}
location_text = location_text + "\r\n\n【解码类型】:" + res.scanType;
if (res.scanType == "QR_CODE" || res.scanType == "DATA_MATRIX" || res.scanType == "PDF_417"){
location_text = location_text+"(二维码)";
} else if (res.scanType == "WX_CODE"){
location_text = location_text + "(小程序码)";
}else{
location_text = location_text + "(一维码)";
}
location_text = location_text + "\r\n\n【字符集】:" + res.charSet;
if (res.path != "undefined" && res.path != "" && res.path != null ){
location_text = location_text + "\r\n\n【Path】:" + res.path;
}
location_text = location_text + "\r\n\n【货架号】:" + getNo;
that.setData({
show_r: 'yes',
show_img: '',
location: location_text,
})
},
//取当前页面的值
fail(res) {
console.log(res);
/*that.setData({
show_r: 'yes',
show_img: '',
location: "识别错误:\r\n" + res.errMsg
})*/
},
complete(res) {
},
})
},