Authored by 张帅

后台发布相关

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include.js"></script>
<link rel="stylesheet" href="/pfcms/css/swiper.min.css">
<script src="/pfcms/js/utils/swiper.min.js"></script>
<style>
.btn-long {
width: 120px;
height: 37px;
line-height: 37px;
font-size: 15px;
color: white;
border-radius: 5px;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-long:hover {
opacity: 0.9;
}
/* 可以设置样式,也可以不设置*/
.swiper-container {
width: 700px;
height: 400px;
}
td {
font-size: 14px;
}
</style>
</head>
<body class="easyui-layout">
<div region="center" id="articleDetail" style="margin-left: 20px">
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="publishArticleForm" id="publishArticleForm" method="post">
<input id="checkedId" name="articleId" type="hidden"/>
<input id="articleImages" name="articleImages" type="hidden"/>
<input id="articleSkns" name="articleSkns" type="hidden"/>
<div style="margin-top: 20px;margin-left: 30px">
<h2>查看详情/审核</h2>
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td style="font-size: 18px">
笔记详情
</td>
</tr>
<tr style="height: 60px">
<td>
<div>
用户Uid: <span id="authorUid"></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;昵称:<span
id="nickName" style="margin-left: 10px"></span>
<br>
内容来源: <span id="sourceStr"></span>
<br>
内容统计: 文字-<span id="contentLength"></span>&nbsp;&nbsp;&nbsp; 图片-<span
id="imgSize"></span>&nbsp;&nbsp;&nbsp;关联商品-<span id="productSize"></span>
<br>
审核状态:<span id="authStatusStr"></span>
</div>
</td>
</tr>
<tr style="height: 60px">
<td>
<div id="articleContent">
</div>
</td>
</tr>
<tr style="height: 20px">
<td>
<div id="labelList">
</div>
</td>
</tr>
<tr style="height: 60px">
<td>
<div class="swiper-container">
<div class="swiper-wrapper" id="imageListDiv">
</div>
<!--&lt;!&ndash; 如果需要分页器 &ndash;&gt;-->
<!--<div class="swiper-pagination"></div>-->
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!--&lt;!&ndash; 如果需要滚动条 &ndash;&gt;-->
<!--<div class="swiper-scrollbar"></div>-->
</div>
</td>
</tr>
<tr style="height: 60px">
<td>
<div id="relatedProduct">
</div>
</td>
</tr>
<tr style="height: 60px">
<td id="goodstd">
<div style="float: left;margin-left: 30px">
<!--<a id="authBtn" class="btn-info" style="display: none">发布</a>-->
<!--<a id="unAuthBtn" class="btn-info" style="display: none">定时发布</a>-->
</div>
</td>
</tr>
</table>
</div>
</form>
</div>
</div>
<script>
var mySwiper = new Swiper('.swiper-container', {
// direction: 'vertical', // 垂直切换选项
// loop: true, // 循环模式选项
// // 如果需要分页器
// pagination: {
// el: '.swiper-pagination',
// },
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// // 如果需要滚动条
// scrollbar: {
// el: '.swiper-scrollbar',
// },
})
</script>
</body>
<script>
var articleId = getUrlParam("articleId");
$(function () {
//加载数据
console.log("articleId:" + articleId);
//获取文章的详细信息
$.ajax({
type: "get",
url: serverContextPath + "/grassArticle/getArticleById?articleId=" + articleId,
success: function (data) {
debugger
if (data != null && data.code == 200) {//成功的
var detailInfo = data.data;
$("#authorUid").html(detailInfo.authorUid);
$("#nickName").html(detailInfo.nickName);
$("#sourceStr").html(detailInfo.sourceStr);
$("#contentLength").html(detailInfo.articleContent == null ? 0 : detailInfo.articleContent.length);
$("#articleContent").html(detailInfo.articleContent == null || detailInfo.articleContent.length == 0 ? "文字内容:空" : "文字内容:" + detailInfo.articleContent);
var imgSize = detailInfo.imgList == null ? 0 : detailInfo.imgList.length;
$("#imgSize").html(imgSize);
//展示图片(肯定有图片,没图片那就是业务有问题,或者数据有问题)
if (detailInfo.imgList != null && detailInfo.imgList.length > 0) {
var imageDivStr = "";
for (var i = 0; i < detailInfo.imgList.length; i++) {
imageDivStr += '<div class="swiper-slide"><img src="' + detailInfo.imgList[i] + '" style="width: 400px;height:300px;margin-left: 100px;margin-right: 5px"/></div>';
}
$("#imageListDiv").html(imageDivStr);
}
var productSize = detailInfo.productlList == null ? 0 : detailInfo.productlList.length;
$("#productSize").html(productSize);
var authStatusStr = "";
var authStatus = detailInfo.authStatus;
if (authStatus == null || authStatus == '0') {
authStatusStr = "待审核";
// $("#authBtn").attr("style", "display:block");
} else if (authStatus == '1') {
authStatusStr = "已通过";
// $("#unAuthBtn").attr("style", "display:block");
} else if (authStatus == '2') {
authStatusStr = "未通过";
// $("#authBtn").attr("style", "display:block");
}
$("#authStatusStr").html(authStatusStr);
if (detailInfo.labelList != null && detailInfo.labelList.length > 0) {
var labelStr = "关联标签: ";
for (var i = 0; i < detailInfo.labelList.length; i++) {
labelStr += "<span style='margin-left: 10px'>#" + detailInfo.labelList[i].name + "</span>";
}
$("#labelList").html(labelStr);
} else {
$("#labelList").html("关联标签: 无");
}
//关联商品
if (detailInfo.productlList != null && detailInfo.productlList.length > 0) {
var productStr = "";
for (var i = 0; i < detailInfo.productlList.length; i++) {
productStr += "<div style='float:left;word-wrap:break-word;word-break: break-all;width: 100px;margin-left: 10px;font-size: 12px'>" +
"<img src='" + detailInfo.productlList[i].productImage + "' style='margin-left:30px;width:50px;height: 50px;align: center'><br>商品:"
+ detailInfo.productlList[i].productName + "<br>skn:" +
detailInfo.productlList[i].productSkn + "</div>";
}
$("#relatedProduct").html(productStr);
} else {//没有关联商品
$("#relatedProduct").html("关联商品: 无");
}
}
}
});
});
//获取url中的参数方法
function getUrlParam(name) {
//构造一个含有目标参数的正则表达式对象
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
//匹配目标参数
var r = window.location.search.substr(1).match(reg);
//返回参数
if (r != null) {
return unescape(r[2]);
} else {
return null;
}
}
//发布
$("#authBtn").linkbutton({
iconCls: "icon-search",
onClick: function () {
switchRecommend(1);
}
});
//定时发布
$("#unAuthBtn").linkbutton({
iconCls: "icon-search",
onClick: function () {
switchRecommend(2);
}
});
//审核通过 或者不通过
function switchRecommend(status) {
if (status == 1) {
message = "发布";
}
if (status == 2) {
message = "定时发布";
}
$.messager.confirm("确认", "确认这篇文章" + message + "吗?", function (flag) {
if (flag) {
$.post(serverContextPath + "/grassArticle/updateArticle?articleId=" + articleId + "&authStatus=" + status + "&operateType=2", function (data) {
if (data.code != 200) {
alert("操作失败,稍后重试");
//刷新当前页面
location.reload();
} else {
alert("操作成功");
//刷新当前页面
location.reload();
}
}, "json");
}
});
}
function switchTimer(id, status,publishTime) {
debugger
var operateType = status == 1 ? 3 : 4;
$.post(serverContextPath + "/grassArticle/updateArticle?articleId=" + id + "&publishTime=" + publishTime+ "&operateType="+ operateType, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
// 定时 选择时间
function getEditDialog(data,id, status){
var timeChoose = $("<div id='timeChoose'>").appendTo($(document.body));
var title = "选择时间";
var textVar = "确认";
window.self.paramObject.mkData = data;
$(timeChoose).myDialog({
title: title,
width: "20%",
height: "20%",
resizable:false,
buttons:[{
id : "saveBtn",
text:textVar,
iconCls : "icon-save",
handler:function(){
debugger;
if($("#publishTimeStr").datetimebox('getValue') !=null && $("#publishTimeStr").datetimebox('getValue') !=''){
var time = parseInt(new Date($("#publishTimeStr").datetimebox('getValue')).getTime() );
switchTimer(id, status,time);
}
$(timeChoose).dialog("close");
}
}, {
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
if(flag){
$(timeChoose).dialog("close");
}
});
}
}],
modal: true,
href: contextPath + "/html/grass/article/chooseTime.html"
});
}
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -160,13 +160,19 @@
var imgList = rowData.imgList;
str =str + '<p>';
if(imgList !=null){//可能没有图片
for (var i=0; i<imgList.length; i++) {
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[0]+'" >' ;
/*for (var i=0; i<imgList.length; i++) {
if(i > 0 && i % 4 == 0){
str = str + "</br>";//每四张换行
str = str + "</br>";//每四张换行
}
str = str + ' <img style="width: 60px; height: 60px" src="'+ imgList[i]+'" onclick="bigImage(this);" >';
}
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[i]+'" rowImages="'+imgList+'" onclick="bigImage(this);" >' ;
}*/
}
str = str + "<a target='_blank' href='"+contextPath+"/html/grass/article/draftArticleDetail.html?articleId="+rowData.articleId+"'>查看详情</a>";
str =str + '</p>';
var labelList = rowData.labelList;
var labelStr = "";
... ...
... ... @@ -35,7 +35,8 @@
}
</style>
<link rel="stylesheet" href="/pfcms/js/emoji/emojionearea.css">
<script type="text/javascript" src="/pfcms/js/emoji/emojionearea.js"></script>
<div region="center" id="labelGroupList" style="margin-left: 20px">
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
... ... @@ -60,8 +61,11 @@
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>文字内容</label> <br>
<textarea rows="5" id="content" style="width:60%; white-space: pre-wrap;" name = "content" class="form-control" placeholder="请在这里输入1-500字的笔记" required="" maxlength="500"></textarea>
<span id="content-count">0</span>/500
<div style="width:600px; word-wrap:break-word;float: left;position: relative" >
<textarea rows="5" id="content" style="width:60%; white-space: pre-wrap;" name = "content" class="form-control" placeholder="请在这里输入1-500字的笔记" required="" maxlength="500"></textarea>
<!--<div style="position: absolute;bottom:0;right:-50px"> <span id="content-count">0</span>/500</div>-->
</div>
</td>
</tr>
... ... @@ -133,6 +137,26 @@
var checkType = 1;
$(function () {
$("#content").emojioneArea({
// options
autoHideFilters: true,
autocomplete : false,
search :false,
recentEmojis: false,
tones: false,
filters: {
// see in source file
animals_nature : true,
food_drink :true,
activity: true,
travel_places :true,
objects:true,
symbols: true,
flags:true
}
});
$("#addImage").linkbutton({
iconCls : "icon-search",
onClick : function() {
... ... @@ -280,7 +304,11 @@
}
var content = $("#content").val();
if(content == '' || content.length<=0){
$.messager.alert("发布失败", "请输入文字内容", "error");
$.messager.alert("保存失败", "请输入文字内容", "error");
return false;
}
if(content.length>500){
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
return false;
}
$("#draftType").val(2);
... ... @@ -355,6 +383,10 @@
$.messager.alert("保存失败", "请输入文字内容", "error");
return false;
}
if(content.length>500){
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
return false;
}
$("#draftType").val(1);
var imgs = '';
var imageCount = 0;
... ...
... ... @@ -81,7 +81,7 @@
</div>
<!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>-->
</td>
</tr>
... ... @@ -233,7 +233,7 @@
//发送请求
$.ajax({
type: "POST",
url: contextPath + "/grassArticle/getUserInfo", //提交到后端的url
url: serverContextPath + "/grassArticle/getUserInfo", //提交到后端的url
dataType: 'json',
data:{
uid : $(this).textbox("getValue")
... ... @@ -289,7 +289,7 @@
valueField: 'id',
textField: 'labelName',
multiple:true,
url : contextPath + "/grassLabelManage/getAllGrassLabelInfo",
url : serverContextPath + "/grassLabelManage/getAllGrassLabelInfo",
loadFilter: function (data) {
return defaultLoadFilter(data);
},
... ... @@ -344,7 +344,7 @@
width:200,
onClick: function () {
$("#publishArticleForm").form("submit",{
url : contextPath+"/grassArticle/publishArticle",
url : serverContextPath+"/grassArticle/publishArticle",
onSubmit : function(param) {
debugger;
if (!$("#publishArticleForm").form("validate")) {
... ... @@ -356,6 +356,10 @@
$.messager.alert("发布失败", "请输入文字内容", "error");
return false;
}
if(content.length>500){
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
return false;
}
var imgs = '';
var imageCount = 0;
$("input[name='url']").each(function(j,item){
... ... @@ -415,7 +419,7 @@
width:200,
onClick: function () {
$("#publishArticleForm").form("submit",{
url : contextPath+"/grassArticle/saveArticleDraft",
url : serverContextPath+"/grassArticle/saveArticleDraft",
onSubmit : function(param) {
debugger;
if (!$("#publishArticleForm").form("validate")) {
... ... @@ -427,6 +431,10 @@
$.messager.alert("保存失败", "请输入文字内容", "error");
return false;
}
if(content.length>500){
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
return false;
}
var imgs = '';
var imageCount = 0;
$("input[name='url']").each(function(j,item){
... ... @@ -482,7 +490,7 @@
height: 120,
realInputName: "url",
uploadInputName: "files",
url: contextPath + '/fileupload/uploads',
url: serverContextPath + '/fileupload/uploads',
queryParams: {
bucket: "grassImg"
},
... ... @@ -578,12 +586,21 @@
return;
}
$("#publishArticleForm").form("submit",{
url : contextPath+"/grassArticle/timerPublish",
url : serverContextPath+"/grassArticle/timerPublish",
onSubmit : function(param) {
debugger;
if (!$("#publishArticleForm").form("validate")) {
return false;
}
var content = $("#content").val();
if(content == '' || content.length<=0){
$.messager.alert("保存失败", "请输入文字内容", "error");
return false;
}
if(content.length>500){
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
return false;
}
param.publishTime =time;
var imgs = '';
var imageCount = 0;
... ...