123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
- <%@ taglib prefix="input" uri="/struts-tags" %>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
- <html>
- <head>
- <title>编辑文章</title>
- <meta name="decorator" content="default"/>
- <style>
- .red{color:red}
- #inputForm{max-width:1200px;width:100%}
- #inputForm table{width:100%;line-height:18px;margin-bottom:50px}
- #inputForm th,#inputForm td{font-weight:normal;text-align:left;padding:8px 5px;border-bottom:1px solid rgb(238,238,238)}
- #inputForm th{width:15%;text-align:right;white-space:nowrap;font-weight:bold}
- #inputForm td input[type="text"]{width:320px;height:16px;line-height:16px}
- .init-label label{margin:5px 10px;color:gray}
- </style>
- <script type="text/javascript">
- var ontypeId = null;
- var typeId = null;
- function ischangeType() {
- if (null != typeId) {
- $("#typeListId option[value=" + typeId + "]").val(ontypeId);
- }
- $("#optionType").find("option").eq(0).prop("selected", true)
- optionTypeParent()
- }
- function optionTypeParent() {
- $("#optionType [parent]").each(function (item) {
- if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
- $(this).show()
- } else {
- $(this).hide()
- }
- })
- }
- function isoptionType() {
- if ("" != $("#optionType option:selected").val()) {
- ontypeId = $("#optionType option:selected").attr("parent")
- typeId = $("#optionType option:selected").val()
- $("#typeListId option:selected").val($("#optionType option:selected").val())
- }else {
- ischangeType()
- }
- }
- $(document).ready(function () {
- $("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
- optionTypeParent()
- isoptionType()
- })
- </script>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li><a href="${ctx}/info/info/?publishSource=2">文章列表</a></li>
- <li class="active"><a href="${ctx}/info/info/toAuditPage?id=${info.id}">审核</a></li>
- </ul>
- <form:form id="inputForm" modelAttribute="info" action="${ctx}/info/info/save?ltype=2&publishSource=2&auditFlag=1" method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <form:hidden path="shopId"/>
- <sys:message content="${message}"/>
- <table border="0" cellspacing="0" cellpadding="0" width="100%">
- <tr>
- <th><span class="red">*</span>文章标题:</th>
- <td colspan="3">
- <form:input path="title" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
- <label id="titleSensitiveWords" class="red"></label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>文章标签:</th>
- <td colspan="3">
- <form:input path="label" htmlEscape="false" maxlength="100" class="input-xxlarge required"/>
- <label id="labelSensitiveWords" class="red"></label>
- <span class="help-inline">多个标签之间请用逗号分隔开</span>
- <div class="init-label"></div>
- <input id="labelName" type="text" placeholder="在此处输入标签,将自动关联到文章标签" class="input-xlarge"/>
- <a href="javascript:addLeable();">添加</a>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>SEO关键词:</th>
- <td colspan="3">
- <form:input path="keyword" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
- <label id="keywordSensitiveWords" class="red"></label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>发布人:</th>
- <td colspan="3">
- <form:input path="publisher" htmlEscape="false" maxlength="50" class="input-xxlarge required"/>
- <label id="publisherSensitiveWords" class="red"></label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>来源:</th>
- <td colspan="3">
- <form:input path="source" htmlEscape="false" maxlength="50" class="input-xlarge"/>
- <label id="sourceSensitiveWords" class="red"></label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>推荐语(描述):</th>
- <td colspan="3">
- <form:textarea path="recommendContent" htmlEscape="false" maxlength="1000" class="input-xxlarge required"/>
- <label id="recommendContentSensitiveWords" class="red"></label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>文章内容:</th>
- <td colspan="3">
- <div class="detailInfoEditor" style="width:760px;">
- <form:textarea path="infoContent" class="input-xlarge hide"/>
- <!-- 富文本编辑器 -->
- <div id="infoDetailEditor">${info.infoContent}</div>
- <label id="infoContentSensitiveWords" class="red"></label>
- </div>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>文章分类:</th>
- <td colspan="3">
- <form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
- <c:forEach items="${typeList}" var="type" varStatus="index">
- <c:if test="${type.parentId eq 0}">
- <form:option value="${type.id}" label="${type.name}"/>
- </c:if>
- </c:forEach>
- </form:select>
- <form:select id="optionType" path="typeId" class="input-small" onchange="isoptionType()">
- <form:option value="" label=" "/>
- <c:forEach items="${typeList}" var="type" varStatus="index">
- <c:if test="${type.parentId ne 0}">
- <form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
- cssStyle="display: none"/>
- </c:if>
- </c:forEach>
- </form:select>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>引导图:</th>
- <td colspan="3">
- <form:hidden id="nameImage" path="guidanceImage" htmlEscape="false" class="input-xlarge required"/>
- <sys:ckfinder input="nameImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
- </td>
- </tr>
- <tr>
- <th>商城首页图:</th>
- <td colspan="3">
- <form:hidden id="homePageImage" path="homePageImage" htmlEscape="false" maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="homePageImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
- <label style="margin-left: 20px">建议图片分辨率252px*252px</label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>发布时间:</th>
- <td colspan="3">
- <fmt:formatDate value="${info.pubdate}" pattern="yyyy-MM-dd HH:mm:ss"/>
- </td>
- </tr>
- <tr>
- <th>审核状态:</th>
- <td colspan="3">
- ${info.auditStatus eq 1?'待审核':info.auditStatus eq 2?'审核通过':'审核失败'}
- </td>
- </tr>
- <tr>
- <th>供应商:</th>
- <td colspan="3">
- ${info.shopName}
- </td>
- </tr>
- <tr>
- <th>添加时间:</th>
- <td colspan="3">
- <fmt:formatDate value="${info.createDate}" pattern="yyyy-MM-dd HH:mm"/>
- </td>
- </tr>
- <c:if test="${not empty info.id}">
- <tr>
- <th><span class="red">*</span>实际点赞:</th>
- <td colspan="3">
- ${empty info.realPraise?0:(info.realPraise)}
- </td>
- </tr>
- </c:if>
- <c:if test="${not empty info.id}">
- <tr>
- <th><span class="red">*</span>实际浏览量:</th>
- <td colspan="3">
- ${empty info.pv?0:(info.pv)}
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>供应商状态:</th>
- <td colspan="3">
- <font color="${info.enabledStatus eq 1?'#2FA4E7':'red'}"> ${info.enabledStatus eq 1?'已发布':'暂不发布'}</font>
- </td>
- </tr>
- </c:if>
- <tr>
- <th><span class="red"></span>审核:</th>
- <td colspan="3">
- <input type="radio" name="auditStatus" value="2" onclick="updateAuditStatus(2)" ${empty info.auditStatus?'checked=checked':info.auditStatus eq 1?'checked=checked':''}> 审核通过
- <input type="radio" name="auditStatus" value="3" onclick="updateAuditStatus(3)" ${info.auditStatus eq 3?'checked=checked':''}> 审核失败
- </td>
- </tr>
- <tr id="failReasonDiv" style="${(empty info.auditStatus or info.auditStatus ne 3)?'display: none':''}">
- <th><span class="red">*</span>失败原因:</th>
- <td colspan="3">
- <textarea type="text" id="failReason" name="failReason" style="width: 400px;height: 90px">${info.failReason}</textarea>
- </td>
- </tr>
- <tr>
- <td colspan="4" style="text-align:center;">
- <shiro:hasPermission name="info:info:edit">
- <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="checkInfo()"/>
- </shiro:hasPermission>
- <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
- </td>
- </tr>
- </table>
- </form:form>
- <!-- 富文本编辑器 -->
- <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
- <%--<script src="https://cdn.bootcdn.net/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js"></script>--%>
- <script type="text/javascript" src="${ctxStatic}/jquery-validation/1.19.3/jquery.validate.js"></script>
- <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
- <script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- //$("#name").focus();
- $("#inputForm").validate({
- ignore:"",
- submitHandler: function(form){
- if ($("#title").val() == '') {
- alertx("请输入文章标题");
- return false;
- }
- if ($("#label").val() == '') {
- alertx("请输入文章标签");
- return false;
- }
- if ($("#keyword").val() == '') {
- alertx("请输入SEO关键词");
- return false;
- }
- if ($("#publisher").val() == '') {
- alertx("请输入发布人");
- return false;
- }
- if ($("#pubdate").val() == '') {
- alertx("请输入发布时间");
- return false;
- }
- if ($("#recommendContent").val() == '') {
- alertx("请输入推荐语(描述)");
- return false;
- }
- if ($("#infoContent").val() == '') {
- alertx("请输入文章内容");
- return false;
- }
- if ($("#guidanceImage").val() == '') {
- alertx("请上传引导图");
- return false;
- }
- if ($("#basePraise").val() == '') {
- alertx("请输入基础点赞");
- return false;
- }
- if ($("#basePv").val() == '') {
- alertx("请输入基础浏览量");
- return false;
- }
- var auditStatus = $("input[name='auditStatus']:checked").val();
- var failReason = $("#failReason").val().trim();
- if (3 == auditStatus && "" == failReason){
- alertx("请输入失败原因");
- return false;
- }
- loading('正在提交,请稍等...');
- form.submit();
- },
- errorContainer: "#messageBox",
- errorPlacement: function(error, element) {
- $("#messageBox").text("输入有误,请先更正。");
- if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
- error.appendTo(element.parent().parent());
- } else {
- error.insertAfter(element);
- }
- }
- });
- });
- //初始化标签
- $(function () {
- $(".init-label label").bind("click",function(){
- var label=$(this).text();
- var label1=label+",";
- var _label=$("#label").val()+",";
- if(_label.indexOf(label1)>-1){
- alert("文章标签中已包含该标签!!");
- }else{
- setLabel(label);
- }
- });
- var title = $("#title").val();
- var label = $("#label").val();
- var keyword = $("#keyword").val();
- var publisher = $("#publisher").val();
- var source = $("#source").val();
- var recommendContent = $("#recommendContent").val();
- var infoContent = $("#infoContent").val();// 检测敏感词
- var propertyMap = new Map();
- propertyMap.set("title", title);
- propertyMap.set("label", label);
- propertyMap.set("keyword", keyword);
- propertyMap.set("publisher", publisher);
- propertyMap.set("source", source);
- propertyMap.set("recommendContent", recommendContent);
- propertyMap.set("infoContent", infoContent);
- var sensitiveWords = '${sensitiveWords}';
- const mint = new MintFilter(sensitiveWords.split('|'));
- var filterSync = '';
- var touchWords = '';
- var touchNum = 0;
- propertyMap.forEach(function (value,key,map) {
- filterSync = mint.filterSync(value);
- filterSync.words.forEach(word=>{
- touchWords += touchWords === '' ? word : "," + word;
- })
- if (touchWords !== '') {
- // 增加敏感词触发数量
- touchNum++;
- // 设置敏感词提示
- $("#" + key + "SensitiveWords").text("敏感词:" + touchWords);
- touchWords = '';
- }
- });
- });
- function updateAuditStatus(auditStatus) {
- var elementById = document.getElementById("failReasonDiv");
- if (auditStatus === 2) {
- elementById.style.cssText = "display:none";
- } else {
- elementById.style.cssText = "";
- }
- }
- $(window).load(function () {
- LabelInit();
- });
- //富文本框编辑
- function checkInfo() {
- var infoContent = infoDetailEditor.getData();
- $("#infoContent").val(infoContent);
- console.log(infoContent);
- }
- $(document).ready(function () {
- //富文本框
- ClassicEditor.create(document.querySelector('#infoDetailEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
- }
- }).then(function(editor) {
- window.infoDetailEditor = editor;
- }).catch(function(error){
- console.log(error);
- });
- });
- function LabelInit(){
- var items="${fns:getDictValue('label','sys_config','')}"+",";
- /* var _labels="${info.label}";
- var _label=_labels.split(",");
- for (var i = 0; i < _label.length; i++) {
- items=items.replace(_label[i]+",","");
- } */
- /* var items="美白,祛斑,祛痘,补水,瘦脸,去皱,缩毛孔,减肥瘦身,提拉紧致,嫩肤,去眼袋,去法令纹,脱毛,纹眉,去黑眼圈,美白嫩肤,面部提升,祛斑祛痣,除皱,去红血丝,祛疤,祛妊娠纹,纹身,纤体塑性,纹眉"; */
- var info=items.split(",");
- var html='';
- for (var i = 0; i < info.length; i++) {
- if(''!=info[i]){
- html+="<label>"+info[i]+"</label>";
- if((i+1)%9==0){
- html+="<br>";
- }
- }
- }
- $(".init-label").append(html);
- $("#labelName").typeahead({
- property : 'name',
- source:function(typeahead, query){
- query = $.trim(query);
- if(''==query){return;}
- $.ajax({
- type:"POST", dataType:"JSON", async:false,
- url: "${ctx}/info/infoLabel/findByName",
- data:{name: query},
- success:function(data){
- typeahead.process(data);
- }
- });
- },
- onselect : function(data) {
- setLabel(data.name);
- $("#labelName").focus(); //选择完后 回到当前输入框以便下一个动作的验证
- }
- });
- }
- function setLabel(name){
- if(name!=''){
- var label=$("#label").val();
- if(label==''){
- label=name;
- }else{
- label=label+","+name;
- }
- $("#label").val(label);
- $("#labelName").val("");
- }
- }
- function addLeable(){
- var label=$("#labelName").val();
- if(''==label){
- $.jBox.tip('添加的标签不能为空!','error');
- }else{
- setLabel(label);
- }
- }
- </script>
- </body>
- </html>
|