Authored by chaogeng

Merge branch 'dev_grass_20190108' of http://git.yoho.cn/platform/platform-cms in…

…to dev_grass_20190108
1 package com.yohobuy.platform.grass.restapi; 1 package com.yohobuy.platform.grass.restapi;
2 2
  3 +import com.yoho.core.dal.datasource.annotation.Database;
3 import com.yohobuy.platform.common.exception.PlatformException; 4 import com.yohobuy.platform.common.exception.PlatformException;
4 import com.yohobuy.platform.grass.service.IGrassArticleService; 5 import com.yohobuy.platform.grass.service.IGrassArticleService;
5 import com.yohobuy.platform.model.common.ApiResponse; 6 import com.yohobuy.platform.model.common.ApiResponse;
1 package com.yohobuy.platform.grass.service.impl; 1 package com.yohobuy.platform.grass.service.impl;
2 2
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
3 import com.google.common.collect.Lists; 5 import com.google.common.collect.Lists;
4 import com.google.common.collect.Maps; 6 import com.google.common.collect.Maps;
  7 +import com.yoho.core.dal.datasource.annotation.Database;
5 import com.yohobuy.platform.common.exception.PlatformException; 8 import com.yohobuy.platform.common.exception.PlatformException;
6 import com.yohobuy.platform.common.util.DateUtil; 9 import com.yohobuy.platform.common.util.DateUtil;
7 import com.yohobuy.platform.dal.grass.IGrassArticleBlockDao; 10 import com.yohobuy.platform.dal.grass.IGrassArticleBlockDao;
@@ -66,8 +69,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -66,8 +69,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
66 int contentOrder =0; 69 int contentOrder =0;
67 for (String url : urls) { 70 for (String url : urls) {
68 GrassArticleBlock content = new GrassArticleBlock(); 71 GrassArticleBlock content = new GrassArticleBlock();
  72 + JSONObject data = new JSONObject();
  73 + data.put("template_name", "image");
  74 + data.put("data", url);
69 content.setArticleId(article.getId()); 75 content.setArticleId(article.getId());
70 - content.setContentData(url); 76 + content.setContentData(data.toJSONString());
71 content.setCreateTime(DateUtil.getCurrentTimeSeconds()); 77 content.setCreateTime(DateUtil.getCurrentTimeSeconds());
72 content.setTemplateKey("image"); 78 content.setTemplateKey("image");
73 content.setOrderBy(contentOrder); 79 content.setOrderBy(contentOrder);
@@ -75,8 +81,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -75,8 +81,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
75 contentList.add(content); 81 contentList.add(content);
76 } 82 }
77 GrassArticleBlock content = new GrassArticleBlock(); 83 GrassArticleBlock content = new GrassArticleBlock();
  84 + JSONObject data = new JSONObject();
  85 + data.put("template_name", "text");
  86 + data.put("data", req.getContent());
78 content.setArticleId(article.getId()); 87 content.setArticleId(article.getId());
79 - content.setContentData(req.getContent()); 88 + content.setContentData(data.toJSONString());
80 content.setCreateTime(DateUtil.getCurrentTimeSeconds()); 89 content.setCreateTime(DateUtil.getCurrentTimeSeconds());
81 content.setTemplateKey("text"); 90 content.setTemplateKey("text");
82 content.setOrderBy(contentOrder); 91 content.setOrderBy(contentOrder);
@@ -146,6 +155,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -146,6 +155,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
146 } 155 }
147 156
148 @Override 157 @Override
  158 + @Database(ForceMaster = true)
