| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>二维码打印</title>
- <style media="all">
- .codeBox {
- /*width: 500px!important;*/
- margin: 0 auto!important;
- -webkit-print-color-adjust: exact;
- color: #000;
- }
- div.wrapper-content{
- padding-top: 8px;
- }
- @media print {
- .codeBox {
- -webkit-print-color-adjust: exact;
- }
- #codeHtml {
- z-index: 9999999;
- position: relative;
- }
- }
- </style>
- </head>
- <body class="gray-bg">
- <div class="wrapper-content animated fadeInRight">
- <input type="hidden" id="qrCode" />
- <!--startprint-->
- <div class="codeBox" style="margin: 0 auto; padding-bottom: 20px; width: 360px; height: 180px;">
- <div style="display: inline-block; margin-top: 10px;margin-left: 28px;vertical-align: middle;">
- <img src='../../img/equp-logo.png' class="logo_img" style="width: 112px; height: 94px;margin: 0;padding: 0; display: none;">
- <p style="font-size: 14px;margin-top: 22px;margin-bottom: 0;color: #000;font-family: '微软雅黑';text-align: center;">微信[扫一扫]</p>
- <p style="font-size: 14px;margin-top: 5px;margin-bottom: 0;color: #000;font-family: '微软雅黑';text-align: center;">获取设备信息</p>
- </div>
- <div style="display: inline-block; margin-top: 0px; margin-left: 46px; vertical-align: middle;">
- <p class="eq_code_con" style="font-size: 14px;color: #000;text-align: left;margin-bottom: 5px;">设备编号:<span id="eq_code" style="display: inline-block;width:76px;border-bottom: 2px solid #000; padding: 0 1px;text-align: center;margin-bottom: -5px;"></span></p>
- <div id="codeHtml" style="z-index: 9999999;position: relative;">
- <div id="code"></div>
- </div>
- </div>
- </div>
- <!--endprint-->
- <p style="text-align: center;margin-top: 25px;"><button class="btns" id="print" onclick="stamp()">打印二维码</button></p>
- </div>
-
- <link rel="stylesheet" href="../../css/init.css" />
- <link rel="stylesheet" href="../../css/Table/table1.css" />
- <script src="../../Script/Common/huayi.load.js"></script>
- <script src="../../Script/Common/huayi.config.js"></script>
- <script src="../js/qrcode.min.js"></script>
-
- <script>
- var ids= helper.request.queryString("ids");
- $('#eq_code').text(ids);
- var qrUrl="http://wechat.nuodajituan.com/index.html?menucode=SBXX&id="+ids+"&type=2";//设备
- $('#qrCode').val(qrUrl);
- $(document).ready(function(){
- makeCode ();
- })
- $("#codeHtml").html('<div id="code"></div>');
- var qrcode = new QRCode(document.getElementById("code"), {
- render: 'canva',
- width: 146, //宽度
- height: 146, //高度
- text: toUtf8(name) //任意内容 :中文存在乱码,需要转换编码
- })
-
- function toUtf8(str) {
- var out, i, len, c;
- out = "";
- len = str.length;
- for(i = 0; i < len; i++) {
- c = str.charCodeAt(i);
- if ((c >= 0x0001) && (c <= 0x007F)) {
- out += str.charAt(i);
- } else if (c > 0x07FF) {
- out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
- out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- } else {
- out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
- out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- }
- }
- return out;
- }
-
- function makeCode () {
- var elText = document.getElementById("qrCode");
- if (!elText.value) {
- elText.focus();
- return;
- }
- qrcode.makeCode(elText.value);
- var canvas = $('#code canvas')
- var img = canvas[0].toDataURL("image/png")
- $('#code').html("<img src='" + img + "'>")
- }
- function stamp(){
- var bdhtml = window.document.body.innerHTML;
- var sprnstr = "<!--startprint-->";
- var eprnstr = "<!--endprint-->";
- var prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
- prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
- var newWindow=window.open("打印二维码","_self");
- newWindow.document.write(prnhtml);
- // newWindow.document.close();
- // setTimeout(function(){
- newWindow.print();
- newWindow.close();
- // newWindow.document.body.innerHTML=bdhtml;
- // }, 10);
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- }
-
-
- </script>
- </body>
- </html>
|