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.

159 lines
6.6 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. @extends('admin.layouts.app')
  2. @section('title', '发布文章')
  3. @section('content')
  4. <h5 class="sub-header"><a href="/fladmin/article">文章列表</a> > 发布文章</h5>
  5. <form id="addarc" method="post" action="/fladmin/article/doadd" role="form" enctype="multipart/form-data" class="table-responsive">{{ csrf_field() }}
  6. <table class="table table-striped table-bordered">
  7. <tbody>
  8. <tr>
  9. <td align="right">文章标题:</td>
  10. <td><input name="title" type="text" id="title" value="" class="required" style="width:60%" placeholder="在此输入标题"></td>
  11. </tr>
  12. <tr>
  13. <td align="right">是否审核:</td>
  14. <td>
  15. <input type="radio" value='0' name="ischeck" checked />&nbsp;&nbsp;&nbsp;
  16. <input type="radio" value='1' name="ischeck" />&nbsp;
  17. </td>
  18. </tr>
  19. <tr>
  20. <td align="right">推荐:</td>
  21. <td>
  22. <select name="tuijian" id="tuijian">
  23. <?php $tuijian = config('custom.tuijian');
  24. for($i=0;$i<count($tuijian);$i++){?><option value="<?php echo $i; ?>"><?php echo $tuijian[$i]; ?></option><?php } ?>
  25. </select>
  26. </td>
  27. </tr>
  28. <tr>
  29. <td align="right">seoTitle:</td>
  30. <td><input name="seotitle" type="text" id="seotitle" value="" style="width:60%"></td>
  31. </tr>
  32. <tr>
  33. <td align="right" style="vertical-align:middle;">缩略图:</td>
  34. <td style="vertical-align:middle;"><button type="button" onclick="upImage();">选择图片</button> <input name="litpic" type="text" id="litpic" value="" style="width:40%"> <img style="margin-left:20px;display:none;" src="" width="120" height="80" id="picview"></td>
  35. </tr>
  36. <script type="text/javascript">
  37. var _editor;
  38. $(function() {
  39. //重新实例化一个编辑器,防止在上面的editor编辑器中显示上传的图片或者文件
  40. _editor = UE.getEditor('ueditorimg');
  41. _editor.ready(function () {
  42. //设置编辑器不可用
  43. _editor.setDisabled('insertimage');
  44. //隐藏编辑器,因为不会用到这个编辑器实例,所以要隐藏
  45. _editor.hide();
  46. //侦听图片上传
  47. _editor.addListener('beforeInsertImage', function (t, arg) {
  48. //将地址赋值给相应的input,只取第一张图片的路径
  49. $('#litpic').val(arg[0].src);
  50. //图片预览
  51. $('#picview').attr("src",arg[0].src).css("display","inline-block");
  52. })
  53. });
  54. });
  55. //弹出图片上传的对话框
  56. function upImage()
  57. {
  58. var myImage = _editor.getDialog("insertimage");
  59. myImage.render();
  60. myImage.open();
  61. }
  62. </script>
  63. <script type="text/plain" id="ueditorimg"></script>
  64. <tr>
  65. <td align="right">来源:</td>
  66. <td colspan="2"><input name="source" type="text" id="source" style="width:160px" value="" size="16">&nbsp;&nbsp; 作者:<input name="writer" type="text" id="writer" style="width:100px" value="">&nbsp;&nbsp; 浏览次数:<input type="text" name="click" id="click" value="<?php echo rand(200,500); ?>" style="width:80px;"></td>
  67. </tr>
  68. <tr>
  69. <td align="right">文章栏目:</td>
  70. <td>
  71. <select name="typeid" id="typeid">
  72. <?php $catlist = category_tree(get_category('arctype',0));foreach($catlist as $row){
  73. if($row["id"]==$catid){ ?>
  74. <option selected="selected" value="<?php echo $row["id"]; ?>"><?php for($i=0;$i<$row["deep"];$i++){echo "";}echo $row["name"]; ?></option>
  75. <?php }else{ ?>
  76. <option value="<?php echo $row["id"]; ?>"><?php for($i=0;$i<$row["deep"];$i++){echo "";}echo $row["name"]; ?></option>
  77. <?php }} ?>
  78. </select>
  79. </td>
  80. </tr>
  81. <tr>
  82. <td align="right">关键词:</td>
  83. <td><input type="text" name="keywords" id="keywords" style="width:50%" value=""> (多个用","分开)</td>
  84. </tr>
  85. <tr>
  86. <td align="right" style="vertical-align:middle;">内容摘要:</td>
  87. <td><textarea name="description" rows="5" id="description" style="width:80%;height:70px;vertical-align:middle;"></textarea></td>
  88. </tr>
  89. <tr>
  90. <td align="right">附加选项:</td>
  91. <td>
  92. <input name="dellink" type="checkbox" class="np" id="dellink" value="1">
  93. 删除非站内链接
  94. <input name="autolitpic" type="checkbox" class="np" id="autolitpic" value="1" checked="1">
  95. 提取第一个图片为缩略图
  96. </td>
  97. </tr>
  98. <tr>
  99. <td colspan="2"><strong>文章内容:</strong></td>
  100. </tr>
  101. <tr>
  102. <td colspan="2">
  103. <!-- 加载编辑器的容器 --><script id="container" name="body" type="text/plain"></script>
  104. <!-- 配置文件 --><script type="text/javascript" src="/other/flueditor/ueditor.config.js"></script>
  105. <!-- 编辑器源码文件 --><script type="text/javascript" src="/other/flueditor/ueditor.all.min.js"></script>
  106. <!-- 实例化编辑器 --><script type="text/javascript">var ue = UE.getEditor('container',{maximumWords:100000,initialFrameHeight:320,enableAutoSave:false});</script></td>
  107. </tr>
  108. <tr>
  109. <td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button>&nbsp;&nbsp;<button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button></td>
  110. </tr>
  111. </tbody></table></form><!-- 表单结束 -->
  112. <script>
  113. $(function(){
  114. $(".required").blur(function(){
  115. var $parent = $(this).parent();
  116. $parent.find(".formtips").remove();
  117. if(this.value=="")
  118. {
  119. $parent.append(' <small class="formtips onError"><font color="red">不能为空!</font></small>');
  120. }
  121. else
  122. {
  123. var title = $("#title").val();
  124. $.ajax({
  125. url: <?php echo route('admin_article_articleexists'); ?>,
  126. type: "GET",
  127. cache: false,
  128. data: {
  129. "title":title
  130. },
  131. success: function(data){
  132. if(data>0)
  133. {
  134. $parent.append(' <small class="formtips onSuccess"><font color="green">已经存在</font></small>');
  135. }
  136. else
  137. {
  138. $parent.append(' <small class="formtips onSuccess"><font color="green">OK</font></small>');
  139. }
  140. }
  141. });
  142. }
  143. });
  144. //重置
  145. $('#addarc input[type="reset"]').click(function(){
  146. $(".formtips").remove();
  147. });
  148. $("#addarc").submit(function(){
  149. $(".required").trigger('blur');
  150. var numError = $('#addarc .onError').length;
  151. if(numError){return false;}
  152. });
  153. });
  154. </script>
  155. @endsection