149 public void updateArticle(GrassArticleReq req) throws PlatformException { 159 public void updateArticle(GrassArticleReq req) throws PlatformException {
150 Integer type= req.getOperateType(); 160 Integer type= req.getOperateType();
151 logger.info("enter updateArticle, req is {}",req); 161 logger.info("enter updateArticle, req is {}",req);
@@ -174,49 +184,61 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -174,49 +184,61 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
174 if(articleId == null){ 184 if(articleId == null){
175 throw new PlatformException("articleId is null", 402); 185 throw new PlatformException("articleId is null", 402);
176 } 186 }
177 - //修改文章内容  
178 - GrassArticle grassArticle = new GrassArticle();  
179 - grassArticle.setId(articleId);  
180 - grassArticle.setTopicId(req.getTopicId());  
181 - grassArticleDao.updateByPrimaryKeySelective(grassArticle);  
182 - //文章图片  
183 - List<GrassArticleBlock> imageList = grassArticleBlockDao.selectByArticleId(articleId);  
184 - List<String> dbImageList = imageList.stream().filter(Objects::nonNull).filter(content ->"image".equals(content.getTemplateKey()) ).map(GrassArticleBlock::getContentData).collect(Collectors.toList()); 187 + //修改文章主体内容
  188 + if(req.getTopicId() !=null){
  189 + GrassArticle grassArticle = new GrassArticle();
  190 + grassArticle.setId(articleId);
  191 + grassArticle.setTopicId(req.getTopicId());
  192 + grassArticle.setUpdateTime(DateUtil.getCurrentTimeSeconds());
  193 + grassArticleDao.updateByPrimaryKeySelective(grassArticle);
  194 + }
  195 +
  196 + //文章内容
  197 + grassArticleBlockDao.deleteByArticleId(articleId);
  198 +
  199 + //图片内容
185 List<String> reqlist = req.getArticleImages() == null ? Lists.newArrayList() : Lists.newArrayList(req.getArticleImages().split(",")); 200 List<String> reqlist = req.getArticleImages() == null ? Lists.newArrayList() : Lists.newArrayList(req.getArticleImages().split(","));
186 - List<String> newimgList = reqlist.stream().filter(s -> !dbImageList.contains(s)).collect(Collectors.toList());  
187 - List<GrassArticleBlock> deleteList = imageList.stream().filter(content -> content!=null&&!reqlist.contains(content.getContentData())).collect(Collectors.toList());  
188 //新增 201 //新增
189 List<GrassArticleBlock> addList = Lists.newArrayList(); 202 List<GrassArticleBlock> addList = Lists.newArrayList();
190 - int contentOrder = imageList.size();  
191 - for (String src : newimgList) { 203 + int contentOrder = 0;
  204 + for (String src : reqlist) {
192 GrassArticleBlock content = new GrassArticleBlock(); 205 GrassArticleBlock content = new GrassArticleBlock();
  206 + JSONObject data = new JSONObject();
  207 + data.put("template_name", "image");
  208 + data.put("data", src);
193 content.setArticleId(articleId); 209 content.setArticleId(articleId);
194 - content.setContentData(src); 210 + content.setContentData(data.toJSONString());
195 content.setCreateTime(DateUtil.getCurrentTimeSeconds()); 211 content.setCreateTime(DateUtil.getCurrentTimeSeconds());
  212 + content.setTemplateKey("image");
196 content.setOrderBy(contentOrder); 213 content.setOrderBy(contentOrder);
197 contentOrder++; 214 contentOrder++;
198 addList.add(content); 215 addList.add(content);
199 } 216 }
  217 + //文字内容
  218 + if(StringUtils.isNotEmpty(req.getContent())){
  219 + GrassArticleBlock content = new GrassArticleBlock();
  220 + JSONObject data = new JSONObject();
  221 + data.put("template_name", "text");
  222 + data.put("data", req.getContent());
  223 + content.setArticleId(articleId);
  224 + content.setContentData(data.toJSONString());
  225 + content.setCreateTime(DateUtil.getCurrentTimeSeconds());
  226 + content.setTemplateKey("text");
  227 + content.setOrderBy(contentOrder);
  228 + addList.add(content);
  229 + }
  230 +
200 if(CollectionUtils.isNotEmpty(addList)){ 231 if(CollectionUtils.isNotEmpty(addList)){
201 grassArticleBlockDao.insertArticleContents(addList); 232 grassArticleBlockDao.insertArticleContents(addList);
202 } 233 }
203 - //删除  
204 - List<Integer> delList = deleteList.stream().filter(Objects::nonNull).map(GrassArticleBlock::getArticleId).collect(Collectors.toList());  
205 - if(CollectionUtils.isNotEmpty(delList)){  
206 - grassArticleBlockDao.deleteArticleContentByIds(delList, DateUtil.getCurrentTimeSeconds());  
207 - }  
208 -  
209 234
210 //商品 235 //商品
211 - List<GrassArticleProduct> sknList = grassArticleProductDao.selectByArticleId(articleId);  
212 - List<Integer> dbSknList = sknList.stream().filter(Objects::nonNull).map(GrassArticleProduct::getProductSkn).collect(Collectors.toList()); 236 + grassArticleProductDao.deleteByArticleId(articleId);
213 List<String> reqSknlist = req.getArticleSkns() == null ? Lists.newArrayList() : Lists.newArrayList(req.getArticleSkns().split(",")); 237 List<String> reqSknlist = req.getArticleSkns() == null ? Lists.newArrayList() : Lists.newArrayList(req.getArticleSkns().split(","));
214 - List<String> newSknList = reqSknlist.stream().filter(s -> !dbSknList.contains(Integer.valueOf(s))).collect(Collectors.toList());  
215 - List<GrassArticleProduct> delSknList = sknList.stream().filter(skn -> skn !=null && !reqlist.contains(String.valueOf(skn.getProductSkn()))).collect(Collectors.toList());  
216 //新增 238 //新增
217 List<GrassArticleProduct> addSknList = Lists.newArrayList(); 239 List<GrassArticleProduct> addSknList = Lists.newArrayList();
218 - int orderBy = sknList.size();  
219 - for (String skn : newSknList) { 240 + int orderBy = 0;
  241 + for (String skn : reqSknlist) {
220 GrassArticleProduct grassArticleSkn = new GrassArticleProduct(); 242 GrassArticleProduct grassArticleSkn = new GrassArticleProduct();
221 grassArticleSkn.setArticleId(articleId); 243 grassArticleSkn.setArticleId(articleId);
222 grassArticleSkn.setProductSkn(Integer.valueOf(skn)); 244 grassArticleSkn.setProductSkn(Integer.valueOf(skn));
@@ -224,14 +246,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -224,14 +246,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
224 grassArticleSkn.setOrderBy(orderBy); 246 grassArticleSkn.setOrderBy(orderBy);
225 orderBy++; 247 orderBy++;
226 addSknList.add(grassArticleSkn); 248 addSknList.add(grassArticleSkn);
227 - }if(CollectionUtils.isNotEmpty(addList)){  
228 - grassArticleProductDao.insertArticleSkns(addSknList);  
229 } 249 }
230 - //删除  
231 - List<Integer> delSknIds = delSknList.stream().filter(Objects::nonNull).map(GrassArticleProduct::getArticleId).collect(Collectors.toList());  
232 - if(CollectionUtils.isNotEmpty(delSknIds)){  
233 - grassArticleProductDao.deleteArticleSkns(delSknIds, DateUtil.getCurrentTimeSeconds()); 250 + if(CollectionUtils.isNotEmpty(addSknList)){
  251 + grassArticleProductDao.insertArticleSkns(addSknList);
234 } 252 }
  253 +
235 } 254 }
236 } 255 }
237 256
@@ -243,11 +262,13 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -243,11 +262,13 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
243 List<Integer> topicIds = articleList.stream().map(GrassArticle::getTopicId).collect(Collectors.toList()); 262 List<Integer> topicIds = articleList.stream().map(GrassArticle::getTopicId).collect(Collectors.toList());
244 List<GrassArticleBlock> grassArticleContentList = grassArticleBlockDao.selectByArticleIds(ids); 263 List<GrassArticleBlock> grassArticleContentList = grassArticleBlockDao.selectByArticleIds(ids);
245 List<GrassArticleProduct> grassArticlePoductList = grassArticleProductDao.selectByArticleIds(ids); 264 List<GrassArticleProduct> grassArticlePoductList = grassArticleProductDao.selectByArticleIds(ids);
246 - GrassArticleBlock grassArticleContent = grassArticleContentList.stream().filter(content -> "text".equals(content.getTemplateKey())).findFirst().orElse(null); 265 + List<GrassArticleBlock> textContent = grassArticleContentList.stream().filter(content -> "text".equals(content.getTemplateKey())).collect(Collectors.toList());
  266 +
