study_edit_bak.html 5.2 KB

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