prediction.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. function getList(page){
  2. var data = $("#saerchFrm").serializeJSON();
  3. data['page'] = page || 1;
  4. data['size'] = 20;
  5. $("#list, #page").empty();
  6. ajax(apiUrl+"forecast/list",data,function(res){
  7. if(res.code == 1){
  8. if(res.data.length > 0){
  9. $("#list").html($.Template7.renderTpl("tempaltelist",res.data));
  10. var newpage = new createPage(res['total'],data['page'],data['size'],3);
  11. $("#page").html(newpage.pageHtml);
  12. $(".table").hoverTable(true);
  13. }else
  14. $("#list").info("暂无信息。");
  15. }else
  16. $("#list").info(res.msg);
  17. });
  18. }
  19. pageGo = getList;
  20. function updateStatus(obj, id){
  21. var status = $(obj).data("status"), statusTxt=status.decode(0,'上架','-1','下架');
  22. confirm("该预测将被禁用并在列表中"+statusTxt+",是否继续操作?",function(){
  23. ajax(apiUrl+"forecast/frame",{"forecastId": id,"onFrame": status},function(res){
  24. if(res.code == 1){
  25. $(obj).text(statusTxt);
  26. $(obj).data("status",status == -1 ? 0 : -1);
  27. }
  28. });
  29. });
  30. }
  31. function getVote(){
  32. ajax(apiUrl+"forecast/voteList",{"forecastId":$.getParam("id")},function(res){
  33. if(res.code == 1){
  34. $(".mainContent").html($.Template7.renderTpl("tempalteVote",res.data));
  35. }else{
  36. alert(res.msg);
  37. }
  38. });
  39. }
  40. function getDetail(){
  41. ajax(apiUrl+"forecast/detail",{"forecastId":$.getParam("id")},function(res){
  42. if(res.code == 1){
  43. res.data.cycle = res.data.cycle.toString().decode(1,"一周",2,'一个月',3,'两个月',4,'三个月',5,'六个月',6,'一年');
  44. $(".mainContent").html($.Template7.renderTpl("tempalteDetail",res.data));
  45. }else{
  46. alert(res.msg);
  47. }
  48. });
  49. }