247 if(CollectionUtils.isNotEmpty(topicIds)){ 267 if(CollectionUtils.isNotEmpty(topicIds)){
248 List<String> topics = Lists.newArrayList(); 268 List<String> topics = Lists.newArrayList();
249 } 269 }
250 Map<Integer, List<String>> imgMap = Maps.newHashMap(); 270 Map<Integer, List<String>> imgMap = Maps.newHashMap();
  271 + Map<Integer,String> textMap = Maps.newHashMap();
251 Map<Integer, List<Integer>> sknMap = Maps.newHashMap(); 272 Map<Integer, List<Integer>> sknMap = Maps.newHashMap();
252 grassArticleContentList.forEach(content ->{ 273 grassArticleContentList.forEach(content ->{
253 if ("image".equals(content.getTemplateKey())) { 274 if ("image".equals(content.getTemplateKey())) {
@@ -255,11 +276,21 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -255,11 +276,21 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
255 if(images == null){ 276 if(images == null){
256 images = Lists.newArrayList(); 277 images = Lists.newArrayList();
257 } 278 }
258 - images.add(content.getContentData()); 279 + JSONObject data = JSON.parseObject(content.getContentData());
  280 + images.add(data.getString("data"));
259 imgMap.put(content.getArticleId(), images); 281 imgMap.put(content.getArticleId(), images);
260 } 282 }
261 283
262 }); 284 });
  285 + textContent.forEach(content ->{
  286 + if ("text".equals(content.getTemplateKey())) {
  287 + String text = textMap.get(content.getArticleId());
  288 + JSONObject data = JSON.parseObject(content.getContentData());
  289 + text = data.getString("data");
  290 + textMap.put(content.getArticleId(), text);
  291 + }
  292 +
  293 + });
