all_print.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .printerbox{
  5. border:1px solid #ccc;
  6. margin: 0 auto;
  7. background-color: #fff;
  8. padding: 10px;
  9. }
  10. .printerbox img{
  11. width: 100%;
  12. }
  13. .printerbox p{
  14. padding-top: 10px;
  15. }
  16. </style>
  17. <div id="printer" class="text-center">
  18. {foreach $list as $key => $value}
  19. <div class="col-xs-6 printerbox">
  20. <img src="{:url('Qrcode/qrcode')}?code={$value['qCode']}" alt="二维码">
  21. <p class="text-center">{$value['title']}</p>
  22. </div>
  23. {/foreach}
  24. </div>
  25. <div class="text-center">
  26. <br>
  27. <a href="javascript:;" class="btn btn-sm btn-primary" onclick="print()"><i class="glyphicon glyphicon-print"> 打印</i></a>
  28. </div>
  29. <script src="/static/jquery-1.11.3.min.js"></script>
  30. <script src="/static/browser.js"></script>
  31. <script src="/static/jquery.jqprint-0.3.js"></script>
  32. <script>
  33. function print(){
  34. $("#printer").jqprint();
  35. }
  36. </script>
  37. <script>
  38. var index = layer.load(1, {
  39. shade: [0.1,'#fff'] //0.1透明度的白色背景
  40. });
  41. document.onreadystatechange = function()   //当页面加载状态改变的时候执行function
  42. {
  43. if(document.readyState == "complete") {   //当页面加载状态为完全结束时进入
  44. layer.closeAll();
  45. window.print();
  46. }
  47. }
  48. </script>
  49. {/block}