Authored by 张帅

后台发布相关

  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8"/>
  5 + <title>Yoho!Buy运营平台</title>
  6 + <script src="/pfcms/js/include.js"></script>
  7 +
  8 + <link rel="stylesheet" href="/pfcms/css/swiper.min.css">
  9 + <script src="/pfcms/js/utils/swiper.min.js"></script>
  10 +
  11 + <style>
  12 + .btn-long {
  13 + width: 120px;
  14 + height: 37px;
  15 + line-height: 37px;
  16 + font-size: 15px;
  17 + color: white;
  18 + border-radius: 5px;
  19 + display: inline-block;
  20 + cursor: pointer;
  21 + text-align: center;
  22 + }
  23 +
  24 + .btn-long:hover {
  25 + opacity: 0.9;
  26 + }
  27 +
  28 + /* 可以设置样式,也可以不设置*/
  29 + .swiper-container {
  30 + width: 700px;
  31 + height: 400px;
  32 + }
  33 +
  34 + td {
  35 + font-size: 14px;
  36 + }
  37 + </style>
  38 +</head>
  39 +<body class="easyui-layout">
  40 +
  41 +
  42 +<div region="center" id="articleDetail" style="margin-left: 20px">
  43 + <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
  44 + <form name="publishArticleForm" id="publishArticleForm" method="post">
  45 + <input id="checkedId" name="articleId" type="hidden"/>
  46 + <input id="articleImages" name="articleImages" type="hidden"/>
  47 + <input id="articleSkns" name="articleSkns" type="hidden"/>
  48 +
  49 + <div style="margin-top: 20px;margin-left: 30px">
  50 + <h2>查看详情/审核</h2>
  51 + <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
  52 +
  53 + <tr style="height: 60px">
  54 + <td style="font-size: 18px">
  55 + 笔记详情
  56 + </td>
  57 + </tr>
  58 +
  59 + <tr style="height: 60px">
  60 + <td>
  61 + <div>
  62 + 用户Uid: <span id="authorUid"></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;昵称:<span
  63 + id="nickName" style="margin-left: 10px"></span>
  64 + <br>
  65 + 内容来源: <span id="sourceStr"></span>
  66 + <br>
  67 + 内容统计: 文字-<span id="contentLength"></span>&nbsp;&nbsp;&nbsp; 图片-<span
  68 + id="imgSize"></span>&nbsp;&nbsp;&nbsp;关联商品-<span id="productSize"></span>
  69 + <br>
  70 + 审核状态:<span id="authStatusStr"></span>
  71 + </div>
  72 + </td>
  73 + </tr>
  74 +
  75 + <tr style="height: 60px">
  76 + <td>
  77 + <div id="articleContent">
  78 +
  79 + </div>
  80 + </td>
  81 + </tr>
  82 + <tr style="height: 20px">
  83 + <td>
  84 + <div id="labelList">
  85 +
  86 + </div>
  87 +
  88 + </td>
  89 + </tr>
  90 + <tr style="height: 60px">
  91 + <td>
  92 + <div class="swiper-container">
  93 + <div class="swiper-wrapper" id="imageListDiv">
  94 +
  95 + </div>
  96 + <!--&lt;!&ndash; 如果需要分页器 &ndash;&gt;-->
  97 + <!--<div class="swiper-pagination"></div>-->
  98 +
  99 + <!-- 如果需要导航按钮 -->
  100 + <div class="swiper-button-prev"></div>
  101 + <div class="swiper-button-next"></div>
  102 +
  103 + <!--&lt;!&ndash; 如果需要滚动条 &ndash;&gt;-->
  104 + <!--<div class="swiper-scrollbar"></div>-->
  105 + </div>
  106 + </td>
  107 + </tr>
  108 + <tr style="height: 60px">
  109 + <td>
  110 +
  111 + <div id="relatedProduct">
  112 +
  113 +
  114 + </div>
  115 +
  116 + </td>
  117 +
  118 + </tr>
  119 + <tr style="height: 60px">
  120 + <td id="goodstd">
  121 + <div style="float: left;margin-left: 30px">
  122 + <!--<a id="authBtn" class="btn-info" style="display: none">发布</a>-->
  123 +
  124 + <!--<a id="unAuthBtn" class="btn-info" style="display: none">定时发布</a>-->
  125 +
  126 + </div>
  127 + </td>
  128 + </tr>
  129 +
  130 + </table>
  131 + </div>
  132 + </form>
  133 +
  134 + </div>
  135 +
  136 +</div>
  137 +<script>
  138 + var mySwiper = new Swiper('.swiper-container', {
  139 +// direction: 'vertical', // 垂直切换选项
  140 +// loop: true, // 循环模式选项
  141 +
  142 +// // 如果需要分页器
  143 +// pagination: {
  144 +// el: '.swiper-pagination',
  145 +// },
  146 +
  147 + // 如果需要前进后退按钮
  148 + navigation: {
  149 + nextEl: '.swiper-button-next',
  150 + prevEl: '.swiper-button-prev',
  151 + },
  152 +
  153 +// // 如果需要滚动条
  154 +// scrollbar: {
  155 +// el: '.swiper-scrollbar',
  156 +// },
  157 + })
  158 +</script>
  159 +</body>
  160 +
  161 +
  162 +<script>
  163 +
  164 + var articleId = getUrlParam("articleId");
  165 + $(function () {
  166 + //加载数据
  167 + console.log("articleId:" + articleId);
  168 + //获取文章的详细信息
  169 + $.ajax({
  170 + type: "get",
  171 + url: serverContextPath + "/grassArticle/getArticleById?articleId=" + articleId,
  172 + success: function (data) {
  173 + debugger
  174 + if (data != null && data.code == 200) {//成功的
  175 + var detailInfo = data.data;
  176 + $("#authorUid").html(detailInfo.authorUid);
  177 + $("#nickName").html(detailInfo.nickName);
  178 + $("#sourceStr").html(detailInfo.sourceStr);
  179 + $("#contentLength").html(detailInfo.articleContent == null ? 0 : detailInfo.articleContent.length);
  180 + $("#articleContent").html(detailInfo.articleContent == null || detailInfo.articleContent.length == 0 ? "文字内容:空" : "文字内容:" + detailInfo.articleContent);
  181 +
  182 + var imgSize = detailInfo.imgList == null ? 0 : detailInfo.imgList.length;
  183 + $("#imgSize").html(imgSize);
  184 +
  185 + //展示图片(肯定有图片,没图片那就是业务有问题,或者数据有问题)
  186 + if (detailInfo.imgList != null && detailInfo.imgList.length > 0) {
  187 + var imageDivStr = "";
  188 + for (var i = 0; i < detailInfo.imgList.length; i++) {
  189 + imageDivStr += '<div class="swiper-slide"><img src="' + detailInfo.imgList[i] + '" style="width: 400px;height:300px;margin-left: 100px;margin-right: 5px"/></div>';
  190 + }
  191 + $("#imageListDiv").html(imageDivStr);
  192 + }
  193 +
  194 + var productSize = detailInfo.productlList == null ? 0 : detailInfo.productlList.length;
  195 + $("#productSize").html(productSize);
  196 + var authStatusStr = "";
  197 + var authStatus = detailInfo.authStatus;
  198 + if (authStatus == null || authStatus == '0') {
  199 + authStatusStr = "待审核";
  200 + // $("#authBtn").attr("style", "display:block");
  201 + } else if (authStatus == '1') {
  202 + authStatusStr = "已通过";
  203 + // $("#unAuthBtn").attr("style", "display:block");
  204 + } else if (authStatus == '2') {
  205 + authStatusStr = "未通过";
  206 + // $("#authBtn").attr("style", "display:block");
  207 + }
  208 + $("#authStatusStr").html(authStatusStr);
  209 +
  210 + if (detailInfo.labelList != null && detailInfo.labelList.length > 0) {
  211 + var labelStr = "关联标签: ";
  212 + for (var i = 0; i < detailInfo.labelList.length; i++) {
  213 + labelStr += "<span style='margin-left: 10px'>#" + detailInfo.labelList[i].name + "</span>";
  214 + }
  215 + $("#labelList").html(labelStr);
  216 + } else {
  217 + $("#labelList").html("关联标签: 无");
  218 + }
  219 +
  220 + //关联商品
  221 + if (detailInfo.productlList != null && detailInfo.productlList.length > 0) {
  222 + var productStr = "";
  223 + for (var i = 0; i < detailInfo.productlList.length; i++) {
  224 + productStr += "<div style='float:left;word-wrap:break-word;word-break: break-all;width: 100px;margin-left: 10px;font-size: 12px'>" +
  225 + "<img src='" + detailInfo.productlList[i].productImage + "' style='margin-left:30px;width:50px;height: 50px;align: center'><br>商品:"
  226 + + detailInfo.productlList[i].productName + "<br>skn:" +
  227 + detailInfo.productlList[i].productSkn + "</div>";
  228 + }
  229 + $("#relatedProduct").html(productStr);
  230 +
  231 + } else {//没有关联商品
  232 + $("#relatedProduct").html("关联商品: 无");
  233 + }
  234 + }
  235 + }
  236 + });
  237 +
  238 +
  239 + });
  240 +
  241 + //获取url中的参数方法
  242 + function getUrlParam(name) {
  243 + //构造一个含有目标参数的正则表达式对象
  244 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  245 + //匹配目标参数
  246 + var r = window.location.search.substr(1).match(reg);
  247 + //返回参数
  248 + if (r != null) {
  249 + return unescape(r[2]);
  250 + } else {
  251 + return null;
  252 + }
  253 + }
  254 +
  255 + //发布
  256 + $("#authBtn").linkbutton({
  257 + iconCls: "icon-search",
  258 + onClick: function () {
  259 + switchRecommend(1);
  260 + }
  261 + });
  262 + //定时发布
  263 + $("#unAuthBtn").linkbutton({
  264 + iconCls: "icon-search",
  265 + onClick: function () {
  266 + switchRecommend(2);
  267 + }
  268 + });
  269 +
  270 +
  271 + //审核通过 或者不通过
  272 + function switchRecommend(status) {
  273 + if (status == 1) {
  274 + message = "发布";
  275 + }
  276 + if (status == 2) {
  277 + message = "定时发布";
  278 + }
  279 + $.messager.confirm("确认", "确认这篇文章" + message + "吗?", function (flag) {
  280 + if (flag) {
  281 + $.post(serverContextPath + "/grassArticle/updateArticle?articleId=" + articleId + "&authStatus=" + status + "&operateType=2", function (data) {
  282 + if (data.code != 200) {
  283 + alert("操作失败,稍后重试");
  284 + //刷新当前页面
  285 + location.reload();
  286 + } else {
  287 + alert("操作成功");
  288 + //刷新当前页面
  289 + location.reload();
  290 + }
  291 + }, "json");
  292 + }
  293 + });
  294 +
  295 + }
  296 +
  297 + function switchTimer(id, status,publishTime) {
  298 + debugger
  299 + var operateType = status == 1 ? 3 : 4;
  300 + $.post(serverContextPath + "/grassArticle/updateArticle?articleId=" + id + "&publishTime=" + publishTime+ "&operateType="+ operateType, function (data) {
  301 + if(data.code != 200){
  302 + alert(data.message);
  303 + }else{
  304 + $("#activityListTable").datagrid("reload");
  305 + }
  306 + }, "json");
  307 + }
  308 +
  309 + // 定时 选择时间
  310 + function getEditDialog(data,id, status){
  311 + var timeChoose = $("<div id='timeChoose'>").appendTo($(document.body));
  312 + var title = "选择时间";
  313 + var textVar = "确认";
  314 +
  315 + window.self.paramObject.mkData = data;
  316 + $(timeChoose).myDialog({
  317 + title: title,
  318 + width: "20%",
  319 + height: "20%",
  320 + resizable:false,
  321 + buttons:[{
  322 + id : "saveBtn",
  323 + text:textVar,
  324 + iconCls : "icon-save",
  325 + handler:function(){
  326 + debugger;
  327 + if($("#publishTimeStr").datetimebox('getValue') !=null && $("#publishTimeStr").datetimebox('getValue') !=''){
  328 + var time = parseInt(new Date($("#publishTimeStr").datetimebox('getValue')).getTime() );
  329 + switchTimer(id, status,time);
  330 + }
  331 + $(timeChoose).dialog("close");
  332 + }
  333 + }, {
  334 + text: "关闭",
  335 + iconCls: "icon-cancel",
  336 + handler: function () {
  337 + $.messager.confirm("确认", "确认关闭吗?", function (flag) {
  338 + if(flag){
  339 + $(timeChoose).dialog("close");
  340 + }
  341 + });
  342 + }
  343 + }],
  344 + modal: true,
  345 + href: contextPath + "/html/grass/article/chooseTime.html"
  346 + });
  347 + }
  348 +
  349 +
  350 +</script>
  351 +</html>
