config.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. $(document).on('click','.btn-re',function () {
  3. layer.alert('如需要进行重置服务号,请联系商务人员/开户人进行重置服务号,谢谢');
  4. });
  5. var Controller = {
  6. index: function () {
  7. // // 初始化表格参数配置
  8. // Table.api.init({
  9. // extend: {
  10. // index_url: 'admin/config/index',
  11. // add_url: 'admin/config/add',
  12. // edit_url: 'admin/config/edit',
  13. // del_url: 'admin/config/del',
  14. // multi_url: 'admin/config/multi',
  15. // table: 'admin_config',
  16. // }
  17. // });
  18. //
  19. // var table = $("#table");
  20. //
  21. // // 初始化表格
  22. // table.bootstrapTable({
  23. // url: $.fn.bootstrapTable.defaults.extend.index_url,
  24. // pk: 'admin_id',
  25. // sortName: 'admin_id',
  26. // columns: [
  27. // [
  28. // {checkbox: true},
  29. // {field: 'admin_id', title: __('Admin_id')},
  30. // {field: 'wx_id', title: __('Wx_id')},
  31. // {field: 'wx_name', title: __('Wx_name')},
  32. // {field: 'wx_nickname', title: __('Wx_nickname')},
  33. // {field: 'wx_app_id', title: __('Wx_app_id')},
  34. // {field: 'wx_app_token', title: __('Wx_app_token')},
  35. // {field: 'wx_app_secret', title: __('Wx_app_secret')},
  36. // {field: 'access_token', title: __('Access_token')},
  37. // {field: 'access_token_endtime', title: __('Access_token_endtime'), formatter: Table.api.formatter.datetime},
  38. // {field: 'subscribe_method_text', title: __('Subscribe_method'), operate:false},
  39. // {field: 'subscribe_url', title: __('Subscribe_url'), formatter: Table.api.formatter.url},
  40. // {field: 'manager_contact', title: __('Manager_contact')},
  41. // {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime},
  42. // {field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime},
  43. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  44. // ]
  45. // ]
  46. // });
  47. //
  48. // // 为表格绑定事件
  49. // Table.api.bindevent(table);
  50. // 给上传按钮添加上传成功事件
  51. $("#plupload-qrcode_image").data("upload-success", function (data) {
  52. var url = Backend.api.cdnurl(data.url);
  53. $(".profile-user-img").prop("src", url);
  54. Toastr.success("上传成功!");
  55. });
  56. // 给表单绑定事件
  57. Controller.api.bindevent();
  58. },
  59. add: function () {
  60. Controller.api.bindevent();
  61. },
  62. edit: function () {
  63. Controller.api.bindevent();
  64. },
  65. push: function () {
  66. $(document).on("click", ".btn-change", function (e) {
  67. e.preventDefault();
  68. $this = $(this);
  69. var field = $this.data('field');
  70. var value = $this.data('value');
  71. Fast.api.ajax({
  72. url: 'admin.config/multi',
  73. data: {
  74. action: '',
  75. ids: $this.data('id'),
  76. params: field + '=' + value
  77. }
  78. }, function (data) {
  79. $this.toggleClass('fa-toggle-on fa-toggle-off');
  80. $this.data('value', value == 0 ? 1 : 0);
  81. }, function (data) {
  82. });
  83. });
  84. },
  85. api: {
  86. bindevent: function () {
  87. Form.api.bindevent($("form[role=form]"));
  88. $(document).on('click','.resource_type',function () {
  89. var sex = $(this).val();
  90. if(sex ==1){
  91. $('.girl').css('display','none');
  92. $('.boy').removeAttr('style');
  93. }
  94. if(sex == 2){
  95. $('.boy').css('display','none');
  96. $('.girl').removeAttr('style');
  97. }
  98. if(sex == 0){
  99. $('.boy').removeAttr('style');
  100. $('.girl').removeAttr('style');
  101. }
  102. })
  103. }
  104. }
  105. };
  106. return Controller;
  107. });