Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

article_edit.htm 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>文章投稿-{eyou:global name='web_name' /}</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  9. <link href="{eyou:global name='web_cmspath'/}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  10. {eyou:static file="users/skin/css/basic.css"/}
  11. {eyou:static file="users/skin/css/eyoucms.css"/}
  12. <!-- 新样式 2020-12-8 -->
  13. {eyou:static file="users/skin/css/element/index.css" /}
  14. {eyou:static file="users/skin/css/e-user.css" /}
  15. {eyou:include file="users/skin/css/diy_css.htm"/}
  16. {eyou:static file="/public/plugins/layui/css/layui.css" /}
  17. {eyou:static file="/public/static/common/js/jquery.min.js"/}
  18. {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
  19. {eyou:static file="/public/static/common/js/tag_global.js"/}
  20. {eyou:static file="/public/static/common/js/mobile_global.js"/}
  21. </head>
  22. <body>
  23. <script type="text/javascript">
  24. var eyou_basefile = "{$Request.baseFile}";
  25. window.UEDITOR_HOME_URL = "__ROOT_DIR__/public/plugins/Ueditor/";
  26. var type20210507 = '';//下载模型的上传类型
  27. var attr_field20210507 = '';//下载模型的attr_field
  28. var servername_use20210507 = '';//下载模型的servername_use
  29. var default_servername20210507 = '';//下载模型的default_servername
  30. </script>
  31. {eyou:static file="/public/plugins/Ueditor/ueditor.config.js"/}
  32. {eyou:static file="/public/plugins/Ueditor/ueditor.all.min.js"/}
  33. {eyou:static file="/public/plugins/Ueditor/lang/zh-cn/zh-cn.js"/}
  34. {eyou:static file="/public/plugins/laydate/laydate.js"/}
  35. {eyou:static file="/public/plugins/layui/layui.js" /}
  36. <div class="ey-header-status">
  37. <div class="header-status-l">
  38. <a href="javascript:history.go(-1);"><i class="el-icon-arrow-left"></i></a>
  39. </div>
  40. <div class="header-status-m">{$MenuTitle}</div>
  41. <div class="header-status-r">
  42. <a href="{eyou:url link='user/Users/index' /}"><i class="el-icon-user"></i></a>
  43. </div>
  44. </div>
  45. <div class="h50"></div>
  46. <div class="ey-container">
  47. <form id="post_form">
  48. <input type="hidden" name="channel" value="{$channel_id}">
  49. <input type="hidden" name="aid" value="{$ArchivesData.aid}">
  50. <input type="hidden" name="old_arcrank" value="{$ArchivesData.arcrank}">
  51. <input type="hidden" name="old_typeid" value="{$ArchivesData.typeid}">
  52. <div class="ey-con ey-row bgfff pt0">
  53. <!-- 公共字段 -->
  54. <div class="item-from-flex">
  55. <div class="item-flex-l">
  56. <div class="item-tit">文章标题 <span class="red">*</span></div>
  57. <div class="item-con">
  58. <input type="text" name="title" id="title" class="input-text" value="{$ArchivesData.title}" maxlength="100" placeholder="请输入文章标题">
  59. </div>
  60. </div>
  61. </div>
  62. <div class="item-from-flex">
  63. <div class="item-flex-l">
  64. <div class="item-tit">所属栏目 <span class="red">*</span></div>
  65. <div class="item-con">
  66. <div class="select">
  67. {$arctype_html}
  68. </div>
  69. </div>
  70. </div>
  71. <div class="item-flex-r"> <i class="el-icon-arrow-right"></i> </div>
  72. </div>
  73. <div class="item-from-flex">
  74. <div class="item-flex-l">
  75. <div class="item-tit">TAG标签</div>
  76. <div class="item-con">
  77. <input type="text" name="tags" id="tags" class="input-text" value="{$ArchivesData.tags}" placeholder="多个标签之间用逗号隔开">
  78. </div>
  79. </div>
  80. </div>
  81. <div class="item-from-flex" id="openLitpic">
  82. <div class="item-flex-l">
  83. <div class="item-tit">缩略图</div>
  84. <div class="item-con">
  85. <div class="item-flex-img">
  86. <a href="javascript:void(0);" onclick="$('#litpicOnclick').trigger('click');" class="img-upload" title="点击上传">
  87. <div class="y-line" id="litpicYline" {notempty name='$ArchivesData.litpic'} style="display: none;" {/notempty}></div>
  88. <div class="x-line" id="litpicXline" {notempty name='$ArchivesData.litpic'} style="display: none;" {/notempty}></div>
  89. <img src="{$ArchivesData.litpic}" id="litpicImgSrc" class="none" {notempty name='$ArchivesData.litpic'} style="display: inline;" {/notempty}>
  90. </a>
  91. <input type="hidden" name="litpic_inpiut" id="litpicInpiut" value="{$ArchivesData.litpic}">
  92. <input type="file" name="litpic_inpiut_file" id="litpicOnclick" onchange="litpicOnclickFile(this);" style="display: none;">
  93. </div>
  94. </div>
  95. </div>
  96. <script type="text/javascript">
  97. function litpicOnclickFile(obj) {
  98. var file = $(obj)[0].files[0];
  99. if (!file) return false;
  100. var formData = new FormData();
  101. formData.append('_ajax', 1);
  102. formData.append('file', file);
  103. formData.append('compress', '1000-1000');
  104. showLayerLoad();
  105. $.ajax({
  106. type: 'post',
  107. url: eyou_basefile + "?m=user&c=Uploadify&a=imageUp",
  108. data: formData,
  109. contentType: false,
  110. processData: false,
  111. dataType: 'json',
  112. success: function (res) {
  113. layer.closeAll();
  114. if (res.state == 'SUCCESS') {
  115. $("#litpicInpiut").val(res.url);
  116. $('#litpicYline, #litpicXline').hide();
  117. $("#litpicImgSrc").attr('src', res.url);
  118. } else {
  119. showErrorAlert(res.state);
  120. }
  121. },
  122. error: function(e) {
  123. layer.closeAll();
  124. showErrorAlert(e.responseText);
  125. }
  126. })
  127. }
  128. </script>
  129. </div>
  130. <!--下载模型特定字段-->
  131. <div style="display: none;" id="downloadModel">
  132. {eyou:include file="users/article_download_edit.htm" /}
  133. </div>
  134. <!--视频模型特定字段-->
  135. <div style="display: none;" id="mediaModel">
  136. {eyou:include file="users/article_media_edit.htm" /}
  137. </div>
  138. <!-- 图集模型特定字段 -->
  139. <div style="display: none;" id="imagesModel">
  140. {eyou:include file="users/article_images_edit.htm" /}
  141. </div>
  142. <!-- 模型自定义字段 -->
  143. <span id="FieldAddonextitem"></span>
  144. <script type="text/javascript">
  145. $(function() {
  146. // 默认执行选中栏目
  147. var aid = {$ArchivesData.aid|default='0'};
  148. var typeid = {$ArchivesData.typeid|default='0'};
  149. if (0 === parseInt(typeid)) typeid = $('#typeid').find('option:selected').val();
  150. getAddonextitem(0, typeid, aid);
  151. // 切换执行选中栏目
  152. $('#typeid').change(function() {
  153. getAddonextitem(1, $(this).val(), aid);
  154. });
  155. });
  156. function getAddonextitem(init, typeid, aid, is_destroy) {
  157. // 设置选中栏目的模型ID
  158. var channel = $("#typeid option:selected").attr('data-channel');
  159. $("input[name='channel']").val(channel);
  160. // 模型字段隐藏、显示处理
  161. $("#mediaModel").hide();
  162. $("#imagesModel").hide();
  163. $("#downloadModel").hide();
  164. if (3 === parseInt(channel)) {
  165. // 图集模型特定字段
  166. $("#imagesModel").show();
  167. } else if (4 === parseInt(channel)) {
  168. // 下载模型特定字段
  169. $("#downloadModel").show();
  170. } else if (5 === parseInt(channel)) {
  171. // 视频特定模型字段
  172. $("#mediaModel").show();
  173. }
  174. // 操作提示
  175. showLayerLoad();
  176. $.ajax({
  177. url: "{:url('user/UsersRelease/get_addonextitem')}",
  178. data: {aid: aid, typeid: typeid, channel: channel, _ajax: 1},
  179. type: 'post',
  180. success: function(res) {
  181. layer.closeAll();
  182. if (0 === parseInt(res.code)) {
  183. showLayerAlert(res.msg);
  184. } else {
  185. // 缩略图隐藏、显示处理
  186. $('#openLitpic').hide();
  187. if (res.data.is_litpic_users_release) $('#openLitpic').show();
  188. // 模型自定义字段加载
  189. $('#FieldAddonextitem').empty().html(res.data.html);
  190. // 渲染编辑器
  191. if (1 === parseInt(init)) {
  192. $.each(res.data.htmltextField, function (index, value) {
  193. showEditor_1597892187('addonFieldExt_'+value);
  194. });
  195. }
  196. if (4 === parseInt(channel)) {
  197. var download = res.data.download;
  198. var arc_level_id = {$ArchivesData.arc_level_id|default='0'};
  199. var users_level_html = '<option value="0" selected>不限会员</option>';
  200. $.each(download.users_level, function (index, value) {
  201. var selected = parseInt(arc_level_id) === parseInt(value.level_id) ? 'selected' : '';
  202. users_level_html += '<option value="'+value.level_id+'" '+selected+'>'+value.level_name+'</option>\n';
  203. });
  204. $('#arc_level_id').html(users_level_html);
  205. if('local' != download.upload_flag) {
  206. // 第三方
  207. var upload_button_html = '<button type="button" class="layui-btn layui-btn-normal" style="position: relative;z-index: 1;">\n'+download.upload_flag_name+'选择多文件\n<input type="file" name="file" id="'+download.upload_flag+'File" multiple="multiple" onchange="'+download.upload_flag+'_download__upload(this);" style="position: absolute;top: 0;right: 0;opacity: 0;width: 110px;height: 30px;"/>\n</button>';
  208. $('#download-layui-upload').html(upload_button_html);
  209. } else {
  210. $("#buttonList").show();
  211. }
  212. $('#download-layui-upload').attr('data-type', download.upload_flag);
  213. if (1 == download.servername_use) $(".th_server_name").show();
  214. type20210507 = download.basic.file_type;
  215. default_servername20210507 = download.default_servername;
  216. attr_field20210507 = download.attr_field;
  217. servername_use20210507 = download.servername_use;
  218. $("#remote-file-checkbox").prop("checked", true);
  219. var downfile_list = '{$downfile_list}';
  220. downfile_list = JSON.parse(downfile_list);
  221. var template_div_remote20210507_html = '';
  222. var demoList_html = '';
  223. var i = 1;
  224. var n = 1;
  225. $.each(downfile_list, function (index, v) {
  226. if (1 == v.is_remote) {
  227. template_div_remote20210507_html += '<div class="template_div20210507"><div style=" display: block; margin-bottom: 5px; ">远程地址'+i+':<input type="text" name="remote_file[]" value="'+v.file_url+'" placeholder="http://" style="width: 250px;"></div>\n' ;
  228. $.each(attr_field20210507, function (index, value) {
  229. var field_use_style = '';
  230. if (1 != value.field_use) field_use_style = ' style="display: none;" ';
  231. if ('server_name' == value.field_name) {
  232. template_div_remote20210507_html += '<span class="ey_'+value.field_name+'" '+field_use_style+'>\n' +
  233. '<span class="title_'+value.field_name+'">'+value.field_title+'</span>:' +
  234. '<input type="text" name="'+value.field_name+'[]" id="'+value.field_name+'_remote_'+i+'" style="width: 80px;" onclick="searchServername(this);" autocomplete="off" value="'+v[value.field_name]+'" >\n' +
  235. '<div class="help-hot-list remote-hot-list" style="display: none;" data-test_val="5434" id="search_keywords_list_'+value.field_name+'_remote_'+i+'"></div>\n' +
  236. '</span>\n' ;
  237. } else {
  238. template_div_remote20210507_html += '<span class="ey_'+value.field_name+'" '+field_use_style+'>\n' +
  239. '<span class="title_'+value.field_name+'">'+value.field_title+'</span>:' +
  240. '<input type="text" name="'+value.field_name+'[]" id="'+value.field_name+'_remote_'+i+'" style="width: 80px;" value="'+v[value.field_name]+'"></span>\n' ;
  241. }
  242. });
  243. template_div_remote20210507_html += '</div>';
  244. i++;
  245. } else {
  246. var servername_html = '';
  247. if (servername_use20210507 != 1) servername_html = " style=\"display: none;\" ";
  248. demoList_html += '<tr><td><a href="'+v.file_url+'" target="_blank">'+v.file_name+'</a></td>\n' +
  249. ' <td class="th_server_name" '+servername_html+'>\n' +
  250. ' <input type="text" name="fileupload[server_name][]" value="'+v.server_name+'" id="servername_local_'+n+'" onclick="searchServername(this);" autocomplete="off">\n' +
  251. ' <div class="help-hot-list" style="display: none;" id="search_keywords_list_servername_local_'+n+'"></div>\n' +
  252. ' </td>\n' +
  253. ' <td>'+v.file_size+'</td>\n' +
  254. ' <td class="th_server_state"><span style="color: #5FB878;">上传成功</span></td>\n' +
  255. ' <td>\n' +
  256. ' <span class="layui-btn layui-btn-xs layui-btn-danger" style="line-height:unset;height: unset;" onclick="DeleteFile(this)">移除</span>\n' +
  257. ' <input type="hidden" name="fileupload[file_url][]" value="'+v.file_url+'">\n' +
  258. ' <input type="hidden" name="fileupload[file_mime][]" value="'+v.file_mime+'">\n' +
  259. ' <input type="hidden" name="fileupload[file_name][]" value="'+v.file_name+'">\n' +
  260. ' <input type="hidden" name="fileupload[file_ext][]" value="'+v.file_ext+'">\n' +
  261. ' <input type="hidden" name="fileupload[file_size][]" value="'+v.file_size+'">\n' +
  262. ' <input type="hidden" name="fileupload[uhash][]" value="'+v.uhash+'}">\n' +
  263. ' <input type="hidden" name="fileupload[md5file][]" value="'+v.md5file+'">\n' +
  264. ' </td></tr>'
  265. n++;
  266. }
  267. });
  268. $("#Template20210507").html(template_div_remote20210507_html);
  269. $("#demoList").html(demoList_html);
  270. $('#ClickRemoteFile').show();
  271. }
  272. }
  273. },
  274. error: function(e){
  275. layer.closeAll();
  276. showErrorAlert(e.responseText);
  277. }
  278. });
  279. }
  280. </script>
  281. <div class="h50"></div>
  282. <!-- 表单验证 -->
  283. {$TokenValue}
  284. <div class="public-btn">
  285. <a href="JavaScript:void(0);" data-url="{:url('UsersRelease/article_edit', ['_ajax'=>1])}" onclick="editArticle(this);">立即发布</a>
  286. </div>
  287. </form>
  288. </div>
  289. <script type="text/javascript">
  290. // 去除 select中值相同的option(去重),配合{$arctype_html}使用
  291. $(function() {
  292. $("#typeid option").each(function() {
  293. var val = $(this).val();
  294. if ($("#typeid option[value='" + val + "']").length > 1) $("#typeid option[value='" + val + "']:eq(0)").remove();
  295. });
  296. });
  297. function editArticle(obj) {
  298. if (!$('#title').val()) {
  299. showLayerMsg('请填写文章标题');
  300. $('#title').focus();
  301. return false;
  302. }
  303. if (0 === parseInt($('#typeid').val())) {
  304. showLayerMsg('请选择所属栏目');
  305. $('#typeid').focus();
  306. return false;
  307. }
  308. // 视频模型处理视频地址
  309. var channel = $("#typeid option:selected").attr('data-channel');
  310. $("input[name='channel']").val(channel);
  311. if (5 === parseInt(channel)) urlToStr();
  312. showLayerLoad();
  313. $.ajax({
  314. url : $(obj).attr('data-url'),
  315. data: $('#post_form').serialize(),
  316. type: 'post',
  317. dataType: 'json',
  318. success: function(res) {
  319. layer.closeAll();
  320. if (1 == res.code) {
  321. showLayerMsg(res.msg, 2, function() {
  322. window.location.href = res.url;
  323. });
  324. } else {
  325. showLayerMsg(res.msg);
  326. if (res.data) $('#'+res.data).focus();
  327. }
  328. },
  329. error: function(e) {
  330. layer.closeAll();
  331. showErrorAlert(e.responseText);
  332. }
  333. });
  334. }
  335. </script>
  336. </body>
  337. </html>