@@ -160,13 +160,19 @@ @@ -160,13 +160,19 @@
160 var imgList = rowData.imgList; 160 var imgList = rowData.imgList;
161 str =str + '<p>'; 161 str =str + '<p>';
162 if(imgList !=null){//可能没有图片 162 if(imgList !=null){//可能没有图片
163 - for (var i=0; i<imgList.length; i++) { 163 + str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[0]+'" >' ;
  164 + /*for (var i=0; i<imgList.length; i++) {
164 if(i > 0 && i % 4 == 0){ 165 if(i > 0 && i % 4 == 0){
165 - str = str + "</br>";//每四张换行 166 + str = str + "</br>";//每四张换行
166 } 167 }
167 - str = str + ' <img style="width: 60px; height: 60px" src="'+ imgList[i]+'" onclick="bigImage(this);" >';  
168 - } 168 + str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[i]+'" rowImages="'+imgList+'" onclick="bigImage(this);" >' ;
  169 + }*/
169 } 170 }
  171 +
  172 +
  173 +
  174 + str = str + "<a target='_blank' href='"+contextPath+"/html/grass/article/draftArticleDetail.html?articleId="+rowData.articleId+"'>查看详情</a>";
  175 +
170 str =str + '</p>'; 176 str =str + '</p>';
171 var labelList = rowData.labelList; 177 var labelList = rowData.labelList;
172 var labelStr = ""; 178 var labelStr = "";
@@ -35,7 +35,8 @@ @@ -35,7 +35,8 @@
35 } 35 }
36 36
37 </style> 37 </style>
38 - 38 +<link rel="stylesheet" href="/pfcms/js/emoji/emojionearea.css">
  39 +<script type="text/javascript" src="/pfcms/js/emoji/emojionearea.js"></script>
