diff --git a/WebContent/WEB-INF/jsp/pc/activity/activityList.jsp b/WebContent/WEB-INF/jsp/pc/activity/activityList.jsp index 225d41c..2e4f411 100644 --- a/WebContent/WEB-INF/jsp/pc/activity/activityList.jsp +++ b/WebContent/WEB-INF/jsp/pc/activity/activityList.jsp @@ -68,26 +68,27 @@ var queryObj = { page: 1, size: 10, - sellerId: 0 + keyword: null }; function initData(queryObj) { - $.get("/zzhnc/goods/search", queryObj, function(data) { + $.get("/zzhnc/article/getArticlesList", queryObj, function(data) { data = data.data; - console.log(data) - + console.log(data); var str = ""; if(data.rows.length < 1) { $(".nodata").show(); + $("#page").hide(); } else { $(".nodata").hide(); + $("#page").show(); for(var i = 0; i < data.rows.length; i++) { str += '' + '' + ((data.page - 1) * data.pageSize + i + 1) + '' + '' + '' + data.rows[i].name + '' + '' + data.rows[i].description + '' + - '' + data.rows[i].primePrice + '' + + '' + data.rows[i].sellerName + '' + '' + data.rows[i].sellerAddress + '' + '' + data.rows[i].sellerPhone + '' + '' + ' ' + @@ -131,7 +132,7 @@ $(".resetBtn").on("click", function() { $("[name=keyword]").val(""); queryObj.page = 1; - queryObj.sellerId = 0; + queryObj.keyword = null; initData(queryObj) return false }) @@ -169,7 +170,7 @@ layer.confirm('您确定要删除该文章吗?', { btn: ['确定', '取消'] }, function(index, layero) { - $.post("/zzhnc/goods/delete", { + $.get("/zzhnc/article/deleteArticle", { id: id }, function(data) { console.log(data) diff --git a/WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp b/WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp index 736be0e..628cd04 100644 --- a/WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp +++ b/WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp @@ -199,31 +199,50 @@ }); //提交 - form.on("submit(submit)",function(data){ + form.on("submit(submit)", function(data){ + var isHome, isHot = false; if(data.field.isHome == "on"){ - data.field.isHome = true - }else{ - data.field.isHome = false; + isHome = true } if(data.field.isHot == "on"){ - data.field.isHot = true - }else{ - data.field.isHot = false; + isHot = true } - data.field.id = goodsid; - data.field.bannerUrl = $(".bannerUrl").attr("src"); - data.field.imgUrl = $(".bannerUrl").attr("src"); + var submitData = { + id: parseInt(goodsid,10), + name: data.field.name, + description: data.field.description, + bannerUrl: $(".bannerUrl").attr("src"), + imgUrl: $(".bannerUrl").attr("src"), + isHome: isHome, + isHot: isHot, + primePrice: data.field.primePrice, + price: data.field.price, + sellerId: 0, + sellerName: data.field.sellerName, + sellerAddress: data.field.sellerAddress, + sellerPhone: data.field.sellerPhone + }; //data.field.content = UE.getEditor('container').getContent(); - console.log(data.field); - updateGoods(data.field); + $.ajax({ + type: 'POST', + url: '/zzhnc/goods/update', + dataType: 'json', + async: true, + contentType: "application/json;charset=UTF-8", + data: JSON.stringify(submitData), + success: function(data){ + layer.msg('操作成功'); + }, + error: function(xhr, type){ + layer.msg('操作失败'); + } + }); return false; }) //修改方法 function updateGoods(data){ - $.post("/zzhnc/goods/update", data, function(res) { - console.log(res); - }) + } })