You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.0 KiB
81 lines
3.0 KiB
|
3 years ago
|
<!DOCTYPE html>
|
||
|
|
<html xmlns:th="http://www.w3.org/1999/xhtml">
|
||
|
|
<html xmlns:th="http://www.thymeleaf.org">
|
||
|
|
<head>
|
||
|
|
<meta charset="utf-8">
|
||
|
|
<title>扫码</title>
|
||
|
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/css/layuimini.css?v=2.0.4.2" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/css/themes/default.css" media="all">
|
||
|
|
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
|
||
|
|
<!--[if lt IE 9]>
|
||
|
|
<script src="/static/js/html5.min.js"></script>
|
||
|
|
<script src="/static/js/respond.min.js"></script>
|
||
|
|
<![endif]-->
|
||
|
|
<!-- vue相关-->
|
||
|
|
<script src="../static/js/vue/vue.js"></script>
|
||
|
|
<script src="../static/js/vue/vue-router.js"></script>
|
||
|
|
<script src="../static/lib/http-vue-loader/src/httpVueLoader.js"></script>
|
||
|
|
<script src="../static/js/VueQrcodeReader.umd.min.js"></script>
|
||
|
|
<script src="/static/js/scanBarCode/html5-qrcode.min.js"></script>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
|
||
|
|
<div style="width: 500px" id="reader">
|
||
|
|
|
||
|
|
</div>
|
||
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
||
|
|
<script>
|
||
|
|
// 用于判断是否包含字母
|
||
|
|
var barCodeList = [];
|
||
|
|
|
||
|
|
|
||
|
|
layui.$(function () {
|
||
|
|
parent.parent.parent.parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
outboundLogic(result);
|
||
|
|
|
||
|
|
},
|
||
|
|
error: function(res) {
|
||
|
|
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
||
|
|
alert('版本过低请升级')
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
outboundLogic = function (result) {
|
||
|
|
barCodeList.push(result);
|
||
|
|
layer.confirm("是否继续扫描", {
|
||
|
|
btn: ["扫描", "取消"]
|
||
|
|
}, function () { // 继续
|
||
|
|
layer.close(layer.index); // 关闭弹窗
|
||
|
|
parent.parent.parent.parent.wx.scanQRCode({
|
||
|
|
desc: 'scanQRCode desc',
|
||
|
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
||
|
|
scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
|
||
|
|
success: function (res) {
|
||
|
|
// 回调
|
||
|
|
var result = res.resultStr;//当needResult为1时返回处理结果
|
||
|
|
outboundLogic(result)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}, function () { // 取消
|
||
|
|
// 关闭当前页
|
||
|
|
layui.$("#barCodeList", window.parent.document).val(barCodeList);
|
||
|
|
var index = parent.layer.getFrameIndex(window.name);
|
||
|
|
parent.layer.close(index);
|
||
|
|
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|