define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { $(document).on('click','.btn-re',function () { layer.alert('如需要进行重置服务号,请联系商务人员/开户人进行重置服务号,谢谢'); }); var Controller = { index: function () { // // 初始化表格参数配置 // Table.api.init({ // extend: { // index_url: 'admin/config/index', // add_url: 'admin/config/add', // edit_url: 'admin/config/edit', // del_url: 'admin/config/del', // multi_url: 'admin/config/multi', // table: 'admin_config', // } // }); // // var table = $("#table"); // // // 初始化表格 // table.bootstrapTable({ // url: $.fn.bootstrapTable.defaults.extend.index_url, // pk: 'admin_id', // sortName: 'admin_id', // columns: [ // [ // {checkbox: true}, // {field: 'admin_id', title: __('Admin_id')}, // {field: 'wx_id', title: __('Wx_id')}, // {field: 'wx_name', title: __('Wx_name')}, // {field: 'wx_nickname', title: __('Wx_nickname')}, // {field: 'wx_app_id', title: __('Wx_app_id')}, // {field: 'wx_app_token', title: __('Wx_app_token')}, // {field: 'wx_app_secret', title: __('Wx_app_secret')}, // {field: 'access_token', title: __('Access_token')}, // {field: 'access_token_endtime', title: __('Access_token_endtime'), formatter: Table.api.formatter.datetime}, // {field: 'subscribe_method_text', title: __('Subscribe_method'), operate:false}, // {field: 'subscribe_url', title: __('Subscribe_url'), formatter: Table.api.formatter.url}, // {field: 'manager_contact', title: __('Manager_contact')}, // {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, // {field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime}, // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} // ] // ] // }); // // // 为表格绑定事件 // Table.api.bindevent(table); // 给上传按钮添加上传成功事件 $("#plupload-qrcode_image").data("upload-success", function (data) { var url = Backend.api.cdnurl(data.url); $(".profile-user-img").prop("src", url); Toastr.success("上传成功!"); }); // 给表单绑定事件 Controller.api.bindevent(); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, push: function () { $(document).on("click", ".btn-change", function (e) { e.preventDefault(); $this = $(this); var field = $this.data('field'); var value = $this.data('value'); Fast.api.ajax({ url: 'admin.config/multi', data: { action: '', ids: $this.data('id'), params: field + '=' + value } }, function (data) { $this.toggleClass('fa-toggle-on fa-toggle-off'); $this.data('value', value == 0 ? 1 : 0); }, function (data) { }); }); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); $(document).on('click','.resource_type',function () { var sex = $(this).val(); if(sex ==1){ $('.girl').css('display','none'); $('.boy').removeAttr('style'); } if(sex == 2){ $('.boy').css('display','none'); $('.girl').removeAttr('style'); } if(sex == 0){ $('.boy').removeAttr('style'); $('.girl').removeAttr('style'); } }) } } }; return Controller; });