auditInfoPage.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
  2. <%@ taglib prefix="input" uri="/struts-tags" %>
  3. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  4. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  5. <html>
  6. <head>
  7. <title>编辑文章</title>
  8. <meta name="decorator" content="default"/>
  9. <style>
  10. .red{color:red}
  11. #inputForm{max-width:1200px;width:100%}
  12. #inputForm table{width:100%;line-height:18px;margin-bottom:50px}
  13. #inputForm th,#inputForm td{font-weight:normal;text-align:left;padding:8px 5px;border-bottom:1px solid rgb(238,238,238)}
  14. #inputForm th{width:15%;text-align:right;white-space:nowrap;font-weight:bold}
  15. #inputForm td input[type="text"]{width:320px;height:16px;line-height:16px}
  16. .init-label label{margin:5px 10px;color:gray}
  17. </style>
  18. <script type="text/javascript">
  19. var ontypeId = null;
  20. var typeId = null;
  21. function ischangeType() {
  22. if (null != typeId) {
  23. $("#typeListId option[value=" + typeId + "]").val(ontypeId);
  24. }
  25. $("#optionType").find("option").eq(0).prop("selected", true)
  26. optionTypeParent()
  27. }
  28. function optionTypeParent() {
  29. $("#optionType [parent]").each(function (item) {
  30. if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
  31. $(this).show()
  32. } else {
  33. $(this).hide()
  34. }
  35. })
  36. }
  37. function isoptionType() {
  38. if ("" != $("#optionType option:selected").val()) {
  39. ontypeId = $("#optionType option:selected").attr("parent")
  40. typeId = $("#optionType option:selected").val()
  41. $("#typeListId option:selected").val($("#optionType option:selected").val())
  42. }else {
  43. ischangeType()
  44. }
  45. }
  46. $(document).ready(function () {
  47. $("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
  48. optionTypeParent()
  49. isoptionType()
  50. })
  51. </script>
  52. </head>
  53. <body>
  54. <ul class="nav nav-tabs">
  55. <li><a href="${ctx}/info/info/?publishSource=2">文章列表</a></li>
  56. <li class="active"><a href="${ctx}/info/info/toAuditPage?id=${info.id}">审核</a></li>
  57. </ul>
  58. <form:form id="inputForm" modelAttribute="info" action="${ctx}/info/info/save?ltype=2&publishSource=2&auditFlag=1" method="post" class="form-horizontal">
  59. <form:hidden path="id"/>
  60. <form:hidden path="shopId"/>
  61. <sys:message content="${message}"/>
  62. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  63. <tr>
  64. <th><span class="red">*</span>文章标题:</th>
  65. <td colspan="3">
  66. <form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
  67. <label id="titleSensitiveWords" class="red"></label>
  68. </td>
  69. </tr>
  70. <tr>
  71. <th><span class="red">*</span>文章标签:</th>
  72. <td colspan="3">
  73. <form:input path="label" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
  74. <label id="labelSensitiveWords" class="red"></label>
  75. <span class="help-inline">多个标签之间请用逗号分隔开</span>
  76. <div class="init-label"></div>
  77. <input id="labelName" type="text" placeholder="在此处输入标签,将自动关联到文章标签" class="input-xlarge"/>
  78. <a href="javascript:addLeable();">添加</a>
  79. </td>
  80. </tr>
  81. <tr>
  82. <th><span class="red">*</span>SEO关键词:</th>
  83. <td colspan="3">
  84. <form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
  85. <label id="keywordSensitiveWords" class="red"></label>
  86. </td>
  87. </tr>
  88. <tr>
  89. <th><span class="red">*</span>发布人:</th>
  90. <td colspan="3">
  91. <form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
  92. <label id="publisherSensitiveWords" class="red"></label>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th><span class="red">*</span>来源:</th>
  97. <td colspan="3">
  98. <form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/>
  99. <label id="sourceSensitiveWords" class="red"></label>
  100. </td>
  101. </tr>
  102. <tr>
  103. <th><span class="red">*</span>推荐语(描述):</th>
  104. <td colspan="3">
  105. <form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/>
  106. <label id="recommendContentSensitiveWords" class="red"></label>
  107. </td>
  108. </tr>
  109. <tr>
  110. <th><span class="red">*</span>文章内容:</th>
  111. <td colspan="3">
  112. <div class="detailInfoEditor" style="width:760px;">
  113. <form:textarea path="infoContent" class="input-xlarge hide"/>
  114. <!-- 富文本编辑器 -->
  115. <div id="infoDetailEditor">${info.infoContent}</div>
  116. <label id="infoContentSensitiveWords" class="red"></label>
  117. </div>
  118. </td>
  119. </tr>
  120. <tr>
  121. <th><span class="red">*</span>文章分类:</th>
  122. <td colspan="3">
  123. <form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
  124. <c:forEach items="${typeList}" var="type" varStatus="index">
  125. <c:if test="${type.parentId eq 0}">
  126. <form:option value="${type.id}" label="${type.name}"/>
  127. </c:if>
  128. </c:forEach>
  129. </form:select>
  130. <form:select id="optionType" path="typeId" class="input-small" onchange="isoptionType()">
  131. <form:option value="" label=" "/>
  132. <c:forEach items="${typeList}" var="type" varStatus="index">
  133. <c:if test="${type.parentId ne 0}">
  134. <form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
  135. cssStyle="display: none"/>
  136. </c:if>
  137. </c:forEach>
  138. </form:select>
  139. </td>
  140. </tr>
  141. <tr>
  142. <th><span class="red">*</span>引导图:</th>
  143. <td colspan="3">
  144. <form:hidden id="nameImage" path="guidanceImage" htmlEscape="false" class="input-xlarge required"/>
  145. <sys:ckfinder input="nameImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  146. </td>
  147. </tr>
  148. <tr>
  149. <th>商城首页图:</th>
  150. <td colspan="3">
  151. <form:hidden id="homePageImage" path="homePageImage" htmlEscape="false" maxlength="255" class="input-xlarge"/>
  152. <sys:ckfinder input="homePageImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
  153. <label style="margin-left: 20px">建议图片分辨率252px*252px</label>
  154. </td>
  155. </tr>
  156. <tr>
  157. <th><span class="red">*</span>发布时间:</th>
  158. <td colspan="3">
  159. <fmt:formatDate value="${info.pubdate}" pattern="yyyy-MM-dd HH:mm:ss"/>
  160. </td>
  161. </tr>
  162. <tr>
  163. <th>审核状态:</th>
  164. <td colspan="3">
  165. ${info.auditStatus eq 1?'待审核':info.auditStatus eq 2?'审核通过':'审核失败'}
  166. </td>
  167. </tr>
  168. <tr>
  169. <th>供应商:</th>
  170. <td colspan="3">
  171. ${info.shopName}
  172. </td>
  173. </tr>
  174. <tr>
  175. <th>添加时间:</th>
  176. <td colspan="3">
  177. <fmt:formatDate value="${info.createDate}" pattern="yyyy-MM-dd HH:mm"/>
  178. </td>
  179. </tr>
  180. <c:if test="${not empty info.id}">
  181. <tr>
  182. <th><span class="red">*</span>实际点赞:</th>
  183. <td colspan="3">
  184. ${empty info.realPraise?0:(info.realPraise)}
  185. </td>
  186. </tr>
  187. </c:if>
  188. <c:if test="${not empty info.id}">
  189. <tr>
  190. <th><span class="red">*</span>实际浏览量:</th>
  191. <td colspan="3">
  192. ${empty info.pv?0:(info.pv)}
  193. </td>
  194. </tr>
  195. <tr>
  196. <th><span class="red">*</span>供应商状态:</th>
  197. <td colspan="3">
  198. <font color="${info.enabledStatus eq 1?'#2FA4E7':'red'}"> ${info.enabledStatus eq 1?'已发布':'暂不发布'}</font>
  199. </td>
  200. </tr>
  201. </c:if>
  202. <tr>
  203. <th><span class="red"></span>审核:</th>
  204. <td colspan="3">
  205. <input type="radio" name="auditStatus" value="2" onclick="updateAuditStatus(2)" ${empty info.auditStatus?'checked=checked':info.auditStatus eq 1?'checked=checked':''}> 审核通过
  206. <input type="radio" name="auditStatus" value="3" onclick="updateAuditStatus(3)" ${info.auditStatus eq 3?'checked=checked':''}> 审核失败
  207. </td>
  208. </tr>
  209. <tr id="failReasonDiv" style="${(empty info.auditStatus or info.auditStatus ne 3)?'display: none':''}">
  210. <th><span class="red">*</span>失败原因:</th>
  211. <td colspan="3">
  212. <textarea type="text" id="failReason" name="failReason" style="width: 400px;height: 90px">${info.failReason}</textarea>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td colspan="4" style="text-align:center;">
  217. <shiro:hasPermission name="info:info:edit">
  218. <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="checkInfo()"/>
  219. </shiro:hasPermission>
  220. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  221. </td>
  222. </tr>
  223. </table>
  224. </form:form>
  225. <!-- 富文本编辑器 -->
  226. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  227. <%--<script src="https://cdn.bootcdn.net/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js"></script>--%>
  228. <script type="text/javascript" src="${ctxStatic}/jquery-validation/1.19.3/jquery.validate.js"></script>
  229. <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
  230. <script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
  231. <script type="text/javascript">
  232. $(document).ready(function() {
  233. //$("#name").focus();
  234. $("#inputForm").validate({
  235. ignore:"",
  236. submitHandler: function(form){
  237. if ($("#title").val() == '') {
  238. alertx("请输入文章标题");
  239. return false;
  240. }
  241. if ($("#label").val() == '') {
  242. alertx("请输入文章标签");
  243. return false;
  244. }
  245. if ($("#keyword").val() == '') {
  246. alertx("请输入SEO关键词");
  247. return false;
  248. }
  249. if ($("#publisher").val() == '') {
  250. alertx("请输入发布人");
  251. return false;
  252. }
  253. if ($("#pubdate").val() == '') {
  254. alertx("请输入发布时间");
  255. return false;
  256. }
  257. if ($("#recommendContent").val() == '') {
  258. alertx("请输入推荐语(描述)");
  259. return false;
  260. }
  261. if ($("#infoContent").val() == '') {
  262. alertx("请输入文章内容");
  263. return false;
  264. }
  265. if ($("#guidanceImage").val() == '') {
  266. alertx("请上传引导图");
  267. return false;
  268. }
  269. if ($("#basePraise").val() == '') {
  270. alertx("请输入基础点赞");
  271. return false;
  272. }
  273. if ($("#basePv").val() == '') {
  274. alertx("请输入基础浏览量");
  275. return false;
  276. }
  277. var auditStatus = $("input[name='auditStatus']:checked").val();
  278. var failReason = $("#failReason").val().trim();
  279. if (3 == auditStatus && "" == failReason){
  280. alertx("请输入失败原因");
  281. return false;
  282. }
  283. loading('正在提交,请稍等...');
  284. form.submit();
  285. },
  286. errorContainer: "#messageBox",
  287. errorPlacement: function(error, element) {
  288. $("#messageBox").text("输入有误,请先更正。");
  289. if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
  290. error.appendTo(element.parent().parent());
  291. } else {
  292. error.insertAfter(element);
  293. }
  294. }
  295. });
  296. });
  297. //初始化标签
  298. $(function () {
  299. $(".init-label label").bind("click",function(){
  300. var label=$(this).text();
  301. var label1=label+",";
  302. var _label=$("#label").val()+",";
  303. if(_label.indexOf(label1)>-1){
  304. alert("文章标签中已包含该标签!!");
  305. }else{
  306. setLabel(label);
  307. }
  308. });
  309. var title = $("#title").val();
  310. var label = $("#label").val();
  311. var keyword = $("#keyword").val();
  312. var publisher = $("#publisher").val();
  313. var source = $("#source").val();
  314. var recommendContent = $("#recommendContent").val();
  315. var infoContent = $("#infoContent").val();// 检测敏感词
  316. var propertyMap = new Map();
  317. propertyMap.set("title", title);
  318. propertyMap.set("label", label);
  319. propertyMap.set("keyword", keyword);
  320. propertyMap.set("publisher", publisher);
  321. propertyMap.set("source", source);
  322. propertyMap.set("recommendContent", recommendContent);
  323. propertyMap.set("infoContent", infoContent);
  324. var sensitiveWords = '${sensitiveWords}';
  325. const mint = new MintFilter(sensitiveWords.split('|'));
  326. var filterSync = '';
  327. var touchWords = '';
  328. var touchNum = 0;
  329. propertyMap.forEach(function (value,key,map) {
  330. filterSync = mint.filterSync(value);
  331. filterSync.words.forEach(word=>{
  332. touchWords += touchWords === '' ? word : "," + word;
  333. })
  334. if (touchWords !== '') {
  335. // 增加敏感词触发数量
  336. touchNum++;
  337. // 设置敏感词提示
  338. $("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
  339. touchWords = '';
  340. }
  341. });
  342. });
  343. function updateAuditStatus(auditStatus) {
  344. var elementById = document.getElementById("failReasonDiv");
  345. if (auditStatus === 2) {
  346. elementById.style.cssText = "display:none";
  347. } else {
  348. elementById.style.cssText = "";
  349. }
  350. }
  351. $(window).load(function () {
  352. LabelInit();
  353. });
  354. //富文本框编辑
  355. function checkInfo() {
  356. var infoContent = infoDetailEditor.getData();
  357. $("#infoContent").val(infoContent);
  358. console.log(infoContent);
  359. }
  360. $(document).ready(function () {
  361. //富文本框
  362. ClassicEditor.create(document.querySelector('#infoDetailEditor'), {
  363. ckfinder: {
  364. uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
  365. }
  366. }).then(function(editor) {
  367. window.infoDetailEditor = editor;
  368. }).catch(function(error){
  369. console.log(error);
  370. });
  371. });
  372. function LabelInit(){
  373. var items="${fns:getDictValue('label','sys_config','')}"+",";
  374. /* var _labels="${info.label}";
  375. var _label=_labels.split(",");
  376. for (var i = 0; i < _label.length; i++) {
  377. items=items.replace(_label[i]+",","");
  378. } */
  379. /* var items="美白,祛斑,祛痘,补水,瘦脸,去皱,缩毛孔,减肥瘦身,提拉紧致,嫩肤,去眼袋,去法令纹,脱毛,纹眉,去黑眼圈,美白嫩肤,面部提升,祛斑祛痣,除皱,去红血丝,祛疤,祛妊娠纹,纹身,纤体塑性,纹眉"; */
  380. var info=items.split(",");
  381. var html='';
  382. for (var i = 0; i < info.length; i++) {
  383. if(''!=info[i]){
  384. html+="<label>"+info[i]+"</label>";
  385. if((i+1)%9==0){
  386. html+="<br>";
  387. }
  388. }
  389. }
  390. $(".init-label").append(html);
  391. $("#labelName").typeahead({
  392. property : 'name',
  393. source:function(typeahead, query){
  394. query = $.trim(query);
  395. if(''==query){return;}
  396. $.ajax({
  397. type:"POST", dataType:"JSON", async:false,
  398. url: "${ctx}/info/infoLabel/findByName",
  399. data:{name: query},
  400. success:function(data){
  401. typeahead.process(data);
  402. }
  403. });
  404. },
  405. onselect : function(data) {
  406. setLabel(data.name);
  407. $("#labelName").focus(); //选择完后 回到当前输入框以便下一个动作的验证
  408. }
  409. });
  410. }
  411. function setLabel(name){
  412. if(name!=''){
  413. var label=$("#label").val();
  414. if(label==''){
  415. label=name;
  416. }else{
  417. label=label+","+name;
  418. }
  419. $("#label").val(label);
  420. $("#labelName").val("");
  421. }
  422. }
  423. function addLeable(){
  424. var label=$("#labelName").val();
  425. if(''==label){
  426. $.jBox.tip('添加的标签不能为空!','error');
  427. }else{
  428. setLabel(label);
  429. }
  430. }
  431. </script>
  432. </body>
  433. </html>