app.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. $(function(){
  2. $('.form-ajax').submit(function(e){
  3. e.preventDefault();
  4. $.ajax({
  5. url : $(this).attr('action'),
  6. type : 'POST',
  7. dataType : 'json',
  8. data: $(this).serialize(),
  9. beforeSend: function(){
  10. $('.prompt-error').text('');
  11. $('.woody-prompt').hide();
  12. },
  13. success : function(result){
  14. if(result.status=='0'){
  15. $('.prompt-error').html('<span class="glyphicon glyphicon-info-sign"></span>&nbsp;'+result.msg);
  16. $('.woody-prompt').show();
  17. }
  18. if(result.status=='1'){
  19. alert(result.msg);
  20. if(result.url){
  21. window.location.href = result.url;
  22. }
  23. }
  24. if(result.status=='0'){
  25. alert(result.msg);
  26. $('[name=chkcode]').val('');
  27. $('.imgcode').click();
  28. }
  29. }
  30. });
  31. });
  32. $('h3 span').click(function(){
  33. $('h3 span').removeClass('current');
  34. $(this).addClass('current');
  35. $('.set').hide();
  36. $('.set'+$(this).index()).removeClass('hide').show();
  37. });
  38. $('[data-toggle="tooltip"]').tooltip();
  39. $('.selectAllCheckbox').click(function(){
  40. if($(this).prop('checked')){
  41. $('.checkbox').prop('checked',true);
  42. } else {
  43. $('.checkbox').prop('checked',false);
  44. }
  45. });
  46. $('.zclipCopy').zclip({
  47. path: '/static/common/ZeroClipboard.swf',
  48. copy: function(){
  49. return $(this).attr('data');
  50. },
  51. afterCopy: function(){
  52. alert('复制成功');
  53. }
  54. });
  55. $(".form_datetime").datetimepicker({
  56. format: 'yyyy-mm-dd',
  57. minView: 'month',
  58. todayBtn: 1,
  59. autoclose: 1,
  60. });
  61. });
  62. function showContent(title,url){
  63. $('#waModal').modal('show');
  64. $('#waModal .modal-title').text(title);
  65. $.get(url,{t:new Date().getTime()},function(data){
  66. $('#waModal .modal-body').html(data);
  67. });
  68. }
  69. function op(id){
  70. $.post('/member/rates/edit',{id:id},function(ret){
  71. if(ret.status=='1'){
  72. if(ret.st=='0'){
  73. $('td.label'+id+' span.label').removeClass('label-danger').addClass('label-success');
  74. $('td.label'+id+' span.glyphicon').removeClass('glyphicon-remove').addClass('glyphicon-ok');
  75. $('td.btn'+id+' a').text('关闭');
  76. }
  77. if(ret.st=='1'){
  78. $('td.label'+id+' span.label').removeClass('label-success').addClass('label-danger');
  79. $('td.label'+id+' span.glyphicon').removeClass('glyphicon-ok').addClass('glyphicon-remove');
  80. $('td.btn'+id+' a').text('打开');
  81. $('td.btn'+id+' a').attr('onclick',"alert('联系客服开通!')");
  82. }
  83. } else {
  84. alert('设置失败');
  85. }
  86. },'json');
  87. }