management.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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+"user/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 $this = $(obj), status = $this.data("status"), statusTxt=status.toString().decode(0,'禁用','-1','启用'), $td = $this.parent().prev();
  22. confirm("禁用该用户将无法在小程序中进行操作,是否继续?",function(){
  23. ajax(apiUrl+"user/forbid",{"id": id,"status": status},function(res){
  24. if(res.code == 1){
  25. $this.text(statusTxt);
  26. $this.data("status", (status == -1 ? 0 : -1));
  27. $td.text(status.toString().decode(0,'正常','-1','已禁用'));
  28. }
  29. });
  30. });
  31. }