Authored by liangyi.chen@yoho.cn

发现好货后台页面

... ... @@ -46,6 +46,11 @@
<groupId>com.yoho.service.platform.model</groupId>
<artifactId>platform-service-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhplatform</groupId>
<artifactId>platform-cms-grass</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
... ...
package com.yohobuy.platform.cms.restapi;
import com.yohobuy.platform.cms.service.IGrassFindgoodsService;
import com.yohobuy.platform.dal.cms.req.GrassFindgoodsReq;
import com.yohobuy.platform.model.cms.response.GrassFindgoodsRspBO;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/grassFindgoods")
public class GrassFindgoodsController {
private static final Logger logger = LoggerFactory.getLogger(GrassFindgoodsController.class);
@Autowired
private IGrassFindgoodsService grassFindgoodsService;
@RequestMapping("/getGrassFindgoodsList")
@ResponseBody
public ApiResponse getGrassFindgoodsList(GrassFindgoodsReq req){
logger.info("enter queryGrassArticleComment.param is {}",req);
PageResponseVO<GrassFindgoodsRspBO> result = grassFindgoodsService.getGrassFindgoodsList(req);
return new ApiResponse.ApiResponseBuilder().data(result).build();
}
@RequestMapping("/deleteFindgoods")
@ResponseBody
public ApiResponse deleteFindgoods(@RequestParam("id") Integer id){
logger.info("enter deleteFindgoods.param is {}",id);
grassFindgoodsService.deleteFindgoods(id);
return new ApiResponse.ApiResponseBuilder().build();
}
@RequestMapping("/updateOrderBy")
@ResponseBody
public ApiResponse updateOrderBy(@RequestParam("id") Integer id,@RequestParam("orderBy") Integer orderBy){
logger.info("enter deleteFindgoods.param is {}",id);
grassFindgoodsService.updateOrderBy(id,orderBy);
return new ApiResponse.ApiResponseBuilder().build();
}
}
... ...
package com.yohobuy.platform.cms.service;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.dal.cms.req.GrassFindgoodsReq;
import com.yohobuy.platform.model.cms.response.GrassFindgoodsRspBO;
/**
*/
public interface IGrassFindgoodsService {
PageResponseVO<GrassFindgoodsRspBO> getGrassFindgoodsList(GrassFindgoodsReq req);
void deleteFindgoods(Integer id);
void updateOrderBy(Integer id , Integer orderBy);
}
... ...
package com.yohobuy.platform.cms.service.impl;
import com.google.common.collect.Lists;
import com.yohobuy.platform.cms.service.IGrassFindgoodsService;
import com.yohobuy.platform.dal.cms.IGrassFindGoodsDAO;
import com.yohobuy.platform.dal.cms.model.GrassFindGoods;
import com.yohobuy.platform.dal.cms.req.GrassFindgoodsReq;
import com.yohobuy.platform.grass.service.IGrassArticleService;
import com.yohobuy.platform.model.cms.response.GrassFindgoodsRspBO;
import com.yohobuy.platform.model.common.PageResponseVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
*/
@Component
public class GrassFindgoodsServiceImpl implements IGrassFindgoodsService {
private static final Logger logger = LoggerFactory.getLogger(GrassFindgoodsServiceImpl.class);
@Resource
IGrassArticleService grassArticleService;
@Resource
IGrassFindGoodsDAO grassFindGoodsDAO;
@Override
public PageResponseVO<GrassFindgoodsRspBO> getGrassFindgoodsList(GrassFindgoodsReq req) {
logger.info("enter getGrassFindgoodsList, req is {}, page is {}", req, req.getPage());
Integer authorUid = req.getAuthorUid();//uid
List<Integer> authorUids = new ArrayList<>();
String nickName = req.getNickName();
PageResponseVO rsp = new PageResponseVO();
rsp.setList(Lists.newArrayList());
rsp.setTotal(0);
rsp.setPage(1);
rsp.setSize(10);
if (StringUtils.isNotEmpty(nickName)) {
authorUids = grassArticleService.getUidByNickName(nickName);
if (CollectionUtils.isEmpty(authorUids)) {
return rsp;
}
}
if (authorUid != null) {//昵称 + uid
if (StringUtils.isNotEmpty(nickName) && !authorUids.contains(authorUid)) {
return rsp;
}
authorUids.clear();
authorUids.add(authorUid);
}
int page = req.getPage();
int size = req.getSize();
int total = grassFindGoodsDAO.selectTotalByParam(req);
if (total == 0) {
return rsp;
}
List<GrassFindGoods> grassFindGoodsList = grassFindGoodsDAO.selectListByParam(req);
rsp.setList(grassArticleService.buildFindgoodsRsp(grassFindGoodsList));
rsp.setTotal(grassArticleService.buildFindgoodsRsp(grassFindGoodsList).size());
rsp.setSize(size);
rsp.setPage(page);
logger.info("out getArticleList ,page is {}", page);
return rsp;
}
@Override
public void deleteFindgoods(Integer id) {
logger.info("enter deleteFindgoods, id is {}", id);
grassFindGoodsDAO.deleteById(id);
}
@Override
public void updateOrderBy(Integer id, Integer orderBy) {
grassFindGoodsDAO.updateOrderBy(id,orderBy);
}
}
... ...
... ... @@ -2,6 +2,8 @@ package com.yohobuy.platform.grass.service;
import com.yoho.service.model.social.response.UserInfoRspBO;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.dal.cms.model.GrassFindGoods;
import com.yohobuy.platform.model.cms.response.GrassFindgoodsRspBO;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
import com.yohobuy.platform.model.grass.response.ArticleDetailRspBo;
... ... @@ -38,4 +40,7 @@ public interface IGrassArticleService {
void updateMarkFlag(GrassArticleReq req) throws PlatformException;
List<UserInfoRspBO> verifyAtUser(GrassArticleReq req) throws PlatformException;
List<GrassFindgoodsRspBO> buildFindgoodsRsp(List<GrassFindGoods> grassFindGoods);
}
... ...
... ... @@ -14,8 +14,6 @@ import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.service.model.sns.model.enums.GrassInboxBusinessTypeEnum;
import com.yoho.service.model.sns.response.GrassArticleBlockRspBO;
import com.yoho.service.model.sns.response.GrassRecommendUserListResp;
import com.yoho.service.model.social.request.BaseReqBO;
import com.yoho.service.model.social.request.UicUserReqBO;
import com.yoho.service.model.social.response.UserInfoRspBO;
... ... @@ -25,6 +23,7 @@ import com.yohobuy.platform.common.helper.ImagesHelper;
import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.common.util.SerializeUtils;
import com.yohobuy.platform.common.util.StringUtil;
import com.yohobuy.platform.dal.cms.model.GrassFindGoods;
import com.yohobuy.platform.dal.grass.*;
import com.yohobuy.platform.dal.grass.model.*;
import com.yohobuy.platform.dal.guang.IAuthorDAO;
... ... @@ -35,6 +34,7 @@ import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
import com.yohobuy.platform.grass.task.TimerArticlePushJob;
import com.yohobuy.platform.grass.util.HtmlUtils;
import com.yohobuy.platform.grass.util.MsgInformSceneEnum;
import com.yohobuy.platform.model.cms.response.GrassFindgoodsRspBO;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GrassArticleProductBo;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
... ... @@ -42,10 +42,12 @@ import com.yohobuy.platform.model.grass.request.GrassCacheReq;
import com.yohobuy.platform.model.grass.request.GrassInBoxAddReq;
import com.yohobuy.platform.model.grass.response.ArticleDetailRspBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
... ... @@ -1796,6 +1798,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
rspBo.setFileId(videoMap.get(article.getId()) == null ? "" : videoMap.get(article.getId()).getString("fileId"));
//是否打标到达人搭配 0-否 1-是
rspBo.setMarkFlag(article.getMarkFlag());
//是否打标到发现好货 0-否 1-是
rspBo.setMarkFlag(article.getMarkFindgoods());
rspBoList.add(rspBo);
});
return rspBoList;
... ... @@ -1836,7 +1840,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
return resultMap;
}
private Map<Integer, List<JSONObject>> buildLabelInfoMap(List<GrassArticleLabel> articleLabelList) {
public Map<Integer, List<JSONObject>> buildLabelInfoMap(List<GrassArticleLabel> articleLabelList) {
Map<Integer, List<JSONObject>> labelRspMap = Maps.newHashMap();
if (CollectionUtils.isEmpty(articleLabelList)) {
return labelRspMap;
... ... @@ -1863,7 +1867,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
return labelRspMap;
}
private Map<Integer, GrassTopic> buildTopicInfoMap(List<GrassArticleTopic> grassArticleTopicList) {
public Map<Integer, GrassTopic> buildTopicInfoMap(List<GrassArticleTopic> grassArticleTopicList) {
Map<Integer, GrassTopic> topicRspMap = Maps.newHashMap();
if (CollectionUtils.isEmpty(grassArticleTopicList)) {
return topicRspMap;
... ... @@ -2228,8 +2232,12 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
Integer id = req.getArticleId();
long time = System.currentTimeMillis();
Integer markFlag = req.getMarkFlag();
if(id != null && markFlag != null){
grassArticleDao.updateMarkFlag(id , markFlag , time);
Integer markFindgoods = req.getMarkFindgoods();
if(markFindgoods == null && markFlag == null){
return;
}
if(id != null){
grassArticleDao.updateMarkFlag(id , markFlag , time,markFindgoods);
}
}
... ... @@ -2322,4 +2330,109 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
req.setTitle(HtmlUtils.translate(req.getTitle()));
req.setSubtitle(HtmlUtils.translate(req.getSubtitle()));
}
public List<GrassFindgoodsRspBO> buildFindgoodsRsp(List<GrassFindGoods> grassFindGoods){
if (CollectionUtils.isEmpty(grassFindGoods)) {
return new ArrayList<>();
}
List<Integer> ids = grassFindGoods.stream().map(GrassFindGoods::getArticleId).collect(Collectors.toList());
Map<Integer,GrassArticle> articleMap = grassArticleDao.selectMapByIds(ids);
if(MapUtils.isEmpty(articleMap)){
return new ArrayList<>();
}
List<GrassArticle> articleList = articleMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
if(CollectionUtils.isEmpty(articleList)){
return new ArrayList<>();
}
List<GrassArticleBlock> grassArticleContentList = grassArticleBlockDao.selectByArticleIds(ids);
List<GrassArticleTopic> grassArticleTopics = grassArticleTopicDao.selectByArticleIdList(ids);
Map<Integer, List<String>> imgMap = Maps.newHashMap();
Map<Integer, String> linkMap = Maps.newHashMap();
Map<Integer, JSONObject> videoMap = Maps.newHashMap();
Map<Integer, String> textMap = Maps.newHashMap();
Map<Integer, GrassTopic> topicMap = buildTopicInfoMap(grassArticleTopics);
grassArticleContentList.forEach(content -> {
if ("image".equals(content.getTemplateKey())) {
List<String> images = imgMap.get(content.getArticleId());
if (images == null) {
images = Lists.newArrayList();
}
JSONObject data = JSON.parseObject(content.getContentData());
String src = JSON.parseObject(data.getString("data")).getString("src");
src = StringUtils.isEmpty(src) ? "" : src.substring(0, src.indexOf("?"));
images.add(src);
imgMap.put(content.getArticleId(), images);
}
if ("text".equals(content.getTemplateKey())) {
JSONObject data = JSON.parseObject(content.getContentData());
String text = JSON.parseObject(data.getString("data")).getString("text");
textMap.put(content.getArticleId(), text);
}
if ("link".equals(content.getTemplateKey())) {
JSONObject data = JSON.parseObject(content.getContentData());
String text = JSON.parseObject(data.getString("data")).getString("url");
linkMap.put(content.getArticleId(), text);
}
if("video".equals(content.getTemplateKey())){
JSONObject data = JSON.parseObject(content.getContentData());
videoMap.put(content.getArticleId(), JSONObject.parseObject(data.getString("data")));
}
});
List<Integer> uids = articleList.stream().filter(article -> article.getAuthorType() == 1).map(GrassArticle::getAuthorUid).distinct().collect(Collectors.toList());
List<Integer> authoruids = articleList.stream().filter(article -> article.getAuthorType() == 2).map(GrassArticle::getAuthorUid).distinct().collect(Collectors.toList());
//用户的基本信息(昵称 头像等)
Map<Integer, UserInfoRspBO> userInfoMap = userInfoCacheHelper.getUserInfoWithCache(uids);
Map<Integer, Author> authorInfoMap = getAuthorInfo(authoruids);
//关联商品信息
List<Integer> sknList = grassFindGoods.stream().
filter(x -> (x.getProductType() != null && x.getProductType() == 1)).
map(GrassFindGoods::getProductSkn).distinct().collect(Collectors.toList());
List<Integer> idList = grassFindGoods.stream().
filter(x -> (x.getProductType() != null && x.getProductType() == 2)).
map(GrassFindGoods::getProductSkn).distinct().collect(Collectors.toList());
List<JSONObject> productInfo = getProductInfoList(sknList, 1);
List<JSONObject> ufoProductInfo = getProductInfoList(idList, 2);
productInfo.addAll(ufoProductInfo);
Map<String,String> sknToNameMap = new HashMap<>();
productInfo.forEach(json ->{
String productSkn = json.getString("productSkn");
String productName = json.getString("productName");
sknToNameMap.put(productSkn,productName);
});
List<GrassFindgoodsRspBO> rspBoList = Lists.newArrayList();
for(int i = 0;i<grassFindGoods.size();i++){
GrassFindGoods findGoods = grassFindGoods.get(i);
GrassArticle grassArticle = articleMap.get(findGoods.getArticleId());
if(grassArticle == null){
continue;
}
GrassFindgoodsRspBO rspBo = new GrassFindgoodsRspBO();
BeanUtils.copyProperties(findGoods,rspBo);
rspBo.setArticleContent(textMap.get(findGoods.getArticleId()) == null ? "" : textMap.get(findGoods.getArticleId()));
rspBo.setAuthorUid(grassArticle.getAuthorUid());
// rspBo.setTopicName(getArticleName(article.getTopicId()));
if (grassArticle.getAuthorType() == 2) {
Author author = authorInfoMap.get(grassArticle.getAuthorUid());
rspBo.setNickName(StringEscapeUtils.escapeHtml4(author == null ? "" : author.getUsername()));
} else {
UserInfoRspBO userinfo = userInfoMap.get(grassArticle.getAuthorUid());
rspBo.setNickName(StringEscapeUtils.escapeHtml4(userinfo == null ? "" : userinfo.getNickName()));
}
rspBo.setImgList(imgMap.get(findGoods.getArticleId()));
GrassTopic topic = topicMap.get(findGoods.getArticleId());
rspBo.setTopicId(topic == null ? null : topic.getId());
rspBo.setTopicName(topic == null ? null : topic.getTopicName());
rspBo.setArticleTitle(grassArticle.getArticleTitle());
rspBo.setArticleSubtitle(grassArticle.getArticleSubtitle());
rspBo.setProductName(sknToNameMap.get(String.valueOf(findGoods.getProductSkn())));
rspBo.setSort(grassArticle.getSort() == null ? 1 : grassArticle.getSort());
rspBo.setProductType((int)(findGoods.getProductType()));
//短视频封面图
rspBo.setCoverImg(videoMap.get(grassArticle.getId()) == null ? "" : videoMap.get(grassArticle.getId()).getString("coverUrl"));
rspBoList.add(rspBo);
}
return rspBoList;
}
}
... ...
... ... @@ -24,7 +24,7 @@
<dependency>
<groupId>com.yoho.service.platform.model</groupId>
<artifactId>platform-service-model</artifactId>
<version>1.2.3-6.9.13-SNAPSHOT</version>
<version>1.2.3-6.9.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhplatform</groupId>
... ... @@ -59,12 +59,12 @@
<dependency>
<groupId>com.yohobuy.platform</groupId>
<artifactId>platform-common</artifactId>
<version>1.0.3-6.9.12-SNAPSHOT</version>
<version>1.0.3-6.9.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yohobuy.platform</groupId>
<artifactId>platform-dal</artifactId>
<version>1.0.3-6.9.12-SNAPSHOT</version>
<version>1.0.3-6.9.14-SNAPSHOT</version>
</dependency>
... ...
... ... @@ -362,6 +362,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassRewardsConfigDAO
- com.yohobuy.platform.dal.grass.ITopicRewardsRelateDAO
- com.yohobuy.platform.dal.grass.IGrassArticleExtraDao
- com.yohobuy.platform.dal.cms.IGrassFindGoodsDAO
yhb_promotion:
servers:
... ...
... ... @@ -360,6 +360,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassRewardsConfigDAO
- com.yohobuy.platform.dal.grass.ITopicRewardsRelateDAO
- com.yohobuy.platform.dal.grass.IGrassArticleExtraDao
- com.yohobuy.platform.dal.cms.IGrassFindGoodsDAO
yhb_promotion:
servers:
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include_grass.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<script src="/pfcms/js/jquery.imageUpload.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.config.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.all.min.js"></script>
<link rel="stylesheet" href="/pfcms/css/swiper.min.css">
<script src="/pfcms/js/utils/swiper.min.js"></script>
<!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/pfcms/ueditor/lang/zh-cn/zh-cn.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.yoho.js"></script>
<script charset="utf-8" src="/pfcms/js/grass_article.js"></script>
<style>
/* 可以设置样式,也可以不设置*/
.swiper-container {
width: 700px;
height: 400px;
}
.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;
}
</style>
</head>
<!--<body class="easyui-layout" fit="true" style="overflow-y: scroll" >-->
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<!--<div region="north" style="height: 30%;">-->
<script>
document.write(addHead('资源管理', '发现好货'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
<input class="easyui-textbox" id="articleId"/>
<input class="easyui-textbox" id="publisher"/>
<input class="easyui-textbox" id="publisherUid"/>
<input class="easyui-textbox" id="productSkn"/>
<input class="easyui-combobox" id="productType"/>
<input class="easyui-combobox" id="orderType"/>
<a id="searchBtn" class="btn-info">筛选</a>
<a id="allBtn" class="btn-info">全部 </a>
</div>
</div>
<div region="center" id="activityList" style="margin-left: 20px" >
<table id="activityListTable" ></table>
</div>
</body>
<script>
$(function() {
//用于页面刷新后的数据行定位
var index ="";
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
//清空筛选数据
$("#articleId").textbox("setValue","");
$("#publisher").textbox("setValue","");
$("#publisherUid").textbox("setValue","");
$("#productSkn").textbox("setValue","");
$("#productType").combobox("setValue","");
$("#orderType").combobox("setValue","");
$("#activityListTable").datagrid("load", {
});
}
});
$("#publisher").textbox({
required:false,
prompt: "用户昵称"
});
$("#publisherUid").textbox({
required:false,
prompt: "uid"
});
$("#articleId").textbox({
required:false,
prompt: "文章id"
});
$("#productSkn").textbox({
required:false,
prompt: "默认关联商品Skn"
});
$("#productType").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "商品类型",
data:[{text:"全部",value:"-1"},{text:"有货",value:"1"},{text:"UFO",value:"2"}]
});
//展示顺序
$("#orderType").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "展示顺序",
data:[{text:"选择顺序",value:"0"},{text:"降序",value:"desc"},{text:"升序",value:"asc"}]
});
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if (action == 'uploadimage' || action == 'uploadfile') {
return serverContextPath + "/fileupload/uploadFile4Editor.do?bucket=grassImg";
} else {
return this._bkGetActionUrl.call(this, action);
}
};
// 检索按钮
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#activityListTable").datagrid("load", {
nickName: $("#publisher").textbox("getValue"),
authorUid: $("#publisherUid").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
productSkn: $("#productSkn").textbox("getValue"),
productType: $("#productType").combobox("getValue"),
orderType: $("#orderType").combobox("getValue")
});
}
});
$("#activityListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
queryParams: {
nickName: $("#publisher").textbox("getValue"),
authorUid: $("#publisherUid").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
productSkn: $("#productSkn").textbox("getValue"),
productType: $("#productType").combobox("getValue"),
orderType: $("#orderType").combobox("getValue")
},
url: serverContextPath + "/grassFindgoods/getGrassFindgoodsList",
method: 'POST',
loadFilter: function (data) {
var tmp = defaultLoadFilter(data);
tmp.rows = tmp.list;
return tmp;
},
columns: [[
{
title: "内容id",
field: "articleId",
width: 25,
align: "center"
},
{
title: "内容",
field: "articleContent",
width: 60,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '<div style=" margin-left: 15px">';
if(rowData.sort == 1 || rowData.sort == 4){
if(rowData.articleContent!='' && rowData.articleContent!=null){
if(rowData.articleContent.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent +'</p>'
}
}
}else{
if(rowData.articleTitle!='' && rowData.articleTitle!=null){
if(rowData.articleTitle.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle +'</p>'
}
}
}
var imgList = rowData.imgList;
str =str + '<p>';
if(imgList !=null){//可能没有图片
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[0] + '?imageView/2/w/60/h/60" >' ;
}
if(rowData.sort == 4 && rowData.coverImg != ''){
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ rowData.coverImg + '?imageView/2/w/60/h/60" >' ;
}
str = str + "<a role='showDetail' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>查看详情</a>";
str =str + '</p>';
//标签替换成话题
var topicName = rowData.topicName;
if( null != topicName && topicName != '' ){
str =str + "<p> #"+topicName+"# </p>";
}
str = str + '</div>';
return str;
}
},
{
title: "用户名",
field: "nickName",
width: 30,
align: "left",
formatter: function (value, rowData, rowIndex) {
var uid ="uid:"+ rowData.authorUid;
var nickName ="昵称:"+ rowData.nickName;
return uid+"<br>"+nickName;
}
},{
title: "默认关联商品",
field: "productSkn",
width: 20,
align: "left"
},{
title: "商品类型",
field: "productType",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
var productType =rowData.productType;
if(productType == 1){
return "有货";
}else if(productType == 2){
return "UFO";
}
}
},{
title: "商品名称",
field: "productName",
width: 40,
align: "left"
},{
title: "排序",
field: "orderBy",
width: 20,
align: "center",
formatter: function (value, rowData) {
return "<input type='text' value=" + value + " style='width:80px;text-align:center' onblur='updateOrderBy(" + rowData.id + "," + "this.value)'>";
}
}, {
title: "操作",
field: "ddg",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str='';
str += "<a role='deleteR' class='btn-success' dataId='"+rowData.id+ "' index='"+ rowIndex + "' style='margin-left:10px'>删除</a>";
return str;
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
if(index != ""){
$(this).datagrid("scrollTo",index);
index = "";
}else{
$(this).datagrid("scrollTo",0);
}
$(this).datagrid("getPanel").find("a[role='deleteR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
$.messager.confirm("确认", "确认删除吗?", function (flag) {
if(flag){
$.post(serverContextPath + "/grassFindgoods/deleteFindgoods?id=" + dataId, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
}
});
// 查看文章详情
$(this).datagrid("getPanel").find("a[role='showDetail']").linkbutton({
iconCls : "icon-edit",
onClick : function() {
index = $(this).attr("index");
var articleId = $(this).attr("dataId");
var row = $("#activityListTable").datagrid('getData').rows[index];
getDetailDialog(row);
}
});
}
});
});
function updateOrderBy(findgoodsId, orderBy){
$.post(serverContextPath + "/grassFindgoods/updateOrderBy", {
id : findgoodsId,
orderBy : orderBy
}, function(data) {
if (data.code == 200) {
$("#activityListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "更新排序值成功!"
});
}else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
}
// 审核 文章详情页
function getDetailDialog(rowData){
var articleId = rowData.articleId;
var detailUrl = "";
if(rowData.sort == 1 || rowData.sort == 4){
detailUrl = "/html/grass/articleAuthorizeManage/articleDetail.html?articleId";
}else{
detailUrl = "/html/grass/articleAuthorizeManage/longArticleDetail.html?articleId";
}
var activityList = $("<div id='activityList'>").appendTo($(document.body));
var title = "内容详情";
// var textVar = articleId == null ? "保存":"保存";
window.self.paramObject.mkData = articleId;
$(activityList).myDialog({
title: title,
width: "98%",
height: "98%",
resizable:false,
buttons:[
{
id:"authBtn",
text: "审核通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=1&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},
{
id:"unAuthBtn",
text: "审核不通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核--不通过
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=2&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},{
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(activityList).dialog("close");
}
}
],
modal: true,
href: contextPath + detailUrl + articleId
});
}
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -74,6 +74,8 @@
</input>
<input class="easyui-combobox" id="sortParam">
</input>
<input class="easyui-combobox" id="markType">
</input>
<input class="easyui-combobox" id="markFlag">
</input>
<a id="searchBtn" class="btn-info">筛选</a>
... ... @@ -211,9 +213,17 @@
textField : "text",
required:false,
editable:false,
prompt: "是否已打标",
prompt: "标记状态",
data:[{text:"全部",value:"-1"},{text:"是",value:"1"},{text:"否",value:"0"}]
});
$("#markType").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "标记类型",
data:[{text:"全部",value:"-1"},{text:"达人搭配",value:"1"},{text:"发现好货",value:"2"}]
});
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
... ... @@ -249,7 +259,8 @@
startTimeStr:startTime,
endTimeStr:endTime,
sort:$("#sortParam").combobox("getValue"),
markFlag:$("#markFlag").combobox("getValue")
markFlag:$("#markFlag").combobox("getValue"),
markType:$("#markType").combobox("getValue")
});
}
});
... ... @@ -529,9 +540,9 @@
}
str += "<a role='markR'";
var classStr = rowData.markFlag == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' markFlag='" + rowData.markFlag + "' style='margin-left:10px'>";
var optStr = rowData.markFlag == 1 ? "取消打标</a>" : "打标</a>";
var classStr = "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex + "' style='margin-left:10px'>";
var optStr = "标记</a>";
str += optStr;
//str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
... ... @@ -599,25 +610,12 @@
});
$(this).datagrid("getPanel").find("a[role='markR']").linkbutton({
iconCls : "icon-edit",
iconCls: "icon-edit",
onClick: function () {
var markFlag = $(this).attr("markFlag");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(markFlag == 1){
message = "确认将该文章取消打标到达人搭配吗?";
}
if(markFlag == 0){
message = "确认将该文章打标到达人搭配吗?";
}
$.messager.confirm("确认", message, function (flag) {
if(flag){
switchMark(dataId, markFlag);
}
});
index = $(this).attr("index");
var row = $("#activityListTable").datagrid('getData').rows[index];
setMark(row);
}
});
... ... @@ -691,6 +689,76 @@
}
});
// 标记
function setMark(data) {
var labelList = $("<div id='activityListTable'>").appendTo($(document.body));
var title = "标记";
window.self.paramObject.mkData = data;
$(labelList).myDialog({
title: title,
width: "20%",
height: "30%",
resizable: false,
buttons: [{
id: "saveBtn",
text: "保存",
iconCls: "icon-save",
handler: function () {
$("#articleMarkForm").form("submit", {
url: serverContextPath + "/grassArticle/updateMarkFlag",
onSubmit: function (param) {
if (data != null) {
param.id = data.id;
}
if($("#articleMarkForm #box1").is(":checked")){
param.markFlag = "1";
}else{
param.markFlag = "0";
}
if($("#articleMarkForm #box2").is(":checked")){
param.markFindgoods = "1";
}else{
param.markFindgoods = "0";
}
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后..."
});
return true;
},
success: function (data) {
$.messager.progress("close");
data = JSON.parse(data);
if (data.code == 200) {
$(labelList).dialog("close");
$("#activityListTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: title + "成功!",
height: 120
});
} else {
$.messager.alert("错误", data.message, "error");
}
}
});
}
}, {
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(labelList).dialog("close");
}
}],
modal: true,
href: contextPath + "/html/grass/articleManage/articleMark.html"
});
}
// 预览
function articlePreview(previewUrl){
var articleEditer = $("<div id='articleEditer' style ='overflow:scroll;'>").appendTo($(document.body));
... ...
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="articleMarkForm" id="articleMarkForm" method="post">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td>
达人搭配:<input type="checkbox" id = "box1"/>
</td>
<td>
发现好货:<input type="checkbox" id = "box2"/>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
var data = paramObject.mkData;
if(data.markFlag == '1'){
$("#box1").attr("checked",true);
}
if(data.markFindgoods == '1'){
$("#box2").attr("checked",true);
}
});
</script>
</html>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Yoho!Buy运营平台</title>
<script src="/pfcms/js/include_grass.js"></script>
<script src="/pfcms/js/ajaxfileupload.js"></script>
<script src="/pfcms/js/jquery.imageUpload.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.config.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.all.min.js"></script>
<link rel="stylesheet" href="/pfcms/css/swiper.min.css">
<script src="/pfcms/js/utils/swiper.min.js"></script>
<!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/pfcms/ueditor/lang/zh-cn/zh-cn.js"></script>
<script charset="utf-8" src="/pfcms/ueditor/ueditor.yoho.js"></script>
<script charset="utf-8" src="/pfcms/js/grass_article.js"></script>
<style>
/* 可以设置样式,也可以不设置*/
.swiper-container {
width: 700px;
height: 400px;
}
.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;
}
</style>
</head>
<!--<body class="easyui-layout" fit="true" style="overflow-y: scroll" >-->
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<!--<div region="north" style="height: 30%;">-->
<script>
document.write(addHead('种草社区管理', '种草内容管理'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
<input class="easyui-combobox" id="isRecommend">
</input>
<input class="easyui-combobox" id="isTop">
</input>
<input class="easyui-textbox" id="publisher">
</input>
<input class="easyui-textbox" id="publisherUid">
</input>
<input class="easyui-textbox" id="articleId">
</input>
<input class="easyui-combobox" id="source">
</input>
<input class="easyui-combobox" id="userType">
</input>
<input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(开始)'"/>
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(结束)'"/>
</input>
<input class="easyui-combobox" id="recommendSort">
</input>
<input class="easyui-combobox" id="authStatus">
</input>
<input class="easyui-combobox" id="sortParam">
</input>
<input class="easyui-combobox" id="markFlag">
</input>
<a id="searchBtn" class="btn-info">筛选</a>
<!--<a id="addActivityBtn" class="btn-success">新增</a>-->
<a id="allBtn" class="btn-info">全部 </a>
</div></div>
<div region="center" id="activityList" style="margin-left: 20px" >
<table id="activityListTable" ></table>
</div>
</body>
<script>
$(function() {
//用于页面刷新后的数据行定位
var index ="";
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
//清空筛选数据
$("#publisher").textbox("setValue","");
$("#articleId").textbox("setValue","");
$("#source").combobox("setValue","");
$("#userType").combobox("setValue","");
$("#isRecommend").combobox("setValue","");
$("#isTop").combobox("setValue","");
$("#startTimeStr").datetimebox('setValue',"");
$("#endTimeStr").datetimebox('setValue',"");
$("#authStatus").combobox("setValue","-1");
$("#activityListTable").datagrid("load", {
authStatus: "1"
});
}
});
$("#publisher").textbox({
required:false,
prompt: "用户昵称"
});
$("#publisherUid").textbox({
required:false,
prompt: "uid"
});
$("#articleId").textbox({
required:false,
prompt: "文章id"
});
$("#isRecommend").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择推荐状态",
data:[{text:"全部",value:"8"},{text:"未推荐",value:"0"},{text:"已推荐",value:"1"}]
});
$("#isTop").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择置顶状态",
data:[{text:"全部",value:"8"},{text:"未置顶",value:"0"},{text:"已置顶",value:"1"}]
});
$("#source").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择来源",
data:[{text:"全部",value:"0"},{text:"社区",value:"1"},{text:"资讯",value:"2"},{text:"晒单",value:"4"},{text:"now",value:"5"},{text:"mars",value:"3"},{text:"爬虫数据",value:"7"}]
});
$("#userType").combobox({
valueField: "id",
textField: "groupName",
required: false,
prompt: "请选择用户身份",
selectOnNavigation : true,
url : serverContextPath + "/grassUserManage/getAllVirtualGroup",
loadFilter: function (data) {
var data = defaultLoadFilter(data);
data.unshift({'id': '0', 'groupName': '全部'});
return data;
}
});
//推荐顺序
$("#recommendSort").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择推荐顺序",
data:[{text:"选择推荐顺序",value:"0"},{text:"推荐降序",value:"desc"},{text:"推荐升序",value:"asc"}]
});
//是否屏蔽
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#authStatus").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "请选择屏蔽状态",
data:[{text:"全部",value:"-1"},{text:"已屏蔽",value:"4"},{text:"未屏蔽",value:"1",selected:true}]
});
$("#sortParam").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "文章内容类型",
data:[{text:"全部",value:"0"},{text:"普通笔记",value:"1"},{text:"长文章",value:"2"},{text:"H5跳转链接",value:"3"},{text:"短视频",value:"4"}]
});
$("#markFlag").combobox({
valueField : "value",
textField : "text",
required:false,
editable:false,
prompt: "是否已打标",
data:[{text:"全部",value:"-1"},{text:"是",value:"1"},{text:"否",value:"0"}]
});
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if (action == 'uploadimage' || action == 'uploadfile') {
return serverContextPath + "/fileupload/uploadFile4Editor.do?bucket=grassImg";
} else {
return this._bkGetActionUrl.call(this, action);
}
};
// 检索按钮
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
var startTime="";
var endTime="";
if ($("#startTimeStr").datetimebox('getValue')!='') {
startTime = parseInt(new Date($("#startTimeStr").datetimebox('getValue')).getTime() );
}
if ($("#endTimeStr").datetimebox('getValue')!='') {
endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() );
}
$("#activityListTable").datagrid("load", {
authStatus: $("#authStatus").combobox("getValue"),
publisher: $("#publisher").textbox("getValue"),
authorUid: $("#publisherUid").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").combobox("getValue"),
userType: $("#userType").combobox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
isRecommend: $("#isRecommend").combobox("getValue"),
isTop: $("#isTop").combobox("getValue"),
startTimeStr:startTime,
endTimeStr:endTime,
sort:$("#sortParam").combobox("getValue"),
markFlag:$("#markFlag").combobox("getValue")
});
}
});
$("#activityListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
queryParams: {
publisher: $("#publisher").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").textbox("getValue"),
userType: $("#userType").textbox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
authStatus: $("#authStatus").combobox("getValue")
},
url: serverContextPath + "/grassArticle/articleList",
method: 'POST',
loadFilter: function (data) {
var tmp = defaultLoadFilter(data);
tmp.rows = tmp.list;
return tmp;
},
columns: [[
{
title: "内容id",
field: "articleId",
width: 25,
align: "center"
},
{
title: "内容",
field: "articleContent",
width: 60,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '<div style=" margin-left: 15px">';
if(rowData.sort == 1 || rowData.sort == 4){
if(rowData.articleContent!='' && rowData.articleContent!=null){
if(rowData.articleContent.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleContent +'</p>'
}
}
}else{
if(rowData.articleTitle!='' && rowData.articleTitle!=null){
if(rowData.articleTitle.length>30){
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle.substring(0,30) +'...</p>'
}else{
str = str +'<p style=" white-space: pre-wrap;word-wrap:break-word">' +rowData.articleTitle +'</p>'
}
}
}
var imgList = rowData.imgList;
str =str + '<p>';
if(imgList !=null){//可能没有图片
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ imgList[0] + '?imageView/2/w/60/h/60" >' ;
}
if(rowData.sort == 4 && rowData.coverImg != ''){
str = str + ' <img style="width:60px; height: 60px;margin-left: 3px" src="'+ rowData.coverImg + '?imageView/2/w/60/h/60" >' ;
}
str = str + "<a role='showDetail' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>查看详情</a>";
str =str + '</p>';
//标签替换成话题
var topicName = rowData.topicName;
if( null != topicName && topicName != '' ){
str =str + "<p> #"+topicName+"# </p>";
}
str = str + '</div>';
return str;
}
},
{
title: "用户名",
field: "nickName",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var uid ="uid:"+ rowData.authorUid;
var nickName ="昵称:"+ rowData.nickName;
return uid+"<br>"+nickName;
}
},{
title: "用户身份",
field: "userTypeStr",
width: 20,
align: "left"
},{
title: "发布时间",
field: "publishTime",
width: 30,
align: "left"
},{
title: "审核时间",
field: "authTimeStr",
width: 30,
align: "left"
},{
title: "内容来源",
field: "source",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.source == '1'){
str = "社区";
}
if(rowData.source == '2'){
str = "资讯";
}
if(rowData.source == '3'){
str = "mars";
}
if(rowData.source == '4'){
str = "晒单";
}
if(rowData.source == '5'){
str = "now";
}
if(rowData.source == '7'){
str = "爬虫数据";
}
return str;
}
},{
title: "内容类型",
field: "sort",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.sort == '1'){
str = "笔记";
}
if(rowData.sort == '2'){
str = "长文章";
}
if(rowData.sort == '3'){
str = "H5跳转链接";
}
if(rowData.sort == '4'){
str = "短视频";
}
return str;
}
},{
title: "数据统计",
field: "praiseCount",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
return "回复:" + rowData.commentCount + "<br>" + "收藏:"+ rowData.favorCount + "<br>" + "点赞:" + rowData.praiseCount;
}
},
// {
// title: "被回复",
// field: "commentCount",
// width: 25,
// align: "left"
// },
// {
// title: "被收藏",
// field: "favorCount",
// width: 20,
// align: "left"
// },
// {
// title: "被赞",
// field: "praiseCount",
// width: 20,
// align: "left"
// },
/*{
title: "推荐时间",
field: "recomTimeStr",
width: 30,
align: "left"
},*/
{
title: "推荐状态",
field: "isRecommend",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.isRecommend == '1'){
str = "已推荐";
}else{
str = "未推荐";
}
return str;
}
},
{
title: "置顶状态",
field: "isTop",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
var str = '';
if(rowData.isTop == '1'){
str = "已置顶";
}else{
str = "未置顶";
}
return str;
}
},
{
title: "屏蔽状态",
field: "authStatus",
width: 25,
align: "left",
formatter: function (value, rowData, rowIndex) {
if(rowData.authStatus == '4'){
return "已屏蔽";
}else{
return "未屏蔽";
}
}
},
{
title: "操作",
field: "ddg",
width: 50,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str='';
str += "<a role='edit'";
var classStr = "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId +"' sort='"+ rowData.sort + "' index='"+ rowIndex + "' style='margin-left:10px'>";
var optStr = "编辑</a>" ;
str += optStr;
if(rowData.authStatus == 1){
str += "<a role='switchR'";
var classStr = rowData.isRecommend == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isRecommend + "' style='margin-left:10px'>";
var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>";
str += optStr;
if(rowData.isRecommend == 1){
str += "<a role='switchT'";
var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>";
var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>";
str += optStr;
}
}
if(rowData.authStatus == 0){
str += "待审核"
}
if(rowData.authStatus == 2){
str += "审核未通过"
}
if(rowData.authStatus == 4){
str += "<a role='shieldR' class='btn-success' dataId='"+rowData.articleId+ "' dataAuthStatus='1' index='"+ rowIndex + "' style='margin-left:10px'>取消屏蔽</a>";
}else{
str += "<a role='shieldR' class='btn-success' dataId='"+rowData.articleId+ "' dataAuthStatus='4' index='"+ rowIndex + "' style='margin-left:10px'>屏蔽</a>";
}
str += "<a role='deleteR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' style='margin-left:10px'>删除</a>";
if(rowData.authStatus == 1){
str += "<a role='showDetail' class='btn-info' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>评论</a>";
}
str += "<a role='markR'";
var classStr = rowData.markFlag == 1 ? "class='btn-danger'" : "class='btn-success'";
str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' markFlag='" + rowData.markFlag + "' style='margin-left:10px'>";
var optStr = rowData.markFlag == 1 ? "取消打标</a>" : "打标</a>";
str += optStr;
//str += "<a role='preview' class='btn-info' dataId='" + rowData.previewUrl + "' index='"+ rowIndex + "' style='margin-left:10px'>预览</a>";
return str;
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
if(index != ""){
$(this).datagrid("scrollTo",index);
index = "";
}else{
$(this).datagrid("scrollTo",0);
}
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
var sort = $(this).attr("sort");
index = $(this).attr("index");
editor(sort, data.rows[index]);
}
});
$(this).datagrid("getPanel").find("a[role='preview']").linkbutton({
iconCls : "icon-save",
onClick: function () {
var previewUrl = $(this).attr("dataId");
articlePreview(previewUrl);
}
});
$(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var status = $(this).attr("status");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(status == 1){
message = "取消推荐";
}
if(status == 0){
message = "推荐";
}
$.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
if(flag){
switchRecommend(dataId, status);
}
});
}
});
$(this).datagrid("getPanel").find("a[role='markR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var markFlag = $(this).attr("markFlag");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(markFlag == 1){
message = "确认将该文章取消打标到达人搭配吗?";
}
if(markFlag == 0){
message = "确认将该文章打标到达人搭配吗?";
}
$.messager.confirm("确认", message, function (flag) {
if(flag){
switchMark(dataId, markFlag);
}
});
}
});
$(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var status = $(this).attr("status");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(status == 1){
message = "取消置顶";
}
if(status == 0){
message = "置顶";
}
$.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
if(flag){
switchTop(dataId, status);
}
});
}
});
// 编辑
$(this).datagrid("getPanel").find("a[role='showDetail']").linkbutton({
iconCls : "icon-edit",
onClick : function() {
index = $(this).attr("index");
var articleId = $(this).attr("dataId");
var row = $("#activityListTable").datagrid('getData').rows[index];
getDetailDialog(row);
}
});
$(this).datagrid("getPanel").find("a[role='deleteR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
$.messager.confirm("确认", "确认删除这篇文章吗?", function (flag) {
if(flag){
$.post(serverContextPath + "/grassArticle/deleteArticle?articleId=" + dataId, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
}
});
$(this).datagrid("getPanel").find("a[role='shieldR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var dataId = $(this).attr("dataId");
var authStatus = $(this).attr("dataAuthStatus");//取消屏蔽则恢复为审核通过状态
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + dataId+"&authStatus="+authStatus+"&operateType=2", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
}
});
// 预览
function articlePreview(previewUrl){
var articleEditer = $("<div id='articleEditer' style ='overflow:scroll;'>").appendTo($(document.body));
var content = '<iframe src="' + previewUrl + '" width="500px" height="800px" frameborder="0"></iframe>';
$(articleEditer).myDialog({
content: content,
noheader: true,
border: true,
resizable: false,//定义对话框是否可调整尺寸。
maximized: false,//默认最大化,可调整为false,改成弹出框模式。
modal: false,
buttons:[
{
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(articleEditer).dialog("close");
}
}
]
});
}
// 编辑
function editor(sort, data) {
var editorFilePath = "";
if (sort == 1) {
editorFilePath = "/html/grass/article/editArticle.html"
}
else if (sort == 4) {
editorFilePath = "/html/grass/article/editorVideoDetail.html";
}
else {
editorFilePath = "/html/grass/longArticle/edit.html"
}
var articleEditer = $("<div id='articleEditer'>").appendTo($(document.body));
var title = "编辑";
data.editFlag = 1;
window.self.paramObject.mkData = data;
$(articleEditer).myDialog({
title: title,
width: "80%",
height: "100%",
resizable:false,
modal: true,
href: contextPath + editorFilePath
});
}
function switchRecommend(id, status) {
var switchStatus = status == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isRecommend=" + switchStatus+ "&operateType=0", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
function switchMark(id, markFlag) {
var switchMark = markFlag == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateMarkFlag.do?articleId=" + id + "&markFlag=" + switchMark, function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
function switchTop(id, status) {
var switchStatus = status == 1 ? 0 : 1;
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) {
if(data.code != 200){
alert(data.message);
}else{
$("#activityListTable").datagrid("reload");
}
}, "json");
}
});
// 审核 文章详情页
function getDetailDialog(rowData){
var articleId = rowData.articleId;
var detailUrl = "";
if(rowData.sort == 1 || rowData.sort == 4){
detailUrl = "/html/grass/articleAuthorizeManage/articleDetail.html?articleId";
}else{
detailUrl = "/html/grass/articleAuthorizeManage/longArticleDetail.html?articleId";
}
var activityList = $("<div id='activityList'>").appendTo($(document.body));
var title = "内容详情";
// var textVar = articleId == null ? "保存":"保存";
window.self.paramObject.mkData = articleId;
$(activityList).myDialog({
title: title,
width: "98%",
height: "98%",
resizable:false,
buttons:[
{
id:"authBtn",
text: "审核通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=1&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},
{
id:"unAuthBtn",
text: "审核不通过",
iconCls: "icon-cancel",
handler: function () {
//文章审核--不通过
//文章审核-通过
$.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + articleId + "&authStatus=2&operateType=2", function (data) {
if (data.code == 200) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
$(activityList).dialog("close");
$("#activityListTable").datagrid("reload");
} else {
$.messager.alert("失败", "操作失败", "error");
}
}, "json");
}
},{
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(activityList).dialog("close");
}
}
],
modal: true,
href: contextPath + detailUrl + articleId
});
}
</script>
</html>
\ No newline at end of file
... ...