263 grassArticlePoductList.forEach(product -> { 294 grassArticlePoductList.forEach(product -> {
264 List<Integer> skns = sknMap.get(product.getArticleId()); 295 List<Integer> skns = sknMap.get(product.getArticleId());
265 if(skns == null){ 296 if(skns == null){
@@ -272,7 +303,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -272,7 +303,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
272 articleList.forEach(article -> { 303 articleList.forEach(article -> {
273 ArticleDetailRspBo rspBo = new ArticleDetailRspBo(); 304 ArticleDetailRspBo rspBo = new ArticleDetailRspBo();
274 rspBo.setArticleId(article.getId()); 305 rspBo.setArticleId(article.getId());
275 - rspBo.setArticleContent(grassArticleContent ==null ? "": grassArticleContent.getContentData()); 306 + rspBo.setArticleContent(textMap.get(article.getId()));
276 rspBo.setAuthorUid(article.getAuthorUid()); 307 rspBo.setAuthorUid(article.getAuthorUid());
277 rspBo.setTopicId(article.getTopicId()); 308 rspBo.setTopicId(article.getTopicId());
278 rspBo.setNickName(""); 309 rspBo.setNickName("");
@@ -28,7 +28,13 @@ @@ -28,7 +28,13 @@
28 iconCls : "icon-search", 28 iconCls : "icon-search",
29 onClick : function() { 29 onClick : function() {
30 checkedItemsObj ={}; 30 checkedItemsObj ={};
31 - $("#labelGroupListTable").datagrid("load", {}); 31 + $("#labelGroupListTable").datagrid("load", {
  32 + productSkns: $("#skn").textbox("getValue"),
  33 + status: 1,
  34 + sales: "Y",
  35 + stocknumber: "1",
  36 + attribute_not: "2"
  37 + });
32 } 38 }
33 }); 39 });
34 $("#skn").textbox({ 40 $("#skn").textbox({
@@ -44,14 +50,14 @@ @@ -44,14 +50,14 @@
44 onUncheckAll: removeAllItem, 50 onUncheckAll: removeAllItem,
45 onUncheck: removeSingleItem, 51 onUncheck: removeSingleItem,
46 queryParams: { 52 queryParams: {
47 - query: $("#skn").textbox("getValue"), 53 + productSkns: $("#skn").textbox("getValue"),
48 status: 1, 54 status: 1,
49 sales: "Y", 55 sales: "Y",
50 stocknumber: "1", 56 stocknumber: "1",
51 attribute_not: "2" 57 attribute_not: "2"
52 }, 58 },
53 - url: "/yohosearch/search",  
54 - // url: contextPath+"/product/queryProductInfoBySkns", 59 + url: "/yohosearch/search.json",
  60 + // url: +serverContextPath+"/product/queryProductInfoBySkns",
55 // url: serverContextPath+"/labelGroupManage/getLabelGroupList", 61 // url: serverContextPath+"/labelGroupManage/getLabelGroupList",
56 method: 'POST', 62 method: 'POST',
57 loadFilter: function (data) { 63 loadFilter: function (data) {
@@ -245,14 +245,18 @@ @@ -245,14 +245,18 @@
245 align: "center", 245 align: "center",
246 formatter: function (value, rowData, rowIndex) { 246 formatter: function (value, rowData, rowIndex) {
247 debugger 247 debugger
248 -  
249 - var str = "<a role='edit' dataId='"+ rowData.articleId +"' style='margin-left:10px' index='"+ rowIndex +"'>编辑内容</a>";  
250 - str += "<a role='switch'" 248 + var str='';
  249 + str += "<a role='switchR'"
251 var classStr = rowData.isRecommend == 1 ? "class='btn-danger'" : "class='btn-success'"; 250 var classStr = rowData.isRecommend == 1 ? "class='btn-danger'" : "class='btn-success'";
252 str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isRecommend + "' style='margin-left:10px'>"; 251 str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isRecommend + "' style='margin-left:10px'>";
253 var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>"; 252 var optStr = rowData.isRecommend == 1 ? "取消推荐</a>" : "推荐</a>";
254 str += optStr; 253 str += optStr;
255 254
  255 + str += "<a role='switchT'"
  256 + var classStr = rowData.isTop == 1 ? "class='btn-danger'" : "class='btn-success'";
  257 + str += classStr +" dataId='" + rowData.articleId + "' index='"+ rowIndex +"' status='" + rowData.isTop + "' style='margin-left:10px'>";
  258 + var optStr = rowData.isTop == 1 ? "取消置顶</a>" : "置顶</a>";
  259 + str += optStr;
256 return str; 260 return str;
257 } 261 }
258 } 262 }
@@ -272,19 +276,31 @@ @@ -272,19 +276,31 @@
272 } 276 }
273 277
274 278
275 - // 编辑  
276 - $(this).datagrid("getPanel").find("a[role='edit']").linkbutton({ 279 +
  280 + $(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({
277 iconCls : "icon-edit", 281 iconCls : "icon-edit",
278 - onClick : function() {  
279 - debugger 282 + onClick: function () {
  283 + var status = $(this).attr("status");
  284 + var dataId = $(this).attr("dataId");
280 index = $(this).attr("index"); 285 index = $(this).attr("index");
281 - var row = $("#activityListTable").datagrid('getData').rows[index];  
282 - getEditDialog(row) 286 + var message = "";
  287 + if(status == 1){
  288 + message = "取消推荐";
  289 + }
  290 + if(status == 0){
  291 + message = "推荐";
  292 + }
  293 + $.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
  294 + if(flag){
  295 + switchRecommend(dataId, status);
  296 +
  297 + }
  298 + });
  299 +
283 } 300 }
284 }); 301 });
285 302
286 - // 停用  
287 - $(this).datagrid("getPanel").find("a[role='switch']").linkbutton({ 303 + $(this).datagrid("getPanel").find("a[role='switchT']").linkbutton({
288 iconCls : "icon-edit", 304 iconCls : "icon-edit",
289 onClick: function () { 305 onClick: function () {
290 var status = $(this).attr("status"); 306 var status = $(this).attr("status");
@@ -292,14 +308,14 @@ @@ -292,14 +308,14 @@
292 index = $(this).attr("index"); 308 index = $(this).attr("index");
293 var message = ""; 309 var message = "";
294 if(status == 1){ 310 if(status == 1){
295 - message = "取消推荐"; 311 + message = "取消置顶";
296 } 312 }
297 if(status == 0){ 313 if(status == 0){
298 - message = "推荐"; 314 + message = "置顶";
299 } 315 }
300 $.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) { 316 $.messager.confirm("确认", "确认"+message+"该文章吗?", function (flag) {
301 if(flag){ 317 if(flag){
302 - switchStatus(dataId, status); 318 + switchTop(dataId, status);
303 319
304 } 320 }
305 }); 321 });
@@ -314,7 +330,7 @@ @@ -314,7 +330,7 @@
314 }); 330 });
315 331
316 332
317 - function switchStatus(id, status) { 333 + function switchRecommend(id, status) {
318 debugger 334 debugger
319 var switchStatus = status == 1 ? 0 : 1; 335 var switchStatus = status == 1 ? 0 : 1;
320 $.post(contextPath + "/grassArticle/updateArticle?articleId=" + id + "&isRecommend=" + switchStatus+ "&operateType=0", function (data) { 336 $.post(contextPath + "/grassArticle/updateArticle?articleId=" + id + "&isRecommend=" + switchStatus+ "&operateType=0", function (data) {
@@ -326,75 +342,20 @@ @@ -326,75 +342,20 @@
326 }, "json"); 342 }, "json");
327 } 343 }
328 344
329 -  
330 - // 编辑活动  
331 - function getEditDialog(data){ 345 + function switchTop(id, status) {
332 debugger 346 debugger
333 - var activityList = $("<div id='activityList'>").appendTo($(document.body));  
334 - var title = data == null ? "新增奖品":"编辑内容";  
335 - var textVar = data == null ? "保存":"保存";  
336 - var msgVar = data == null ? "确认新增奖品吗?":"确认保存本次修改吗?";  
337 -  
338 - window.self.paramObject.mkData = data;  
339 - $(activityList).myDialog({  
340 - title: title,  
341 - width: "70%",  
342 - height: "80%",  
343 - resizable:false,  
344 - buttons:[{  
345 - id : "saveBtn",  
346 - text:textVar,  
347 - iconCls : "icon-save",  
348 - handler:function(){  
349 - debugger;  
350 -  
351 - $("#publishArticleForm").form("submit", {  
352 - url: contextPath + "/grassArticle/updateArticle",  
353 - onSubmit: function (param) {  
354 -  
355 - if (!$("#activityAddForm").form("validate")) {  
356 - return false;  
357 - }  
358 - $.messager.progress({  
359 - title: "正在执行",  
360 - msg: "正在执行,请稍后..."  
361 - });  
362 - return true;  
363 - },  
364 - success: function (data) {  
365 - debugger;  
366 - $.messager.progress("close");  
367 - data = JSON.parse(data);  
368 - if (data.code == 200) {  
369 - $(activityList).dialog("close");  
370 - $("#activityListTable").datagrid("reload");  
371 - $.messager.show({  
372 - title: "提示",  
373 - msg: title + "成功!",  
374 - height: 120  
375 - });  
376 - needTips();  
377 - } else {  
378 - $.messager.alert("失败", data.message, "error");  
379 - }  
380 - }  
381 - });  
382 - }  
383 - }, {  
384 - text: "关闭",  
385 - iconCls: "icon-cancel",  
386 - handler: function () {  
387 - $.messager.confirm("确认", "确认关闭吗?", function (flag) {  
388 - if(flag){  
389 - $(activityList).dialog("close");  
390 - }  
391 - });  
392 - }  
393 - }],  
394 - modal: true,  
395 - href: contextPath + "/html/grass/articleManage/editArticle.html",  
396 - }); 347 + var switchStatus = status == 1 ? 0 : 1;
  348 + $.post(contextPath + "/grassArticle/updateArticle?articleId=" + id + "&isTop=" + switchStatus+ "&operateType=0", function (data) {
  349 + if(data.code != 200){
  350 + alert(data.message);
  351 + }else{
  352 + $("#activityListTable").datagrid("reload");
  353 + }
  354 + }, "json");
397 } 355 }
  356 +
  357 +
  358 +
398 }); 359 });
399 360
400 361
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 <div region="center" id="labelGroupList" style=" margin-left: 20px"> 2 <div region="center" id="labelGroupList" style=" margin-left: 20px">
3 <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll"> 3 <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
4 <form name="publishArticleForm" id="publishArticleForm" method="post" > 4 <form name="publishArticleForm" id="publishArticleForm" method="post" >
  5 + <input id="checkedId" name="articleId" type="hidden"/>
  6 + <input id="articleImages" name="articleImages" type="hidden"/>
  7 + <input id="articleSkns" name="articleSkns" type="hidden"/>
5 <div style="margin-top: 20px;margin-left: 30px"> 8 <div style="margin-top: 20px;margin-left: 30px">
6 <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab"> 9 <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
7 10
@@ -140,18 +143,19 @@ @@ -140,18 +143,19 @@
140 }); 143 });
141 144
142 145
143 - debugger 146 + debugger;
144 var data = paramObject.mkData; 147 var data = paramObject.mkData;
145 148
146 if (data){ 149 if (data){
147 150
148 $("#articleUid").combobox("setValue", data.authorUid); 151 $("#articleUid").combobox("setValue", data.authorUid);
149 - $("#articleUid").combobox('combobox').attr('readonly',true); 152 + // $("#articleUid").combobox('combobox').attr('readonly',true);
150 153
  154 + $("#checkedId").val( data.articleId);
151 $("#content").val( data.articleContent); 155 $("#content").val( data.articleContent);
152 $("#topic").combobox("setValue", data.topicId); 156 $("#topic").combobox("setValue", data.topicId);
153 for (var i=1; i<=data.imgList.length; i++){ 157 for (var i=1; i<=data.imgList.length; i++){
154 - $("#imageUpload"+i).imageUpload('setValue',data.imgList[i]); 158 + $("#imageUpload"+i).imageUpload('setValue',data.imgList[i-1]);
155 159
156 } 160 }
157 } 161 }