define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { $(document).on('click','.btn-re',function () { layer.alert('如需要进行重置服务号,请联系商务人员/开户人进行重置服务号,谢谢'); }); $(document).on('click','.updateAuthBtn',function(){ layer.open({ type: 2, title: $(this).html(), maxmin: false, area: ['60%', '60%'], shadeClose: true, //点击遮罩关闭层 content: $(this).attr('href') }); return false; }); $(document).on('click','.getSourceIdBtn',function(){ var url = $(this).attr('href'); $.ajax({ type: 'get', url: url, cache: false, async: false, success:function(data){ if(!data.code){ Toastr.error(data.msg); }else{ $('.getSourceIdBtnShow').addClass('hide'); $('.getSourceIdInput').val(data.data); Toastr.success('操作成功'); } }, error:function(err){ Toastr.error('操作失败'); } }); return false; }) var Controller = { index: function () { $(document).on('click','.layer-open',function () { Fast.api.open($(this).attr('href'), $(this).data('title')?$(this).data('title'):'配置回传信息', {}); return false; }); // 给上传按钮添加上传成功事件 $("#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(); }, updateauth:function(){ $('.close-auth-btn').click(function(){ console.log('ddddd'); var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); parent.location.reload(); }); }, 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) { }); }); $(document).on("click", ".btn-change-extend", function (e) { e.preventDefault(); $this = $(this); var field = $this.data('field'); var value = $this.data('value'); Fast.api.ajax({ url: 'admin.config/editextend', 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; });