Sin descripción
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.

article_add.htm 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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="0">
  49. <div class="ey-con ey-row bgfff">
  50. <!-- 公共字段 -->
  51. <div class="item-from-flex">
  52. <div class="item-flex-l">
  53. <div class="item-tit">文章标题 <span class="red">*</span></div>
  54. <div class="item-con">
  55. <input type="text" name="title" id="title" class="input-text" maxlength="100" placeholder="请输入文章标题">
  56. </div>
  57. </div>
  58. </div>
  59. <div class="item-from-flex">
  60. <div class="item-flex-l">
  61. <div class="item-tit">所属栏目 <span class="red">*</span></div>
  62. <div class="item-con">
  63. <div class="select">
  64. {$arctype_html}
  65. </div>
  66. </div>
  67. </div>
  68. <div class="item-flex-r"> <i class="el-icon-arrow-right"></i> </div>
  69. </div>
  70. <div class="item-from-flex">
  71. <div class="item-flex-l">
  72. <div class="item-tit">TAG标签</div>
  73. <div class="item-con">
  74. <input type="text" name="tags" id="tags" class="input-text" placeholder="多个标签之间用逗号隔开">
  75. </div>
  76. </div>
  77. </div>
  78. <div class="item-from-flex" id="openLitpic" {empty name='$is_litpic_users_release' value='1'} style="display: none;" {/empty}>
  79. <div class="item-flex-l">
  80. <div class="item-tit">缩略图</div>
  81. <div class="item-con">
  82. <div class="item-flex-img">
  83. <a href="javascript:void(0);" onclick="$('#litpicOnclick').trigger('click');" class="img-upload" title="点击上传">
  84. <div class="y-line" id="litpicYline"></div>
  85. <div class="x-line" id="litpicXline"></div>
  86. <img src="" id="litpicImgSrc">
  87. </a>
  88. <input type="hidden" name="litpic_inpiut" id="litpicInpiut">
  89. <input type="file" name="litpic_inpiut_file" id="litpicOnclick" onchange="litpicOnclickFile(this);" style="display: none;">
  90. <!-- <span id="litpicSpan" style="cursor: pointer; display: none;" onclick="$('#litpicOnclick').trigger('click');">修改</span> -->
  91. </div>
  92. </div>
  93. </div>
  94. <script type="text/javascript">
  95. function litpicOnclickFile(obj) {
  96. var file = $(obj)[0].files[0];
  97. if (!file) return false;
  98. var formData = new FormData();
  99. formData.append('_ajax', 1);
  100. formData.append('file', file);
  101. formData.append('compress', '1000-1000');
  102. showLayerLoad();
  103. $.ajax({
  104. type: 'post',
  105. url: eyou_basefile + "?m=user&c=Uploadify&a=imageUp",
  106. data: formData,
  107. contentType: false,
  108. processData: false,
  109. dataType: 'json',
  110. success: function (res) {
  111. layer.closeAll();
  112. if (res.state == 'SUCCESS') {
  113. // $('#litpicSpan').show();
  114. $("#litpicInpiut").val(res.url);
  115. $('#litpicYline, #litpicXline').hide();
  116. $("#litpicImgSrc").attr('src', res.url);
  117. } else {
  118. showErrorAlert(res.state);
  119. }
  120. },
  121. error: function(e) {
  122. layer.closeAll();
  123. showErrorAlert(e.responseText);
  124. }
  125. })
  126. }
  127. </script>
  128. </div>
  129. <!--下载模型特定字段-->
  130. <div style="display: none;" id="downloadModel">
  131. {eyou:include file="users/article_download_add.htm" /}
  132. </div>
  133. <!--视频模型特定字段-->
  134. <div style="display: none;" id="mediaModel">
  135. {eyou:include file="users/article_media_add.htm" /}
  136. </div>
  137. <!-- 图集模型特定字段 -->
  138. <div style="display: none;" id="imagesModel">
  139. {eyou:include file="users/article_images_add.htm" /}
  140. </div>
  141. <!-- 模型自定义字段 -->
  142. <span id="FieldAddonextitem"></span>
  143. <script type="text/javascript">
  144. $(function() {
  145. // 默认执行选中栏目
  146. var typeid = {$typeid|default='0'};
  147. if (0 === parseInt(typeid)) typeid = $('#typeid').find('option:selected').val();
  148. getAddonextitem(0, typeid);
  149. // 切换执行选中栏目
  150. $('#typeid').change(function() {
  151. getAddonextitem(1, $(this).val());
  152. });
  153. });
  154. function getAddonextitem(init, typeid) {
  155. // 设置选中栏目的模型ID
  156. var channel = $("#typeid option:selected").attr('data-channel');
  157. $("input[name='channel']").val(channel);
  158. // 模型字段隐藏、显示处理
  159. $("#mediaModel").hide();
  160. $("#imagesModel").hide();
  161. $("#downloadModel").hide();
  162. if (3 === parseInt(channel)) {
  163. // 图集模型特定字段
  164. $("#imagesModel").show();
  165. } else if (4 === parseInt(channel)) {
  166. // 下载模型特定字段
  167. $("#downloadModel").show();
  168. } else if (5 === parseInt(channel)) {
  169. // 视频特定模型字段
  170. $("#mediaModel").show();
  171. }
  172. // 操作提示
  173. showLayerLoad();
  174. $.ajax({
  175. url : "{:url('user/UsersRelease/get_addonextitem')}",
  176. data: {typeid: typeid, channel: channel, _ajax: 1},
  177. type: 'post',
  178. success: function(res) {
  179. layer.closeAll();
  180. if (0 === parseInt(res.code)) {
  181. showErrorAlert(res.msg);
  182. } else {
  183. // 缩略图隐藏、显示处理
  184. $('#openLitpic').hide();
  185. if (res.data.is_litpic_users_release) $('#openLitpic').show();
  186. // 模型自定义字段加载
  187. $('#FieldAddonextitem').empty().html(res.data.html);
  188. // 渲染编辑器
  189. if (1 === parseInt(init)) {
  190. $.each(res.data.htmltextField, function (index, value) {
  191. showEditor_1597892187('addonFieldExt_'+value);
  192. });
  193. }
  194. // 下载模型特定处理
  195. if (4 === parseInt(channel)) {
  196. var download = res.data.download;
  197. var users_level_html = '<option value="0" selected>不限会员</option>';
  198. $.each(download.users_level, function (index, value) {
  199. users_level_html += '<option value="'+value.level_id+'">'+value.level_name+'</option>\n';
  200. });
  201. $('#arc_level_id').html(users_level_html);
  202. if ('local' != download.upload_flag) {
  203. // 第三方
  204. var upload_button_html = '<button type="button" class="layui-btn layui-btn-normal" style="position: relative;z-index: 1;">\n' + download.upload_flag + '选择多文件\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>';
  205. $('#download-layui-upload').prepend(upload_button_html);
  206. } else {
  207. $("#buttonList").show();
  208. }
  209. $('#download-layui-upload').attr('data-type', download.upload_flag);
  210. if (1 === parseInt(download.servername_use)) $(".th_server_name").show();
  211. type20210507 = download.basic.file_type;
  212. attr_field20210507 = download.attr_field;
  213. servername_use20210507 = download.servername_use;
  214. default_servername20210507 = download.default_servername;
  215. }
  216. }
  217. },
  218. error: function(e){
  219. layer.closeAll();
  220. showErrorAlert(e.responseText);
  221. }
  222. });
  223. }
  224. </script>
  225. </div>
  226. <div class="h50"></div>
  227. {$TokenValue}
  228. <div class="public-btn">
  229. <a href="JavaScript:void(0);" data-url="{:url('UsersRelease/article_add', ['_ajax'=>1])}" onclick="addArticle(this);">立即发布</a>
  230. </div>
  231. </form>
  232. </div>
  233. <script type="text/javascript">
  234. // 去除 select中值相同的option(去重),配合{$arctype_html}使用
  235. $(function() {
  236. $("#typeid option").each(function() {
  237. var val = $(this).val();
  238. if ($("#typeid option[value='" + val + "']").length > 1) $("#typeid option[value='" + val + "']:eq(0)").remove();
  239. });
  240. });
  241. function addArticle(obj) {
  242. if (!$('#title').val()) {
  243. showLayerMsg('请填写文章标题');
  244. $('#title').focus();
  245. return false;
  246. }
  247. if (0 === parseInt($('#typeid').val())) {
  248. showLayerMsg('请选择所属栏目');
  249. $('#typeid').focus();
  250. return false;
  251. }
  252. // 视频模型处理视频地址
  253. var channel = $("#typeid option:selected").attr('data-channel');
  254. $("input[name='channel']").val(channel);
  255. if (5 === parseInt(channel)) urlToStr();
  256. showLayerLoad();
  257. $.ajax({
  258. url : $(obj).attr('data-url'),
  259. data: $('#post_form').serialize(),
  260. type: 'post',
  261. dataType: 'json',
  262. success: function(res) {
  263. layer.closeAll();
  264. if (1 == res.code) {
  265. if (res.data.email) eyUnifiedSendRemind(res.data.email);
  266. if (res.data.mobile) eyUnifiedSendRemind(res.data.mobile);
  267. showLayerMsg(res.msg, 2, function() {
  268. window.location.href = res.url;
  269. });
  270. } else {
  271. showLayerMsg(res.msg);
  272. if (res.data) $('#'+res.data).focus();
  273. }
  274. },
  275. error: function(e) {
  276. layer.closeAll();
  277. showErrorAlert(e.responseText);
  278. }
  279. });
  280. }
  281. </script>
  282. </body>
  283. </html>