study_add_bak.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. {Template header}
  2. <body>
  3. <div class="warp">
  4. <div class="title winnone">资料管理 - 添加</div>
  5. <form >
  6. <ul class="setting-UMeditor">
  7. <li>
  8. 分类:<select name="class" class="select">
  9. {loop $studyclass as $val}
  10. <option value="{$val['id']}">{$val['title']}</option>
  11. {/loop}</select>
  12. </li>
  13. <li>
  14. <em>标题:</em>
  15. <input class="must" value="" name="title" type="text" >
  16. </li>
  17. <li class="length">
  18. <em>平台:</em>
  19. <div class="checkbox">
  20. {loop $plat_list as $key=>$val}
  21. <span class="ckrows"><label><input name="type" type="checkbox" value="{$key}"><font>{$val}</font></label></span>
  22. {/loop}
  23. </div>
  24. </li>
  25. <li class="length" >
  26. <em>文档:</em>
  27. <input value="" name="wdurl" type="hidden">
  28. <font class="scwd">点击上传文档</font>
  29. <font class="wdxz"></font>
  30. </li>
  31. <div style="clear:both;"></div>
  32. </ul>
  33. <div class="editor-wrapper">
  34. <textarea id="newsEditor" name="content" ></textarea>
  35. </div>
  36. <input id="hide" type="text" style='opacity: 0'>
  37. <div class="button"><font class="datasavee_tmp" onclick="tijiao()">提 交</font> <font class="fh">关 闭</font></div>
  38. </div>
  39. <div style="display:none;">
  40. <input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
  41. </div>
  42. </form>
  43. <script type="text/javascript" src="/style/ueditor/ueditor.config.js"></script>
  44. <script type="text/javascript" src="/style/ueditor/ueditor.all.js"></script>
  45. <script>var addedit="/study/add/";
  46. var scwd = "/fullorderexcel/scwd";
  47. $(function(){
  48. UE.getEditor('newsEditor');
  49. })
  50. function tijiao() {
  51. $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在添加中,请稍后...");
  52. $(".ts").show();
  53. var f = "";
  54. var e = "";
  55. $(".select").each(function() {
  56. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  57. });
  58. $("input:text").each(function() {
  59. str2 = $(this).val().replace(/\</g, "&lt;");
  60. str2 = str2.replace(/\>/g, "&gt;");
  61. str2 = str2.replace(/\+/g, "%2B");
  62. str2 = str2.replace(/&/g, "%26");
  63. f = f + $(this).attr("name") + "=" + str2 + "&";
  64. });
  65. $("input:password").each(function() {
  66. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  67. });
  68. $("input:hidden").each(function() {
  69. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  70. });
  71. if ($("#content").length > 0) {
  72. var vl = $("#content").html().replace(/\+/g, "%2B");
  73. vl = vl.replace(/\&/g, "%26");
  74. f = f + "content=" + encodeURI(vl) + "&";
  75. }
  76. $("textarea").each(function() {
  77. var str2 = $(this).val().replace(/\+/g, "%2B");
  78. var str2 = str2.replace(/&/g, "%26");
  79. f = f + $(this).attr("name") + "=" + str2 + "&";
  80. });
  81. if ($(".scimg img").length > 0 || $(".scimg video").length > 0) {
  82. var a = '';
  83. for (var b = 0; b < $(".scimg .upimg img").length; b++) {
  84. a = a + $(".scimg .upimg img")[b].src + "|";
  85. }
  86. for (var b = 0; b < $(".scimg .upimg video").length; b++) {
  87. a = a + $('.scimg .upimg video')[b].src + "|";
  88. }
  89. var a = a.replace(/\+/g, "%2B");
  90. var a = a.replace(/&/g, "%26");
  91. f = f + "img=" + a + "&";
  92. }
  93. for (i = 0; i < $(".checkbox").length; i++) {
  94. var checkid = "";
  95. var checkname = "";
  96. $(".checkbox:eq(" + i + ") .ckrows input:checked").each(function() {
  97. checkname = $(this).attr("name");
  98. checkid = checkid + $(this).val() + ",";
  99. });
  100. if (checkname == "") {
  101. $(".ts p").text($(".checkbox:eq(" + i + ")").prevAll("em").text() + "为必填项");
  102. $(".ts").show();
  103. setTimeout('$(".ts").fadeOut()', 600);
  104. return false;
  105. }
  106. f = f + checkname + "=" + checkid + "&";
  107. }
  108. for (i = 0; i < $(".checkboxfbt").length; i++) {
  109. var checkid = "";
  110. var checkname = "";
  111. $(".checkboxfbt:eq(" + i + ") .ckrows input:checked").each(function() {
  112. checkname = $(this).attr("name");
  113. checkid = checkid + $(this).val() + ",";
  114. });
  115. if (checkname != "") {
  116. f = f + checkname + "=" + checkid + "&";
  117. }
  118. }
  119. var ab = 0;
  120. $(".must").each(function() {
  121. if ($.trim($(this).val()).length == 0) {
  122. $(this).css("border", "1px solid #F66");
  123. ab = ab + 1;
  124. }
  125. });
  126. if (ab > 0) {
  127. $(".ts p").text("红框为必填项");
  128. $(".ts").show();
  129. setTimeout('$(".ts").fadeOut()', 600);
  130. return false;
  131. }
  132. $.ajax({
  133. url: addedit,
  134. data: $("form").serialize(),
  135. type: "POST",
  136. dataType: "json",
  137. success: function(a) {
  138. if (a && a.success) {
  139. $(".ts").hide();
  140. $(".express p:eq(0)").html(a.msg + "是否关闭?");
  141. $(".express p:eq(1)").html(
  142. "<font class='fh'>确 定</font><font class='esc'>取 消</font>");
  143. $(".express").show();
  144. } else {
  145. $(".ts").hide();
  146. $(".ts p").html(a.msg);
  147. $(".ts").fadeIn();
  148. setTimeout('$(".ts").fadeOut()', 800);
  149. }
  150. }
  151. });
  152. }
  153. </script>
  154. <script type="text/javascript" src="{$theme}js/ajaxupload.3.5.js"></script>
  155. {Template footer}