infoForm.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
  2. <%@ page contentType="text/html;charset=UTF-8" %>
  3. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  4. <html>
  5. <head>
  6. <title>文章列表管理</title>
  7. <meta name="decorator" content="default"/>
  8. <style type="text/css">
  9. .init-label label{margin: 5px 10px;color: gray; }
  10. </style>
  11. </head>
  12. <body>
  13. <ul class="nav nav-tabs">
  14. <li><a href="${ctx}/info/info/">文章列表</a></li>
  15. <li class="active"><a href="${ctx}/info/info/form?id=${info.id}&ltype=${ltype}">文章<shiro:hasPermission name="info:info:edit">${not empty info.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="info:info:edit">查看</shiro:lacksPermission></a></li>
  16. </ul><br/>
  17. <form:form id="inputForm" modelAttribute="info" action="${ctx}/info/info/save?ltype=${ltype}" method="post" class="form-horizontal">
  18. <form:hidden path="id"/>
  19. <sys:message content="${message}"/>
  20. <div class="control-group">
  21. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>标题:</label>
  22. <div class="controls">
  23. <form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
  24. </div>
  25. </div>
  26. <div class="control-group">
  27. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>文章标签:</label>
  28. <div class="controls">
  29. <form:input path="label" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
  30. <span class="help-inline">多个标签之间请用逗号分隔开</span>
  31. <div class="init-label">
  32. <!-- <label>美白</label><label>祛斑</label><label>祛痘</label><label>瘦脸</label><label>去皱</label><label>缩毛孔</label>
  33. <label>减肥瘦身</label><label>祛斑</label><label>祛痘</label><label>瘦脸</label><label>去皱</label><label>缩毛孔</label> -->
  34. </div>
  35. <input id="labelName" type="text" placeholder="在此处输入标签,将自动关联到文章标签" class="input-xlarge"/>
  36. <a href="javascript:addLeable();">添加</a>
  37. </div>
  38. </div>
  39. <div class="control-group">
  40. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>SEO关键词:</label>
  41. <div class="controls">
  42. <form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xlarge required"/>
  43. </div>
  44. </div>
  45. <div class="control-group">
  46. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>发布人:</label>
  47. <div class="controls">
  48. <form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xlarge required"/>
  49. </div>
  50. </div>
  51. <div class="control-group">
  52. <label class="control-label">来源:</label>
  53. <div class="controls">
  54. <form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/>
  55. </div>
  56. </div>
  57. <div class="control-group">
  58. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>推荐语(描述):</label>
  59. <div class="controls">
  60. <form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/>
  61. </div>
  62. </div>
  63. <div class="control-group">
  64. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>文章内容:</label>
  65. <div class="controls" style="width:812px">
  66. <form:textarea path="infoContent" htmlEscape="false" class="input-xlarge required hide" />
  67. <!-- 富文本编辑器 -->
  68. <div id="infoContentEditor">${info.infoContent}</div>
  69. </div>
  70. </div>
  71. <div class="control-group">
  72. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>文章分类:</label>
  73. <div class="controls">
  74. <%-- <form:input path="typeId" htmlEscape="false" maxlength="11" class="input-xlarge required"/> --%>
  75. <form:select path="infoType.id" class="input-small required">
  76. <form:options items="${typeList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
  77. </form:select>
  78. </div>
  79. </div>
  80. <div class="control-group">
  81. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>引导图:</label>
  82. <div class="controls">
  83. <form:hidden id="nameImage" path="guidanceImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
  84. <sys:ckfinder input="nameImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  85. </div>
  86. </div>
  87. <div class="control-group">
  88. <label class="control-label"><span class="help-inline"></span>商城首页图:</label>
  89. <div class="controls">
  90. <form:hidden id="homePageImage" path="homePageImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
  91. <sys:ckfinder input="homePageImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  92. <label style="margin-left: 20px">建议图片分辨率252px*252px</label>
  93. </div>
  94. </div>
  95. <div class="control-group">
  96. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>发布时间:</label>
  97. <div class="controls">
  98. <input name="pubdate" type="text" maxlength="20" class="input-medium Wdate required"
  99. value="<fmt:formatDate value="${info.pubdate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
  100. onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
  101. </div>
  102. </div>
  103. <div class="control-group">
  104. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>推荐状态:</label>
  105. <div class="controls">
  106. <form:radiobuttons path="recommendStatus" items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
  107. </div>
  108. </div>
  109. <div class="control-group">
  110. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>状态:</label>
  111. <div class="controls">
  112. <form:radiobuttons path="enabledStatus" items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
  113. </div>
  114. </div>
  115. <%--<div class="control-group">
  116. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>优先级:</label>
  117. <div class="controls">
  118. <form:input path="priorityIndex" htmlEscape="false" maxlength="9" class="input-xlarge required digits" value="${empty info.priorityIndex?0:(info.priorityIndex)}"/>
  119. </div>
  120. </div>--%>
  121. <div class="control-group">
  122. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>基础点赞:</label>
  123. <div class="controls">
  124. <form:input path="basePraise" htmlEscape="false" maxlength="11" class="input-xlarge required digits" value="${empty info.basePraise?0:(info.basePraise)}"/>
  125. </div>
  126. </div>
  127. <c:if test="${not empty info.id}">
  128. <div class="control-group">
  129. <label class="control-label">实际点赞:</label>
  130. <div class="controls">
  131. ${empty info.realPraise?0:(info.realPraise)}
  132. </div>
  133. </div>
  134. </c:if>
  135. <div class="control-group">
  136. <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>基础浏览量:</label>
  137. <div class="controls">
  138. <form:input path="basePv" htmlEscape="false" maxlength="11" class="input-xlarge required digits" value="${empty info.basePv?0:(info.basePv)}"/>
  139. </div>
  140. </div>
  141. <c:if test="${not empty info.id}">
  142. <div class="control-group">
  143. <label class="control-label">实际浏览量:</label>
  144. <div class="controls">
  145. ${empty info.pv?0:(info.pv)}
  146. </div>
  147. </div>
  148. </c:if>
  149. <div class="form-actions">
  150. <shiro:hasPermission name="info:info:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick="checkInfo()"/>&nbsp;</shiro:hasPermission>
  151. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  152. </div>
  153. </form:form>
  154. <!-- 富文本编辑器 -->
  155. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  156. <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
  157. <script type="text/javascript">
  158. $(document).ready(function() {
  159. //富文本框
  160. ClassicEditor.create(document.querySelector('#infoContentEditor'), {
  161. ckfinder: {
  162. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  163. }
  164. }).then(function(editor) {
  165. window.infoContentEditor = editor;
  166. }).catch(function(error){
  167. console.log(error);
  168. });
  169. //$("#name").focus();
  170. $("#inputForm").validate({
  171. ignore:"",
  172. submitHandler: function(form){
  173. loading('正在提交,请稍等...');
  174. form.submit();
  175. },
  176. errorContainer: "#messageBox",
  177. errorPlacement: function(error, element) {
  178. $("#messageBox").text("输入有误,请先更正。");
  179. if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
  180. error.appendTo(element.parent().parent());
  181. } else {
  182. error.insertAfter(element);
  183. }
  184. }
  185. });
  186. LabelInit();
  187. $(".init-label label").bind("click",function(){
  188. var label=$(this).text();
  189. var label1=label+",";
  190. var _label=$("#label").val()+",";
  191. if(_label.indexOf(label1)>-1){
  192. alert("文章标签中已包含该标签!!");
  193. }else{
  194. setLabel(label);
  195. }
  196. });
  197. });
  198. //富文本框编辑
  199. function checkInfo(){
  200. var infoContent=infoContentEditor.getData();
  201. $("#infoContent").val(infoContent);
  202. console.log(infoContent);
  203. }
  204. function LabelInit(){
  205. var items="${fns:getDictValue('label','sys_config','')}"+",";
  206. /* var _labels="${info.label}";
  207. var _label=_labels.split(",");
  208. for (var i = 0; i < _label.length; i++) {
  209. items=items.replace(_label[i]+",","");
  210. } */
  211. /* var items="美白,祛斑,祛痘,补水,瘦脸,去皱,缩毛孔,减肥瘦身,提拉紧致,嫩肤,去眼袋,去法令纹,脱毛,纹眉,去黑眼圈,美白嫩肤,面部提升,祛斑祛痣,除皱,去红血丝,祛疤,祛妊娠纹,纹身,纤体塑性,纹眉"; */
  212. var info=items.split(",");
  213. var html='';
  214. for (var i = 0; i < info.length; i++) {
  215. if(''!=info[i]){
  216. html+="<label>"+info[i]+"</label>";
  217. if((i+1)%9==0){
  218. html+="<br>";
  219. }
  220. }
  221. }
  222. $(".init-label").append(html);
  223. $("#labelName").typeahead({
  224. property : 'name',
  225. source:function(typeahead, query){
  226. query = $.trim(query);
  227. if(''==query){return;}
  228. $.ajax({
  229. type:"POST", dataType:"JSON", async:false,
  230. url: "${ctx}/info/infoLabel/findByName",
  231. data:{name: query},
  232. success:function(data){
  233. typeahead.process(data);
  234. }
  235. });
  236. },
  237. onselect : function(data) {
  238. setLabel(data.name);
  239. $("#labelName").focus(); //选择完后 回到当前输入框以便下一个动作的验证
  240. }
  241. });
  242. }
  243. function setLabel(name){
  244. if(name!=''){
  245. var label=$("#label").val();
  246. if(label==''){
  247. label=name;
  248. }else{
  249. label=label+","+name;
  250. }
  251. $("#label").val(label);
  252. $("#labelName").val("");
  253. }
  254. }
  255. function addLeable(){
  256. var label=$("#labelName").val();
  257. if(''==label){
  258. $.jBox.tip('添加的标签不能为空!','error');
  259. }else{
  260. setLabel(label);
  261. }
  262. }
  263. </script>
  264. </body>
  265. </html>