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.

CardPrint.cshtml 2.5 KiB

4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width" />
  5. <title>CardPrint</title>
  6. @Html.AppendJsFile("/Content/jquery/jquery-1.10.2.min.js", "/Areas/EducationalAdministration/Views/StuEnroll/LodopFuncs.js","/Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js")
  7. <link href="~/Content/cardprint/CardPrint.css" rel="stylesheet" />
  8. <script>
  9. function request(d) {
  10. for(var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) {
  11. var b = c[a].split("=");
  12. if(b[0] == d)
  13. if("undefined" == unescape(b[1])) break;
  14. else return unescape(b[1])
  15. }
  16. return ""
  17. };
  18. </script>
  19. </head>
  20. <body>
  21. <div id="carddiv">
  22. <div class="printBox">
  23. <!--printstart-->
  24. <div class="printBox2">
  25. <div class="print">
  26. <div class="printImg">
  27. <div><img id="stuImg" src="" alt=""></div>
  28. </div>
  29. <div class="printCon">
  30. <div class="printT" id="StuName">王同学</div>
  31. <div class="printTxt" id="ClassName">小育2018002班</div>
  32. </div>
  33. </div>
  34. </div>
  35. <!--printend-->
  36. </div>
  37. <!--<div class="img">
  38. <img src="~/Content/cardprint/back.jpg" alt="">
  39. </div>-->
  40. </div>
  41. <div id="btnprint" type="button" class="btns" value="打印">打印</div>
  42. <script>
  43. var imgUrl = '';
  44. $(function() {
  45. $("#btnprint").on("click", function() {
  46. AddPrintContent3()
  47. });
  48. var keyValue = request('keyValue');
  49. $.ajax({
  50. url: top.$.rootUrl + '/EducationalAdministration/StuEnroll/GetStuDefaultInfo?StuId=' + keyValue,
  51. type: "POST",
  52. dataType: "json",
  53. async: true,
  54. cache: false,
  55. success: function(data) {
  56. if(data.code == top.learun.httpCode.exception) {
  57. top.learun.httpErrorLog(data.info);
  58. data.info = '系统异常,请联系管理员!';
  59. }
  60. // //绑定数据
  61. $("#StuName").html(data.data.stuName);
  62. $("#ClassName").html(data.data.className);
  63. $("#stuImg").attr("src", data.data.imgUrl);
  64. },
  65. error: function(XMLHttpRequest, textStatus, errorThrown) {
  66. top.learun.httpErrorLog(textStatus);
  67. },
  68. beforeSend: function() {},
  69. complete: function() {}
  70. });
  71. });
  72. // 打印表单
  73. function AddPrintContent3() {
  74. var bdhtml = window.document.body.innerHTML;
  75. // var prnhtml = $('.printBox').html();
  76. // window.document.body.innerHTML = prnhtml;
  77. $('#btnprint').css('display', 'none')
  78. window.print();
  79. $('#btnprint').css('display', 'block')
  80. }
  81. </script>
  82. </body>
  83. </html>