prediction.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.toString().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. console.log($(obj).data());
  28. }
  29. });
  30. });
  31. }
  32. function getVote(){
  33. ajax(apiUrl+"forecast/voteList",{"forecastId":$.getParam("id")},function(res){
  34. if(res.code == 1){
  35. $(".mainContent").html($.Template7.renderTpl("tempalteVote",res.data));
  36. }else{
  37. alert(res.msg);
  38. }
  39. });
  40. }
  41. function getDetail(){
  42. ajax(apiUrl+"forecast/detail",{"forecastId":$.getParam("id")},function(res){
  43. if(res.code == 1){
  44. res.data.cycle = res.data.cycle.toString().decode(1,"一周",2,'一个月',3,'两个月',4,'三个月',5,'六个月',6,'一年');
  45. $(".mainContent").html($.Template7.renderTpl("tempalteDetail",res.data));
  46. }else{
  47. alert(res.msg);
  48. }
  49. });
  50. }