auditInfoPage.jsp 15 KB

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