Ejemplo n.º 1
0
        $('.form-submit').bind('click' , function () {
            let formItem = $('.form-item');
            let formData = {};

            formItem.each(function(index , item){
                formData[$(item).attr('name')] = $(item).val();
            });

            formData['rule'] = [];
            let ruleLength = 0;

            $('.rule').each(function (index , rule) {
                if($(rule).attr('checked')){
                    formData['rule'].push($(rule).val());
                }
            });

            let layerLoad = layer.load(1, {
                shade: [0.1,'#fff'] //0.1透明度的白色背景
            });
            common.ajaxPost('/admin/permission/update' , formData , function (error , data) {
                if(error == null && data.code == 0){
                    layer.msg('修改成功');
                    window.location.reload();
                }else if(error == null){
                    layer.msg(data.msg)
                }else{
                    layer.alert(error)
                }
            });

        });
Ejemplo n.º 2
0
        $('.form-submit').bind('click' , function () {
            let formData = {};
            $('.form-item').each(function(index , item){
                formData[$(item).attr('name')] = $(item).val();
            });

            common.ajaxPost('/admin/login' , formData , function (error , data) {
                if(error == null && data.code == 0){
                    window.location.href = '/admin/index';
                }
            });

        });
Ejemplo n.º 3
0
        $('.table').on('click' , '.permission' , function () {

            let permission = getCheckedPermission(this);

            let userId = $('.current_user').attr('user-id');
            common.ajaxPost('/admin/adminuser/update/permission' , {id: userId , permission:permission} , function (error , data) {
                if(error == null && data.code == 0){
                    layer.msg('修改成功');
                }else{
                    layer.alert(error)
                }
            });

        });
Ejemplo n.º 4
0
 $('.form-submit').bind('click' , function () {
     let formData = {};
     $('.form-item').each(function(index , item){
         formData[$(item).attr('name')] = $(item).val();
     });
     common.ajaxPost('/admin/role/add' , formData , function (error , data) {
         if(error == null && data.code == 0){
             layer.msg('添加成功');
         }else if(error == null){
             layer.msg(data.msg)
         }else{
             layer.alert(error)
         }
     });
 });
Ejemplo n.º 5
0
        $('body').on('click' , '.update-form-button' , function () {
            let formData = {};
            $('.update-item').each(function(index , item){
                formData[$(item).attr('name')] = $(item).val();
            });
            common.ajaxPost('/admin/roles/update' , formData , function (error , data) {
                if(error == null && data.code == 0){
                    layer.msg('修改成功');
                }else if(error == null){
                    layer.msg(data.msg)
                }else{
                    layer.alert(error)
                }

                layer.close(layerDialog);
            });
        });
Ejemplo n.º 6
0
        $('.form-submit').bind('click' , function () {

            let layerLoad = layer.load(1, {
                shade: [0.1,'#fff']
            });

            let formData = getFormData();
            console.log(formData);

            common.ajaxPost('/admin/adminuser/update' , formData , function (error , data) {
                if(error == null && data.code == 0){
                    layer.msg('修改成功');
                    window.location.reload();
                }else if(error == null){
                    layer.msg(data.msg);
                }else{
                    layer.msg(error);
                }
                layer.close(layerLoad);
            });
        });