seat_sticker.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>考生考场座位贴</title>
  9. <style>
  10. .room{
  11. width: 100%;
  12. border:1px solid #cecece;
  13. }
  14. .room.selected{
  15. border:1px solid #f20e01;
  16. }
  17. .print h2{
  18. text-align: center;
  19. }
  20. .print .list .item{
  21. width: 200px;
  22. text-align: center;
  23. line-height: 40px;
  24. font-weight: bold;
  25. font-size: 20px;
  26. float: left;
  27. }
  28. .print .list .item .avatar{
  29. width: 180px;
  30. height: 253px;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. @foreach($data as $k=>$v)
  36. <div class="room clearfix">
  37. <div class="print">
  38. <div class="list">
  39. @foreach($v as $key => $val)
  40. <div class="item">
  41. <div class="avatar">
  42. <img src="{{$val['avatar']}}" width="170" />
  43. </div>
  44. <div class="seat">
  45. 座位号:{{$val['seat']}}
  46. </div>
  47. <div class="realname">
  48. 姓名:{{$val['realname']}}
  49. </div>
  50. <div class="number">
  51. 准考证:{{$val['number']}}
  52. </div>
  53. </div>
  54. @endforeach
  55. </div>
  56. </div>
  57. </div>
  58. <div class="print" style="margin: 10px 0;text-align: center">
  59. <button class="print_page btn btn-sm btn-info" style="width: 200px;height: 60px;font-size: 30px;line-height: 40px">打印此页</button>
  60. </div>
  61. @endforeach
  62. <div id="print_body" ></div>
  63. <script type="text/javascript" src="{{ theme_asset('app/js/hiprint/polyfill.min.js') }}"></script>
  64. <script type="text/javascript" src="{{ theme_asset('app/js/hiprint/hiprint.bundle.js') }}"></script>
  65. <script type="text/javascript" src="{{ theme_asset('app/js/hiprint/plugins/JsBarcode.all.min.js') }}"></script>
  66. <script type="text/javascript" src="{{ theme_asset('app/js/hiprint/plugins/qrcode.js') }}"></script>
  67. <script type="text/javascript" src="{{ theme_asset('app/js/jQuery.print.js') }}"></script>
  68. <script>
  69. $(".print_page").on('mouseover',function(){
  70. var dom = $(this).parent().prev();
  71. $(dom).addClass('selected')
  72. });
  73. $(".print_page").on('mouseout',function(){
  74. var dom = $(this).parent().prev();
  75. $(dom).removeClass('selected')
  76. });
  77. $(".print_page").on('click',function(){
  78. var dom = $(this).parent().prev();
  79. console.log(dom)
  80. $(dom).print()
  81. });
  82. // hiprint.init();
  83. // <!-- 创建打印模板对象-->
  84. // var hiprintTemplate = new hiprint.PrintTemplate();
  85. // <!-- 模板对象添加打印面板 paperHeader:页眉线 paperFooter:页尾线-->
  86. // var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
  87. // <!-- 文本 打印面板添加文本元素-->
  88. // panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } });
  89. // <!-- 条形码 打印面板添加条形码元素-->
  90. // panel.addPrintText({ options: { width: 140, height: 35, top: 40, left: 20, title: '123456', textType: 'barcode' } });
  91. // <!-- 二维码 打印面板添加二维码元素-->
  92. // panel.addPrintText({ options: { width: 35, height: 35, top: 40, left: 165, title: '二维码', textType: 'qrcode' } });
  93. // <!-- 长文本 打印面板添加长文本元素-->
  94. // panel.addPrintLongText({ options: { width: 180, height: 35, top: 90, left: 20, title: '长文本:' } });
  95. // <!-- 表格 打印面板添加表格元素 content为字符串 -->
  96. // panel.addPrintTable({ options: { width: 252, height: 35, top: 130, left: 20, content: $('#testTable').html() } });
  97. // <!-- html 打印面板添加自定义html content为字符串或$('..') -->
  98. // panel.addPrintHtml({ options: { width: 140, height: 35, top: 180, left: 20, content:'' } });
  99. // <!-- 竖线 -->
  100. // panel.addPrintVline({ options: { height: 35, top: 230, left: 20 } });
  101. // <!-- 横线 -->
  102. // panel.addPrintHline({ options: { width: 140, top: 245, left: 120 } });
  103. // <!-- 矩形 -->
  104. // panel.addPrintRect({ options: { width: 35, height: 35, top: 230, left: 60 } });
  105. // <!-- 打印设计 -->
  106. // hiprintTemplate.design('#print_body');
  107. </script>
  108. </body>
  109. </html>