39 40
40 <div region="center" id="labelGroupList" style="margin-left: 20px"> 41 <div region="center" id="labelGroupList" style="margin-left: 20px">
41 <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll"> 42 <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
@@ -60,8 +61,11 @@ @@ -60,8 +61,11 @@
60 <tr style="height: 60px"> 61 <tr style="height: 60px">
61 <td> 62 <td>
62 <span style="color:red">*</span><label>文字内容</label> <br> 63 <span style="color:red">*</span><label>文字内容</label> <br>
63 - <textarea rows="5" id="content" style="width:60%; white-space: pre-wrap;" name = "content" class="form-control" placeholder="请在这里输入1-500字的笔记" required="" maxlength="500"></textarea>  
64 - <span id="content-count">0</span>/500 64 + <div style="width:600px; word-wrap:break-word;float: left;position: relative" >
  65 + <textarea rows="5" id="content" style="width:60%; white-space: pre-wrap;" name = "content" class="form-control" placeholder="请在这里输入1-500字的笔记" required="" maxlength="500"></textarea>
  66 + <!--<div style="position: absolute;bottom:0;right:-50px"> <span id="content-count">0</span>/500</div>-->
  67 +
  68 + </div>
65 </td> 69 </td>
66 </tr> 70 </tr>
67 71
@@ -133,6 +137,26 @@ @@ -133,6 +137,26 @@
133 var checkType = 1; 137 var checkType = 1;
134 $(function () { 138 $(function () {
135 139
  140 + $("#content").emojioneArea({
  141 + // options
  142 + autoHideFilters: true,
  143 + autocomplete : false,
  144 + search :false,
  145 + recentEmojis: false,
  146 + tones: false,
  147 + filters: {
  148 + // see in source file
  149 + animals_nature : true,
  150 + food_drink :true,
  151 + activity: true,
  152 + travel_places :true,
  153 + objects:true,
  154 + symbols: true,
  155 + flags:true
  156 + }
  157 +
  158 + });
  159 +
136 $("#addImage").linkbutton({ 160 $("#addImage").linkbutton({
137 iconCls : "icon-search", 161 iconCls : "icon-search",
138 onClick : function() { 162 onClick : function() {
@@ -280,7 +304,11 @@ @@ -280,7 +304,11 @@
280 } 304 }
281 var content = $("#content").val(); 305 var content = $("#content").val();
282 if(content == '' || content.length<=0){ 306 if(content == '' || content.length<=0){
283 - $.messager.alert("发布失败", "请输入文字内容", "error"); 307 + $.messager.alert("保存失败", "请输入文字内容", "error");
  308 + return false;
  309 + }
  310 + if(content.length>500){
  311 + $.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
284 return false; 312 return false;
285 } 313 }
286 $("#draftType").val(2); 314 $("#draftType").val(2);
@@ -355,6 +383,10 @@ @@ -355,6 +383,10 @@
355 $.messager.alert("保存失败", "请输入文字内容", "error"); 383 $.messager.alert("保存失败", "请输入文字内容", "error");
356 return false; 384 return false;
357 } 385 }
  386 + if(content.length>500){
  387 + $.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
  388 + return false;
  389 + }
358 $("#draftType").val(1); 390 $("#draftType").val(1);
359 var imgs = ''; 391 var imgs = '';
360 var imageCount = 0; 392 var imageCount = 0;
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 </div> 81 </div>
82 82
83 <!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>--> 83 <!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>-->
84 - 84 +
85 </td> 85 </td>
86 </tr> 86 </tr>
87 87
@@ -233,7 +233,7 @@ @@ -233,7 +233,7 @@
233 //发送请求 233 //发送请求
234 $.ajax({ 234 $.ajax({
235 type: "POST", 235 type: "POST",
236 - url: contextPath + "/grassArticle/getUserInfo", //提交到后端的url 236 + url: serverContextPath + "/grassArticle/getUserInfo", //提交到后端的url
237 dataType: 'json', 237 dataType: 'json',
238 data:{ 238 data:{
239 uid : $(this).textbox("getValue") 239 uid : $(this).textbox("getValue")
@@ -289,7 +289,7 @@ @@ -289,7 +289,7 @@
289 valueField: 'id', 289 valueField: 'id',
290 textField: 'labelName', 290 textField: 'labelName',
291 multiple:true, 291 multiple:true,
292 - url : contextPath + "/grassLabelManage/getAllGrassLabelInfo", 292 + url : serverContextPath + "/grassLabelManage/getAllGrassLabelInfo",
293 loadFilter: function (data) { 293 loadFilter: function (data) {
294 return defaultLoadFilter(data); 294 return defaultLoadFilter(data);
295 }, 295 },
@@ -344,7 +344,7 @@ @@ -344,7 +344,7 @@
344 width:200, 344 width:200,
345 onClick: function () { 345 onClick: function () {
346 $("#publishArticleForm").form("submit",{ 346 $("#publishArticleForm").form("submit",{
347 - url : contextPath+"/grassArticle/publishArticle", 347 + url : serverContextPath+"/grassArticle/publishArticle",
348 onSubmit : function(param) { 348 onSubmit : function(param) {
349 debugger; 349 debugger;
350 if (!$("#publishArticleForm").form("validate")) { 350 if (!$("#publishArticleForm").form("validate")) {
@@ -356,6 +356,10 @@ @@ -356,6 +356,10 @@
356 $.messager.alert("发布失败", "请输入文字内容", "error"); 356 $.messager.alert("发布失败", "请输入文字内容", "error");
357 return false; 357 return false;
358 } 358 }
  359 + if(content.length>500){
  360 + $.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
  361 + return false;
  362 + }
359 var imgs = ''; 363 var imgs = '';
360 var imageCount = 0; 364 var imageCount = 0;
361 $("input[name='url']").each(function(j,item){ 365 $("input[name='url']").each(function(j,item){
@@ -415,7 +419,7 @@ @@ -415,7 +419,7 @@
415 width:200, 419 width:200,
416 onClick: function () { 420 onClick: function () {
417 $("#publishArticleForm").form("submit",{ 421 $("#publishArticleForm").form("submit",{
418 - url : contextPath+"/grassArticle/saveArticleDraft", 422 + url : serverContextPath+"/grassArticle/saveArticleDraft",
419 onSubmit : function(param) { 423 onSubmit : function(param) {
420 debugger; 424 debugger;
421 if (!$("#publishArticleForm").form("validate")) { 425 if (!$("#publishArticleForm").form("validate")) {
@@ -427,6 +431,10 @@ @@ -427,6 +431,10 @@
427 $.messager.alert("保存失败", "请输入文字内容", "error"); 431 $.messager.alert("保存失败", "请输入文字内容", "error");
428 return false; 432 return false;
429 } 433 }
  434 + if(content.length>500){
  435 + $.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
  436 + return false;
  437 + }
430 var imgs = ''; 438 var imgs = '';
431 var imageCount = 0; 439 var imageCount = 0;
432 $("input[name='url']").each(function(j,item){ 440 $("input[name='url']").each(function(j,item){
@@ -482,7 +490,7 @@ @@ -482,7 +490,7 @@
482 height: 120, 490 height: 120,
483 realInputName: "url", 491 realInputName: "url",
484 uploadInputName: "files", 492 uploadInputName: "files",
485 - url: contextPath + '/fileupload/uploads', 493 + url: serverContextPath + '/fileupload/uploads',
486 queryParams: { 494 queryParams: {
487 bucket: "grassImg" 495 bucket: "grassImg"
488 }, 496 },
@@ -578,12 +586,21 @@ @@ -578,12 +586,21 @@
578 return; 586 return;
579 } 587 }
580 $("#publishArticleForm").form("submit",{ 588 $("#publishArticleForm").form("submit",{
581 - url : contextPath+"/grassArticle/timerPublish", 589 + url : serverContextPath+"/grassArticle/timerPublish",
582 onSubmit : function(param) { 590 onSubmit : function(param) {
583 debugger; 591 debugger;
584 if (!$("#publishArticleForm").form("validate")) { 592 if (!$("#publishArticleForm").form("validate")) {
585 return false; 593 return false;
586 } 594 }
  595 + var content = $("#content").val();
  596 + if(content == '' || content.length<=0){
  597 + $.messager.alert("保存失败", "请输入文字内容", "error");
  598 + return false;
  599 + }
  600 + if(content.length>500){
  601 + $.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
  602 + return false;
  603 + }
587 param.publishTime =time; 604 param.publishTime =time;
588 var imgs = ''; 605 var imgs = '';
589 var imageCount = 0; 606 var imageCount = 0;