function getList(page){ var data = $("#saerchFrm").serializeJSON(); data['page'] = page || 1; data['size'] = 20; $("#list, #page").empty(); ajax(apiUrl+"forecast/list",data,function(res){ if(res.code == 1){ if(res.data.length > 0){ $("#list").html($.Template7.renderTpl("tempaltelist",res.data)); var newpage = new createPage(res['total'],data['page'],data['size'],3); $("#page").html(newpage.pageHtml); $(".table").hoverTable(true); }else $("#list").info("暂无信息。"); }else $("#list").info(res.msg); }); } pageGo = getList; function updateStatus(obj, id){ var status = $(obj).data("status"), statusTxt=status.decode(0,'上架','-1','下架'); confirm("该预测将被禁用并在列表中"+statusTxt+",是否继续操作?",function(){ ajax(apiUrl+"forecast/frame",{"forecastId": id,"onFrame": status},function(res){ if(res.code == 1){ $(obj).text(statusTxt); $(obj).data("status",status == -1 ? 0 : -1); } }); }); } function getVote(){ ajax(apiUrl+"forecast/voteList",{"forecastId":$.getParam("id")},function(res){ if(res.code == 1){ $(".mainContent").html($.Template7.renderTpl("tempalteVote",res.data)); }else{ alert(res.msg); } }); } function getDetail(){ ajax(apiUrl+"forecast/detail",{"forecastId":$.getParam("id")},function(res){ if(res.code == 1){ res.data.cycle = res.data.cycle.toString().decode(1,"一周",2,'一个月',3,'两个月',4,'三个月',5,'六个月',6,'一年'); $(".mainContent").html($.Template7.renderTpl("tempalteDetail",res.data)); }else{ alert(res.msg); } }); }